5
$\begingroup$

I am trying DSolve in Mathematica for an ODE. Here is the command I am trying and the result I get

DSolve[{x'[t] + y[t] x[t] == 0, x[0] == x0}, x[t], t]

$$ \left\{\left\{x(t)\to \text{x0} \exp \left(\int_1^t -y(K[1]) \, dK[1]-\int_1^0 -y(K[1]) \, dK[1]\right)\right\}\right\} $$

Why does Mathematica separate the integration between 0 and 1 and the rest? The answer as one would expect is

$$ x(t) = x0 \exp\left(-\int_0^t y(t') dt' \right) $$

How to get Mathematica to give the above result from DSolve?

Without the initial condition in the list of equations, I just get the integral from 1 to t.

Thanks for any help or suggestions!

PS: I searched for a solution and couldn't find one. If this was already addressed, please point me to relevant sources.

$\endgroup$
1
  • $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$
    – Michael E2
    Aug 11, 2015 at 16:54

1 Answer 1

4
$\begingroup$

DSolve seems to have a general solution to linear first-order ODEs that uses an integration that starts at 1. It then solves the boundary condition for the constant of integration. In this case, the constant involves the integral from 1 to the initial value for t, namely 0.

Block[{DSolve`print = Print},
 DSolve[{x'[t] + y[t] x[t] == 0, x[0] == x0}, x[t], t]
 ]

Mathematica graphics

(*  {{x[t] -> E^(-Integrate[-y[K[1]], {K[1], 1, 0}] + 
                  Integrate[-y[K[1]], {K[1], 1, t}])*x0}}   *)

(Mathematica does not have built-in methods for recombining integrals and sums. There are questions about doing such things on this site.)

$\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.