Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have a integro-differential equation of the form $y'(t) = - \int_0^t {y(t_1 )} e^{t_1 - t} dt_1, {\rm{ t}} \in {\rm{[0,10], y(0) = 1}}$

My code is:

f[t_Real] := NIntegrate[y[t1]*Exp[t1-t]], {t1, 0, t}];

solution1=NDSolve[{D[y[t], t]==-f[t], y[0] == 1}, y[t], {t, 0, 10}];

Plot[Evaluate[y[t] /. solution1], {t, 0, 10}, PlotRange -> All].

But this simply outputs the error:

NIntegrate::nlim: t1 = t is not a valid limit of integration.

share|improve this question
    
Mathematica can't directly handle integro-differential equations. Try converting it to an ODE, before feeding it to NDSolve[]. –  J. M. May 4 '13 at 4:20

1 Answer 1

This integral equation is solvable using the LaplaceTransform technique:

Clear[s, t];
eqn = y'[t] == -Integrate[y[t1] Exp[t1 - t], {t1, 0, t}]

LaplaceTransform[eqn, t, s]

(*
==> 
s LaplaceTransform[y[t], t, s] - y[0] == -(
  LaplaceTransform[y[t], t, s]/(1 + s))
*)

Solve[%, LaplaceTransform[y[t], t, s]]

(*
==> {{LaplaceTransform[y[t], t, s] -> ((1 + s) y[0])/(
   1 + s + s^2)}}
*)

InverseLaplaceTransform[%, s, t]

(*
==> {{y[t] -> (
   E^(-t/2) (Sqrt[3] Cos[(Sqrt[3] t)/2] + Sin[(Sqrt[3] t)/2]) y[0])/
   Sqrt[3]}}
*)

ySolution[t_] = y[t] /. First[%] /. y[0] -> 1

(*
==> (E^(-t/
  2) (Sqrt[3] Cos[(Sqrt[3] t)/2] + Sin[(Sqrt[3] t)/2]))/Sqrt[3]
*)

Plot[ySolution[t], {t, 0, 10}]

solution

share|improve this answer
    
Thank you. But I need the numerical solution of the integro-differential equation. –  user7260 May 4 '13 at 5:37
    
...@user, Jens gave you a closed form solution, which is a bit more useful. Why do you still need a numerical solution? Unless... what you posted is in fact not your actual problem. –  J. M. May 4 '13 at 6:23
    
Thank you very much! I want to compare the difference the numerical and exact solution of the integro-differential equation. –  user7260 May 4 '13 at 7:15
    
@user7260 If you use this package for Laplace inversion, then you can get a semi-numerical solution. –  xzczd Jun 7 '13 at 4:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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