grzegorzmazur / yacas

Computer calculations made easy
http://www.yacas.org
GNU Lesser General Public License v2.1
120 stars 23 forks source link

Abs(x)^2 should not simplify to x^2 #331

Open uazu opened 3 years ago

uazu commented 3 years ago

This is incorrect for complex numbers:

In> (Abs(x))^2
Out> x^2
In> (Abs(3+4*I))^2
Out> 25
In> (3+4*I)^2
Out> Complex(-7,24)
grzegorzmazur commented 3 years ago

You are absolutely right of course. The problem is that yacas is not very consistent with assuming either real or complex values during calculations. This has to be fixed, but it's a huge undertaking in general.