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

integrate(sqrt(1-4*sin(x)^2),x) is wrong #24117

Closed
seblabbe opened this issue Oct 27, 2017 · 13 comments
Closed

integrate(sqrt(1-4*sin(x)^2),x) is wrong #24117

seblabbe opened this issue Oct 27, 2017 · 13 comments

Comments

@seblabbe
Copy link
Contributor

I received an email from Pierre Arnoux saying that this is wrong:

sage: integrate (sqrt(1-4*sin(x)^2),x, algorithm='maxima')
-1/12*sin(3*x) + 1/4*sin(x)

Quoting what Pierre says: "Ce qui est visiblement faux: il y a un point d'inflexion horizontal en 0 alors que la fonction à intégrer vaut 1 en 0, ça ne peut pas être une primitive. Est-ce que vous avez une idée de ce qui ne marche pas?"

Other programs in Sage just can't solve this integral:

sage: integrate (sqrt(1-4*sin(x)^2),x, algorithm='fricas')  # installed with "sage -i fricas"
integral(sqrt(4*cos(x)^2 - 3), x)
sage: integrate (sqrt(1-4*sin(x)^2),x, algorithm='giac')
integrate(sqrt(-4*sin(x)^2 + 1), x)
sage: integrate (sqrt(1-4*sin(x)^2),x, algorithm='sympy')
....does not halt...

CC: @kcrisman @jhpalmieri @slel

Component: calculus

Keywords: maxima, abs_integrate

Author: Frédéric Chapoton

Branch/Commit: 9406e0a

Reviewer: Sébastien Labbé

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

@seblabbe seblabbe added this to the sage-8.1 milestone Oct 27, 2017
@rwst
Copy link

rwst commented Oct 27, 2017

comment:1

See also #18821.

@slel
Copy link
Member

slel commented Nov 26, 2017

comment:2

Here is how I would describe this bug in the integrate function.
(This can be turned into a doctest when this bug is resolved.)

sage: f(x) = sqrt(1-4*sin(x)^2)
sage: F(x) = integrate(f(x), x)
sage: F(x)
-1/12*sin(3*x) + 1/4*sin(x)

Comparing the derivative of F with f shows this is wrong.

sage: g(x) = diff(F(x), x)
sage: g(x)
-1/4*cos(3*x) + 1/4*cos(x)
sage: f(0), g(0)
(1, 0)

Looking at the plots of f and F also reveals an error:

sage: xr = (-0.4, 0.4)
sage: plot(f, xr, color='blue') + plot(F, xr, color='red')

Here, f (blue curve) is 1 at 0, so its primitive F (red curve)
should have slope 1 at 0, instead of 0.

@rwst
Copy link

rwst commented Nov 26, 2017

comment:3

There are half a dozen similar tickets to this. The reason is that Sage uses a (now) unmaintained package of Maxima, see #12731 for an overview.

@fchapoton
Copy link
Contributor

Changed keywords from maxima to maxima, abs_integrate

@fchapoton
Copy link
Contributor

comment:5

this one is fixed by #27958, that needs review

@fchapoton
Copy link
Contributor

Commit: 020d526

@fchapoton
Copy link
Contributor

Author: Frédéric Chapoton

@fchapoton
Copy link
Contributor

Branch: u/chapoton/24117

@fchapoton
Copy link
Contributor

comment:6

easy one


New commits:

0661926add some safety check for numerical integrals up to infinity
020d526add a doctest for 24117

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 25, 2020

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

9406e0aadd doctest for 24117

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 25, 2020

Changed commit from 020d526 to 9406e0a

@seblabbe
Copy link
Contributor Author

Reviewer: Sébastien Labbé

@vbraun
Copy link
Member

vbraun commented Jun 27, 2020

Changed branch from u/chapoton/24117 to 9406e0a

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

5 participants