1
$\begingroup$

Today, I tried to obtain the solution of the following equation,

sol = DSolve[ {m v'[t] + \[Gamma] v[t] == \[Xi][t] , v[0] == v0}, v[t], t] 

The solution, of course, can be easily obtained and the result was,

$$ \left\{\left\{v(t)\to e^{-\frac{\gamma t}{m}} \left(-\int_1^0 \frac{\xi (K[1]) e^{\frac{\gamma K[1]}{m}}}{m} \, dK[1]+\int_1^t \frac{\xi (K[1]) e^{\frac{\gamma K[1]}{m}}}{m} \, dK[1]+\text{v0}\right)\right\}\right\}$$

This is correct solution but I am surprised that two integrals were present in this solution. Then, I tried to simplify using functions like FullSimplify and so on, but I failed to simplify it. Is there any automatic way to accomplish this goal?

I am using Mathematica 10.0 on the linux machine.

$\endgroup$
5
  • $\begingroup$ to further simplify you need to know something about the range of t. try specifying assumptions. $\endgroup$
    – george2079
    Oct 22, 2014 at 11:51
  • $\begingroup$ @george2079: Thank you. I tried to add some assumptions by defining $Assumptions = {\[Gamma] > 0, m > 0, t > 0, v0 > 0};. But, at least, this approach does not give a simpler form. $\endgroup$
    – Sungmin
    Oct 22, 2014 at 12:02
  • $\begingroup$ mathematically you need 0<=t<=1 to consolidate that to a single integral (from 0 to t). (I don't know if mathematica will do the simplify even under that assumption though) $\endgroup$
    – george2079
    Oct 22, 2014 at 12:38
  • $\begingroup$ @george2079 I am not very sure that your condition 0<= t<= 1 is really needed. Anyway, this additional assumption does not give a simpler solution. Thank you anyway. $\endgroup$
    – Sungmin
    Oct 22, 2014 at 12:46
  • $\begingroup$ right of course, caught me commenting before my second cup of coffee. I'll point out you can show this more simply as Integrate[ f[x] , {x, 0, 1} ] + Integrate[ f[x] , {x, 1, t } ] does not simplify under any assumptions I can think of. $\endgroup$
    – george2079
    Oct 22, 2014 at 14:13

1 Answer 1

1
$\begingroup$

you might handle this with a TransformationFunction:

 Simplify[ 
    Integrate[ f[x] , {x, 0, 1} ] + Integrate[ f[x] , {x, 1, t } ] ]
 t[s_Plus?(
      Length[#] == 2 &&
      Head[#[[1]]] == Integrate &&
      Head[#[[2]]] == Integrate &&
      #[[1, 1]] == #[[2, 1]] &&
      #[[1, 2, 3]] == #[[2, 2, 2]] &)] := 
       Integrate[s[[1, 1]], {s[[1, 2, 1]], s[[1, 2, 2]], s[[2, 2, 3]]}]
 Simplify[ 
    Integrate[ f[x] , {x, 0, 1} ] + Integrate[ f[x] , {x, 1, t } ] , 
    TransformationFunctions -> {Automatic , t }]

enter image description here

I'm sure this can be made cleaner and more robust..for example you need to deal with reversing limits and changing signs, and so on (eg:)

 t[s_Times?(#[[1]] == -1 &&  Head[#[[2]] ] == Integrate &)] :=
    Integrate[s[[2, 1]], {s[[2, 2, 1]], s[[2, 2, 3]], s[[2, 2, 2]]}]
 t[s_Plus?(
        Length[#] == 2 &&
        Head[#[[1]]] == Integrate &&
        Head[#[[2]]] == Integrate &&
        #[[1, 1]] == #[[2, 1]] &&
        #[[1, 2, 3]] == #[[2, 2, 2]] &)] := 
             Integrate[s[[1, 1]], {s[[1, 2, 1]], s[[1, 2, 2]], s[[2, 2, 3]]}]
 Simplify[ -Integrate[ f[x] , {x, 1, 0} ] + Integrate[ f[x] , {x, 1, t } ] , 
         TransformationFunctions -> {Automatic , t }]

same result

For your example this works if you do:

 Simplify[sol /. v0 -> 0, TransformationFunctions -> {Automatic, t }]

to be more general you'd need to coax simplify to test every combination of terms in multi term sum.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.