Menu ▾ ▴

#2259 ratsubst() doesn't substitute

None
open
nobody
ratsubst (11)
5
2024-11-24
2011-08-25
No

INPUT

build_info();
display2d : false;
e : x*y+y*z;
ratsubst(t,e,e+x^2);
ratsubst(t,e,e+y^2);
ratsubst(t,e,e+z^2);

INPUT AND OUTPUT

(%i1) build_info();
Maxima version: 5.25.0
Maxima build date: 12:0 8/2/2011
Host type: i686-pc-mingw32
Lisp implementation type: Clozure Common Lisp
Lisp implementation version: Version 1.7-r14925M (WindowsX8632)
(%o1)
(%i2) display2d : false;
(%o2) false
(%i3) e : x*y+y*z;
(%o3) y*z+x*y
(%i4) ratsubst(t,e,e+x^2);
(%o4) x^2+t
(%i5) ratsubst(t,e,e+y^2);
(%o5) y^2+t
(%i6) ratsubst(t,e,e+z^2);
(%o6) z^2+y*z+x*y

Discussion

  • Stavros Macrakis

    The original problem is reproducible in 5.47. Here is a similar case I came across:

    E: 2*x*y+x$
    
    ratsubst(Q,E,E+x^2); /* x^2+Q */
    ratsubst(Q,E,E+z^2); /* z^2+Q */
    ratsubst(Q,E,E+x*z^2); /* x*z^2+Q */
    

    but

    ratsubst(Q,E,E+x*y^2); /* x*y^2+2*x*y+x */
    

    This is especially frustrating because I'd have thought that ratsubst could use the same workaround that I use by hand:

    ratsubst(Q-x,E-x,E+x*y^2); /* x*y^2+Q */
    

    Maxima 5.47.0 SBCL 2.4.9

     

    Last edit: Stavros Macrakis 2024-11-24
  • Stavros Macrakis

    • labels: Lisp Core --> ratsubst
    • Group: --> None
     

Log in to post a comment.