I have not found a solution by using google so I hope I can ask this here. I have an issue with a problem I am trying to solve and I was wondering whether what I am doing is not possible with mathematica's built-in tools or whether I am simply not telling mathematica the right thing ... Minimal Working Example of my problem would be:

NDSolve[{x'[t] == Integrate[x[t - q], {q, 1, 10}],   x[t /; t <= 0] == 1}, x, {t, 0, 20}]

And the error code I get upon execution is:

NDSolve::rdelay: "Delay -1.\ q is not real valued."

I would greatly appreciate any help :) Thank you in advance!

  • 2
    $\begingroup$ Mathematica does not yet support delay integro-differential equations. Try to reformulate as a DDE. $\endgroup$ Commented May 25, 2016 at 19:08
  • $\begingroup$ This is a pity, but thank you a lot for your answer. I will look into how to reformulate these kind of problems into DDEs ... $\endgroup$
    – Sanya
    Commented May 25, 2016 at 19:53
  • $\begingroup$ Welcome to Mathematica.SE! I hope you will become a regular contributor. To get started, 1) take the introductory tour now, 2) 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, 3) remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, and 4) give help too, by answering questions in your areas of expertise. $\endgroup$
    – bbgodfrey
    Commented May 25, 2016 at 22:14

1 Answer 1


The integro-differential equation can be rewritten as

s = NDSolve[{x'[t] == Integrate[x[q], {q, t - 10, t - 1}], x[t /; t <= 0] == 1},
    x, {t, 0, 20}]

In itself, this transformation does not help. But, it does suggest a course of action. First, note that x'[0] == 9. Then note that the DDE can be differentiated to give

s = NDSolve[{x''[t] == x[t - 1] - x[t - 10], x[t /; t <= 0] == 1, x'[0] == 9}, 
    x, {t, 0, 20}][[1, 1]];

which Mathematica can handle.

Plot[x[t] /. s, {t, 0, 4}]

enter image description here

We see that the slope is 9 for 0 < t < 1, as it should be, and then x[t] begins to grow rapidly, again as expected. The plot for the entire range is

LogPlot[x[t] /. s, {t, 0, 20}]

enter image description here

Not surprisingly, growth soon becomes exponential.

Addendum: Asymptotic Solution

Because the second plot looks like an exponential at large t, it may be fruitful to compute the growth rate. Suppose x[t] -> c Exp[a t] for large t. Then, in this limit the left side of the DDE in the first line of code in this answer is a x[t], and the right side is Exp[-a] (1 - Exp[-9 a])/a x[t]. Equating the two and solving gives

FindRoot[a == Exp[-a] (1 - Exp[-9 a])/a, {a, .7}]
(* {a -> 0.703002} *)

Hence, we would expect the growth of x[t] for 5 < t < 20 to be approximately

Exp[15 a /. %]
(* 37988.2 *)

The actual value from NDSolve is

(x[20]/x[5]) /. s
(* 37854. *)

showing that c Exp[a t] approximates x[t] well even at fairly modest values of t.

  • $\begingroup$ Thank you a lot, this was very instructive :) $\endgroup$
    – Sanya
    Commented May 25, 2016 at 21:57
  • $\begingroup$ It's a DDE and not an ODE, but it's merely a minor blemish in an otherwise nice answer. $\endgroup$ Commented May 26, 2016 at 0:06
  • $\begingroup$ @J.M. Indeed, so. I have corrected the terminology. Thanks. $\endgroup$
    – bbgodfrey
    Commented May 26, 2016 at 0:12
  • $\begingroup$ I have spent a bit of time reformulating my original problem and I have arrived at an expression like Integrate[x[q]*f[t-q], {q, 0, t}] where f[t-q] has an exponential form. I fear the same scheme as in this simple case can't successfully be applied there, can it? $\endgroup$
    – Sanya
    Commented May 26, 2016 at 17:32
  • $\begingroup$ @Sanya My answer probably works only for some cases of f[t -q], including that in your question above. However, Integrate[x[q]*f[t-q], {q, 0, t}] is a convolution, so it should be solvable in general by means of a Laplace transform. This is so different from what you asked above that I recommend that you ask a new question, rather than modifying the one above. At the risk of seeming self-serving, I would ask that you accept the answer I posted, if it adequately addresses your original question. Best wishes. $\endgroup$
    – bbgodfrey
    Commented May 26, 2016 at 18:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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