Menu

#3649 Wrong integrate(log(cot(x)-1),x,0,%pi/4) (regression)

closed
nobody
None
5
2026-08-21
2020-08-19
No

We noticed the following regression between Maxima 5.42.2 and Maxima 5.44.0:

With Maxima 5.42.2:

(%i1) display2d:false;

(%o1) false
(%i2) integrate(log(cot(x)-1),x,0,%pi/4);

(%o2) (%i*li[2]((%i+1)/2)-%i*li[2](-(%i-1)/2))/2
 -(%i*(2*li[2](%i+1)-2*li[2](1-%i))+%pi*log(2))/4
(%i3) expand(float(%));

(%o3) 0.2721982612879501

Which seems OK since the integral is supposed to be pi*log(2)/8 whose numerical value is 0.272198261287950.

But with Maxima 5.44.0, some imaginary value appears:

(%i1) display2d:false;

(%o1) false
(%i2) integrate(log(cot(x)-1),x,0,%pi/4);

(%o2) (-(%i*li[2](%i+1))/2)+(%i*li[2]((%i+1)/2))/2-(%i*li[2](-(%i-1)/2))/2
                           +(%i*li[2](1-%i))/2
                           -(%pi*log(4)-%pi*log(2)-2*%pi*log(-2))/8
                           -(3*%pi*log(2))/8
(%i3) expand(float(%));

(%o3) 2.467401100272339*%i+0.2721982612879502

Downstream related ticket : https://trac.sagemath.org/ticket/30063

Discussion

  • Peter Bruin

    Peter Bruin - 2020-08-19

    This seems to be caused by commit 47a6afd.

     
  • Kris Katterjohn

    Kris Katterjohn - 2020-08-19

    I'll add a little more context here, along with some links.

    The commit message for the aforementioned commit [47a6af] (which was fixing bug [#3484]) says that it caused this integral to fail. This integral is in our test suite (added in commit [ce7c53] from bug [#2501]) and it's currently marked as a known failure.

     

    Related

    Bugs: #2501
    Bugs: #3484
    Commit: [47a6af]
    Commit: [ce7c53]

  • Peter Bruin

    Peter Bruin - 2020-08-20

    Thanks for the explanation!
    Possibly also related: [#3079]

     

    Related

    Bugs: #3079

  • David Scherfgen

    David Scherfgen - 2026-08-21

    In Maxima 5.50post (SBCL 2.6.7) integrate(log(cot(x)-1),x,0,%pi/4) returns %catalan - %i*li[2]((1-%i)/2)/2 + %i*li[2]((1+%i)/2)/2, which is purely real; the spurious 2.467401100272339*%i seen in 5.44.0 is gone. Its float, 0.27219826128795016, matches %pi*log(2)/8 = 0.27219826128795027 and quad_qags = 0.2721982612879502. A few informational "atanh: argument 1 isn't in the domain of atanh" messages are printed during the computation; they are warnings, not errors, and do not affect the result.

    (%i2) integrate(log(cot(x)-1),x,0,%pi/4);
    (%o2) -((%i*li[2]((1-%i)/2))/2)+(%i*li[2](-((-%i-1)/2)))/2+%catalan
    (%i3) expand(float(%));
    (%o3) 0.27219826128795016
    (%i5) quad_qags(log(cot(x)-1),x,0,%pi/4);
    (%o5) [0.2721982612879502,1.1892767769145847e-14,21,0]
    

    Verified by Claude.

     

Log in to post a comment.