# Incorrect result when integrating

Mathematica 10.4.1.0 produces

Integrate[
Log[1 + 2 a*Cos[2 x] + a^2]*Sin[x]^2, {x, 0, Pi/2},
Assumptions -> a > 1
]

ConditionalExpression[1/4 Pi (-1 + 2 Log[a]), a < 3]


whereas the correct result is $$\frac\pi 4\left(\ln a^2 -\frac 1 a\right)$$ according to Gradshtein & Ryzhik, formula 4.397.14.

How to correct this defect?

• The conditional expression generic formula seems not to match a particular case, Integrate[Log[1 + 2 2*Cos[2 x] + 2^2]*Sin[x]^2, {x, 0, Pi/2}] (which matches GR). – b.gates.you.know.what Jul 21 '16 at 7:24
• NIntegrate[] works fine here if it's of any help. l = Transpose[{Range[1, 3, 0.1], Table[ NIntegrate[ Log[1 + 2 a*Cos[2 x] + a^2]*Sin[x]^2, {x, 0, Pi/2}], {a, 1, 3, 0.1}]}]; ListPlot[l] – Feyre Jul 21 '16 at 7:33

Using the conditions in the book

ClearAll[a, x];
expr = Log[1 + 2 a*Cos[2 x] + a^2]*Sin[x]^2;
r = Integrate[expr, {x, 0, Pi/2}, Assumptions -> a^2 > 1]


Book result

You used $a>1$ but the book says to use $a^2>1$. These are not the same.

Update: I asked about this on another forum. Experts opinions says that result should be valid for $|a|>1$ and not just $a^2>1$. reference. So the result given should also apply for $a>1$.

• @ Naser: Thank you. How about the case $a>1$ which implies $a^2>1$? – user64494 Jul 21 '16 at 8:13
• @user64494 $a>1$ implies $a^2>1$, but $a^2>1$ does not imply $a>1$ and the result in the book is valid for $a^2>1$ which agrees with what M gives. Now for $a>1$ the result is what you show in your question. Which I assume is correct. – Nasser Jul 21 '16 at 8:19
• This gives the conditional expression that a< -1, even though it is valid for a>1 too. – Feyre Jul 21 '16 at 8:22
• @Feyre You might be right. I updated the answer with link. – Nasser Jul 21 '16 at 22:11
• @MichaelE2 I am using 10.4.1, 64 bit, on windows 7 64 bits. Screen shot !Mathematica graphics if you are not on windows, then this means there is platform difference ! – Nasser Jul 22 '16 at 0:33