How do I get define to recurse?



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

>(%i1) declare(f, multiplicative);
>(%o1)                                done
>(%i2) declare(f, additive);
>(%o2)                                done
>(%i3) f(a+b);
>(%o3)                             f(b) + f(a)
>(%i4) f(a*b);
>(%o4)                              f(a) f(b)
>(%i5) f(a*b +c);
>(%o5)                            f(c) + f(a b)
>
>How do I get maxima to expand out the f(a*b) in
>%o5 properly?

This is a known bug. One workaround is to do expand(%o5).
Another is to use the experimental code (from CVS only)
/share/contrib/multiadditive.lisp. After downloading
this file, you should be able to do:

(%i1) load("multiadditive")$
(%i2) declare(f,multiplicative)$
(%i3) declare(f,multiadditive)$
(%i4) f(a+b*c);
(%o4) f(b)*f(c)+f(a)
(%i5) f(a+b,c+d);
(%o5) f(b,d)+f(b,c)+f(a,d)+f(a,c)

Unlike 'additive,' the multiadditive declaration makes a
function additive in *all* of its arguments.

Expect bugs in 'multiadditive' (it is only a week or so old).
Let me know if you find any.
Barton