Lesson 5 of 15

The Jacobian Matrix

The Jacobian Matrix

When we change coordinates on a manifold, vectors and tensors transform. The transformation is governed by the Jacobian — the matrix of all partial derivatives of the coordinate change.

For a map F:Rn→RmF: \mathbb{R}^n \to \mathbb{R}^m with F=(F0,F1,…,Fm−1)F = (F_0, F_1, \ldots, F_{m-1}), the Jacobian at a point pp is:

Jij=∂Fi∂xj(p)J_{ij} = \frac{\partial F_i}{\partial x_j}(p)

Example: Polar-to-Rectangular

The map F(r,θ)=(rcos⁡θ,  rsin⁡θ)F(r, \theta) = (r\cos\theta,\; r\sin\theta) has Jacobian:

J=(cos⁡θ−rsin⁡θsin⁡θrcos⁡θ)J = \begin{pmatrix} \cos\theta & -r\sin\theta \\ \sin\theta & r\cos\theta \end{pmatrix}

At (r=1,θ=0)(r=1, \theta=0): J=(1001)J = \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix} — the identity.

At (r=2,θ=0)(r=2, \theta=0): J=(1002)J = \begin{pmatrix} 1 & 0 \\ 0 & 2 \end{pmatrix} — ∂y/∂θ=r=2\partial y / \partial \theta = r = 2.

Determinant

The determinant det⁡(J)\det(J) is the local volume scale factor: how much the map stretches areas. For polar coordinates, det⁡(J)=r\det(J) = r, so the area element in polar coords is r dr dθr\,dr\,d\theta.

Your Task

Implement jacobian(F, n) that takes a vector-valued function F:Rn→RmF: \mathbb{R}^n \to \mathbb{R}^m and returns a function J(point) that computes the Jacobian matrix J[i][j]=∂Fi/∂xjJ[i][j] = \partial F_i / \partial x_j at that point.

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