6
$\begingroup$

I am trying to solve this differential equation in Mathematica:

y'[t]+integral from 0 to t of y[x]dx =e^(-t) where y[0]=0.

Is this possible?

$\endgroup$
7
$\begingroup$

Method 1, using Laplace transform

eq = y'[t] + Integrate[y[x], {x, 0, t}] == Exp[-t];
eq = LaplaceTransform[eq, t, s];
eq /. LaplaceTransform[y[t], t, s] -> U0
sol = Solve[%, U0]
Simplify@InverseLaplaceTransform[U0 /. sol, s, t]
% /. y[0] -> 0

Mathematica graphics

Method 2, convert to second order ODE

You can, but you are missing a second initial condition. This is second order ODE actually. Assuming y'[0]==0

eq = y'[t] + Integrate[y[x], {x, 0, t}] == Exp[-t];
eq = D[eq, t];

Mathematica graphics

The above is the ODE you want to solve.

DSolve[{eq, y[0] == 0, y'[0] == 0}, y[t], t]

Mathematica graphics

$\endgroup$
  • $\begingroup$ How can you use a laplace transform in mathematica to solve this? $\endgroup$ – Jimmeny Dec 12 '14 at 0:34
  • $\begingroup$ @NimblePawn added Laplace method. Not sure why -Sin[t] shows up in the ODE method vs. +Sin[t] in the Laplace now. But these are two methods I know about. The correct answer with zero IC should be the ODE based one. with -sin. $\endgroup$ – Nasser Dec 12 '14 at 0:36
  • $\begingroup$ I'm not sure why either. That is pretty strange. Thank you for the help! $\endgroup$ – Jimmeny Dec 12 '14 at 0:43
  • $\begingroup$ @Nasser Nice answer :).The problem with the sign comes from a wrong assumption for y'[0] If you look at the original equation you' ll most certainly find that it should be y'[0] == 1 $\endgroup$ – Dr. belisarius Dec 12 '14 at 7:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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