Lesson 11 of 15

The Metric Tensor

The Metric Tensor

A metric tensor gg gives the manifold its geometry — it defines lengths, angles, and volumes. At each point pp, gpg_p is a symmetric bilinear form on tangent vectors:

g(u,v)=i,jgij(p)uivjg(u, v) = \sum_{i,j} g_{ij}(p)\, u^i v^j

where gijg_{ij} is the metric component matrix.

Examples

Euclidean metric on R2\mathbb{R}^2: gij=δijg_{ij} = \delta_{ij} (identity matrix) g(u,v)=uxvx+uyvyg(u, v) = u_x v_x + u_y v_y

Sphere of radius RR in colatitude θ\theta, longitude ϕ\phi: g=(R200R2sin2θ)g = \begin{pmatrix} R^2 & 0 \\ 0 & R^2\sin^2\theta \end{pmatrix}

The ϕ\phi-direction shrinks near the poles (θ0\theta \to 0 or π\pi) because circles of latitude get smaller.

Length of a Vector

v2=g(v,v)=i,jgijvivj|v|^2 = g(v, v) = \sum_{i,j} g_{ij} v^i v^j

For v=[3,4]v = [3, 4] on flat R2\mathbb{R}^2: v2=9+16=25|v|^2 = 9 + 16 = 25, so v=5|v| = 5.

Lagrangian Connection

The kinetic energy Lagrangian for free motion on a manifold with metric gg is:

L=12mg(q˙,q˙)=m2ijgij(q)q˙iq˙jL = \frac{1}{2} m\, g(\dot{q}, \dot{q}) = \frac{m}{2}\sum_{ij} g_{ij}(q)\dot{q}^i \dot{q}^j

This connects geometry to dynamics.

Your Task

Implement metric(G_fn) where G_fn(point) returns the n×nn \times n matrix [gij][g_{ij}]. Return a function g such that g(u, v)(*point) computes gp(u,v)g_p(u, v).

Python runtime loading...
Loading...
Click "Run" to execute your code.