[Maxima] Applying vector identities in Maxima

Robert Dodier robert.dodier at gmail.com
Fri May 19 00:02:11 CDT 2006

Hi Neilen,

> I'm trying to use the vect pacakge to apply some vector identies to an
> expression. Consider
>   curl(l1*grad(l2)),
> where l1 and l2 are scalar functions.

OK, it looks like vect.mac knows only a few identities.
There are probably other problems as well; the demo
script doesn't appear to yield the expected results
(although it's hard to tell what should be expected).

Anyway, I find that the following ...

load (vect);

matchdeclare (xx, scalar_not1p, yy, nonscalarp, [aa, bb], all);

scalar_not1p (e) := e # 1 and scalarp (e);

simp : false;

tellsimpafter (curl (xx*yy), xx*(curl yy) - yy~(grad xx));
tellsimpafter ((xx * yy) ~ aa, xx * (yy ~ aa));
tellsimpafter (aa ~ (xx * yy), xx * (aa ~ yy));

simp : true;

declare (["grad", "laplacian"], nonscalar);

... equips Maxima to handle the specific problem you
mentioned. A couple of identities are represented as
simplification rules. Writing such rules is something of
an art -- let me know if you want to go into details.

Here is an example session.

(%i1) announce_rules_firing : true;
(%o1)                         true
(%i2) load ("./vect.mac");
By expressrule1 , express(etrue) --> express1(etrue)
(%o2)                      ./vect.mac
(%i3) load ("./morevect.mac");
yy xx partitions `product'
yy xx partitions `product'
yy xx partitions `product'
(%o3)                    ./morevect.mac
(%i4) declare ([s, t], scalar);
(%o4)                         done
(%i5) curl (s * grad t);
By curlrule2 , curl (s*grad t) --> s*curl grad t-(-grad s) ~ grad t
(%o5)          s curl grad t - (- grad s) ~ grad t
(%i6) ''%;
By ~rule5 , (-grad s) ~ grad t --> -grad s ~ grad t
By curlrule1 , curl grad t --> 0
(%o6)                    grad s ~ grad t

Note that not all of the rules were applied to get %o5,
so I reevaluated it (i.e. ''%) to apply some more rules.

The global flag announce_rules_firing controls the
"By foorule, bar --> baz" debug output.

Robert Dodier

More information about the Maxima mailing list