Possibly related to this question, but it seems slightly different:
Strange behaviour of PolyLog Function
Wikipedia says that for real s, z<1 should be real. So I was confused when MMa returned:
PolyLog[0.5, -2.35]
-0.962331 + 1.96262*10^-17 I
Which, to be fair, has a teensy imaginary part. But still enough to mess up functions expecting only real values.
To get a better idea, I did
Plot[Im@PolyLog[.5, x], {x, -5, .5}]
Which gave me this plot:
So it seems to oscillate between 4 values for the imaginary part.
Can I just use Re[] to get rid of this part safely, i.e., is it just some artifact of the function? I don't need insane accuracy or anything, so as long as the real part is close to what it should be, it's alright.
PolyLog
is working correctly and should ideally be real-valued, it should be safe to applyRe
, if a purely real output is desired. $\endgroup$Plot[PolyLog[1/2, x], {x, -5, 5}, WorkingPrecision -> 20]
$\endgroup$