Opened 3 years ago
Last modified 4 weeks ago
#25636 new defect
ECL crashes in integration
Reported by: | gh-nasser1 | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-9.5 |
Component: | symbolics | Keywords: | integrate, segfault |
Cc: | Merged in: | ||
Authors: | Reviewers: | ||
Report Upstream: | Reported upstream. No feedback yet. | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description (last modified by )
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 (Maxima) bug report: https://sourceforge.net/p/maxima/bugs/3442/
Attachments (2)
Change History (28)
comment:1 Changed 3 years ago by
comment:2 Changed 3 years ago by
Manual input in Sage's Maxima does not show this (just unsolved returned).
BTW, the impact of the Rubi test suite is much appreciated.
comment:3 Changed 3 years ago by
- Priority changed from major to critical
- Summary changed from Detected access to protected memory, also kwown as 'bus or segmentation fault' to ECL crashes in integration
comment:4 Changed 3 years ago by
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)
comment:5 Changed 3 years ago by
"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 ](https://groups.google.com/forum/#!topic/sci.math.symbolic/HBxFZd6uinY)
"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
comment:6 Changed 3 years ago by
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.
comment:7 follow-up: ↓ 9 Changed 3 years ago by
"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.
comment:8 Changed 3 years ago by
@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!
comment:9 in reply to: ↑ 7 Changed 3 years ago by
Replying to gh-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.
comment:10 follow-up: ↓ 11 Changed 3 years ago by
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
comment:11 in reply to: ↑ 10 Changed 3 years ago by
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.
comment:12 Changed 3 years ago by
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.
comment:13 Changed 3 years ago by
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
comment:14 Changed 3 years ago by
- Description modified (diff)
comment:15 Changed 3 years ago by
- Priority changed from critical to major
- Report Upstream changed from N/A to Reported upstream. No feedback yet.
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.
comment:16 Changed 3 years ago by
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) >
comment:17 Changed 3 years ago by
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 ;;;
comment:18 Changed 3 years ago by
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.
comment:19 Changed 3 years ago by
- Description modified (diff)
- Keywords segfault added
I'm including the upstream bug link (from comment 15) in the ticket description. (Thanks for having reported upstream!)
comment:20 Changed 3 years ago by
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
comment:21 Changed 3 years ago by
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)
comment:22 Changed 3 years ago by
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)
comment:23 Changed 3 years ago by
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)
comment:24 Changed 5 months ago by
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)
comment:25 Changed 5 months ago by
- Milestone changed from sage-8.3 to sage-9.4
comment:26 Changed 4 weeks ago by
- Milestone changed from sage-9.4 to sage-9.5
See also this ask.sagemath post from same author.
I can confirm this in 8.3.beta6 on Mac OS as well.