This has been reported to Wolfram and confirmed as a bug in Mathematica V12

This follows on from This question

I get a different answer for the same integral input in different ways e.g.

Integrate[Log[(Sin[k] + Sqrt[1 + Sin[k]^2])^2], {k, 0, π}]
(* 4 Catalan + π Log[2] *)

\*SubsuperscriptBox[\(∫\), \(0\), \(π\)]\(Log[\((Sin[
       k] + Sqrt[1 + Sin[k]^2])\)^2] \[DifferentialD]k\)\)
(* 4 Catalan *)

Numerical integration confirms that the second result is correct.

See the screenshot for a clearer view of what I did

enter image description here

As a further point of evidence, I get the correct answer if I wrap it in Hold, and then release it:

 Hold[Integrate[Log[(Sin[k] + Sqrt[1 + Sin[k]^2])^2], {k, 0, π}]]]
(* 4 Catalan *)
  • 1
    $\begingroup$ On 12.0.0 for Mac OS X x86 (64-bit) (April 7, 2019) the result is 4 Catalan for both. $\endgroup$ Sep 28 '19 at 20:35
  • 1
    $\begingroup$ On 10.4.1 for Microsoft Windows (64-bit) (April 11, 2016) the result is 4 Catalan for both. $\endgroup$ Sep 28 '19 at 23:27
  • 3
    $\begingroup$ @mikado, I found another amazing behavior. If you change the order of inputs: In[3] and next In[1], then both results are correct. So, probably the correct result is with integral sign (your In[3]) and then MMA caches this somehow and uses with Integrate[...] (your In[1]) and gives right answer. MMA 12, Windows 10. $\endgroup$
    – Alx
    Sep 29 '19 at 1:05

The format appears to be a distraction. I get a different answer on the second time I evaluate the integral.


 Integrate[Log[(Sin[k] + Sqrt[1 + Sin[k]^2])^2], {k, 0, π}]]

(* 4 Catalan + π Log[2] *)

(* 4 Catalan *)

(* "12.0.0 for Linux x86 (64-bit) (April 7, 2019)" *)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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