Opened 5 years ago

Last modified 6 days ago

#8728 new defect

Incorrect integral from Maxima

Reported by: kcrisman Owned by: burcin
Priority: major Milestone: sage-6.4
Component: calculus Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: Fixed upstream, in a later stable release. Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

From #sage-devel:

Boulemans left the chat room. (Read error: Connection reset by peer)
[11:58am] Boule joined the chat room.
[11:58am] Boule: (laptop shutdown due to power supply)
[11:59am] Boule: e, T, w = var("e T w"); assume(1 = e^2)>0; integrate(cos(w+T)/(1+e*cos(T))^2,T,0,2*pi) should give -2*pi e cos w/(1-e^2)^3/2 instead of 0
[11:59am] Boule: can someone help?
[12:00pm] wjp: yeah, sage seems to have some trouble with this integral. You could try http://groups.google.com/group/sage-support since the right people don't seem to be here currently
[12:00pm] Boule: ok, thanx
[12:08pm] kcrisman: By the way, I just tried this and get a hang in Maxima.  Can you type the exact commands which lead to an answer of 0?
[12:08pm] kcrisman: If I plug something (.5, .75) in for e in Maxima in Sage, I do get zero as an output.
[12:12pm] Boule: don't know maxima, but with numerical values for e and w at wolfram-alfa, it gives something different than 0
[12:13pm] wjp: *nod* maple gives non-zeros too
[12:13pm] kcrisman: Can you give the *exact* sequence of commands which yield zero in Sage itself? 
[12:14pm] Boule: e = var('e')
[12:14pm] Boule: T = var('T')
[12:14pm] Boule: w = var('w')
[12:14pm] baali1 joined the chat room.
[12:14pm] baali left the chat room. (Quit: Leaving.)
[12:15pm] Boule: assume(1-e^2>0)
[12:15pm] Boule:  integrate(cos(w+T)/(1+e*cos(T))^2,T,0,2*pi)
[12:15pm] kcrisman: Okay, that's what I thought.
[12:16pm] kcrisman: Okay, it takes a while but I do get 0.

Change History (18)

comment:1 follow-up: Changed 5 years ago by jason

I wonder if this is another manifestation of this bug:

sage: integrate(sqrt(sin(x)^2+cos(x)^2), x,0,2*pi)
pi

comment:2 Changed 5 years ago by jason

#8729 may point to a solution.

comment:3 Changed 5 years ago by kcrisman

Hmm, I forgot about this, and it's true it never got implemented, did it?

comment:4 Changed 5 years ago by jason

It was fixed about two weeks ago in maxima. There was a new release of maxima a few days ago---I'm trying to make an spkg right now.

comment:5 Changed 5 years ago by kcrisman

Sweet. I haven't been keeping up on the Maxima list lately, thanks.

comment:6 in reply to: ↑ 1 Changed 5 years ago by jason

Replying to jason:

I wonder if this is another manifestation of this bug:

sage: integrate(sqrt(sin(x)^2+cos(x)^2), x,0,2*pi)
pi

I just checked; this ticket isn't the same bug.

comment:7 Changed 5 years ago by jason

The upgrade to maxima 5.21.1 does not fix this. After #8731:

sage: e, T, w = var("e T w")    
sage: assume(1-e^2>0)
sage: integrate(cos(w+T)/(1+e*cos(T))^2,T,0,2*pi)                                           
0

comment:8 Changed 4 years ago by kcrisman

Maxima 5.23.2 still has this, and we still haven't reported it.

Maxima 5.23.2 http://maxima.sourceforge.net
using Lisp SBCL 1.0.24
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
The function bug_report() provides bug reporting information.
(%i1) assume(1-e^2>0);
                                     2
(%o1)                              [e  < 1]
(%i3) integrate(cos(w+T)/(1+e*cos(T))^2,T,0,2*%pi);
(%o3)                                  0

This is now Maxima bug 3211975.

comment:9 Changed 4 years ago by kcrisman

  • Report Upstream changed from Not yet reported upstream; Will do shortly. to Fixed upstream, but not in a stable release.

According to the bug report, this is now fixed. However, some examples may still throw a Lisp error, so we should check out whether that will affect us before saying we're totally fixed when we upgrade.

comment:10 Changed 2 years ago by kcrisman

Maxima 5.28 is now out.

comment:11 Changed 2 years ago by kcrisman

See #13973 where this should (?) be fixed, just need a doctest here?

comment:12 Changed 17 months ago by jdemeyer

  • Milestone changed from sage-5.11 to sage-5.12

comment:13 Changed 11 months ago by vbraun_spam

  • Milestone changed from sage-6.1 to sage-6.2

comment:14 Changed 8 months ago by vbraun_spam

  • Milestone changed from sage-6.2 to sage-6.3

comment:15 follow-up: Changed 7 months ago by pbruin

In Maxima 5.33.0 (see #13973):

(%i1) assume(e^2<1);
                                     2
(%o1)                              [e  < 1]
(%i2) integrate(cos(w+T)/(1+e*cos(T))^2, T, 0, 2*%pi);
                      2
Is abs(e) - sqrt(1 - e ) - 1 positive, negative or zero?

negative;
   !          2     !
Is !sqrt(1 - e ) - 1! - abs(e) positive, negative or zero?

negative;
                                             2
                           2 %pi e sqrt(1 - e ) cos(w)
(%o2)                    - ---------------------------
                                   4      2
                                  e  - 2 e  + 1

This appears to be the correct answer. Note that the answers to both questions are "negative" for all e with -1 < e < 1, so it would be nice if Maxima didn't ask those questions.

comment:16 Changed 4 months ago by vbraun_spam

  • Milestone changed from sage-6.3 to sage-6.4

comment:17 in reply to: ↑ 15 Changed 2 months ago by kcrisman

In Maxima 5.33.0 (see #13973):
This appears to be the correct answer. Note that the answers to both questions are "negative" for all e with -1 < e < 1, so it would be nice if Maxima didn't ask those questions.

The thing noted in the message upstream when they closed their ticket

sage: integrate(cos(w+T)/(1+.5*cos(T))^2,T,0,2*pi)
<boom>

does still happen, but I think that is a different issue tracked elsewhere here (the usual keepfloat thing).

So... do we have a reasonable test case to add here to confirm this is fixed and close it?

comment:18 Changed 6 days ago by kcrisman

  • Report Upstream changed from Fixed upstream, but not in a stable release. to Fixed upstream, in a later stable release.
Note: See TracTickets for help on using tickets.