problems with maxima 5.22.1



Am Donnerstag, den 07.10.2010, 19:04 +0200 schrieb Bruno Torremans:
> Hello Mr Kaiser
> 
> Thanks for your help.
> Unfortunately, I'm not a specialist in Maxima or Lisp, but merely a 
> beginning user (electronics engineer).
> 
> I don't know how to include the patch (didn't find anything in the 
> documentation ...)
> 
> I've included the batch-file : cylinder.mac from 
> http://www.csulb.edu/~woollett/
> 
> With the batch-file you will see that the laplacian, divergence and curl 
> isn't calculated correctly in cylindrical coordinates.
> 
> Hope this helps.
> 
> Best regards,

Hello Bruno,

first, thank you very much for your report. I have needed some time to
get a shorter example. Here it is:

c3rule : [x = rh*cos(p), y = rh*sin(p)  ]$
c3sub(expr) := (subst(c3rule,expr),trigsimp(%%) )$

rhxy : sqrt(x^2 + y^2)$
assume(rh > 0)$

drhdx : (diff(rhxy,x),c3sub(%%) );
drhdy : (diff(rhxy,y),c3sub(%%) );

dpdx : (diff( atan(y/x) ,x),c3sub(%%) );
dpdy : (diff( atan(y/x) ,y),c3sub(%%) );

( gradef(rh,x,drhdx),gradef(rh,y,drhdy) )$
( gradef(p,x,dpdx),gradef(p,y,dpdy) )$

depends(f,[rh,p,z]);

( diff(f,x,2) + diff(f,y,2) + diff(f,z,2),trigsimp(%%), multthru(%%) );

The result of the last line is expected to be the Laplace operator in
cylindrical coordinates:

'diff(f,rh,1)/rh+'diff(f,p,2)/rh^2+'diff(f,z,2)+'diff(f,rh,2)


Maxima gets this result up to the version 5.21, but not for the version
5.22. With Maxima 5.22 we get for the above example:

(2*'diff(f,p,1,rh,1)*cos(p)*sin(p)+'diff(f,rh,1)*cos(p)^2)/rh
 -2*'diff(f,p,1)*cos(p)*sin(p)/rh^2+'diff(f,p,2)*cos(p)^2/rh^2
 +'diff(f,rh,2)*sin(p)^2+'diff(f,z,2)

At first I have thought it is a bug I have introduced, but I think this
is not the problem. The example depends on a wrong behavior of Maxima's
old implementation of the function DEPENDS. The old function has not
checked on which variable a symbol depends. Therefore, any declaration
of a dependency like f(x) causes that the function had a dependency on
any other arbitrary variable too.

For this example we have the dependency f(rh,p,z), but we have not
declared that rh and p depend on x and y. The old code worked, but not
the new implementation.

If we introduce for the example of this posting the following
dependencies in addition:

depends(rh,[x,y]);
depends(p,[x,y]);

we get the correct result for Maxima 5.22 too. Therefore, I think the
examples of Edwin Woollett have to be reworked to take into account the
more correct implementation of the Maxima user function DEPENDS.

I can go in more detail, if there are some open questions. 

Dieter Kaiser