# Solving partial integro-differential equation

I want to solve a partial integro-differential equation of this form:

using NDSolve, something like

NDSolve[{D[u[t, x], t] == D[u[t, x], x, x] - D[u[t, x]*int[w (s)*u[t, x + s]], {s, -L, L}],x] + u[t,x] * (1-u[t,x]), u[0, x] == u0, u[t, -L] == u[t, L],u, {t, 0, tend}, {x, 0, 2 xend}],


but can't find how to interpolate such integral with Simpson's rule or something similar. Any idea?

• Imgur is down here so I can't see your image at the moment, but have you checked the post under the tag integral-equations? – xzczd Nov 20 '19 at 8:18
• @xzczd Thanks for the suggestion. I took a look at the posts under the tag you suggested, but as I'm new in Mathematica didn't manage to solve the problem due to the complexity of the equation and the way the integral is defined. Do you know if I need to interpolate the integral before adding it to the NDSolve? – maths56 Nov 20 '19 at 9:33
• Yes, certain pre-processing is necessary, because currently NDSolve can't directly handle integro-differential equation. – xzczd Nov 20 '19 at 9:54
• @maths56 Add the definition of $\omega(s)$ and $R(n)$ to make the discussion useful. – Alex Trounev Nov 20 '19 at 18:05
• @AlexTrounev ω(s) can be a Gaussian and R(n) is the reaction term and can be a logistic growth function, I just added them in the picture. I initially omitted some bits as it is a system that I need to solve, but the integral in this equation causes me the problem – maths56 Nov 20 '19 at 20:06

I use the code from my answer on Solving partial differential equation involving Hilbert transform

We put $$\mu =0,\sigma^2 =1/2$$,L=Infinity,n[0,x]==Cos[x]

n = Sum[f[m][t] Exp[I m x], {m, -Infinity, Infinity}]


Then the integral is calculated as

 Integrate[
Exp[-s^2] Exp[I m s]/Sqrt[Pi], {s, -Infinity, Infinity}]

(*Out[]= E^(-(m^2/4))*)


Now we can make a system of equations

nn = 137; tm = 1.; eq =
Table[-f[m]'[t] - m^2 f[m][t] -
I m Sum[If[Abs[m - k] <= nn, f[m - k][t], 0] Exp[-k^2/4] f[k][
t], {k, -nn, nn}] + f[m][t] -
Sum[If[Abs[m - k] <= nn, f[m - k][t], 0] f[k][t], {k, -nn, nn}] ==
0, {m, -nn, nn}];
ic = Table[
f[m][0] == (KroneckerDelta[m, 1] + KroneckerDelta[m, -1])/
2, {m, -nn, nn}];
var = Table[f[i], {i, -nn, nn}];
sol = NDSolveValue[{eq, ic}, var, {t, 0, tm}];


Data visualization

{Plot[Evaluate[
Table[Re[
Sum[sol[[m + 1]][t] Exp[I (-nn + m) x], {m, 0, 2*nn}]], {t, 0,
tm, .2}]], {x, 0, 2*Pi}, Mesh -> None, ColorFunction -> Blue,
AxesLabel -> Automatic, PlotLegends -> Automatic, PlotRange -> All],
Plot3D[Re[
Sum[sol[[m + 1]][t] Exp[I (-nn + m) x], {m, 0, 2*nn}]], {t, 0.,
tm}, {x, 0, 2*Pi}, Mesh -> None, ColorFunction -> Hue,
AxesLabel -> Automatic, PlotRange -> All]}


• Thank you very much. Sorry for asking more questions, but I'm very new to this and I don't understand every step of your code. Is the above code part of your previous code in mathematica.stackexchange.com/questions/200270/…? Cause when I run the above I got "General::stop: Further output of Part::partd will be suppressed during this calculation." – maths56 Nov 21 '19 at 11:56
• Check first \$Version. What do you have, what version? – Alex Trounev Nov 21 '19 at 13:02
• I've got version 11.0.1 – maths56 Nov 21 '19 at 13:31
• Sorry, I did not copy the line of code sol = NDSolveValue[{eq, ic}, var, {t, 0, tm}];. Corrected. Check it out. – Alex Trounev Nov 21 '19 at 14:13
• Perfect, thanks so much. I've got a few questions though. First, how is the IC translated with the KroneckerDelta? So if I want a Gaussian for ICs or anything else what would be the correct command line? Also, when I increased the tm I got "NDSolveValue::ndsz: At t == 1.0963228918206627`, step size is effectively zero; singularity or stiff system suspected." and further messages. I was planning to run for tmax=100, is this possible? And finally, have you done something similar for a system? In my case there is one more reaction-diffusion pde and one ode. – maths56 Nov 21 '19 at 14:39