#2549 function sqrt gives incorrect result

None
open
nobody
5
2013-05-24
2013-02-19
Valery Lovchikov
No

(%i1) declare(z,complex); diff(z(q),q)^2conjugate(diff(z(q),q))^2; sqrt(%);
(%o1) done
(%o2) ('diff(z(q),q,1))^2
conjugate('diff(z(q),q,1))^2
(%o3) 1

Should be: ('diff(z(q),q,1))*conjugate('diff(z(q),q,1))

Discussion

  • Maybe Bug #2550 is related to this problem. Could reproduce the problem with wxMaxima 12.04.0 which contains Maxima Version 5.28.0-2.

    Tried the same with

    Maxima version: 5.19.2
    Maxima build date: 8:55 8/31/2009
    host type: i686-pc-mingw32
    lisp-implementation-type: GNU Common Lisp (GCL)
    lisp-implementation-version: GCL 2.6.8

    declare(z,complex); diff(z(q),q)^2 * conjugate(diff(z(q),q))^2; sqrt(%);
    

    Got:

     (%o2) done
     (%o3) ('diff(z(q),q,1))^2*conjugate('diff(z(q),q,1))^2
     (%o4) sqrt(('diff(z(q),q,1))^2*conjugate('diff(z(q),q,1))^2)
    
     
  • Robert Dodier
    Robert Dodier
    2013-05-24

    Observed in current development version. It appears to be a simplification bug, since it happens in a quoted expression:

    '(sqrt(''%o2));
      => 1
    

    Maxima version: "branch_5_30_base_90_g122d48e_dirty"
    Maxima build date: "2013-05-22 18:42:44"
    Host type: "i686-pc-linux-gnu"
    Lisp implementation type: "SBCL"
    Lisp implementation version: "1.0.49"

     
  • Robert Dodier
    Robert Dodier
    2013-05-24

    • labels: function sqrt gives incorrect result --> Lisp Core - Simplification