# Why does this lead to zero when integrating a non-negative function?

When I try to integrate this $$\int_0^{1} \frac{\log ^2(x+1) \log ^2(1-x)}{x} \, dx$$, it leads to 0.

And when I use NIntegrate, it turns into a positive number, which seems to be right.

The codes are shown below.

Clear["Global*"];
Plot[Log[1 + x]^2 Log[1 - x]^2/x, {x, 0, 1}]
Integrate[Log[1 + x]^2 Log[1 - x]^2/x, {x, 0, 1}]
NIntegrate[Log[1 + x]^2 Log[1 - x]^2/x, {x, 0, 1}]

• Setting $x=0$ and $x=1$ gives Indeterminate and Infinity. In v12.3.1 it doesn't return zero - it can't work out the integral. Commented Sep 14, 2021 at 12:18
• Rubi and Maple 2021 fail with it, returning the input. Commented Sep 14, 2021 at 13:24
• @flinty - with v12.3.1 on my Mac I get zero for Integrate (after a long wait). Commented Sep 14, 2021 at 13:40
• Confirm it in 12.3.1 on Windows 10 Pro. Commented Sep 14, 2021 at 13:43
• It would probably be worth sending this to Wolfram's Product Feedback team to make them aware of the issue (if they aren't already.) Commented Sep 14, 2021 at 19:15

I cannot answer why, but I can provide an analytical solution with MA. We have

$$\int_0^1 \frac{\log ^2(1-x) \log ^2(x+1)}{x} \, dx= \frac{1}{12} \int_0^1 \frac{\log ^4\left(1-x^2\right)}{x} \, dx +\frac{1}{12} \int_0^1 \frac{\log ^4\left(\frac{1-x}{x+1}\right)}{x} \, dx -\frac{1}{6} \int_0^1 \frac{\log ^4(1-x)}{x} \, dx -\frac{1}{6} \int_0^1 \frac{\log ^4(x+1)}{x} \, dx.$$

Each of them can be correctly computed with MA

i1 = 1/12 Integrate[Log[1 - x^2]^4/x, {x, 0, 1}]
(*Zeta[5]*)
i2 = 1/12 Integrate[Log[(1 - x)/(1 + x)]^4/x, {x, 0, 1}]
(*(31 Zeta[5])/8*)
i3 = -1/6 Integrate[Log[1 - x]^4/x, {x, 0, 1}]
(*-4 Zeta[5]*)
i4 = -1/6 Integrate[Log[1 + x]^4/x, {x, 0, 1}]
(*1/6 (-(2/3) \[Pi]^2 Log[2]^3 + (4 Log[2]^5)/5 + 21/2 Log[2]^2 Zeta[3] +
24 (Log[2] PolyLog[4, 1/2] + PolyLog[5, 1/2] - Zeta[5]))*)


Combining together we obtain

i = i1 + i2 + i3 + i4


$$4 \text{Li}_5\left(\frac{1}{2}\right)+\text{Li}_4\left(\frac{1}{2}\right) \log (16)-\frac{25 \zeta (5)}{8}+\frac{7}{4} \zeta (3) \log ^2(2)+\frac{2 \log ^5(2)}{15}-\frac{1}{9} \pi ^2 \log ^3(2).$$

• Could you ground that the integral under consideration equals i1+i2+i3+i4 in order to complete your answer? TIA. Commented Sep 14, 2021 at 21:38
• @user64494 Does FullSimplify[Log[1 - x^2]^4/(12 x) + Log[(1 - x)/(x + 1)]^4/(12 x) - Log[1 - x]^4/(6 x) - Log[1 + x]^4/(6 x), Assumptions -> 0 < x < 1] which results in (Log[1 - x]^2 Log[1 + x]^2)/x provide the desired justification?
– JimB
Commented Sep 14, 2021 at 21:53
• @JimB: Yes. Thank you. Commented Sep 14, 2021 at 22:00
• BTW, now Integrate[Log[1 + x]^2 Log[1 - x]^2/x, {x, 0, 1}] returns the input. Commented Sep 14, 2021 at 22:03
• @SHBookP You would do such a separation when solving the integral manually. The four integrals are easier to compute. It seems to be easier to MA as well. Concerning your second question, how they can be actually computed. These are popular integral types often discussed in math.stackexchange.com. Have a look at the solutions of simpler integral math.stackexchange.com/q/795867/435814 . If you ar interested in the manual solution, post your question there, you'll get the answer quick. For MA--post another question here. Commented Sep 23, 2021 at 5:48

Not an answer for the question only how easy compute integral

This such form integrals we can compute with MultipleZetaValues-1.1.0 package.

<< MultipleZetaValues
MZIntegrate[Log[1 + x]^2 Log[1 - x]^2/x, {x, 0, 1}]

(*-(1/9) \[Pi]^2 Log[2]^3 + (2 Log[2]^5)/15 +
4 Log[2] PolyLog[4, 1/2] + 4 PolyLog[5, 1/2] +
7/4 Log[2]^2 Zeta[3] - (25 Zeta[5])/8*)

• This an analytical-form expression, not a closed-form expression (see en.wikipedia.org/w/… for the definitions), is of low interest. In fact, we use the result of NIntegrate[Log[1 + x]^2 Log[1 - x]^2/x, {x, 0, 1}] only. Commented Apr 11 at 9:47

I am the OP. The current situation is like this. I am running it in my 14.0.0 version:

AbsoluteTiming[Integrate[Log[1 + x]^2*(Log[1 - x]^2/x), {x, 0, 1}]]
$Version  The first result is like this: which shows that after more than 3 minutes, Mathematica returns an unevaluated output. After sending the bug to Wolfram's Product Feedback team on 2021-09-24, they didn't reply after confirming the issue. Then I asked them again yesterday and got the following reply(personal information has been erased): Hello ████ ███, Thank you for your email. The issue has been fixed since Mathematica 13.3. There is no closed-form solution to the given integral, so Mathematica will return an unevaluated output. In[1]:= AbsoluteTiming[Integrate[Log[1+x]^2*(Log[1-x]^2/x),{x,0,1}]] Out[1]= {131.705, Integrate[(Log[1 - x]^2*Log[1 + x]^2)/x, {x, 0, 1}]} In[2]:=$Version
Out[2]= 14.0.0 for Mac OS X ARM (64-bit) (December 13, 2023)


Please feel free to let me know if you have any further questions.

Sincerely,

██ ███, PhD

Wolfram Technical Support

Wolfram Research, Inc.

http://support.wolfram.com

@yarchik's answer is an analytical form for the integration, and there is indeed no closed-form solution to the given integral. Thanks to @user64494 for reminding me.

• @yarchik found an analytical form, not a closed-form expression for that integral. See Wiki for info. All that is old-fashioned math. In fact, we use the result of NIntegrate[Log[1 + x]^2 Log[1 - x]^2/x, {x, 0, 1}] only. Commented Apr 11 at 5:00
• Sorry, I don't understand the difference between the two. If you are free or interested, you can Edit my answer. @user64494 Commented Apr 11 at 9:14
• SHBooKP (@ does not work): Did you look in the link to a Wiki article (where the definitions of a closed form and an analytical form are done) from my comment before having posted your comment? Commented Apr 11 at 9:37