3
$\begingroup$

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

enter image description here

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?

$\endgroup$
9
  • $\begingroup$ 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? $\endgroup$
    – xzczd
    Commented Nov 20, 2019 at 8:18
  • $\begingroup$ @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? $\endgroup$
    – maths56
    Commented Nov 20, 2019 at 9:33
  • 2
    $\begingroup$ Yes, certain pre-processing is necessary, because currently NDSolve can't directly handle integro-differential equation. $\endgroup$
    – xzczd
    Commented Nov 20, 2019 at 9:54
  • 1
    $\begingroup$ @maths56 Add the definition of $\omega(s)$ and $R(n)$ to make the discussion useful. $\endgroup$ Commented Nov 20, 2019 at 18:05
  • $\begingroup$ @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 $\endgroup$
    – maths56
    Commented Nov 20, 2019 at 20:06

1 Answer 1

5
$\begingroup$

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

Figire 1

$\endgroup$
6
  • $\begingroup$ 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." $\endgroup$
    – maths56
    Commented Nov 21, 2019 at 11:56
  • $\begingroup$ Check first $Version. What do you have, what version? $\endgroup$ Commented Nov 21, 2019 at 13:02
  • $\begingroup$ I've got version 11.0.1 $\endgroup$
    – maths56
    Commented Nov 21, 2019 at 13:31
  • $\begingroup$ Sorry, I did not copy the line of code sol = NDSolveValue[{eq, ic}, var, {t, 0, tm}];. Corrected. Check it out. $\endgroup$ Commented Nov 21, 2019 at 14:13
  • 1
    $\begingroup$ If there is a system, then the solution will be different. Show the system and all the data, then we will discuss. $\endgroup$ Commented Nov 21, 2019 at 16:54

Your Answer

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