This article introduces a way to find the Laplace operator (Laplacian) in polar coordinates. The Laplace operator of 2-dimensional and 3-dimensional spaces often appears in problems in electromagnetism, quantum mechanics and so on, for those with rotational symmetry.
Though the Laplacian in the Cartesian coordinates takes such a simple form, once one moves to other coordinates, e.g. polar coordinates, it converts into such a complex form. The process of the conversion from Cartesian to polar coordinates asks your patience with dealing with many terms made of trigonometric functions. Simplifying those expressions is such time-consuming and less productive. There is a way to avoid it: USE your computer!
SymPy is such a Python library that makes it possible. The following article introduces basics for some usage of SymPy:
This article demonstrates how to obtain expressions for the Laplacian in polar coordinates in 2-dimensional and 3-dimensional spaces using SymPy. In addition to them, 4-dim. case is examined and resultants for 5- and 6-dim. are provided without showing the source code. (It is a great advantage of using computers that one can carry out extensions in such an easy fashion.)
- Laplacian in 2-dimensional space
- Laplacian in 3-dimensional space
- Laplacian in 4-dimensional space
- Laplacian in 5-dimensional space
- Laplacian in 6-dimensional space
Laplacian in 2-dimensional space
Let it start with the 2-dimensional Laplacian:
The relation between 2-dim. polar coordinates and the Cartesian coordintes is given by
equivalently
The Leibniz' chain rule gives
where the matrix is introduced by
The expression for the matrix is obtained by running the following code in Python:
import sympy as sp sp.var('x, y') r = sp.sqrt(x**2+y**2) theta = sp.atan(y/x) r2 = sp.simplify(sp.Matrix([ [sp.diff(r,x),sp.diff(theta,x)], [sp.diff(r,y),sp.diff(theta,y)] ])) del(r, theta) sp.var('r, theta', positive = True) R2 = sp.trigsimp(r2.subs(x, r*sp.cos(theta)).subs(y, r*sp.sin(theta))) R2
resulting in
Introducing an arbitrary test function , and a matrix via
then one can find the Laplacian as follows:
Running the following code in Python
from sympy.core.function import Function f = Function('f')(r,theta) T2 = R2*sp.Matrix([[sp.diff(f,r)],[sp.diff(f,theta)]]) i = sp.symbols('i',integer=True) sp.trigsimp(sp.summation( R2[i,0]*sp.diff(T2[i,0],r)+R2[i,1]*sp.diff(T2[i,0],theta), (i,0,1)))
one may obtain
Laplacian in 3-dimensional space
Let it move to 3-dim. case:
The relation between the polar coordinates and the Cartesian coordinates is
equivalently
Let be an arbitrary test function and be
then one can find the Laplacian via
First, let all the symbols initialized in the code:
%reset
then run the following code
import sympy as sp sp.var('x, y, z') r = sp.sqrt(x**2+y**2+z**2) theta = sp.atan(sp.sqrt(x**2+y**2)/z) phi = sp.atan(y/x) r3 = sp.simplify(sp.Matrix([ [sp.diff(r,x),sp.diff(theta,x),sp.diff(phi,x)], [sp.diff(r,y),sp.diff(theta,y),sp.diff(phi,y)], [sp.diff(r,z),sp.diff(theta,z),sp.diff(phi,z)] ])) del(r, theta, phi) sp.var('r, theta, phi', nonnegative = True) R3 = sp.expand(sp.trigsimp( r3.subs(x, r*sp.sin(theta)*sp.cos(phi)). subs(y, r*sp.sin(theta)*sp.sin(phi)).subs(z, r*sp.cos(theta)) ), trig = True).subs(sp.Abs(sp.sin(theta)), sp.sin(theta)) T3 = R3*sp.Matrix([ [sp.diff(r,x),sp.diff(theta,x),sp.diff(phi,x)], [sp.diff(r,y),sp.diff(theta,y),sp.diff(phi,y)], [sp.diff(r,z),sp.diff(theta,z),sp.diff(phi,z)] ]) from sympy.core.function import Function f = Function('f')(r,theta,phi) T3 = R3*sp.Matrix([[sp.diff(f,r)],[sp.diff(f,theta)],[sp.diff(f,phi)]]) i = sp.symbols('i',integer=True) sp.trigsimp(sp.summation( R3[i,0]*sp.diff(T3[i,0],r)+R3[i,1]*sp.diff(T3[i,0],theta)+R3[i,2]*sp.diff(T3[i,0],phi), (i,0,2)))
then one may find
Laplacian in 4-dimensional space
The 4-dim. Laplacian
is converted on the polar coordinates whose relation to is given by
or
One may be able to figure out the pattern. Without explaining the details any more, but running the following code
%reset import sympy as sp sp.var('x, y, z, w') r = sp.sqrt(x**2+y**2+z**2+w**2) theta = sp.atan(sp.sqrt(x**2+y**2+z**2)/w) phi = sp.atan(sp.sqrt(x**2+y**2)/z) psi = sp.atan(sp.sqrt(x**2)/y) r4 = sp.simplify(sp.Matrix([ [sp.diff(r,x),sp.diff(theta,x),sp.diff(phi,x),sp.diff(psi,x)], [sp.diff(r,y),sp.diff(theta,y),sp.diff(phi,y),sp.diff(psi,y)], [sp.diff(r,z),sp.diff(theta,z),sp.diff(phi,z),sp.diff(psi,z)], [sp.diff(r,w),sp.diff(theta,w),sp.diff(phi,w),sp.diff(psi,w)] ])) del(r, theta, phi, psi) sp.var('r, theta, phi, psi', nonnegative = True) R4 = sp.expand(sp.trigsimp( r4.subs(x, r*sp.sin(theta)*sp.sin(phi)*sp.sin(psi)). subs(y, r*sp.sin(theta)*sp.sin(phi)*sp.cos(psi)). subs(z, r*sp.sin(theta)*sp.cos(phi)). subs(w, r*sp.cos(theta))). subs(sp.Abs(sp.sin(theta)), sp.sin(theta)). subs(sp.Abs(sp.sin(phi)), sp.sin(phi)). subs(sp.Abs(sp.sin(psi)), sp.sin(psi)), trig = True) T4 = R4*sp.Matrix([ [sp.diff(r,x),sp.diff(theta,x),sp.diff(phi,x),sp.diff(psi,x)], [sp.diff(r,y),sp.diff(theta,y),sp.diff(phi,y),sp.diff(psi,y)], [sp.diff(r,z),sp.diff(theta,z),sp.diff(phi,z),sp.diff(psi,z)], [sp.diff(r,w),sp.diff(theta,w),sp.diff(phi,w),sp.diff(psi,w)] ]) from sympy.core.function import Function f = Function('f')(r,theta,phi,psi) T4 = R4*sp.Matrix([[sp.diff(f,r)],[sp.diff(f,theta)],[sp.diff(f,phi)],[sp.diff(f,psi)]]) i = sp.symbols('i',integer=True) sp.trigsimp(sp.summation( R4[i,0]*sp.diff(T4[i,0],r)+R4[i,1]*sp.diff(T4[i,0],theta) +R4[i,2]*sp.diff(T4[i,0],phi)+R4[i,3]*sp.diff(T4[i,0],psi), (i,0,3)))
gives
It will be a good exercise to make your hypothesis for 5-dim, 6-dim, etc. and check them via Python.
Here are the answers:
Laplacian in 5-dimensional space
The polar coord. in 5-dim.
converts the Laplacian into