Here I'd like to share how to find the Laplacian in polar coordinates with the help of Maxima.
It also serves as a good exercise for learning how to use Maxima.
Those who have learned electromagnetism, or quantum mechanics,
would be familiar with 2-, 3-dimensional Laplacian.
A problem in physics sometimes concerns with the case with rotational invariance,
it is natural to move on to discussion on polar coordinates, rather than the Cartesian coordinates.
However, the Laplacian in polar coordinates appears a bit cumbersome,
while in Cartesian coordinates it takes such a simple form.
Its derivation is rather tedious;
this "sine" combines with that "cosine" and together with another, they cancel ... !! ... !!
spending an hour!!!
This kind of simple but lengthy work shall be done by computer.
Maxima is such a free software enabling you to do it.
The following article provides an essence and a flavor of how to use Maxima:
In this article, I'd like to show you how to find the Laplacian
on 2-, 3-dim. polar coordinates with the help of Maxima.
Additionally, I'll demonstrate 4-dimensional case,
and show the result for 5- and 6-dimensional cases.
(It is an advantage of using computer that an extension is easily available)
- 2-dimensional Laplacian
- 3-dimensional Laplacian
- 4-dimensional Laplacian
- 5-dimensional Laplacian
- 6-dimensional Laplacian
2-dimensional Laplacian
As a warm-up, let us rewrite the 2-dimensional Laplacian
in polar coordinates . The relation among and is given by
or equivalently
From the chain rule of the differential it follows that
Here I introduced a matrix
hence
This matrix is calculated by putting the following source in Maxima
kill(all)$ assume(r>0)$ r(x,y):=sqrt(x^2+y^2)$ theta(x,y):=atan(y/x)$ r2:matrix([diff(r(x,y),x),diff(theta(x,y),x)],[diff(r(x,y),y),diff(theta(x,y),y)])$ R2:trigsimp(subst(r*sin(theta), y, subst(r*cos(theta), x, r2)));
which is found to be
Let be an arbitrary function, and define
Then, we can find the Laplacian by calculating
Putting in Maxima to evaluate the above mentioned object
depends(f,[r,theta])$ T2:R2.matrix([diff(f,r)],[diff(f,theta)]); Lap2:expand(trigsimp(sum( R2[i][1]*diff(T2[i][1],r)+R2[i][2]*diff(T2[i][1],theta), i, 1, 2)));
we obtain
3-dimensional Laplacian
The idea of finding 3-dimensional Laplacian is a straightforward extension of 2-dimensional case:
The relation between the Crtesian coordinates and polar coordinates is given by
or
Let be an arbitrary function, and introduce
Then one can find the Laplacian via
Put the following source in Maxima
kill(all)$ assume(r>0)$ assume(sin(theta)>0)$ r(x,y,z):=sqrt(x^2+y^2+z^2)$ theta(x,y,z):=atan(sqrt(x^2+y^2)/z)$ phi(x,y,z):=atan(y/x)$ r3:matrix( [diff(r(x,y,z),x),diff(theta(x,y,z),x),diff(phi(x,y,z),x)], [diff(r(x,y,z),y),diff(theta(x,y,z),y),diff(phi(x,y,z),y)], [diff(r(x,y,z),z),diff(theta(x,y,z),z),diff(phi(x,y,z),z)])$ R3:trigsimp( subst(r*cos(theta), z, subst(r*sin(theta)*sin(phi), y, subst(r*sin(theta)*cos(phi), x, r3)))); depends(f,[r,theta,phi])$ T3:R3.matrix([diff(f,r)],[diff(f,theta)],[diff(f,phi)])$ Lap3:expand(trigsimp(sum( R3[i,1]*diff(T3[i][1],r)+R3[i,2]*diff(T3[i][1],theta)+R3[i,3]*diff(T3[i][1],phi), i, 1, 3)));
one finds
4-dimensional Laplacian
Finally the 4-dimensional Laplacian
on polar coordinates whose relation to the Cartesian coordinates is
or
Putting the following into Maxima
kill(all)$ assume(r>0)$ assume(sin(theta)>0)$ assume(sin(phi)>0)$ assume(sin(psi)>0)$ r(x,y,z,w):=sqrt(x^2+y^2+z^2+w^2)$ theta(x,y,z,w):=atan(sqrt(x^2+y^2+z^2)/w)$ phi(x,y,z,w):=atan(sqrt(x^2+y^2)/z)$ psi(x,y,z,w):=atan(sqrt(x^2)/y)$ r4:matrix( [diff(r(x,y,z,w),x),diff(theta(x,y,z,w),x),diff(phi(x,y,z,w),x),diff(psi(x,y,z,w),x)], [diff(r(x,y,z,w),y),diff(theta(x,y,z,w),y),diff(phi(x,y,z,w),y),diff(psi(x,y,z,w),y)], [diff(r(x,y,z,w),z),diff(theta(x,y,z,w),z),diff(phi(x,y,z,w),z),diff(psi(x,y,z,w),z)], [diff(r(x,y,z,w),w),diff(theta(x,y,z,w),w),diff(phi(x,y,z,w),w),diff(psi(x,y,z,w),w)])$ R4:trigsimp( subst(r*cos(theta), w, subst(r*sin(theta)*cos(phi), z, subst(r*sin(theta)*sin(phi)*cos(psi), y, subst(r*sin(theta)*sin(phi)*sin(psi), x, r4))))); depends(f,[r,theta,phi,psi])$ T4:R4.matrix([diff(f,r)],[diff(f,theta)],[diff(f,phi)],[diff(f,psi)])$ Lap4:expand(trigsimp(sum( R4[i,1]*diff(T4[i][1],r)+R4[i,2]*diff(T4[i][1],theta)+ R4[i,3]*diff(T4[i][1],phi)+R4[i,4]*diff(T4[i][1],psi), i, 1, 4)));
one finds
From these results, you may guess the result for 5-, 6-, ... dimension, and check it!
The results shall be ...
5-dimensional Laplacian
The polar coordinates in 5-dimension is
The 5-dimensional Laplacian in polar coordinate takes the form
and for 6-dimension