#2550 abs((%i+x)^2) evaluates to (x + %i)^2


There is an error in the simplification of the abs function:

abs((%i+x)^2) ==> (x + %i)^2

Other examples work, e.g.

abs(%i^2) ==> 1
abs((%i+x)^2 + 1) ==> abs((%i+x)^2 + 1)

Maxima version: "5.28.0-2"
Maxima build date: "2012-08-27 23:16:48"
Host type: "i686-pc-mingw32"
Lisp implementation type: "GNU Common Lisp (GCL)"
Lisp implementation version: "GCL 2.6.8"

This worked in Version 5.19.02:

abs((%i+x)^2) ==> sqrt((x^2-1)^2 + 4 * x^2)


<< < 1 2 (Page 2 of 2)
  • Rupert Swarbrick

    Er, it would indeed be work. I meant worth, of course...

  • Jaime E. Villate

    Yes Rupert, I think that Stavros' write-up is much better than the current manual description. However, as Stavros himself says, his summary refers to an ideal-world Maxima. In practice, abs does not work exactly as described in his summary (recent bugs or new features?). For instance abs((x+%i*y)^2)returns (%i*y+x)^2 and not abs(%i*y+x)^2.
    Also, users might end up thinking that cabs should not be used when you want to simplify an expression, but in some cases the situation is the opposite: abs will not make the simplification you expected while cabs will; see for instance today's message in the mailing list and the answer given by Leo Butler.

    Last edit: Jaime E. Villate 2013-11-22
    • Albrecht Mueller

      If abs(x) - where x is a real or a complex number - returns or is simplified to something that is not a real number I think this is a recent bug. I cannot imagine what kind of a new useful feature this behaviour could be.

<< < 1 2 (Page 2 of 2)

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks