6

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?

halirutan
  • 112,764
  • 7
  • 263
  • 474
Jimmeny
  • 123
  • 4

1 Answers1

7

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

Nasser
  • 143,286
  • 11
  • 154
  • 359
  • How can you use a laplace transform in mathematica to solve this? – Jimmeny Dec 12 '14 at 00:34
  • @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. – Nasser Dec 12 '14 at 00:36
  • I'm not sure why either. That is pretty strange. Thank you for the help! – Jimmeny Dec 12 '14 at 00:43
  • @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 – Dr. belisarius Dec 12 '14 at 07:08