tellsimp and abs



-----maxima-bounces at math.utexas.edu wrote: -----

>If matchdeclare is not called, tellsimp(foo(a),
>...) only matches the literal argument a. Maybe the following
>yields the behavior you expected ...
>
>matchdeclare (a, all);
>tellsimp (abs(a), a - 1);
>abs(a);
>  => a - 1
>abs([a]);
>  => [a - 1]

Other than trying to illustrate a putative bug, I wasn't
trying to do anything useful. Let's try again:

As intended, this rule does a literal match to 'a'

(%i1) tellsimp(abs(a),a)$

Why doesn't abs(5*a) simplify to 5 * a ? I think this is a bug

(%i2) abs(5*a);
(%o2) 5*abs(a)

To simplify this to 5 * a requires trickery

(%i3) expand(%,0);
(%o3) 5*a

The cause of this bug is that simpabs tries to save
a few steps by not going through simplifya to simplify
terms in a product -- instead it calls simpabs directly.
New version of simpabs that fixes this putative bug

(%i1) load("simp.lisp")$
(%i2) tellsimp(abs(a),a)$
(%i3) abs(5*a);
(%o3) 5*a

Barton