Possibility/ease of doing some vector ops in Maxima



Hi.

On Mon, 2002-09-23 at 06:01, Valerij Pipin wrote:
> Hi
> 
> tellsimp() or tellsimpafter don't work for me in this case
> the one possibility is to use subst(del(p),0,expr) and another way is
> via defrule-apply1
> (C23) defrule(delp,del(p),0);
> (D23)                         delp : DEL(p) -> 0
> (C24) f : diff(L_1*L_2*(L_1-L_2)^(p-1));
>                                     p - 1
> (D24) L_1 LOG(L_1 - L_2) (L_1 - L_2)      L_2 DEL(p)
> 
>                    p - 1                  p - 2
>  + (L_1 (L_1 - L_2)      - L_1 (L_1 - L_2)      L_2 (p - 1)) DEL(L_2)
> 
>                    p - 2                          p - 1
>  + (L_1 (L_1 - L_2)      L_2 (p - 1) + (L_1 - L_2)      L_2) DEL(L_1)
> (C25) apply1(%,delp);
>                       p - 1                  p - 2
> (D25) (L_1 (L_1 - L_2)      - L_1 (L_1 - L_2)      L_2 (p - 1)) DEL(L_2)
> 
>                              p - 2                          p - 1
>            + (L_1 (L_1 - L_2)      L_2 (p - 1) + (L_1 - L_2)      L_2)DEL(L_1)
> 
Yes, this seems to work.  But, in the end I realised I don't really need
to have this work.  Since I pass p as a parameter to a function, for
generating the given order of function, it gets evaluated as a constant
anyway.

Thanks
Neilen

> > Hi Barton
> >
> > On Thu, 2002-09-19 at 03:00, willisb@unk.edu wrote:
> > > 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)
> >
> > When I try this, I get the following:
> >
> > (C309) tellsimpafer(del(p),0);
> > (D309) 					        tellsimpafer(DEL(p), 0)
> > (C310) f : diff(L_1*L_2*(L_1-L_2)^(p-1));
> > L_1*LOG(L_1-L_2)*(L_1-L_2)^(p-1)*L_2*DEL(p)+(L_1*(L_1-L_2)^(p-1)-
> > L_1*(L_1-L_2)^(p-2)*L_2*(p-1))*DEL(L_2)+(L_1*(L_1-L_2)^(p-2)*L_2*(p-1)+
> > (L_1-L_2)^(p-1)*L_2)*DEL(L_1)
> >
> > I assume the tellsimpafer command is not doing quite the right thing?
> >
> > Thanks
> > Neilen
> >
> > > 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
> > >
> > >
> > >
> > >
> > > _______________________________________________
> > > Maxima mailing list
> > > Maxima@www.math.utexas.edu
> > > http://www.math.utexas.edu/mailman/listinfo/maxima
> _______________________________________________
> Maxima mailing list
> Maxima@www.math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
> 
-- 
all we are waiting for is something worth waiting for
		   		   --- KMFDM