Skip to content
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

doctest fixed integral from Maxima #8728

Closed
kcrisman opened this issue Apr 20, 2010 · 32 comments
Closed

doctest fixed integral from Maxima #8728

kcrisman opened this issue Apr 20, 2010 · 32 comments

Comments

@kcrisman
Copy link
Member

This is fixed now and needs a doctest:

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.

Component: calculus

Author: Ralf Stephan

Branch: d4b0db5

Reviewer: Travis Scrimshaw

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

@jasongrout
Copy link
Member

comment:1

I wonder if this is another manifestation of this bug:

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

@jasongrout
Copy link
Member

comment:2

#8729 may point to a solution.

@kcrisman
Copy link
Member Author

comment:3

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

@jasongrout
Copy link
Member

comment:4

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.

@kcrisman
Copy link
Member Author

comment:5

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

@jasongrout
Copy link
Member

comment:6

Replying to @jasongrout:

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.

@jasongrout
Copy link
Member

comment:7

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

@kcrisman
Copy link
Member Author

comment:8

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.

@kcrisman
Copy link
Member Author

comment:9

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.

@kcrisman
Copy link
Member Author

Changed upstream from Not yet reported upstream; Will do shortly. to Fixed upstream, but not in a stable release.

@kcrisman
Copy link
Member Author

comment:10

Maxima 5.28 is now out.

@kcrisman
Copy link
Member Author

comment:11

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

@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 21, 2014

comment:15

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.

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

comment:17

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?

@kcrisman
Copy link
Member Author

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

@rwst

This comment has been minimized.

@rwst
Copy link

rwst commented Feb 1, 2015

comment:19

Here's the doctest:

sage: assume(1-e^2>0)
sage: assume(abs(e)-sqrt(1-e^2)-1>0)
sage: assume(abs(sqrt(1-e^2)-1)-abs(e)>0)
sage: integrate(cos(w+T)/(1+e*cos(T))^2,T,0,2*pi)
2*pi*sqrt(-e^2 + 1)*e*cos(w)/(e^4 - 2*e^2 + 1)

@rwst rwst changed the title Incorrect integral from Maxima doctest fixed integral from Maxima Feb 1, 2015
@rwst
Copy link

rwst commented Feb 2, 2015

@rwst
Copy link

rwst commented Feb 2, 2015

Commit: fab7369

@rwst
Copy link

rwst commented Feb 2, 2015

New commits:

fab73698728: doctest

@rwst
Copy link

rwst commented Feb 2, 2015

Author: Ralf Stephan

@pjbruin
Copy link
Contributor

pjbruin commented Feb 2, 2015

comment:22

Your assumptions are contradictory: the first assumption (1 - e^2 > 0) implies the negation of the other two assumptions (see also comment:15).

A fortiori, the other two assumptions (after negating) are actually redundant. It is annoying that we have to add them; ideally, we would only declare this integral to be "fixed" if Maxima did not need the extra two assumptions...

@rwst
Copy link

rwst commented Aug 5, 2016

Changed branch from u/rws/doctest_fixed_integral_from_maxima to u/rws/8728

@rwst
Copy link

rwst commented Aug 5, 2016

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

@rwst
Copy link

rwst commented Aug 5, 2016

Changed commit from fab7369 to d4b0db5

@rwst
Copy link

rwst commented Aug 5, 2016

New commits:

d4b0db58728: doctest fixed integral from Maxima

@rwst rwst modified the milestones: sage-6.4, sage-7.4 Aug 5, 2016
@tscrim
Copy link
Collaborator

tscrim commented Aug 5, 2016

Reviewer: Travis Scrimshaw

@vbraun
Copy link
Member

vbraun commented Aug 7, 2016

Changed branch from u/rws/8728 to d4b0db5

@pjbruin
Copy link
Contributor

pjbruin commented Aug 11, 2016

Changed commit from d4b0db5 to none

@pjbruin
Copy link
Contributor

pjbruin commented Aug 11, 2016

comment:27

I noticed just now that this ticket has been closed; it seems comment:15 and comment:22 were ignored...

@rwst
Copy link

rwst commented Aug 11, 2016

comment:28

That would seem so. I think you are asking for a feature (redundancy of additional assumptions) in Maxima that would warrant a separate ticket. I apologize for not answering earlier.

@pjbruin
Copy link
Contributor

pjbruin commented Aug 11, 2016

comment:29

Replying to @rwst:

I think you are asking for a feature (redundancy of additional assumptions) in Maxima that would warrant a separate ticket.

That too, but more importantly I meant the fact that the assumptions that are currently made in the doctest are mutually inconsistent:

assume(1-c^2 > 0)
assume(abs(c) - sqrt(1-c^2) - 1 > 0)
assume(abs(sqrt(1-c^2)-1) - abs(c) > 0)

Namely, the first assumption is equivalent to -1 < c < 1, and on this domain the functions abs(c) - sqrt(1-c^2) - 1 and abs(sqrt(1-c^2)-1) - abs(c) are strictly negative.

There is already some functionality for detecting inconsistent assumptions (e.g. assume(x > 0); assume(x < 0) raises an error), but it doesn't detect this case.

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

8 participants