3
$\begingroup$

I'm trying to reproduce some plots from the analytical expression:

$f(\xi)=\left(\frac{2}{\beta^2}-1\right)+\left(\frac{\theta\,e^{-\beta}}{2}-\frac{1}{2}\right)\xi+\sum_{n=1}^{60}\left[\frac{(-\beta)^n}{n!}\xi^{1+n/2}\zeta_H\left(-\frac{n}{2},1+\frac{1}{\xi}\right)\right]$.

I need to plot $f(-4x)$ for several values of $\beta$ and with $\theta=0$ and $\theta=1$. In the attached picture, the left panel is what I have to get (ignore the blue curves), but Mathematica gives me a lot of noise.

Left: correct results. Right: My result. My code is:

f[β_, ξ_,M_, θ_] := ((2/β^2 -1) + ((θ Exp[-β])/2 - 1/2) ξ + Sum[((-β)^n ξ^(1 + n/2))/n! HurwitzZeta[-(n/2), 1 + 1/ξ], {n, 1, M}]);

Plot[{f[0.5, -4 x, 60, 1], f[0.5, 4 x, 60, 0], 
  f[0.8, -4 x, 60, 1], f[0.8, 4 x, 60, 0], f[1.1, -4 x, 60, 1], 
  f[1.1, 4 x, 60, 0]}, {x, -6, 6}, AxesOrigin -> {0, 0}, 
 PlotStyle -> {Green, Green, Red, Red, Black, Black}, 
 PlotRange -> {0, 8}]

Do you have an idea of what is going on?

Thanks!

$\endgroup$
  • 1
    $\begingroup$ For now, try using WorkingPrecision -> 30 in Plot[]. $\endgroup$ – J. M.'s ennui May 31 '20 at 2:15
5
$\begingroup$
Clear["Global`*"]

f[β_, ξ_, M_, θ_] := ((2/β^2 - 1) 
      + ((θ Exp[-β])/2 - 1/2) ξ + 
    Sum[((-β)^n ξ^(1 + n/2))/n! HurwitzZeta[-(n/2), 
       1 + 1/ξ], {n, 1, M}]);

To use high precision, make the input parameters exact values.

Plot[{
  f[1/2, -4 x, 60, 1],
  f[1/2, 4 x, 60, 0],
  f[4/5, -4 x, 60, 1],
  f[4/5, 4 x, 60, 0],
  f[11/10, -4 x, 60, 1],
  f[11/10, 4 x, 60, 0]},
 {x, -6, 6},
 AxesOrigin -> {0, 0},
 Frame -> True,
 PlotStyle -> {Green, {Green, Dashed}, Red, {Red, Dashed}, 
   Black, {Black, Dashed}},
 PlotRange -> {0, 8},
 WorkingPrecision -> 50,
 PlotPoints -> 100,
 MaxRecursion -> 5,
 PlotLegends -> "Expressions"]

enter image description here

Just change the styles back to get rid of the dashes.

$\endgroup$
  • $\begingroup$ Thank you all guys. It solved my problem. :) $\endgroup$ – Jorge Castaño May 31 '20 at 19:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.