# Why is PolyLog[] giving weird answers for ordinary values? [duplicate]

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.

• Looks like floating point errors. Assuming PolyLog is working correctly and should ideally be real-valued, it should be safe to apply Re, if a purely real output is desired. – DumpsterDoofus Jan 19 '15 at 18:34
• Try: Plot[PolyLog[1/2, x], {x, -5, 5}, WorkingPrecision -> 20] – Mr.Wizard Jan 19 '15 at 19:15
• Proposed duplicates: (3152), (71675) – Mr.Wizard Jan 19 '15 at 19:16