Computation for small z
The power sum converges rapidly when .
To compute the series expansion with respect to , we substitute
and obtain
where
The remainder term is bounded
via the following strategy, implemented in mag_polylog_tail()
.
Denote the terms by . We pick a nonincreasing function such that
Then, as soon as ,
In particular, we take
where . This follows from the bounds
and
Expansion for general z
For general complex , we write the polylogarithm as a sum of
two Hurwitz zeta functions
in which .
With the principal branch of , we obtain the conventional
analytic continuation of the polylogarithm with a branch
cut on .
To compute the series expansion with respect to , we substitute
in this formula
(at the end of the computation, we map to
obtain the power series for ).
The right hand side becomes
where , ,
, .
When , the and terms become Laurent series with
a leading term. In this case,
we compute the deflated series .
Then
Note that is a power series, since the constant term in
is zero when . So we simply compute one extra derivative
of both and , and shift them one step.
When , the prefactor has a pole.
In this case, we proceed analogously and formally multiply
with .
Note that the formal cancellation only works when the order (or )
is an exact integer: it is not currently possible to use this method when
is a small ball containing any of (then the
result becomes indeterminate).
The Hurwitz zeta method becomes inefficient when (it
gives an indeterminate
result when ). This is not a problem since we just use the defining series
for the polylogarithm in that region.
It also becomes inefficient when , for which an asymptotic
expansion would better.