Opened 3 years ago

Last modified 2 months ago

#24587 new defect

Wrong integral of sqrt(1-cos(x))

Reported by: tmonteil Owned by:
Priority: major Milestone: sage-8.2
Component: symbolics Keywords: integrate
Cc: charpent, mafra, kcrisman Merged in:
Authors: Reviewers:
Report Upstream: Reported upstream. No feedback yet. Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description (last modified by kcrisman)

As reported on this ask question:

sage: integral(sqrt(1-cos(x)), x, 0, 2*pi)
0

This comes from the following wrong primitive

sage: integral(sqrt(1-cos(x)), x, algorithm='maxima')
-2*sqrt(2)/sqrt(sin(x)^2/(cos(x) + 1)^2 + 1)

where Fricas find a correct answer:

-2*(cos(x) + 1)*sqrt(-cos(x) + 1)/sin(x)

See Maxima bug 3659.

Change History (9)

comment:1 Changed 3 years ago by mafra

  • Cc mafra added

comment:2 Changed 3 years ago by mantepse

#25220 fixes the problem with FriCAS.

Last edited 3 years ago by mantepse (previous) (diff)

comment:3 Changed 6 months ago by chapoton

  • Description modified (diff)

comment:4 Changed 6 months ago by chapoton

  • Description modified (diff)

comment:5 Changed 6 months ago by chapoton

  • Keywords integrate added

comment:6 Changed 2 months ago by chapoton

  • Cc kcrisman added

This should be upstreamed to maxima. Karl-Dieter, would you do so, please ?

comment:7 Changed 2 months ago by kcrisman

Interestingly, this may not necessarily be a problem with domain:complex. Can you just confirm that the Fricas antiderivative makes more sense at this graphic? It's been a while since I've had to deal with branch cuts and I feel like that is part of the question here - but the way in which the graphs are different between pi and 2pi is definitely a problem. BUT Maxima gives the correct answer to the definite integral between pi and 2pi with either setting of domain.

comment:8 Changed 2 months ago by kcrisman

Okay, it is domain:complex, but more subtly.

(%i1) integrate(sqrt(1-cos(x)), x, %pi, 2*%pi);
                                      3/2
(%o1)                                2
(%i2) integrate(sqrt(1-cos(x)), x, 0, 2*%pi);  
                                      5/2
(%o2)                                2
(%i3) domain:complex;
(%o3)                               complex
(%i4) integrate(sqrt(1-cos(x)), x, %pi, 2*%pi);
                                      3/2
(%o4)                                2
(%i5) integrate(sqrt(1-cos(x)), x, 0, 2*%pi);
(%o5)                                  0

This I am more confident about reporting upstream.

comment:9 Changed 2 months ago by kcrisman

  • Description modified (diff)
  • Report Upstream changed from N/A to Reported upstream. No feedback yet.
Note: See TracTickets for help on using tickets.