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.
f
andg
, in your question. $\endgroup$