# Unable to solve this differential equation with NDSolve. NIntegrate::inumr error

My code goes as follows:

\[Alpha] = 1; n = 2;
g[\[Omega]_] = PDF[NormalDistribution[\[Alpha], n*\[Alpha]], \[Omega]]
f[t_] := NIntegrate[g[\[Omega]]*Exp[I*(\[Alpha] - \[Omega])*(t)], {\[Omega], 0, 10}]


Everything is fine up to this point. And, finally, I want to evaluate:

NDSolve[{G'[t] + NIntegrate[f[t - v]*G[v], {v, 0, t}] == 0, G == 1}, G, {t, 0, 1}]


But, I get error:

NIntegrate::inumr: The integrand E^(-I v (1-[Omega])-1/8 (-1+[Omega])^2)/(2 Sqrt[2 [Pi]]) has evaluated to non-numerical values for all sampling points in the region with boundaries {{0,10}}. ...... x3

General::stop: Further output of NIntegrate::inumr will be suppressed during this calculation.

Why is it unable to evaluate this integral numerically?

• I'm not at a computer with Mathematica right now, but maybe try replacing f[t_] with f[t_?NumericQ]. This often fixes problems of this type. Sep 1, 2021 at 2:00
• Already tried that, same error appears Sep 1, 2021 at 2:15

I don't know why Mathematica doesn't solve, but I can provide a workaround to get an approximated solution:

\[Alpha] = 1; n = 2;
g[\[Omega]_] = PDF[NormalDistribution[\[Alpha], n*\[Alpha]], \[Omega]]


First f[t] can be evaluated symbolically

f = Function[{t},Integrate[g[\[Omega]]*Exp[I*(\[Alpha] - \[Omega])*(t)], {\[Omega], 0, 10}] //Evaluate]
(*Function[{t},1/2 E^(-2 t^2) (-Erf[(-1 + 4 I t)/(2 Sqrt)] +Erf[(9 + 4 I t)/(2 Sqrt)])]*)


Integrating your ode gives the integralequation

G[t]==1+Integrate[G[v] f[tau-v] , {\[Tau], 0, t} , {v, 0, \[Tau]}]

which is solved iteratively (Piccard iteration seems to converge)

ti = Subdivide[0, 1, 50]; (*discretisation*)
Clear [gip]
gip[G_] :=
Block[{ t, \[Tau], v},
Interpolation[Table[{t,1 - NIntegrate[
G[v] f[\[Tau] - v] , {\[Tau], 0, t} , {v, 0, \[Tau]}] },
{t,ti}] ]]

sol = NestList[gip, 1 &, 5]; (*complex solution*)

Show[{Plot[ReIm[Through[sol[t]]] // Evaluate, {t, 0, 1}],
Plot[ReIm[ sol[[-1]][t]] // Evaluate, {t, 0, 1},PlotStyle -> {{Dashed ,Black}, {Dotted , Black}}]}] Hope it helps!

• Could you please explain the plot a little bit? What exactly are the colored lines and why two of them? Sep 8, 2021 at 4:19
• Also, what exactly is 1& used for? Sep 8, 2021 at 5:37
• And, shouldn't it be "1+ NIntegrate" rather than "1 -NIntegrate"? Sep 8, 2021 at 5:46