I have a differential equation that I would like to solve numerically in the region $z \in [0,L]$ and $t \in [0,t_{max}]$:

$$ \partial_t S(z,t) = f(z)S(z,t) + \int_0^L \text{d} z'g(z,z') S(z',t), $$ where $f(z)$ and $g(z,z')$ are complex-valued functions.As an initial condition I woud like to consider something like $S(z,0) = \exp(-(z-L/5)^2)$.

So somehow I have to use Mathematicas NDSolve and NIntegrate in one procedure. If the integral would not be there, I would just NDSolve. In fact I tried something naive like

NDSolve[{D[S[z, t], t] == f[z] S[z, t] + 
  NIntegrate[g[z, zprime] S[zprime, t], {zprime, -\[Infinity], \[Infinity]}], 
  S[z, 0] == Exp[-(z - L/5)^2]}, S, {t, 0, tsteps}, {z, 0, L}]

but Mathematica does not like this at all. Any thoughts about how I should deal with this problem? Ultimately I would like to find an interpolating function for $S$, which I can then plot dynamically.

  • $\begingroup$ to use numerical solving functions you need to define all the variables like alpha, beta and L $\endgroup$
    – k_v
    Commented Feb 3, 2015 at 10:39
  • $\begingroup$ @k_v I did this, I just did not display it here. $\endgroup$
    – Funzies
    Commented Feb 3, 2015 at 10:46
  • 1
    $\begingroup$ Please provide those quantities, including f and g, in your question. $\endgroup$
    – bbgodfrey
    Commented Feb 3, 2015 at 14:45
  • $\begingroup$ Once refer to this link: mathematica.stackexchange.com/questions/200270/…. You equation is similar to that of in the link. You have mentioned directly the integral, where as in that question hilbert transform is mentioned. I think you can figure it out. So you just change the function and boundary values and I think you get the answer thereafter. $\endgroup$ Commented Jun 26, 2019 at 6:42

1 Answer 1


I corrected several syntax errors by editing your equation (parentheses to brackets, z' to zprime) in your Question, and also manufactured some simple expressions for the four undefined quantities:

L = 1; tsteps = 1; f[z_] := 1; g[z_, zprime_] := 1

With these changes, NDSolve runs but, not surprisingly, generates errors:

NIntegrate::inumr: The integrand S[zprime,t] has evaluated to non-numerical values for all sampling points in the region with boundaries {{-\[Infinity],0.}}. >>
NDSolve::delpde: Delay partial differential equations are not currently supported by NDSolve. >>

To the best of my knowledge, NDSolve cannot solve integro-differential equations. However, similar equations have been addressed before. See, for instance, 66800 and references therein. In essence, S is approximated by a Piecewise function and the resulting coupled ordinary differential equations solved using NDSolve.


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