Opened 6 months ago

Last modified 5 months ago

#27816 new defect

sqrt(-r_0^2 + r_1^2 + 2*r_0*x - x^2): Maxima gives an antiderivative but *crashes* on definite integral

Reported by: charpent Owned by:
Priority: major Milestone:
Component: symbolics Keywords: definite integral
Cc: Merged in:
Authors: Reviewers:
Report Upstream: Not yet reported upstream; Will do shortly. Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

Inspired by this ask.sagemath.org question:

var("x, y, t, r_0, r_1, X", domain="real")
rr=var("rr")
assume(r_0>0,X<r_0,r_1>0,r_1<2*r_0,rr>0)
with assuming(y>0): foo=solve(x^2 + y^2 == r_0^2, y)[0].rhs()
Y_0(x)=foo
with assuming(y>0): foo=solve((r_0-x)^2 + y^2 == r_1^2, y)[0].rhs()
Y_1(x)=foo
X=solve(Y_1(x)^2==Y_0(x)^2,x)[0].rhs()
g(x)=integrate(Y_1(x),x).expand()

So far, so good :

sage: (g(X)-g(r_0-r_1)).expand()
1/4*pi*r_1^2 - 1/2*r_1^2*arcsin(1/2*r_1/r_0) - 1/8*sqrt(4*r_1^2 - r_1^4/r_0^2)*r_1^2/r_0

But integrate(Y_1(x),x,r_0-r_1,X).expand() crashes Maxima (and Sage) :

sage: integrate(Y_1(x),x,r_0-r_1,X)

;;;
;;; Detected access to protected memory, also kwown as 'bus or segmentation fault'.
;;; Jumping to the outermost toplevel prompt
;;;

repeated /ad nauseam/...

This can be reproduced in Maxima. This works as expected:

assume(r_0>0,X<r_0,r_1>0,r_1<2*r_0,rr>0);
assume(y>0);
define(Y_0(x),rhs(solve(x^2+y^2=r_0^2,y)[2]));
define(Y_1(x),rhs(solve((r_0-x)^2+y^2=r_1^2,y)[2]));
X:rhs(solve(Y_0(x)^2=Y_1(x)^2,x)[1]);
Y:Y_0(X);
define(g(x),expand(integrate(Y_1(x),x)));
g(X)-g(r_0-r_1);

But asking for integrate(Y_1(x),x,r_0-r_1,X); crashes Maxima with the same error messages...

This seems different from bugs already reported on definite integration.

FWIW, both giac and fricas give acceptable answers (different in their integration process : one uses arcsin, the other arctan, with similar geometric interpretation...).

Change History (2)

comment:1 Changed 6 months ago by charpent

This is still true in 8.8.beta7, which has maxima 5.42.2...

Last edited 6 months ago by charpent (previous) (diff)

comment:2 Changed 5 months ago by embray

  • Milestone sage-8.8 deleted

As the Sage-8.8 release milestone is pending, we should delete the sage-8.8 milestone for tickets that are not actively being worked on or that still require significant work to move forward. If you feel that this ticket should be included in the next Sage release at the soonest please set its milestone to the next release milestone (sage-8.9).

Note: See TracTickets for help on using tickets.