Possibility/ease of doing some vector ops in Maxima
Subject: Possibility/ease of doing some vector ops in Maxima
From: willisb at unk
Date: Wed, 18 Sep 2002 20:00:05 -0500
Instead of grad, try using diff without a second argument.
Used this way, diff works like a total derivative operator:
diff(f(x,y)) = diff(f(x,y),x) * del(x) + diff(f(x,y),y) * del(y).
First, tell Maxima that del(p) is zero.
(C1) tellsimpafer(del(p),0);
(D1) tellsimpafer(DEL(p),0)
Second, compute the total derivative
(C2) f : diff(L_1*L_2*(L_1-L_2)^(p-1));
(D2) (L_1*(L_1-L_2)^(p-1)-(p-1)*L_1*(L_1-L_2)^(p-2)*L_2) * DEL(L_2)
+((L_1-L_2)^(p-1)*L_2+(p-1)*L_1*(L_1-L_2)^(p-2)*L_2)*DEL(L_1)
If you want grad instead of del, use subst
(C3) f : subst(grad,del,f);
(D3) (L_1*(L_1-L_2)^(p-1)-(p-1)*L_1*(L_1-L_2)^(p-2)*L_2) * GRAD(L_2)
+GRAD(L_1)*((L_1-L_2)^(p-1)*L_2 +(p-1)*L_1*(L_1-L_2)^(p-2)*L_2)
To extract the coefficients of grad(L_1), etc, use expand followed
by coeff
(C4) f : expand(f);
(D4) -p*L_1*(L_1-L_2)^(p-2)*L_2*GRAD(L_2)
+L_1*(L_1-L_2)^(p-2)*L_2*GRAD(L_2)
+L_1*(L_1-L_2)^(p-1)*GRAD(L_2)
+GRAD(L_1)*(L_1-L_2)^(p-1)*L_2
+p*L_1*GRAD(L_1)*(L_1-L_2)^(p-2)*L_2
-L_1*GRAD(L_1)*(L_1-L_2)^(p-2)*L_2
(C5) [coeff(f, grad(L_1)), coeff(f,grad(L_2))];
(D5) [(L_1-L_2)^(p-1)*L_2+p*L_1*(L_1-L_2)^(p-2)*L_2
-L_1*(L_1-L_2)^(p-2)*L_2,
-p*L_1*(L_1-L_2)^(p-2)*L_2+L_1*(L_1-L_2)^(p-2)*L_2
+L_1*(L_1-L_2)^(p-1)]
(C6)
Maybe this helps?
Barton