sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.34k stars 452 forks source link

ECL crashes in integration #25636

Open nasser1 opened 6 years ago

nasser1 commented 6 years ago

Computing the following integral using "maxima" for integration causes a Sage core dump.

>sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 8.3.beta6, Release Date: 2018-06-17               │
│ Type "notebook()" for the browser-based notebook interface.        │
│ Type "help()" for help.                                            │
└────────────────────────────────────────────────────────────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Warning: this is a prerelease version, and it may be unstable.     ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
sage: var('x m a b')
(x, m, a, b)
sage: integrate(x^m/sqrt(a + b*x^(2 - m)), x)

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

When using other algorithms, it works, i.e. Sage does not crash.

sage: integrate(x^m/sqrt(a + b*x^(2 - m)),x,algorithm="giac")
integrate(x^m/sqrt(b*x^(-m + 2) + a), x)

Observed under Linux Manjaro, 17.1 on an intel PC.

I would add the core dump file itself, but I do know if one is created or where it is saved. Do not see one in my current folder.

Any other information needed, please let me know.

Note: the same error occurs using Sage 8.2-6 (from the Arch Linux packaging) under Linux Manjaro MATE 17.1.

$ sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 8.2, Release Date: 2018-05-05                     │
│ Type "notebook()" for the browser-based notebook interface.        │
│ Type "help()" for help.                                            │
└────────────────────────────────────────────────────────────────────┘

Note:

Upstream: Fixed upstream, but not in a stable release.

Component: symbolics

Keywords: integrate, segfault

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

kcrisman commented 6 years ago
comment:1

See also this ask.sagemath post from same author.

I can confirm this in 8.3.beta6 on Mac OS as well.

rwst commented 6 years ago

Valgrind core dump

rwst commented 6 years ago
comment:2

Attachment: t.gz

Manual input in Sage's Maxima does not show this (just unsolved returned).

BTW, the impact of the Rubi test suite is much appreciated.

rwst commented 6 years ago
comment:4

BTW, the variables a,b,c,d,e,... in the Rubi test suite are intended to be real, I think. And the vars m,n,... are integer. In fact, this does not crash:

sage: var('a b', domain='real'); var('m,n', domain='integer')
(a, b)
(m, n)
sage: integrate(x^m/sqrt(a + b*x^(2 - m)),x)
integrate(x^m/sqrt(b*x^(-m + 2) + a), x)
nasser1 commented 6 years ago
comment:5

"BTW, the variables a,b,c,d,e,... in the Rubi test suite are intended to be real, I think. "

Hello;

Actually Rubi is not even meant to be used for floating point numbers. Only exact numbers. Please see this

"Rubi is only designed to handle rational, not floating point, numbers. If you substitute 3/10 instead of 0.3 for a, it returns the correct antiderivative without the GCD error. "

The integrate command should have worked as is without assumption made on variables being real. Adding assumptions have no effect on Rubi's integrate result, since it does not use assumptions.

In[19]:= $Assumptions = x == 0;

(*Rubi*)
Int[1/x, x]
Out[20]= Log[x]

(*Mathematica*)
In[21]:= Integrate[1/x, x]
Out[21]= ComplexInfinity

btw, In Mathematica 11.3 and Rubi also, the result for the original integral is

In[11]:= Integrate[x^m/Sqrt[a + b*x^(2 - m)], x]

Out[11]= (x^(1 + m)*Sqrt[1 + (b*x^(2 - m))/a]*
Hypergeometric2F1[1/2, (1 + m)/(2 - m), -(3/(-2 + m)), -((b*x^(2 - m))/a)])/((1 + m)
*Sqrt[a + b*x^(2 - m)])

No assumptions are used. But good to know that with Maxima using assumptions, now it does not crash sage.

Thank you

--Nasser

nbruin commented 6 years ago
comment:6

Of course it fails in maxima because, well ... from sage it fails in maxima. There's a theoretical possibility that sage corrupts maxima's memory, but we've never observed such bugs, so that's very unlikely. In this case, with

besselexpand : true;
display2d : false;
domain : complex;
keepfloat : true;
load(to_poly_solve);
load(simplify_sum);
load(abs_integrate);
load(diag);

