I want to numerically integrate and the plot the following $$ \psi(r)=\frac{1}{\sqrt{2\pi\sigma^2}}\int_{0}^{\infty}\frac{dk}{k}\frac{\sin kr}{kr}\exp\left[ -\frac{\ln^{2}(k/k_{0})}{2\sigma^2} \right] $$ over a range of $r$ for $\sigma=0.8$ and $k_{0}=10^{10}$. Since I want to make the plots dimensionless, I keep the $x$-axis as $k_{0}r$ and evaluate the integral over $r\in (\epsilon,6/k_{0})$, where $\epsilon$ is very small so that Mathematica does not produce warning messages. Below is the small code that I have

psi[r_]:=NIntegrate[(Sin[k*r]/(r*k^2))*P[k],{k,0,Infinity},Method -> {Automatic, "SymbolicProcessing" -> 0}];
rlist = Table[i, {i, 10^-12, 6.0/k0, (6.0*10^-10 - 10^-12)/750}];
psilist = Quiet[Table[psi[i], {i, 10^-12, 6.0/k0, (6.0*10^-10 - 10^-12)/750}]];
ListPlot[Transpose[{k0*rlist, psilist}],Joined -> True]

When I evaluate and plot the integral over the list of values of r, I get the following graph Upper limit <span class=$k=\infty$" /> The plot that I am expecting should not have bumps like this. However, it appears that if I choose the upper limit of the integral as $10^{12}$, I get a smoother plot enter image description here Can anyone tell me what is causing this? This apparently happens for $\sigma>0.6$ for some odd reason.

  • $\begingroup$ Is pi supposed to be Pi? And \[Psi] is psi perhaps? What are the two tables for? How did you produce the troublesome plot? Why did you turn off ”SymbolicProcessing” on such an oscillatory integral? $\endgroup$
    – Michael E2
    Commented May 25, 2021 at 5:05
  • $\begingroup$ I edited the code. The table rlist is a list of values of r over which psilist is evaluated. I think I turned off SymbolicProcessing because I thought it cuts down on the time it takes for evaluation. $\endgroup$
    – Judas503
    Commented May 25, 2021 at 5:42
  • $\begingroup$ Your observation indicates numerical erasing problem for k>> k0. Check for example value of Exp[-(Log[k/k0]^2)/(2*sig^2)] for k/k0== 100 $\endgroup$ Commented May 25, 2021 at 7:14
  • $\begingroup$ I'm sorry, I do not understand what 'numerical erasing' means. $\endgroup$
    – Judas503
    Commented May 25, 2021 at 7:37


Your Answer

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

Browse other questions tagged or ask your own question.