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

cosh integral incorrect because of abs_integrate #14591

Open
kcrisman opened this issue May 15, 2013 · 11 comments
Open

cosh integral incorrect because of abs_integrate #14591

kcrisman opened this issue May 15, 2013 · 11 comments

Comments

@kcrisman
Copy link
Member

See this ask.sagemath question.

sage: a = integrate(sqrt(1-1/4*cosh(x)^2),x)
sage: a.full_simplify()
cosh(x)

Not that I'm an expert here, but at any rate, viewed as real functions this makes no sense, though perhaps on some branch it does. This happens because


Maxima 5.29.1 http://maxima.sourceforge.net
using Lisp ECL 12.12.1
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) domain:complex;
(%o1)                               complex
(%i2) display2d:false;

(%o2) false
(%i3) B:integrate(sqrt(1-cosh(x)^2/4),x);

(%o3) 'integrate(sqrt(1-cosh(x)^2/4),x)
(%i4) trigsimp(B);

(%o4) 'integrate(sqrt(-(cosh(x)^2-4)/4),x)
(%i5) fullratsimp(B);

(%o5) 'integrate(sqrt(-(cosh(x)^2-4)/4),x)
(%i6) load(abs_integrate);

(%o6) "/Users/.../sage-5.9.rc1/local/share/maxima/5.29.1/share/contrib/integration/abs_integrate.mac"
(%i7) trigsimp(B);

(%o7) cosh(x)
(%i8) fullratsimp(B);

(%o8) cosh(x)

I'm not sure we want to unload abs_integrate but we need to figure something out here.

Upstream: Reported upstream. No feedback yet.

CC: @sagetrac-tmonteil @gagern

Component: calculus

Keywords: abs_integrate

Stopgaps: #12731

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

@jdemeyer
Copy link

comment:3

Fixed by #13973.

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

comment:7

The answer cosh(x) is completely wrong, even in a neighbourhood of x = 0:

cosh(x) = integrate(sqrt(1 - 1/4*cosh(x)^2),x)
=> sinh(x) = sqrt(1 - 1/4*cosh(x)^2)
=> sinh(x)^2 = 1 - 1/4*cosh(x)^2
=> 0 = 3/4  (substitute x = 0)

According to the ask.sagemath.org link in the ticket description, the correct answer can be expressed in terms of an elliptic integral function, which I trust much more.

@kcrisman
Copy link
Member Author

comment:8

As Thierry pointed out on the ask.sagemath question. So, does #13973 fix this or not?

@pjbruin
Copy link
Contributor

pjbruin commented May 28, 2014

comment:9

Replying to @kcrisman:

As Thierry pointed out on the ask.sagemath question.

Yes, I just wanted to give a clear reason here why the answer couldn't possibly be right.

So, does #13973 fix this or not?

No, it doesn't. I have been doing some debugging of the Maxima command

trigsimp(integrate(sqrt(4 - cosh(x)^2),x));

which returns cosh(x) when executed after loading abs_integrate. It seems that the problem arises in ratsubst, when substituting 1 + sinh(x)^2 for cosh(x)^2. What makes it more tricky is that calling ratsubst directly with the same arguments gives a correct answer. Possibly some flag is set at some intermediate point that triggers the bug.

@pjbruin
Copy link
Contributor

pjbruin commented May 28, 2014

comment:10

Reported upstream: https://sourceforge.net/p/maxima/bugs/2737/

@pjbruin
Copy link
Contributor

pjbruin commented May 28, 2014

Upstream: Reported upstream. No feedback yet.

@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:12

See also #12731.

@sagetrac-jakobkroeker
Copy link
Mannequin

sagetrac-jakobkroeker mannequin commented Feb 10, 2015

Stopgaps: #12731

@fchapoton
Copy link
Contributor

Changed keywords from none to abs_integrate

@fchapoton
Copy link
Contributor

comment:15

Works (no wrong answer) in sage 8.9.b7 with py3:

sage: sage: a = integrate(sqrt(1-1/4*cosh(x)^2),x)
1/2*integrate(sqrt(-cosh(x)^2 + 4), x)

@pjbruin
Copy link
Contributor

pjbruin commented Aug 24, 2019

comment:16

Also in 8.8:

┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 8.8, Release Date: 2019-06-26                     │
│ Using Python 2.7.15. Type "help()" for help.                       │
└────────────────────────────────────────────────────────────────────┘
sage: a = integrate(sqrt(1-1/4*cosh(x)^2),x)
sage: a.full_simplify()
integrate(sqrt(-1/4*cosh(x)^2 + 1), x)

This is most likely due to #12731. I'm not sure we should view this bug as being fixed; ideally, the answer should be given as an elliptic integral (see the ask.sagemath question).

@mkoeppe mkoeppe removed this from the sage-6.4 milestone Dec 29, 2022
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

6 participants