# Can your Mathematica do the following integral?

Backslide introduced in v10 and fixed in v10.4.1.

I was trying to do the following integral in Mathematica:

Integrate[(z-2) PolyLog[2,z]Log[1-z]/z^3,z]


What I got was:

The result after FullSimplify:

While on my friends' computers, Using mathematica, both of them were able to get the result of the integral immediately, which is

Could anyone tell what went wrong with my Mathematica or what setting should I change? I'm using the student edition, Version 10.3.1.

The other weird thing is Mathematica is actually able to do the following integrals separately:

And I tried just now, Wolfram Alpha is actually able to do this integral:http://www.wolframalpha.com/input/?i=Integrate%5B%28x-2%29+PolyLog%5B2%2Cz%5D+Log%5B1-z%5D%2Fz%5E3%2Cz%5D

• Verified on my 10.3.1. A FullSimplify doesn't help. I took the derivative of the answer provided, and indeed it gives the integrand. Yet 10.3.1 can't do the integral. Dec 26, 2015 at 4:15
• Ditto @MarkAdler's comment. What was your friends machine and which version of Mathematica?
– Moo
Dec 26, 2015 at 4:16
• I actually tried it on my 10.1.0, and it's not working, then I updated my Mathematica to 10.3.1, and it's still not work.
– Nahc
Dec 26, 2015 at 4:17
• One of them is using Macbook and the other one is using Windows.
– Nahc
Dec 26, 2015 at 4:18
• Here is a workaround, since it can do it term by term. f = (z - 2) PolyLog[2, z] Log[1 - z]/z^3;Simplify[Integrate[#, z] & /@ Expand[f]] !Mathematica graphics Mathematica seems to be really confused about something here. Dec 26, 2015 at 5:06

\$Version

(*  "10.3.1 for Mac OS X x86 (64-bit) (December 9, 2015)"  *)

f[z_] = (z - 2) PolyLog[2, z] Log[1 - z]/z^3;

fi[z_] = Integrate[#, z] & /@ (f[z] // Expand) //
FullSimplify

(*  (1/(6*z^2))*
(z^2*(Pi^2 - 24*ArcTanh[
1 - 2*z]) +
12*z*Log[1 - z] - 3*(-1 + z)^2*
Log[1 - z]^2 -
6*(z*(1 + z) + (-1 + z)*
Log[1 - z])*PolyLog[2, z])  *)

D[fi[z], z] == f[z] // Simplify

(*  True  *)

• It seems that Expand is expanding the integrand into the two terms that the OP points out in the question can be integrated. (I just noticed it was also pointed out by Nasser. Oh, well, interesting.) Dec 27, 2015 at 5:13
• @Bob Hanlon Dear Bob, on my machine Win7/Mma10.3 the operator Integrate[#, z] & /@ (f[z]) already nicely makes the job. However, strangely seemingly the operator Integrate[f[z], z] that is very close the the previous one, returns the expression only partially evaluated. Could you kindly comment on the reasons of such a behavior? Feb 22, 2016 at 8:31
• @AlexeiBoulbitch - the direct integration encounters a pattern in the integrand (or intermediate step) for which it does not have a rule/algorithm. Mapping onto the component parts provides simpler forms for which it has the necessary rules/algorithms. Presumably there is some reason why Mma doesn't automatically do this mapping (efficiency or edge cases where it would complicate dealing with singularities?). I view this as similar to the way that use of Simplify or FullSimplify is left to the user's discretion: apply as necessary. Feb 22, 2016 at 14:15
• @Bob Hanlon Thank you, good to know. Feb 22, 2016 at 15:26

Here's a workaround to get an antiderivative:

ad = Integrate[(z - 2) PolyLog[2, z] Log[1 - z]/z^3, {z, 1/2, x},
GenerateConditions -> False]
(*
(1/(24 x^2))(-48 (-1 + x) x Log[1 - x] - 12 (-1 + x)^2 Log[1 - x]^2 +
x^2 (-24 (Log[2]^2 + Log[2]^3 - 2 Log[4]) + π^2 (6 + Log[16]) +
48 Log[x]) - 24 (x (1 + x) + (-1 + x) Log[1 - x]) PolyLog[2, x])
*)


Numeric checks against NIntegrate:

(* For 0 < x < 1 *)
{Hold[NIntegrate[(z - 2) PolyLog[2, z] Log[1 - z]/z^3, {z, 1/2, #},
WorkingPrecision -> 20] & /@ x],
ad} /. x -> RandomReal[1, 10, WorkingPrecision -> 20] // ReleaseHold
Subtract @@ %
(*
{{-4.3165400356514353565,  1.3300977020665013728,   1.2997863764381825926,
1.6292844375810144296,  0.82000829487649921791, -2.6361785894927865795,
-1.8584257847053658824, -3.3417797354652695764,   0.44399367232706982999,
-1.4571741116926172876},
{-4.31654003565143536,    1.330097702066501373,    1.299786376438182593,
1.629284437581014430,   0.820008294876499218,   -2.636178589492786580,
-1.858425784705365882,  -3.34177973546526958,     0.443993672327069830,
-1.457174111692617288}}

{0.*10^-18, 0.*10^-19, 0.*10^-19, 0.*10^-19, 0.*10^-19,
0.*10^-19, 0.*10^-19, 0.*10^-18, 0.*10^-19, 0.*10^-19}
*)

(* For -2 < x < 0 *)
{Hold[NIntegrate[(z - 2) PolyLog[2, z] Log[1 - z]/z^3, {z, -1, #},
WorkingPrecision -> 20] & /@ x],
ad - (ad /. x -> -1)} /. x -> RandomReal[{-2, 0}, 10, WorkingPrecision -> 20] //
ReleaseHold;
Subtract @@ %
(*
{0.*10^-19 + 0.*10^-19 I, 0.*10^-19 + 0.*10^-19 I,
0.*10^-19 + 0.*10^-19 I, 0.*10^-19 + 0.*10^-19 I,
0.*10^-19 + 0.*10^-19 I, 0.*10^-19 + 0.*10^-19 I,
0.*10^-19 + 0.*10^-19 I, 0.*10^-19 + 0.*10^-19 I,
0.*10^-19 + 0.*10^-19 I, 0.*10^-19 + 0.*10^-19 I}
*)


Another way to get an antiderivative:

Integrate[(z - 2) PolyLog[2, z] Log[1 - z]/z^3, z] /.
HoldPattern@Integrate[i_, v_] :> (Integrate[#, v] & /@ Expand[i]) //
FullSimplify
(*
(1/(6 z^2))(3 (4 - 3 z) z Log[1 - z] - 3 (-1 + z)^2 Log[1 - z]^2 +
z^2 (-3 + 2 π^2 - 3 Log[-1 + z] + 12 Log[z]) -
6 (z (1 + z) + (-1 + z) Log[1 - z]) PolyLog[2, z])
*)

• Hi, I tried to use your way of doing another integral :Integrate[(24 (1 - z)^a)/((-1 + (1 - z)^\a)^2 z) /. HoldPattern@Integrate[i_, v_] :> (Integrate[#, v] & /@ Expand[i]) // FullSimplify, but it seems that the result it gave isn't the integral. Could you tell me when your command is applicable? Thank you so much!
– Nahc
May 31, 2016 at 21:44