Skip to content

Incorrect integral in Maxima #13733

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kcrisman opened this issue Nov 20, 2012 · 26 comments
Closed

Incorrect integral in Maxima #13733

kcrisman opened this issue Nov 20, 2012 · 26 comments

Comments

@kcrisman
Copy link
Member

See this ask.sagemath.org question.

sage: integral(log(cot(x)-1),x,0,pi/4)

ValueError: Integral is divergent.

But according to the poster it is pi log(2) / 8. And indeed in the most recent Maxima (5.28) we have

(%i5) display2d:false;

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

Is %pi/8 an ?integer?

n;
Is %pi/4 an ?integer?

n;
Is 2*%pi an ?integer?

n;
(%o6) -(%i*(2*li[2](%i+1)-2*li[2](1-%i))+%pi*log(2))/4
 +%i*li[2]((%i+1)/2)/2-%i*li[2](-(%i-1)/2)/2

though with the interaction this is not an improvement we can immediately use.

Component: calculus

Author: Peter Bruin

Branch: 59bb147

Reviewer: Ralf Stephan, Frédéric Chapoton

Issue created by migration from https://trac.sagemath.org/ticket/13733

@kcrisman
Copy link
Member Author

comment:1

According to the upstream report, that problem is also fixed here and there is also a commit of the integral in question as a test.

expand(integrate(log(cot(x)-1),x,0,%pi/4));
-%i*li[2](%i+1)/2+%i*li[2](%i/2+1/2)/2-%i*li[2](1/2-%i/2)/2+%i*li[2](1-%i)/2-%pi*log(2)/4$

So I guess when the next Maxima after 5.29.1 is ready and we put it in, we can try to close this report with a doctest.

@kcrisman
Copy link
Member Author

Upstream: Fixed upstream, but not in a stable release.

@kcrisman
Copy link
Member Author

comment:2

See #13973 for where we might fix this.

@jdemeyer jdemeyer modified the milestones: sage-5.11, sage-5.12 Aug 13, 2013
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.1, sage-6.2 Jan 30, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.2, sage-6.3 May 6, 2014
@pjbruin
Copy link
Contributor

pjbruin commented May 16, 2014

comment:6

Maxima 5.33 returns the answer without asking any questions.

@kcrisman
Copy link
Member Author

comment:7

Great, then all that's needed is a doctest once #13973 is ready.

Maxima 5.33 returns the answer without asking any questions.

@pjbruin
Copy link
Contributor

pjbruin commented May 23, 2014

comment:8

Unfortunately the fact that Sage loads the abs_integrate package causes this to fail when called from within Sage with the message PSLOG: internal error. So we still have to look into that.

@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.3, sage-6.4 Aug 10, 2014
@kcrisman
Copy link
Member Author

kcrisman commented Dec 8, 2014

comment:10

See also #12731.

@rwst
Copy link
Contributor

rwst commented Mar 7, 2015

comment:11

Replying to @pjbruin:

Maxima 5.33 returns the answer without asking any questions.

Maybe but 5.35 is back to original (PSLOG: internal error).

@rwst
Copy link
Contributor

rwst commented Mar 7, 2015

comment:12

Replying to @pjbruin:

Unfortunately the fact that Sage loads the abs_integrate package causes this to fail when called from within Sage with the message PSLOG: internal error. So we still have to look into that.

Maybe but Sage+Maxima-5.35 without abs_integrate gives -1/4*pi*log(2) - 1/2*I*polylog(2, I + 1) + 1/2*I*polylog(2, -I + 1) + 1/2*I*polylog(2, 1/2*I + 1/2) - 1/2*I*polylog(2, -1/2*I + 1/2) so this is not resolved either way.

@pjbruin
Copy link
Contributor

pjbruin commented Feb 3, 2017

comment:13

In SageMath 7.6.beta2, the answer appears to be correct up to simplification (probably thanks to Maxima commit ce7c53f1):

sage: integral(log(cot(x)-1),x,0,pi/4)
-1/4*pi*log(2) - 1/2*I*dilog(I + 1) + 1/2*I*dilog(-I + 1) + 1/2*I*dilog(1/2*I + 1/2) - 1/2*I*dilog(-1/2*I + 1/2)
sage: N(_)
0.272198261287950
sage: N(pi*log(2)/8)
0.272198261287950

Should we add this as a doctest and declare the bug to be fixed?

@kcrisman
Copy link
Member Author

kcrisman commented Feb 3, 2017

comment:14

I vote yes.

@pjbruin
Copy link
Contributor

pjbruin commented Feb 3, 2017

Author: Peter Bruin

@pjbruin
Copy link
Contributor

pjbruin commented Feb 3, 2017

Commit: 325a20b

@pjbruin
Copy link
Contributor

pjbruin commented Feb 3, 2017

@pjbruin
Copy link
Contributor

pjbruin commented Feb 3, 2017

Changed upstream from Fixed upstream, but not in a stable release. to none

@rwst
Copy link
Contributor

rwst commented Feb 4, 2017

Reviewer: Ralf Stephan

@vbraun
Copy link
Member

vbraun commented Feb 5, 2017

Changed branch from u/pbruin/13733-doctest_fixed_integral to 325a20b

@vbraun
Copy link
Member

vbraun commented Feb 6, 2017

Changed commit from 325a20b to none

@vbraun
Copy link
Member

vbraun commented Feb 6, 2017

comment:19

On one of the 32-bit buildbots:

sage -t --long src/sage/symbolic/integration/integral.py
6771**********************************************************************
6772File "src/sage/symbolic/integration/integral.py", line 771, in sage.symbolic.integration.integral.integrate
6773Failed example:
6774    N(a)  # long time
6775Expected:
6776    0.272198261287950
6777Got:
6778    0.272198261287950 + 5.55111512312578e-17*I
6779**********************************************************************
67801 item had failures:
6781   1 of 125 in sage.symbolic.integration.integral.integrate
6782    [168 tests, 1 failure, 16.86 s]

@vbraun vbraun reopened this Feb 6, 2017
@pjbruin
Copy link
Contributor

pjbruin commented Feb 7, 2017

Changed branch from 325a20b to u/pbruin/13733-doctest_fixed_integral

@pjbruin
Copy link
Contributor

pjbruin commented Feb 7, 2017

comment:20

The doctest should now be more robust.

@pjbruin
Copy link
Contributor

pjbruin commented Feb 7, 2017

Commit: 59bb147

@fchapoton
Copy link
Contributor

Changed reviewer from Ralf Stephan to Ralf Stephan, Frédéric Chapoton

@vbraun
Copy link
Member

vbraun commented May 21, 2017

Changed branch from u/pbruin/13733-doctest_fixed_integral to 59bb147

@sagetrac-tmonteil
Copy link
Mannequin

sagetrac-tmonteil mannequin commented Aug 14, 2020

comment:23

Follow-up: a bug with this integral reappared in recent Maxima release, see #30063

@sagetrac-tmonteil
Copy link
Mannequin

sagetrac-tmonteil mannequin commented Aug 14, 2020

Changed commit from 59bb147 to none

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants