Laplacian in Spherical Coordinates

The Euclidean Laplacian has a coordinate-independent meaning, but its formula changes with the coordinates. We derive the spherical-coordinate expression from the metric and then verify it by the multivariable chain rule.

Coordinate metric

The line element is

$$ds^2=dr^2+r^2d\theta^2+r^2\sin^2\theta\,d\phi^2.$$

The coordinate map is differentiated to obtain tangent vectors. Their dot products give the metric, and its inverse is then computed from that induced matrix.

declare symbol r, θ, φ : MathValue

def x : Vector MathValue := [| r, θ, φ |]
def position : Vector MathValue :=
  [| r * sin θ * cos φ
   , r * sin θ * sin φ
   , r * cos θ
   |]

def e_i_j : Matrix MathValue := ∂/∂ position_j x~i
def g_i_j : Matrix MathValue :=
  generateTensor (\[a, b] -> V.* e_a_# e_b_#) [3, 3]
def g~i~j : Matrix MathValue := M.inverse g_#_#

def f : MathValue := function (r, θ, φ)
g_#_#
$\begin{pmatrix} 1 & 0 & 0 \\ 0 & r^{2} & 0 \\ 0 & 0 & \sin(θ)^{2} r^{2} \\ \end{pmatrix}_{\#\#}^{\;\;}$

Covariant derivation

For a scalar field, the Laplace--Beltrami operator can be written

$$ \Delta f=g^{ij}\partial_i\partial_jf -g^{ij}\Gamma^k{}_{ij}\partial_kf. $$

Egison contracts the repeated tensor indices in precisely this formula.

def Γ_i_j_k : Tensor MathValue :=
  (1 / 2) *
    (∂/∂ g_i_k x~j + ∂/∂ g_i_j x~k - ∂/∂ g_j_k x~i)

def Γ~i_j_k : Tensor MathValue := withSymbols [m]
  g~i~m . Γ_m_j_k

def laplacian : MathValue := withSymbols [i, j, k]
  g~i~j . ∂/∂ (∂/∂ f x~j) x~i
    - g~i~j . Γ~k_i_j . ∂/∂ f x~k

Result

$$ \Delta f=\frac{\partial^2f}{\partial r^2} +\frac2r\frac{\partial f}{\partial r} +\frac1{r^2}\frac{\partial^2f}{\partial\theta^2} +\frac{\cos\theta}{r^2\sin\theta}\frac{\partial f}{\partial\theta} +\frac1{r^2\sin^2\theta}\frac{\partial^2f}{\partial\phi^2}. $$

laplacian
$\frac{\partial^2 f}{\partial 1^2} + 2 \frac{\partial f}{\partial 1} r^{-1} + \frac{\partial^2 f}{\partial 2^2} r^{-2} + \cos(θ) \sin(θ)^{-1} \frac{\partial f}{\partial 2} r^{-2} + \sin(θ)^{-2} \frac{\partial^2 f}{\partial 3^2} r^{-2}$

Chain-rule verification

Finally we regard a Cartesian function of three variables as a function of the new coordinates. Expanding the displayed coordinate formula should cancel every mixed derivative and leave the Cartesian Laplacian.

def X : MathValue := r * sin θ * cos φ
def Y : MathValue := r * sin θ * sin φ
def Z : MathValue := r * cos θ
def u : MathValue := function (X, Y, Z)

def uR : MathValue := ∂/∂ u r
def uRR : MathValue := ∂/∂ (∂/∂ u r) r
def uΘ : MathValue := ∂/∂ u θ
def uΘΘ : MathValue := ∂/∂ (∂/∂ u θ) θ
def uΦΦ : MathValue := ∂/∂ (∂/∂ u φ) φ
uRR + 2 * uR / r + uΘΘ / r^2
  + cos θ * uΘ / (r^2 * sin θ)
  + uΦΦ / (r^2 * (sin θ)^2)
$\frac{\partial^2 u}{\partial 3^2} + \frac{\partial^2 u}{\partial 2^2} + \frac{\partial^2 u}{\partial 1^2}$

The expanded result is $u_{XX}+u_{YY}+u_{ZZ}$. The first-derivative terms are exactly the corrections produced by the changing radial and angular scale factors.

Links

Back to the Table of Contents