[Maxima] Linear display not correct?

Dieter Kaiser drdieterkaiser at web.de
Tue Aug 5 06:29:47 CDT 2008

```Robert wrote:
> I'm pretty sure any operator which has a simplification function
> (as indicated by the OPERATORS property) is simplified (be it in
> an evaluating or non-evaluating context).

I have tried to collect some aspects of the different implementations of Maxima
functions:

Case 1: Simplifying function, noun, verb and alias on property list

A lot of functions like sin, cos, log, gamma... have a noun,verb and an alias on
the property list. I think that was the way in early times all functions were
implemented. This functions work with linear display. The parser does the change
from \$function -> %function. The Maxima User never calls the corresponding Lisp
function. The argument check is done by the simplifying function. A wrong number
of arguments gives a Maxima Error. Quoting does not prevent simplification:
'(sin 1.0)) is evaluated. The \$-function can only be called within Lisp code
e.g. (\$log arg) is equivalent to (simplifya (list '(%log) (resimplify arg) t).

Remark:
Something like (take '(%log) arg) is unnecessary and perhaps dangerous. We have
the \$-function as a shortcut. In the case of the Log function "take" introduces
a direct call to simpln. The code depends on the actual implementation of the
Log function and not on the general concept of the simplifer. This works e.g.
for the Gamma funcion too. So we can call (\$gamma arg) instead of (simplify
(list '(%gamma) arg)) or even more worse a new shortcut like (gm arg) or (take
'(%gamma) arg).

Case 2: Simplifying functions and no entries on the proberty list
e.G. bessel_j, airy_ai, elliptic_ec

The parser returns ((\$function) <args>). The transformation to the Noun-form is
done by a supplied \$-Lisp-function. A Maxima user calls directly the Lisp
function. Linear display has problems. Quoting prevent evaluation
'(bessel_j(1,0.5) -> bessel_j(1,0.5). A call with a wrong number of arguments
causes Lisp Errors or strange effects.

Case 3: No simplifying function supported
e.g. realpart, cabs, hermite, ...

Only a \$-function. Noun form is not supported. The parser returns ((\$function)
<args>). No problems with linear display. A Maxima User calls directly the Lisp
function. Lisp Error when called with wrong number of arguments. No
automatically simplification of forms like '(realpart(1)).
Sometimes a noun form is introduced in a returned expresssion e. g. ((%realpart)
arg) when evaluation is not possible. This noun form is not known by Maxima.
Linear display has problems with this noun form. In other cases e. g. hermite
something like ((\$function simp) <args>) is returned.

Case 4: Simplifying functions and no entries on the proberty list
\$-function defined with defmspec, e.g. sum, lsum and product

Like Case 2 but argument check by the Maxima mfexpr*-function and Maxima Error
when called with wrong number of arguments. No call of a Lisp function by the
Maxima User. This mechanismen is used for Maxima User functions like save,
batch,....

There are further variations (see \$integrate, \$diff). But I think most of the
Maxima User functions fit in one of the above cases.

Dieter Kaiser

```