## #512 Simplifications involving abs

closed
nobody
5
2010-02-13
2004-02-20
No

abs(q)/q^2 and q^2/abs(q) currently don't simplify.
These should simplify to 1/abs(q) and abs(q). This is
especially useful since things like sqrt(q^2) simplify to
abs(q).

It would be even nicer if GCD understood this case, but I
can understand that that would be harder, e.g.

gcd(abs(q)+q^2,abs(q)) => 1+abs(q)

This seems practically justifiable; is there any theoretical
reason it might not be justifiable?

## Discussion

• Barton Willis - 2004-02-22

Logged In: YES
user_id=895922

When 'domain' is complex or q has been declared
complex, the simplification abs(q) / q^2 --> 1/abs(q)
shouldn't happen.

Barton

• Stavros Macrakis - 2004-02-22

Logged In: YES
user_id=588346

With declare(q,complex), q/abs(q) should presumably simplify
to carg(q), except for the problems with that (620246,
902290). Assuming definition by continuity, q/abs(q) and carg
(q) even have the same 'value' (ind) at q=0.

With *real* r, r/abs(r) = signum(r) *except* at r=0, where
the first is undefined, but the second is well-defined (=0).

• Stavros Macrakis - 2005-02-21

Logged In: YES
user_id=588346

abs(x)^(2*n+1) should simplify to x^(2*n)*abs(x), extending
the current case where abs(x)^(2*n) simplifies to x^(2*n).
This simple change makes (e.g.) abs(x)^3/x simplify with no
further work.

• Robert Dodier - 2006-07-23
• labels: --> Lisp Core - Simplification

• Robert Dodier - 2006-07-23

Logged In: YES
user_id=501686

Observed in 5.9.3cvs.

• Dieter Kaiser - 2010-02-13

The suggested simplifications have been implemented in simp.lisp revision 1.101.
Closing this bug report as fixed.
Dieter Kaiser

• Dieter Kaiser - 2010-02-13
• status: open --> closed