applying function identities (proposal)



On 2/26/07, Billinghurst, David (RTATECH)
<David.Billinghurst at riotinto.com> wrote:

> (%i4) besselcrunch((-(1+2*n)*bessel_j(n,x))/x+bessel_j(1+n,x)+bessel_j(n-1,x));
>
> Maxima encountered a Lisp error:
>
>  Expected a maxima function designator but got NIL.

OK, I get the same error with the current version of Maxima (5.11.0cvs)
and share/contrib/opsubst.lisp (r1.5).

Going back through the revisions of opsubst, the same error happens
with r1.4 but not with r1.3 (timestamp = 2006/05/06).
However, with r1.3 the results I get are different from the ones shown
in Barton's original message.
(http://www.math.utexas.edu/pipermail/maxima/2006/001287.html)

e.g. besselcrunch((-(1+2*n)*bessel_j(n,x))/x+bessel_j(1+n,x)+bessel_j(n-1,x));
  => -2*n*?%bessel_j(n,x)/x-?%bessel_j(n,x)/x+?%bessel_j(n+1,x)
                      +?%bessel_j(n-1,x)

(Uh-oh -- looks like there's a bug in MSIZE-ATOM or something ... rats.)

It looks like the noun/verb distinction is causing the opsubst stuff
to fail to recognize %BESSEL_J as the same as $BESSEL_J ...
The following definition of OP-EQUALP (otherwise defined in src/compar.lisp)
yields the expected result for the above example (namely 0).

(defun op-equalp (e &rest op) (and (consp e) (consp (car e)) (some
#'(lambda (s) (equal ($verbify (caar e))  s)) (mapcar #'$verbify
op))))

Dunno if that causes unexpected results elsewhere.

FWIW
Robert