Menu

#2553 Stack overflow in to_poly_solve

None
maybe-fixed
nobody
5
2022-06-20
2013-02-25
No
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

Discussion

  • Robert Dodier

    Robert Dodier - 2013-05-24
    • labels: --> Lisp Core - Solving equations, Lisp Core - Complex
     
  • Robert Dodier

    Robert Dodier - 2013-05-24

    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.

     
  • Robert Dodier

    Robert Dodier - 2022-06-20

    Tried it with current development version (commit b48f887, post-5.46) and I get a result immediately:

    %union(%if(c # 0,
               [x = -(sqrt(3)*sqrt((-4*c^9)+((-36*b)-36*a)*c^8
                                           +((-144*b^2)-288*a*b-144*a^2)*c^7
                                           +((-336*b^3)-1008*a*b^2-1008*a^2*b
                                                       -336*a^3)
                                            *c^6
                                           +((-504*b^4)-2016*a*b^3-3024*a^2*b^2
                                                       -2016*a^3*b-504*a^4)
                                            *c^5
                                           +((-504*b^5)-2520*a*b^4-5040*a^2*b^3
                                                       -5040*a^3*b^2-2520*a^4*b
                                                       -504*a^5)
                                            *c^4
                                           +((-336*b^6)-2016*a*b^5-5040*a^2*b^4
                                                       -6720*a^3*b^3-5040*a^4*b^2
                                                       -2016*a^5*b-336*a^6)
                                            *c^3
                                           +((-144*b^7)-1008*a*b^6-3024*a^2*b^5
                                                       -5040*a^3*b^4-5040*a^4*b^3
                                                       +(19683*a^2-3024*a^5)*b^2
                                                       -1008*a^6*b-144*a^7)
                                            *c^2
                                           +((-36*b^8)-288*a*b^7-1008*a^2*b^6
                                                      -2016*a^3*b^5-2520*a^4*b^4
                                                      -2016*a^5*b^3-1008*a^6*b^2
                                                      -288*a^7*b-36*a^8)
                                            *c-4*b^9-36*a*b^8-144*a^2*b^7
                                           -336*a^3*b^6-504*a^4*b^5-504*a^5*b^4
                                           -336*a^6*b^3-144*a^7*b^2-36*a^8*b
                                           -4*a^9)
                  -243*a*b*c)
                  /(18*a*c^3+(54*a*b+54*a^2)*c^2+(54*a*b^2+108*a^2*b+54*a^3)*c
                            +18*a*b^3+54*a^2*b^2+54*a^3*b+18*a^4),
                y = (sqrt(3)*sqrt((-4*c^9)+((-36*b)-36*a)*c^8
                                          +((-144*b^2)-288*a*b-144*a^2)*c^7
                                          +((-336*b^3)-1008*a*b^2-1008*a^2*b
                                                      -336*a^3)
                                           *c^6
                                          +((-504*b^4)-2016*a*b^3-3024*a^2*b^2
                                                      -2016*a^3*b-504*a^4)
                                           *c^5
                                          +((-504*b^5)-2520*a*b^4-5040*a^2*b^3
                                                      -5040*a^3*b^2-2520*a^4*b
                                                      -504*a^5)
                                           *c^4
                                          +((-336*b^6)-2016*a*b^5-5040*a^2*b^4
                                                      -6720*a^3*b^3-5040*a^4*b^2
                                                      -2016*a^5*b-336*a^6)
                                           *c^3
                                          +((-144*b^7)-1008*a*b^6-3024*a^2*b^5
                                                      -5040*a^3*b^4-5040*a^4*b^3
                                                      +(19683*a^2-3024*a^5)*b^2
                                                      -1008*a^6*b-144*a^7)
                                           *c^2
                                          +((-36*b^8)-288*a*b^7-1008*a^2*b^6
                                                     -2016*a^3*b^5-2520*a^4*b^4
                                                     -2016*a^5*b^3-1008*a^6*b^2
                                                     -288*a^7*b-36*a^8)
                                           *c-4*b^9-36*a*b^8-144*a^2*b^7
                                          -336*a^3*b^6-504*a^4*b^5-504*a^5*b^4
                                          -336*a^6*b^3-144*a^7*b^2-36*a^8*b-4*a^9)
                  +243*a*b*c)
                  /(18*b*c^3+(54*b^2+54*a*b)*c^2+(54*b^3+108*a*b^2+54*a^2*b)*c
                            +18*b^4+54*a*b^3+54*a^2*b^2+18*a^3*b)],%union()),
           %if(c # 0,
               [x = (sqrt(3)*sqrt((-4*c^9)+((-36*b)-36*a)*c^8
                                          +((-144*b^2)-288*a*b-144*a^2)*c^7
                                          +((-336*b^3)-1008*a*b^2-1008*a^2*b
                                                      -336*a^3)
                                           *c^6
                                          +((-504*b^4)-2016*a*b^3-3024*a^2*b^2
                                                      -2016*a^3*b-504*a^4)
                                           *c^5
                                          +((-504*b^5)-2520*a*b^4-5040*a^2*b^3
                                                      -5040*a^3*b^2-2520*a^4*b
                                                      -504*a^5)
                                           *c^4
                                          +((-336*b^6)-2016*a*b^5-5040*a^2*b^4
                                                      -6720*a^3*b^3-5040*a^4*b^2
                                                      -2016*a^5*b-336*a^6)
                                           *c^3
                                          +((-144*b^7)-1008*a*b^6-3024*a^2*b^5
                                                      -5040*a^3*b^4-5040*a^4*b^3
                                                      +(19683*a^2-3024*a^5)*b^2
                                                      -1008*a^6*b-144*a^7)
                                           *c^2
                                          +((-36*b^8)-288*a*b^7-1008*a^2*b^6
                                                     -2016*a^3*b^5-2520*a^4*b^4
                                                     -2016*a^5*b^3-1008*a^6*b^2
                                                     -288*a^7*b-36*a^8)
                                           *c-4*b^9-36*a*b^8-144*a^2*b^7
                                          -336*a^3*b^6-504*a^4*b^5-504*a^5*b^4
                                          -336*a^6*b^3-144*a^7*b^2-36*a^8*b-4*a^9)
                  +243*a*b*c)
                  /(18*a*c^3+(54*a*b+54*a^2)*c^2+(54*a*b^2+108*a^2*b+54*a^3)*c
                            +18*a*b^3+54*a^2*b^2+54*a^3*b+18*a^4),
                y = -(sqrt(3)*sqrt((-4*c^9)+((-36*b)-36*a)*c^8
                                           +((-144*b^2)-288*a*b-144*a^2)*c^7
                                           +((-336*b^3)-1008*a*b^2-1008*a^2*b
                                                       -336*a^3)
                                            *c^6
                                           +((-504*b^4)-2016*a*b^3-3024*a^2*b^2
                                                       -2016*a^3*b-504*a^4)
                                            *c^5
                                           +((-504*b^5)-2520*a*b^4-5040*a^2*b^3
                                                       -5040*a^3*b^2-2520*a^4*b
                                                       -504*a^5)
                                            *c^4
                                           +((-336*b^6)-2016*a*b^5-5040*a^2*b^4
                                                       -6720*a^3*b^3-5040*a^4*b^2
                                                       -2016*a^5*b-336*a^6)
                                            *c^3
                                           +((-144*b^7)-1008*a*b^6-3024*a^2*b^5
                                                       -5040*a^3*b^4-5040*a^4*b^3
                                                       +(19683*a^2-3024*a^5)*b^2
                                                       -1008*a^6*b-144*a^7)
                                            *c^2
                                           +((-36*b^8)-288*a*b^7-1008*a^2*b^6
                                                      -2016*a^3*b^5-2520*a^4*b^4
                                                      -2016*a^5*b^3-1008*a^6*b^2
                                                      -288*a^7*b-36*a^8)
                                            *c-4*b^9-36*a*b^8-144*a^2*b^7
                                           -336*a^3*b^6-504*a^4*b^5-504*a^5*b^4
                                           -336*a^6*b^3-144*a^7*b^2-36*a^8*b
                                           -4*a^9)
                  -243*a*b*c)
                  /(18*b*c^3+(54*b^2+54*a*b)*c^2+(54*b^3+108*a*b^2+54*a^2*b)*c
                            +18*b^4+54*a*b^3+54*a^2*b^2+18*a^3*b)],%union()))
    

    I didn't verify the result, but anyway it's possible that the bug has been fixed somewhere along the way.

     
  • Robert Dodier

    Robert Dodier - 2022-06-20
    • status: open --> maybe-fixed
     

Log in to post a comment.