(That's most of the code sage feeds to maxima for initialization, see github) we get

(%i9) integrate(x^m/sqrt(a + b*x^(2 - m)),x);
...
Segmentation fault (core dumped)

For

Maxima 5.41.0 http://maxima.sourceforge.net
using Lisp SBCL 1.4.2-1.fc27

this fails just as badly.

For all these integrals, the right place to report them is really maxima. You'll just have to dig a little to find the combinations of settings that trigger the error in maxima. Of course, you might get the reply back "using these options together doesn't make sense, don't do that" (although I don't think Robert has ever said that), in which case sage might have to reconsider its use of maxima.

nasser1 commented 6 years ago
comment:7

"For all these integrals, the right place to report them is really maxima."

Hello;

But when I try the integral directly into Maxima 5.41.0, with lisp ECL 16.1.2, on the same Linux box (Manjora 17.1), Maxima does not crash.

It hanged for long time thinking, so I ended terminating the command eventually. But it did not crash or even give an error.

Only when called from SageMath, there is a crash and it happens very quickly after the call.

May be SageMath is using different Maxima version. I do not know. I do not know how Sage communicate with Maxima, or what version of Maxima sage uses. I assumed it is the same as the Maxima installed on same Linux box, or may be Sage is just linked to a Maxima .so lib

If I report this problem to Maxima, they could tell me that it does not crash in Maxima, which is true, and to report it to SageMath.

Thank you for looking at this.

mantepse commented 6 years ago
comment:8

@Nasser, I would like to ask you a favour: please get back to the tickets for the bugs you reported, once they are fixed. The bugfixes won't make it into sage mainline otherwise (or only after a long time). It's enough to try the bugfix (eg., using git trac try followed by the ticket number, see http://doc.sagemath.org/html/en/developer/git_trac.html), and if it works for you, mention this as a comment on the ticket. That would be extremely helpful!

nbruin commented 6 years ago
comment:9

Replying to @nasser1:

It hanged for long time thinking, so I ended terminating the command eventually. But it did not crash or even give an error.

Sage uses maxima with non-standard settings. I listed a large part of those settings above. If you execute those commands in maxima before you run the relevant command then it's already a lot more probably you'll be getting the same behaviour in maxima (there are still some further differences, so it's not a full guarantee).

If I report this problem to Maxima, they could tell me that it does not crash in Maxima, which is true, and to report it to SageMath.

Indeed, before reporting it to maxima it first needs to be figured out how to create the conditions under which maxima does crash. Hopefully, with the information on this ticket it'll be a little easier to find those conditions. Ultimately, these errors need to be fixed in maxima (or sage should change integration engine), so the translation step needs to be made at some point.

nasser1 commented 6 years ago

sage math build log file

nasser1 commented 6 years ago
comment:10

Attachment: sagemath.txt

Hello;

I see. Thanks for the explanation. I now typed these commands you gave above, into my Maxima

besselexpand : true;
display2d : false;
domain : complex;
keepfloat : true;
load(to_poly_solve);
load(simplify_sum);
load(abs_integrate);
load(diag);
integrate(x^m/sqrt(a + b*x^(2 - m)),x);

but it did NOT crash. It is just sitting there for last 15 minutes thinking. No errors or anything.

So the difference seems to be in the LISP used. You seem to be using Maxima 5.41.0 using Lisp SBCL 1.4.2-1.fc27 while the Maxima I have is Maxima 5.41.0, with lisp ECL 16.1.2. (I assume that the Maxima I have on Linux got installed when I installed SageMath? I do not know. Since I myself did not install Maxima explicitly myself. I just installed Linux Manjaro, followed by installing SageMath using Majaro pacman, which complied everything from source. The log file for the the build of SageMath is a attached FYI. (this was for sage 8.3 beta5, since then I now updated to sage 8.3 beta 6, but I only kept the log file for the build for beta5, but it should be similar)

Thank you

--Nasser

nbruin commented 6 years ago
comment:11

Interesting. That's something the maxima people can figure out. I get a failure both on

$ maxima
Maxima 5.41.0 http://maxima.sourceforge.net
using Lisp SBCL 1.4.2-1.fc27
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.

and on

$ sage -maxima
;;; Loading #P"/local-scratch/sage/sage/local/lib/ecl/sb-bsd-sockets.fas"
;;; Loading #P"/local-scratch/sage/sage/local/lib/ecl/sockets.fas"
;;; Loading #P"/local-scratch/sage/sage/local/lib/ecl/defsystem.fas"
;;; Loading #P"/local-scratch/sage/sage/local/lib/ecl/cmp.fas"
Maxima 5.39.0 http://maxima.sourceforge.net
using Lisp ECL 16.1.2
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.

The errors in both cases are highly indicative of infinite recursions, so it should fail on any lisp. From your perspective, you indeed haven't found the right settings to show the error in maxima yet.

rwst commented 6 years ago
comment:12

In order to make sure you test the Maxima that is used by Sage, you need to run local/bin/maxima in your Sage directory. Just typing maxima will give you the one installed in your system, Nasser.

nasser1 commented 6 years ago
comment:13

Hello;

"you need to run local/bin/maxima in your Sage directory."

Sorry, I do not understand what the above means. I do not know what "sage directory" is.

I have no "sage directory". I installed sage directly from git using the Manjaro package manager.


>which sage
/usr/bin/sage

>sage --version
SageMath version 8.3.beta6, Release Date: 2018-06-17

>which maxima
/usr/bin/maxima

>maxima --version
;;; Loading #P"/usr/lib/ecl-16.1.2/sb-bsd-sockets.fas"
;;; Loading #P"/usr/lib/ecl-16.1.2/sockets.fas"
;;; Loading #P"/usr/lib/ecl-16.1.2/defsystem.fas"
;;; Loading #P"/usr/lib/ecl-16.1.2/cmp.fas"
Maxima 5.41.0

>sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 8.3.beta6, Release Date: 2018-06-17               │
│ Type "notebook()" for the browser-based notebook interface.        │
│ Type "help()" for help.                                            │
└────────────────────────────────────────────────────────────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Warning: this is a prerelease version, and it may be unstable.     ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

sage:  print(maxima.version())

;;; Warning: Maxima is unable to set up the help system.
(Details: CL-INFO::LOAD-PRIMARY-INDEX: Filesystem error with pathname #P"/usr/info/maxima-index.lisp".
Either
 1) the file does not exist, or
 2) we are not allowed to access the file, or
 3) the pathname points to a broken symbolic link.)

