{ "cells": [ { "cell_type": "markdown", "id": "82fca0f8", "metadata": {}, "source": [ "# Hodge Laplacian in Polar Coordinates\n", "\n", "This notebook derives the scalar Hodge Laplacian from the metric and\n", "differential-form operators. For polar coordinates $(r,\\theta)$ with\n", "$r>0$,\n", "\n", "$$g=dr^2+r^2d\\theta^2.$$\n", "\n", "With the codifferential convention used below, the result is the\n", "negative of the usual positive-coordinate Laplace operator.\n" ] }, { "cell_type": "markdown", "id": "3a37b734", "metadata": {}, "source": [ "## Polar metric\n", "\n", "Both the covariant and contravariant metrics carry explicit tensor\n", "indices. This lets Egison contract them automatically in the Hodge\n", "formula.\n" ] }, { "cell_type": "code", "execution_count": 1, "id": "1a4aa201", "metadata": {}, "outputs": [], "source": [ "declare symbol r, θ : MathValue\n", "\n", "def N : Integer := 2\n", "def x : Vector MathValue := [| r, θ |]\n", "\n", "def g_i_j : Matrix MathValue :=\n", " [| [| 1, 0 |], [| 0, r ^ 2 |] |]_i_j\n", "def g~i~j : Matrix MathValue :=\n", " [| [| 1, 0 |], [| 0, r ^ (-2) |] |]~i~j\n" ] }, { "cell_type": "code", "execution_count": 2, "id": "8cab770d", "metadata": {}, "outputs": [ { "data": { "text/html": [ "$\\begin{pmatrix} 1 & 0 \\\\ 0 & r^{2} \\\\ \\end{pmatrix}_{\\#\\#}^{\\;\\;}$" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "g_#_#\n" ] }, { "cell_type": "markdown", "id": "9508b31a", "metadata": {}, "source": [ "## Exterior derivative and Hodge star\n", "\n", "The Hodge star combines the Levi-Civita tensor, the inverse metric,\n", "and the volume density $\\sqrt{|g|}=r$.\n" ] }, { "cell_type": "code", "execution_count": 3, "id": "6aa28359", "metadata": {}, "outputs": [], "source": [ "def d (A : Tensor MathValue) : Tensor MathValue :=\n", " !(flip ∂/∂) x A\n", "\n", "def hodge (A : Tensor MathValue) : Tensor MathValue :=\n", " let k := dfOrder A\n", " in withSymbols [i, j]\n", " sqrt (M.det g_#_#) *\n", " foldl\n", " (.)\n", " ((subrefs A (map 1#j_$1 (between 1 k))) .\n", " (subrefs (ε' N k) (map 1#i_$1 (between 1 N))))\n", " (map 1#g~(i_$1)~(j_$1) [1..k])\n" ] }, { "cell_type": "markdown", "id": "5893c721", "metadata": {}, "source": [ "## Codifferential and Laplacian\n", "\n", "The codifferential is the metric adjoint of $d$ and can be written in\n", "terms of two Hodge stars. The degree test selects the appropriate\n", "endpoint formula for zero- and top-degree forms.\n" ] }, { "cell_type": "code", "execution_count": 4, "id": "faddc387", "metadata": {}, "outputs": [], "source": [ "def δ (A : Tensor MathValue) : Tensor MathValue :=\n", " let k := dfOrder A\n", " in (-1) ^ (N * (k + 1) + 1) * (hodge (d (hodge A)))\n", "\n", "def Δ (A : Tensor MathValue) : Tensor MathValue :=\n", " match (dfOrder A) as integer with\n", " | #0 -> δ (d A)\n", " | #N -> d (δ A)\n", " | _ -> d (δ A) + δ (d A)\n", "\n", "def f : MathValue := function (r, θ)\n" ] }, { "cell_type": "markdown", "id": "8840f8f2", "metadata": {}, "source": [ "Applying the operator to an arbitrary scalar function leaves its\n", "derivatives symbolic, so the coordinate formula is visible directly.\n" ] }, { "cell_type": "code", "execution_count": 5, "id": "04b501b1", "metadata": {}, "outputs": [ { "data": { "text/html": [ "$-\\frac{\\partial^2 f}{\\partial 1^2} - \\frac{\\partial f}{\\partial 1} r^{-1} - \\frac{\\partial^2 f}{\\partial 2^2} r^{-2}$" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "Δ f\n" ] }, { "cell_type": "markdown", "id": "bf201951", "metadata": {}, "source": [ "The displayed expression is\n", "\n", "$$\n", "\\Delta f=-\\left(\n", " \\frac{\\partial^2f}{\\partial r^2}\n", " +\\frac1r\\frac{\\partial f}{\\partial r}\n", " +\\frac1{r^2}\\frac{\\partial^2f}{\\partial\\theta^2}\n", "\\right).\n", "$$\n", "\n", "The $1/r$ and $1/r^2$ terms are not inserted by hand: they arise from\n", "the determinant and inverse metric inside the Hodge star.\n" ] } ], "metadata": { "kernelspec": { "display_name": "Egison", "language": "egison", "name": "egison" }, "language_info": { "codemirror_mode": "egison", "file_extension": ".egi", "mimetype": "text/x-egison", "name": "egison" } }, "nbformat": 4, "nbformat_minor": 5 }