Maybe an alternative is something like:
(%i1) load(pdiff)$
(%i2) assume(r > 0)$
(%i3) phi(sqrt(x^2+y^2),atan2(y,x));
(%o3) phi(sqrt(y^2+x^2),atan2(y,x))
(%i4) diff(%,x,2) + diff(%,y,2)$
(%i5) ratsubst(r^2, x^2+y^2,%);
(%o5)
(r^5*phi[(2,0)](r,atan2(y,x))+r^4*phi[(1,0)](r,atan2(y,x))+r^3*phi[(0,2)](r,atan2(y,x)))/r^5
(%i6) ratsubst(theta, atan2(y,x),%);
(%o6)
(r^2*phi[(2,0)](r,theta)+r*phi[(1,0)](r,theta)+phi[(0,2)](r,theta))/r^2
Convert to non-positional derivatives:
(%i7) convert_to_diff(%);
(%o7)
('diff(phi(r,theta),theta,2)+r^2*('diff(phi(r,theta),r,2))+r*('diff(phi(r,theta),r,1)))/r^2
But I'm not the elegance judge.
--Barton
maxima-bounces at math.utexas.edu wrote on 09/13/2010 12:31:57 AM:
> [image removed]
>
> [Maxima] How to avoid this gradef
>
> Diego Torquemada
>
> to:
>
> maxima
>
> 09/13/2010 11:36 AM
>
> Sent by:
>
> maxima-bounces at math.utexas.edu
>
> Hello,
>
> I was wondering if there is a more elegant way than the following:
>
>
> depends([r,t],[x,y])$ depends(phi,[r,t])$
>
> (gradef(r,x,cos(t)), gradef(r,y,sin(t)),
> gradef(t,x,-sin(t)/r), gradef(t,y,cos(t)/r))$
>
> trigreduce(diff(phi,x,2)+diff(phi,y,2));
>
>
> in order to calculate the laplacian in polar coordinates. I do not
> want to use that gradef() for specifying the derivatives of r and t,
> given that they should be defined something like
>
> r(x,y) := sqrt(x^2+y^2); t(x,y) := atan2(y,x);
>
> It would be nice if I can have the last line in my code
>
> Thank you very much for your help,
>
> Diego
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima