Bug?

80 views
Skip to first unread message

OHappyDay

unread,
Sep 5, 2024, 9:16:37 AMSep 5
to sage-support
I recently stumbled upon something that looks like a bug:

Try to integrate the following function:

f(x)=log(1-4*cos(x)+4)
integrate(f,x,0,pi)

According to the following video (https://www.youtube.com/watch?v=nscSDYApAjM) the result should be

2*pi*log(2)

But my local Sage as well as online I get this result:

1/12*I*pi^2 + pi*log(3) - 1/2*pi*log(9/4) + 1/2*I*log(2)^2 - I*dilog(2) + I*dilog(-1/2) + I*dilog(-2)

which is a complex number instead.

Similarly this function

g(x)=log(1-cos(x)+1/4)
integrate(g,x,0,pi)

results in

1/12*I*pi^2 - pi*log(3) + 1/2*pi*log(9/4) + 1/2*I*log(2)^2 - I*dilog(2) + I*dilog(-1/2) + I*dilog(-2)

although it should be ZERO.

David Joyner

unread,
Sep 5, 2024, 9:19:02 AMSep 5
to sage-s...@googlegroups.com
On Thu, Sep 5, 2024 at 9:16 AM 'OHappyDay' via sage-support <sage-s...@googlegroups.com> wrote:
I recently stumbled upon something that looks like a bug:

Try to integrate the following function:

f(x)=log(1-4*cos(x)+4)
integrate(f,x,0,pi)

According to the following video (https://www.youtube.com/watch?v=nscSDYApAjM) the result should be

2*pi*log(2)

But my local Sage as well as online I get this result:

1/12*I*pi^2 + pi*log(3) - 1/2*pi*log(9/4) + 1/2*I*log(2)^2 - I*dilog(2) + I*dilog(-1/2) + I*dilog(-2)

which is a complex number instead.

This could be a bug in Maxima:

sage: CC(integrate(f,x,0,pi, algorithm='sympy'))

4.35517218060720

sage: CC(integrate(f,x,0,pi, algorithm='maxima'))

4.44089209850063e-16 - 3.28986813369645*I

sage: CC(2*pi*log(2))

4.35517218060720
 

Similarly this function

g(x)=log(1-cos(x)+1/4)
integrate(g,x,0,pi)

results in

1/12*I*pi^2 - pi*log(3) + 1/2*pi*log(9/4) + 1/2*I*log(2)^2 - I*dilog(2) + I*dilog(-1/2) + I*dilog(-2)

although it should be ZERO.

--
You received this message because you are subscribed to the Google Groups "sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sage-support...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/d3714f3c-b193-4d32-9d44-8a5a6d8ec5f1n%40googlegroups.com.

OHappyDay

unread,
Sep 7, 2024, 11:20:08 AMSep 7
to sage-support
I have reported this to the Maxima team.

OHappyDay

unread,
Sep 9, 2024, 5:13:18 AMSep 9
to sage-support
The Maxima team has opened two bug reports about this issue:

incorrect dilogarithm limit in definite integral & incorrect trig substitution:

OHappyDay

unread,
Sep 17, 2024, 6:14:29 PMSep 17
to sage-support
For the curious: the Maxima team opened a third bug report: https://sourceforge.net/p/maxima/bugs/4373/ which discusses a possible fix (evaluating  conjugate(li[n](x)) does not consider that li[n](x) can also be complex :-( ).
Reply all
Reply to author
Forward
0 new messages