rtoy / maxima

A Clone of Maxima's repo
Other
0 stars 0 forks source link

Stack overflow in to_poly_solve #3002

Open rtoy opened 2 months ago

rtoy commented 2 months ago

Imported from SourceForge on 2024-07-07 08:37:31 Created by pipeforge on 2013-02-25 06:58:11 Original: https://sourceforge.net/p/maxima/bugs/2553


0 jan@muizenberg:/srv/local/Disk_Space/jan/sage-5.7/local/bin$./maxima
;;; Loading #P"/srv/local/Disk_Space/jan/sage-5.7/local/lib/ecl-12.12.1/sb-bsd-sockets.fas"
;;; Loading #P"/srv/local/Disk_Space/jan/sage-5.7/local/lib/ecl-12.12.1/sockets.fas"
;;; Loading #P"/srv/local/Disk_Space/jan/sage-5.7/local/lib/ecl-12.12.1/defsystem.fas"
;;; Loading #P"/srv/local/Disk_Space/jan/sage-5.7/local/lib/ecl-12.12.1/cmp.fas"
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) load (to_poly_solve);

Loading maxima-grobner $Revision: 1.6 $ $Date: 2009-06-02 07:49:49 $
(%o1) /srv/local/Disk_Space/jan/sage-5.7/local/share/maxima/5.29.1/share/to_po\
ly_solve/to_poly_solve.mac
(%i2) to_poly_solve ([(a*x+b*y)*x*y/c=1,3*log(a + b + c) - log(27*a*b*x*y)],[x,y]);

This causes many errors like below and then a segfault

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

Segmentation fault
rtoy commented 2 months ago

Imported from SourceForge on 2024-07-07 08:37:32 Created by robert_dodier on 2013-05-24 03:21:26 Original: https://sourceforge.net/p/maxima/bugs/2553/#657c


rtoy commented 2 months ago

Imported from SourceForge on 2024-07-07 08:37:36 Created by robert_dodier on 2013-05-24 03:21:26 Original: https://sourceforge.net/p/maxima/bugs/2553/#f716


Observed in current development version (post-5.30). I can't figure out exactly what's going on, but it appears to be that there is an attempt to compute realpart(3*log(a + b + c)) which gets stuck in a loop. By itself, realpart(3*log(a + b + c)) doesn't cause any trouble, so it must be an interaction with something introduced by to_poly_solve.

With log(a + b + c) replaced by foo(a, b, c), to_poly_solve returns successfully. Substituting back into the solution, I get:

%union(%if(c # 0,
       [x = -2*(c+b+a)^6/(3^(3/2)*a*sqrt(19683*a^2*b^2*c^2-4*(c+b+a)^9)
                         -729*a^2*b*c),
        y = -(sqrt(3)*sqrt(19683*a^2*b^2*c^2-4*(c+b+a)^9)-243*a*b*c)
          /(18*b*(c+b+a)^3)],%union()),
   %if(c # 0,
       [x = 2*(c+b+a)^6/(3^(3/2)*a*sqrt(19683*a^2*b^2*c^2-4*(c+b+a)^9)
                        +729*a^2*b*c),
        y = (sqrt(3)*sqrt(19683*a^2*b^2*c^2-4*(c+b+a)^9)+243*a*b*c)
          /(18*b*(c+b+a)^3)],%union()))$

I don't know if that's right.

rtoy commented 2 months ago

Imported from SourceForge on 2024-07-07 08:37:39 Created by robert_dodier on 2022-06-20 18:14:28 Original: https://sourceforge.net/p/maxima/bugs/2553/#c138