1
$\begingroup$

In my code i want to solve the Fermi-Dirac-Integral numerically. This can be achieved with a Polylogarithm.

Actually I'm coding in C#, so my function to calculate this polylogarithm looks like that:

public double PolyLog(double s, double z)
{
    double sum = 0;
    for (int k = 0; k < 1e5; k++)
        sum += Math.Pow(z, k) / Math.Pow(k, s);
    return sum;
}

This actually does it's job pretty well for values |z| < 1. However, I need to calculate the polylogarithm also for values that are bigger than 1.

Is there any code, that calculates polylogarithms for |z|>1?
Probably this would be done by any kind of analytic continuation. Although, I'm using C#, I don't care about the language. I can easily translate any code to C#.

$\endgroup$
1

1 Answer 1

4
$\begingroup$

"Note on fast polylogarithm computation" by R. E. Crandall contains an explicit algorithm for computing the polylogarithm.

$\endgroup$
1
  • $\begingroup$ Thanks to both of you who asked and answered this question! I have implemented algorithm 2.1 from that paper, and found that for negative n and |z| >= 2 it tries to compute a negative factorial in equation 1.3, and equation 1.5 requires many iterations for negative n. I replaced equation 1.5 with an expansion based on Eulerian numbers, and only use equation 1.3 for positive n. I'm well outside my depth with this, but my code is here, for the curious: github.com/mike-bourgeous/mb-math/blob/… $\endgroup$
    – nitrogen
    Commented Jul 9, 2021 at 21:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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