Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
I fixed some syntax errors in your code. Also I do not get the same error. I get NIntegrate::inumr (because of the symbolic y[t1] in the integral. You probably had a hidden definition f[t_] := NIntegrate[..] that you had not cleared. It's a good idea to restart the kernel and retry your code before posting. – Michael E2 Jun 1 '15 at 10:48

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])/

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}]


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

This is probably what @Guess who it is. had in mind in the comment posted under the question.

solution1 = NDSolve[{
    D[y[t], t] == -Exp[-t] f0[t], y[0] == 1,
    f0'[t] == y[t]*Exp[t], f0[0] == 0},
   y[t], {t, 0, 10}];

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

Mathematica graphics

Comparison with Jens's exact solution and how well the combined PrecisionGoal/AccuracyGoal is satisfied:

jsol = (E^(-t/2) (Sqrt[3] Cos[(Sqrt[3] t)/2] + Sin[(Sqrt[3] t)/2])) / Sqrt[3];
Plot[Evaluate[{y[t] - jsol /. solution1,
      {1, -1} (10^-(MachinePrecision/2.) + 10^-(MachinePrecision/2.) jsol)} // Flatten],
 {t, 0, 10}]

Mathematica graphics

share|improve this answer

Your Answer


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.