[Maxima] tellsimp and abs

Robert Dodier robert.dodier at gmail.com
Sun Jan 14 11:10:41 CST 2007


Barton,

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]

> As a general rule, 'simplifya' is the only function
> that should directly call a simplifying function. True or false?

Hmm, maybe so. But I don't really have an opinion on this point.

> (1) Since Maxima lists don't correspond to any one
> particular mathematical object, I think it's wrong for 'abs' to
> automatically map over a list. When listarith == true, then OK
> map 'abs' over lists. Agree or disagree?

OK by me to make the behavior of abs w.r.t. lists depend on
listarith. Better still would be to have some kind of
"foo distributes over bar" declaration.

> (2) The reflection simplification for abs doesn't work when the CL
> special 'expandp' is 't' (look at signum1). I don't have an example
> where this causes a problem. Nevertheless, we could change simpabs
> to use the reflection rule scheme defined in trigi.lisp. The test
> suite is OK with this change. OK or gratuitous?

OK by me to change it if you want.

> (3) Do we really want abs to call cabs whenever the expression
> contains an %i?

Well, cabs, realpart, and imagpart could all stand to be revised.
Maybe it wouldn't be so bad to punt to cabs if cabs were a little
better behaved. Be that as it may, the policy "punt to cabs
when %i is present" is faulty, right? Because expressions
containing %i might or might not be complex, and complex
expressions might or might not contain %i.

Thanks for thinking about this stuff --

Robert


More information about the Maxima mailing list