5.41.0
nasser1 commented 6 years ago

Description changed:

--- 
+++ 
@@ -40,6 +40,23 @@

 Any other information needed, please let me know.

-thanks
+**Update**
+
+fyi,
+
+I get same error using 8.2-6 on Linux Manjaro MATE 17.1. 
+
+
+```
+$ sage
+┌────────────────────────────────────────────────────────────────────┐
+│ SageMath version 8.2, Release Date: 2018-05-05                     │
+│ Type "notebook()" for the browser-based notebook interface.        │
+│ Type "help()" for help.                                            │
+└────────────────────────────────────────────────────────────────────┘
+
+
+```
+

 --Nasser
nbruin commented 6 years ago

Upstream: Reported upstream. No feedback yet.

nbruin commented 6 years ago
comment:15

Reported on

https://sourceforge.net/p/maxima/bugs/3442/

and removed "critical" status, since fixing this will have to happen in maxima anyway, so the status here doesn't help to bump priority.

nasser1 commented 6 years ago
comment:16

fyi, on sagemath 8.3 beta7, this still crashes sage, but it now gives a screen dump which I did not see in sagemath 8.3 beta6. This might be useful for someone. Here it is

>sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 8.3.beta7, Release Date: 2018-06-23               │
│ Type "notebook()" for the browser-based notebook interface.        │
│ Type "help()" for help.                                            │
└────────────────────────────────────────────────────────────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Warning: this is a prerelease version, and it may be unstable.     ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
sage:  var('x m a b')
(x, m, a, b)
sage: integrate(x^m/sqrt(a + b*x^(2 - m)),x)
ext::getcwd error: Numerical result out of range

