Generalizing the previous question: Define Log so that negative reals evaluate on lower edge of branch

For real positive values $x>1$, Mathematica's polylogarithm function PolyLog[2, x] yields a result whose imaginary part is negative (because it is defined to be evaluated just below the cut).

For example:

In[1] := PolyLog[2, 1.6]
Out[1] = 2.41313 - 1.47656 I  

In the spirit of the previous question (linked above) what is the cleanest way to get Mathematica to evaluate the function just above the cut, so that I get a positive imaginary part?

Desired output:

Out[1] = 2.41313 + 1.47656 I  


The PolyLog appears inside the definition of a larger function that I am using. I need to use this function for both analytic and numeric purposes. I should be able to evaluate it numerically, and also be able to differentiate it without giving a lot of non-analytic garbage associated with the deserved change. Is there anything I can do so that I get both properties?

  • $\begingroup$ Or PolyLog[2, 1.6] /. x_Complex -> Conjugate[x] $\endgroup$
    – Bob Hanlon
    Jul 10, 2014 at 13:35
  • $\begingroup$ @Öskå These won't do; I need to be able to use this analytically too. See the edit. $\endgroup$
    – QuantumDot
    Jul 10, 2014 at 14:31
  • $\begingroup$ @ QuantumDot: With my prescription you can do exactly what you descibed in your edit. You leave eps in the formulas, in the analytic parts you let eps->+-0 in the numerical parts you put in a small numerical value for eps and look how the numeric solution depends on eps (which it should'n for small enough eps) $\endgroup$ Aug 21, 2014 at 8:34

2 Answers 2


It seems to me there is a perfectly simple way to go about this:

dilogAbove[z_] := Conjugate[PolyLog[2, Conjugate[z]]]

As the dilogarithm is analytic except at its branch cut from $[1,\infty)$, this double conjugation will leave this modified dilogarithm taking exactly the same values as the original dilogarithm. At the branch cut, the new function becomes continuous from above instead of the default of being continuous from below.

PolyLog[2, 1.6]
   2.4131311379746245 - 1.4765599487989438 I

   2.4131311379746245 + 1.4765599487989438*I

Of course, though the construction given above is simple and completely suitable for numerical work, it will not "play nice" with operations like D[]. There is a more complicated form for the dilogarithm which is also continuous from above, based on Euler's reflection formula:

dilogabove[z_] := π^2/6 - PolyLog[2, 1 - z] + Log[z] Log[1/(1 - z)]

You can check using D[] that its derivative is consistent with the result of D[PolyLog[2, z], z] after replacing the Log[] with log0[] in whuber's answer to a closely related question.

Unfortunately, this construction will not work at $z=0,1$, though the expression gives the expected results with Limit[]. Thus: use the double conjugation for numerics, and the Euler-reflected form for symbolics.

  • $\begingroup$ The running result in v13.3 is inconsistent with the answer. $\endgroup$
    – lotus2019
    Nov 3 at 7:53

After some contemplation (and some errating comments) I realized that exactly on the real axis above $z=1$ the function PolyLog[k, z] is not well defined, but a choice must be made from which bank of the branch cut we are approaching the real axis (hence my "contemplation" led to a well known result). Mathematica has made that choice which is, however, hidden in its intrinsics. In order to regain governance over this choice the procedure should be the following.

Extend the definition of the function introducing a real parameter eps

myPolyLog[k_, z_, eps_] := PolyLog[k, z + I eps]

Do with this function - as a function of z - all things you want but keep eps in place. Only in the end perform the limit eps -> 0. And now the clue: there is an option Direction by which you can specify your choice.

Ok, let's do it for your example of $z = 1.6$:

First choice Direction -> +1

Limit[myPolyLog[2, 1.6, eps], eps -> 0, Direction -> +1]
2.41313 - 1.47656 I

Second choice Direction -> -1

Limit[myPolyLog[2, 1.6, eps], eps -> 0, Direction -> -1]
2.41313 + 1.47656 I

Now for the derivative (as an example)

d = D[myPolyLog[2, z, eps], z]
-(Log[1 - I eps - z]/(I eps + z))
Limit[d, eps -> 0, Direction -> +1]
Limit[d, eps -> 0, Direction -> -1]
-(Log[1 - z]/z)

-(Piecewise[{{Conjugate[Log[1 - z]], Im[z] == 0 && Re[z] > 0}}, Log[1 - z]]/z)

Interestingly Conjugate pops up "by itself".

Now specifically at z = 1.6 (and the Limit in the utmost end!)

Limit[d /. z -> 1.6, eps -> 0, Direction -> +1]
Limit[d /. z -> 1.6, eps -> 0, Direction -> -1]
0.319266 - 1.9635 I

0.319266 + 1.9635 I

In the end it's almost trivial. I have only considered two examples of manipulations on the function, but I guess that the procedure can be applied consistently through analytic manipulations.

Hope this helps.

Best regards, Wolfgang

  • $\begingroup$ To whom it concerns: please explain the recent downvoting by 15 points. $\endgroup$ Sep 14, 2017 at 16:01
  • $\begingroup$ The running result in v13.3 is inconsistent with the answer. $\endgroup$
    – lotus2019
    Nov 3 at 7:53
  • $\begingroup$ @lotus2019 Could you please elaborate what you mean precisely? $\endgroup$ Nov 3 at 19:44

Your Answer

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

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