# [Maxima] Nonsimplifying nounforms: abs, realpart, carg, etc. (maxima-Bugs-902290)

Stavros Macrakis macrakis at alum.mit.edu
Sun Jan 11 12:53:35 CST 2009

```In
https://sourceforge.net/tracker/?func=detail&atid=104933&aid=902290&group_id=4933,
there has been some discussion of a bug report of mine, which I think is
worth discussing on the larger list.

The bug is that some nounforms, like realpart(1), do not simplify.

Dieter Kaiser suggests (2009-01-11 15:05):
>>>>>>>>>>
It seems to be not difficult to extend the functions realpart and imagpart
to simplifying functions. That is the code which is necessary:...
(defun simp-realpart (x y simpflag)
(oneargcheck x)
(setq y (simpcheck (cadr x) simpflag))
(cond
((taylorize (mop x) (second x)))
(t (car (trisplit y)))))
...The functions work as expected as simlifying functions.
<<<<<<<<<<

This change assumes that the simplification of a nounform is the same thing
as the evaluation of verbs.  The Maxima design philosophy is quite different
from this -- please see my comment of 2007-07-14 22:24 in the bug report for
more detail.

To summarize:

Simplification is supposed to be a relatively low-cost, local transformation
of an expression.  It is *not* supposed to change the expression radically
or put it into canonical form.  Thus, for example, the general simplifier
(as opposed to the CRE subsystem) does *not* perform GCDs on quotients
((x^2-1)/(x-1) remains as-is), expansions of polynomials, etc.

It is appropriate for 'cabs(-3) => 3; 'cabs(x) => abs(x) (if x is real);
etc., but NOT appropriate for 'cabs(w+z) (where w and z are complex to
simplify to
sqrt(('realpart(z)+'realpart(w))^2+('imagpart(z)+'imagpart(w))^2).

Calling trisplit from the simplifying function violates this understanding
of simplification.

-s
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.math.utexas.edu/pipermail/maxima/attachments/20090111/52b8e9cb/attachment.htm
```