Internal or unrecoverable error in:
Can't work without CWD
  [34: Numerical result out of range]

;;; ECL C Backtrace
;;; /usr/lib/libecl.so.16.1(si_dump_c_backtrace+0x3e) [0x7f3069cb56de]
;;; /usr/lib/libecl.so.16.1(ecl_internal_error+0x48) [0x7f3069c9e4a8]
;;; /usr/lib/libecl.so.16.1(+0x1e26ba) [0x7f3069cd86ba]
;;; /usr/lib/libecl.so.16.1(si_getcwd+0xd5) [0x7f3069cd9055]
;;; /usr/lib/libecl.so.16.1(cl_boot+0x3b8) [0x7f3069b91e38]
;;; /usr/lib/python2.7/site-packages/sage/libs/ecl.so(+0xe7be) [0x7f306a18e7be]
;;; /usr/lib/python2.7/site-packages/sage/libs/ecl.so(+0xa792) [0x7f306a18a792]
;;; /usr/lib/python2.7/site-packages/sage/libs/ecl.so(initecl+0x909) [0x7f306a197d02]
;;; /usr/lib/libpython2.7.so.1.0(_PyImport_LoadDynamicModule+0x83) [0x7f38fcf68093]
;;; /usr/lib/libpython2.7.so.1.0(+0x17f490) [0x7f38fcf68490]
;;; /usr/lib/libpython2.7.so.1.0(PyImport_ImportModuleLevel+0xb77) [0x7f38fcf19547]
;;; /usr/lib/libpython2.7.so.1.0(+0x132c1a) [0x7f38fcf1bc1a]
;;; /usr/lib/libpython2.7.so.1.0(PyObject_Call+0x43) [0x7f38fce85003]
;;; /usr/lib/libpython2.7.so.1.0(PyEval_CallObjectWithKeywords+0x31) [0x7f38fcf30c91]
;;; /usr/lib/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x3995) [0x7f38fce9b295]
;;; /usr/lib/libpython2.7.so.1.0(PyEval_EvalCodeEx+0x2d6) [0x7f38fcf315a6]
;;; /usr/lib/libpython2.7.so.1.0(PyEval_EvalCode+0x1a) [0x7f38fcf3675a]
;;; /usr/lib/libpython2.7.so.1.0(PyImport_ExecCodeModuleEx+0xc1) [0x7f38fcf67ae1]
;;; /usr/lib/libpython2.7.so.1.0(+0x17ecca) [0x7f38fcf67cca]
;;; /usr/lib/libpython2.7.so.1.0(+0x17f490) [0x7f38fcf68490]
;;; /usr/lib/libpython2.7.so.1.0(PyImport_ImportModuleLevel+0xb77) [0x7f38fcf19547]
;;; /usr/lib/libpython2.7.so.1.0(+0x132c1a) [0x7f38fcf1bc1a]
;;; /usr/lib/python2.7/site-packages/sage/misc/lazy_import.so(+0x6160) [0x7f38f4889160]
;;; /usr/lib/python2.7/site-packages/sage/misc/lazy_import.so(+0xb275) [0x7f38f488e275]
;;; /usr/lib/python2.7/site-packages/sage/misc/lazy_import.so(+0xcaeb) [0x7f38f488faeb]
;;; /usr/lib/python2.7/site-packages/sage/misc/lazy_import.so(+0xd8fa) [0x7f38f48908fa]
;;; /usr/lib/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x2fb) [0x7f38fce97bfb]
;;; /usr/lib/libpython2.7.so.1.0(PyEval_EvalCodeEx+0x2d6) [0x7f38fcf315a6]
;;; /usr/lib/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x5def) [0x7f38fce9d6ef]
;;; /usr/lib/libpython2.7.so.1.0(PyEval_EvalCodeEx+0x2d6) [0x7f38fcf315a6]
;;; /usr/lib/libpython2.7.so.1.0(+0xefbcf) [0x7f38fced8bcf]
;;; /usr/lib/libpython2.7.so.1.0(PyObject_Call+0x43) [0x7f38fce85003]
Aborted (core dumped)
>
nasser1 commented 6 years ago
comment:17

