Applying vector identities, revisited



Hi.

A while ago I was looking to apply the following vector identities to
simplify:

curl(l1*grad(l2)),

where l1 and l2 are scalar functions.

I want to apply curl(s*V) = s*curl(V) - V ~ grad(s), where s is a scalar
function and V a vector function to get:

  l1*curl(grad(l2)) - grad(l2) ~ grad(l1),

and then apply curl(grad(f)) = 0 to get:

  grad(l1) ~ grad(l2).

Robert suggested I try:

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);

which works pretty well when dealing with the curl of one term:

(%i11) announce_rules_firing : true;
(%o11) true

(%i12) declare ([s, t], scalar);
(%o12) done

(%i13) curl(s*grad t);
By curlrule2 , curl (s*grad t) --> 
s*curl grad t -(-grad s) ~ grad t 
(%o13) s*curl(grad(t))-(-grad(s))~grad(t)

(%i14) ev(%);
By ~rule5 , (-grad s) ~ grad t --> -grad s ~ grad t 
By curlrule1 , curl grad t --> 0 
(%o14) grad(s)~grad(t)

But if there is more than one term in the curl():

(%i38) curl(s*grad t - t*grad s);
(%o38) curl(s*grad(t)-grad(s)*t)

(%i39) ev(%);
(%o39) curl(s*grad(t)-grad(s)*t)

One can see that ~rule5 was not triggered.

This works:

(%i42) curl(s*grad t) - curl(t*grad s);
By curlrule2 , curl (s*grad t) -->
s*curl grad t-(-grad s) ~ grad t 
By curlrule2 , curl (grad s*t) --> 
curl grad s*t-grad s ~ grad t 
(%o42) s*curl(grad(t))-curl(grad(s))*t+grad(s)~grad(t)-(-grad(s))~grad(t)

(%i43) ev(%);
By ~rule5 , (-grad s) ~ grad t --> -grad s ~ grad t 
By curlrule1 , curl grad s --> 0 By curlrule1 , curl grad t --> 0 
(%o43) 2*grad(s)~grad(t)

Presumably I need to add a rule that will expand curl(a + b) to curl(a) +
curl(b) first. How may I do this?

Thanks
Neilen

-- 
you know its kind of tragic 
we live in the new world
but we've lost the magic
-- Battery 9 (www.battery9.co.za)