Vector Identities, Redux and more questions



Subject:      Re: Vector Identities, Redux and more questions
From:         Neilen Marais <nmarais at sun.ac.za>
Newsgroups:   gmane.comp.mathematics.maxima.general
Date:         Tue, 12 Sep 2006 19:00:16 +0200

On Mon, 11 Sep 2006 19:31:11 -0600, Robert Dodier wrote:

> On 9/11/06, Neilen Marais <nmarais at sun.ac.za> wrote:
> 
>> 1) Wouldn't it be a good idea to include these definitions in the standard
>> vect package?
> 
> Agreed. What needs to happen is that someone (probably you) needs to paste
> the new identities and declarations into a copy of vect.mac, and
> someone (again probably you) needs to make up a list of test cases
> to verify that the new stuff works as intended and doesn't cause problems
> for the existing stuff. Maxima test cases are just pairs of expressions,
> the second one is the expected result from evaluating the first one.

OK, I think I'm up for this. I'd be happy to contribute something to Maxima :)
I'll probably ask some more questions about the process once I get going.

I've actually found that I needed tot add some more rules to do what I
need for my work. I've managed to get some of them to work for me, but not
all. Perhaps you can give me a hint? My more_vect.mac looks like this now:

matchdeclare ([ww,xx], scalar_not1p, [yy, zz],  nonscalarp, [aa, bb], all)$
scalar_not1p (e) := e # 1 and scalarp (e)$
/* curl(s*V) = s*curl(V) - V ~ grad(s), where s is a scalar, V vector */
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)$
declare ("curl",additive)$

/* div(s*V) = s*div(V) + V.grad(s) */
simp: false$
tellsimpafter (div (xx*yy), xx*(div yy) + yy.(grad xx))$
simp: true$
declare ("div", additive)$

/* div(A~B) = B.(curl A) - A.(curl B) */
simp: false$
tellsimpafter (div(yy ~ zz), zz.(curl yy) - yy.(curl zz))$
simp: true$

/* grad(f*g) = f*grad(g) + g*grad(f) */
simp: false$
tellsimpafter (grad (ww*xx), ww*(grad xx) + xx*(grad ww))$
simp: true$
declare("grad", additive)$

I get all of the rules except the last working the way I want. The last rule
just does not seem to get applied at all.

I digged a little deeper and tried to see if I can "manually" do it using
pattern matching rules. I got a little confused at this point:

(%i1) matchdeclare (a, atom, b, atom)$
(%i2) defmatch (multp, a*b)$
b*a partitions `product'
(%i3) multp(a*b);
(%o3) [b=a*b,a=1]
(%i4) atom(a*b);
(%o4) false

Surely it should be matched into [a=a, b=b]? The match as made here does not
even satisfy the atom predicate? I should actually be using scalar_not1p for
this identity, but could not get it to match anything at all. I'd appreciate
some enligthenment :)

Just thinking aloud about what to put in vect.mac... Probably it's not sensible
to put all vector identites
(e.g. http://grus.berkeley.edu/~jrg/ay202/node189.html) in as telsimpafter
rules... Which ones should be there?  For the others it may be nice to have
pre-defined rules in vect.mac so that a user may apply them as needed.

> 
> best,
> Robert Dodierf

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)