fyi, I found another integral which crashes sage 8.3 rc0

┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 8.3.rc0, Release Date: 2018-07-08                 │
│ Type "notebook()" for the browser-based notebook interface.        │
│ Type "help()" for help.                                            │
└────────────────────────────────────────────────────────────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Warning: this is a prerelease version, and it may be unstable.     ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

var('x')
integrate(log(sin(x))*sin(x)^2,x)

;;;
;;; Detected access to protected memory, also kwown as 'bus or segmentation fault'.
;;; Jumping to the outermost toplevel prompt
;;;
nbruin commented 6 years ago
comment:18

Yup,

besselexpand : true;
display2d : false;
domain : complex;
keepfloat : true;
load(to_poly_solve);
load(simplify_sum);
load(abs_integrate);
load(diag);
integrate(log(sin(x))*sin(x)^2,x);

causes an infinite recursion on both

Maxima 5.41.0 http://maxima.sourceforge.net
using Lisp SBCL 1.4.2-1.fc27

and

Maxima 5.41.0 http://maxima.sourceforge.net
using Lisp ECL 16.1.2

so if this is reported to the maxima bug-tracker, they can do something with it.

slel commented 6 years ago

Changed keywords from integrate to integrate, segfault

slel commented 6 years ago
comment:19

I'm including the upstream bug link (from comment 15) in the ticket description. (Thanks for having reported upstream!)

slel commented 6 years ago

Description changed:

--- 
+++ 
@@ -1,7 +1,5 @@
-I do not know if this is known or not, or if this happens only on my Linux PC, but thought to report it just in case.
-
-This causes sage to core dump. Only when using "maxima" for integration.
-
+Computing the following integral using "maxima" for integration
+causes a Sage core dump.

sage @@ -15,37 +13,30 @@ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ sage: var('x m a b') (x, m, a, b) -sage: integrate(x^m/sqrt(a + bx^(2 - m)),x) +sage: integrate(x^m/sqrt(a + bx^(2 - m)), x)

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


-
-When using other algorithm, it works OK. i.e. sage does not crash
-
+When using other algorithms, it works, i.e. Sage does not crash.

sage: integrate(x^m/sqrt(a + bx^(2 - m)),x,algorithm="giac") integrate(x^m/sqrt(bx^(-m + 2) + a), x)


-I am using Linux Manjaro, 17.1 on an intel PC.
+Observed under Linux Manjaro, 17.1 on an intel PC.

-I would add the core dump file itself, but I do know if one is created or where it is saved. Do not see one in my current folder.
+I would add the core dump file itself, but I do know if one is created
+or where it is saved. Do not see one in my current folder.

 Any other information needed, please let me know.

-**Update**
-
-fyi,
-
-I get same error using 8.2-6 on Linux Manjaro MATE 17.1. 
-
+Note: the same error occurs using Sage 8.2-6 (from the
+Arch Linux packaging) under Linux Manjaro MATE 17.1.

$ sage @@ -54,9 +45,10 @@ │ Type "notebook()" for the browser-based notebook interface. │ │ Type "help()" for help. │ └────────────────────────────────────────────────────────────────────┘ +``` + +Note: + +- Upstream (Maxima) bug report: https://sourceforge.net/p/maxima/bugs/3442/

-```

- ---Nasser

nasser1 commented 6 years ago
comment:20

fyi, found another one that crashes sagemath

>sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 8.3.rc0, Release Date: 2018-07-08                 │
│ Type "notebook()" for the browser-based notebook interface.        │
│ Type "help()" for help.                                            │
└────────────────────────────────────────────────────────────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Warning: this is a prerelease version, and it may be unstable.     ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
sage: var('c b a m')
(c, b, a, m)
sage: integrate((c*sin(b*x + a)^m)^(5/2),x)

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

thank you --Nasser

nasser1 commented 6 years ago
comment:21

fyi, found another one that crashes sagemath


>sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 8.3.rc0, Release Date: 2018-07-08                 │
│ Type "notebook()" for the browser-based notebook interface.        │
│ Type "help()" for help.                                            │
└────────────────────────────────────────────────────────────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Warning: this is a prerelease version, and it may be unstable.     ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
sage: 
sage: var('a f m c')
(a, f, m, c)
sage: integrate((a*sin(f*x + e) + a)^m*(-c*sin(f*x + e) + c)^(-m - 4)*cos(f*x + e)^2,x)

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

