Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I discovered some strange behaviour of the PolyLog[] Function in Mathematica which seems to me like a bug in the function implementation.

It looks like PolyLog is breaking down for big arguments and non-integer orders

In[1]:=  -PolyLog[5/2, -E^500] // N
Out[1]:= 2.691151407447062*10^8626 + 9.87331945684138*10^8623 I

which is for sure incorrect. For such big arguments the PolyLog function has nice asymptotic approximations (which are e.g. used for complete Fermi-Dirac Integrals which are related to PolyLog's) through $F_n(x)=-\mathrm{Li}_{n+1}(-e^x)$.

This can be demonstrated by using even orders for the PolyLog[] with similar big arguments

In[2]:=  -PolyLog[4, -E^500] // N
Out[2]:= 2.60437*10^9

if compared to the asymptotic approximation $\frac{u^n}{\Gamma(n+1)}$ of $-\mathrm{Li}_n(-e^u)$

In[3]:=  u^4/Gamma[5] /. u->500 //N
Out[3]:= 2.60417*10^9

the results look o.k.

The expected result of above given argument E^500 and order 5/2 should be

In[4]:=  u^(5/2)/Gamma[5/2 + 1] /. u -> 500 // N
Out[4]:= 1.68209*10^6

I assume that the function algorithm somehow gets troubles with internal accuracy. Any ideas to "tell" Mathematica to increase the accuracy for the numerical calculation?

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

Is the following a better result? (I'm not an expert.)

Block[{$MaxExtraPrecision = 100},
  N[-PolyLog[5/2, -E^500], 20]
]

(* Out: 1.6821298518320559359*10^6 + 0.*10^-14 I *)
share|improve this answer
    
Yes this is a better result - see update of question above. Thanks for the proposal. This leaves the question why Mathematica is not able to calculate the correct result in first place with the default accuracy. –  Rainer Mar 29 '13 at 23:24
1  
@Rainer Again, I'm not an expert on PolyLogs specifically, but this is a common issue in special function evaluation. I certainly wouldn't trust the result of N[Sin[E^500]], I would be more comfortable with N[Sin[E^500], 20], after increasing $MaxExtraPrecision to 400 or so. –  Mark McClure Mar 29 '13 at 23:32
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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