# Odd plotting/math issue (could be a precision problem) [closed]

I've got a pretty odd error on a project I'm working on and was hoping to enlist some advice to fix it. The goal of this notebook is to show that I can eliminate the non-normalizable (blowing up part) of the Whittaker W function for small arguments by multiplying by a constant.

I first start by defining the W function in a more convenient way:

f[r_, k_, w_, v_] := WhittakerW[-I*(k^2/(4*w)), v, -I*r^2*w]


Expanding f (Series[f[r, k, w, v], {r, 0, 1}, Assumptions -> {r>0, w>0, v>0, k>0}]) I see that the constant I need to multiply by is $c = \frac{\Gamma[1/2 + \nu + i(k^2/(4*\omega))]}{(-i)^{1/2 - \nu}}$. This is the imaginary term on all of the non-normalizable parts of $W$ (you can see this if you include higher order terms in the series expansion). So multiplying by this should, in principle, wipe out the imaginary part of the non-normalizable piece, and leave me with a normalizable imaginary part. Unfortunately, it isn't working out this way in Mathematica:

const[k_,w_,v_] = Gamma[1/2 + v + I*(k^2/(4*w))]/(-I)^(1/2 - v)
LogLogPlot[Abs[Im[const[10, .01, 3.1]*f[r, 10, .01, 3.1]]], {r, 0.001, .01}]


The above plot shows a line with negative slope, going to infinity, rather than zero. When I define a function for the Taylor series, however:

bdry2[r_] =
Normal[FullSimplify[
Series[const[10, .01, 3.1]*f[r, 10, .01, 3.1], {r, 0, 5},
Assumptions -> r > 0]]]


The plot: LogLogPlot[{Abs[Im[bdry2[r]]]}, {r, 0.000001, .001}] is normalizable. So this is quite confusing for me, and I think there is some sort of rounding error going on -- but I'm not quite sure where my error lies. Any help would be much appreciated.

Thanks in advance!

## closed as unclear what you're asking by user9660, MarcoB, RunnyKine, Öskå, JensMay 6 '16 at 15:51

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• I believe it is a precision issue, try this to force high precision calculation: N[const[10, 1/100, 31/10]*f[2/1000, 10, 1/100, 31/10], 100] you will see the result is purely real . – george2079 Aug 25 '15 at 15:52
• Ok - interesting. It seems the imaginary part is 10^(-84) here -- whereas without including as much precision, it was probably non-negligible. Any idea how I can implement this level of precision into my plotting? – Schwinger Aug 25 '15 at 15:55
• I suspect this requires more of a mathematics study of the function rather than relying on numerical evaluation even at high precision. – george2079 Aug 25 '15 at 16:01
• I think I have good reason to believe what I'm doing is possible numerically -- there are only a couple terms in the taylor series that are non-normalizable (for small v, but still this should hold for any v) -- and they all have some factor $c*r^{-\gamma}$, where $c$ is complex -- so dividing by c should make the coefficient of that term real. Not quite sure I understand the difficulty Mathematica's having with it – Schwinger Aug 25 '15 at 16:08
• Schwinger, you should be able to implement increased precision in your plot using arbitrary precision arguments as mentioned by @george2079, by specifying the plotting range in the same way (i.e. {r, 1/1000, 1/100}), and finally by using the WorkingPrecision option to the plotting function. For instance, you could use WorkingPrecision -> 100. – MarcoB Mar 9 '16 at 4:11