^C^CSegmentation fault (core dumped)
nasser1 commented 6 years ago
comment:22

fyi, found another one that crashes sagemath

SageMath version 8.3.rc0, Release Date: 2018-07-08


sage: var('g f x m n a c')
(g, f, x, m, n, a, c)

sage: integrate((g*cos(f*x + e))^(-m - n - 1)*(a*sin(f*x + e) + a)^m*(-c*sin(f*x + e) + c)^(n + 3),x)

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

^C
Segmentation fault (core dumped)
nasser1 commented 6 years ago
comment:23

fyi found another one that crashes sagemath

sage: version()
'SageMath version 8.3.rc1, Release Date: 2018-07-14'

sage: var('x c b a m')
(x, c, b, a, m)
sage: integrate((c*cos(b*x + a)^m)^(5/2),x)

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

^C
Segmentation fault (core dumped)
mkoeppe commented 3 years ago
comment:24

I have tried the first few examples from description and comments in 9.3.rc2, on macOS 10.15. Some of the examples take long, but there are no crashes.

sage: var('x m a b')                                                                                                                                                                                                     
(x, m, a, b)
sage: integrate(x^m/sqrt(a + b*x^(2 - m)), x)                                                                                                                                                                            
-x*x^m*gamma(-m/(m - 2) - 1/(m - 2))*hypergeometric((1/2, -m/(m - 2) - 1/(m - 2)), (-m/(m - 2) - 1/(m - 2) + 1,), -b*x^2/(a*x^m))/(sqrt(a)*m*gamma(-m/(m - 2) - 1/(m - 2) + 1) - 2*sqrt(a)*gamma(-m/(m - 2) - 1/(m - 2) + 1))
sage: var('x') 
....: integrate(log(sin(x))*sin(x)^2,x) 
....:                                                                                                                                                                                                                                                             
x
1/4*I*x^2 - 1/2*I*x*arctan2(sin(x), cos(x) + 1) + 1/2*I*x*arctan2(sin(x), -cos(x) + 1) - 1/4*x*log(cos(x)^2 + sin(x)^2 + 2*cos(x) + 1) - 1/4*x*log(cos(x)^2 + sin(x)^2 - 2*cos(x) + 1) + 1/4*(2*x - sin(2*x))*log(sin(x)) + 1/4*x + 1/2*I*dilog(-e^(I*x)) + 1/2*I*dilog(e^(I*x)) + 1/8*sin(2*x)
sage: var('c b a m')                                                                                                                                                                                                                                              
(c, b, a, m)
sage: integrate((c*sin(b*x + a)^m)^(5/2),x)                                                                                                                                                                                                                       
integrate((c*sin(b*x + a)^m)^(5/2), x)
kcrisman commented 2 years ago
comment:27

According to this commit this is now fixed upstream.

kcrisman commented 2 years ago

Changed upstream from Reported upstream. No feedback yet. to Fixed upstream, but not in a stable release.

nbruin commented 2 years ago
comment:28

Replying to @mkoeppe:

I have tried the first few examples from description and comments in 9.3.rc2, on macOS 10.15. Some of the examples take long, but there are no crashes.

I think abs_integrate has been excluded from the standard options. So I think there are now more integrals that sage won't do by default, and less crashes (while abs_integrate tries some things that allow it to integrate functions that maxima otherwise can't, it also produces quite a few really problematic results (and crashes)). So the reported problems here may be "invalid" for sagemath already because they now just return unevaluated by default. As kcrisman reports, there has been a whole bunch of updates, so possibly abs_integrate has improved. I don't know if that is substantial enough to reintroduce it as a default strategy.

slel commented 2 years ago
comment:29

Indeed abs_integrate was removed in #12731, merged in Sage 8.9.

A very recent maxima mailing list discussion about fixes to abs_integrate

highlights the role of reports from the Sage community.

At the next Maxima release, we can discuss re-enabling abs_integrate in Sage.