01/ Integration Over Curved Manifolds
In vector calculus and physical modeling, we frequently encounter the need to accumulate physical quantities across curved surfaces. Examples range from calculating the total electrostatic charge on a curved conductor to computing heat flux or estimating the mass of a shell with variable density. These problems are solved using surface integrals of scalar fields.
Unlike integration over flat Euclidean domains, integrating over a curved surface requires translating the coordinate space of a flat 2D parameter region onto a manifold embedded in 3D space. This process introduces local geometric distortion, requiring a correction factor known as the Jacobian scaling factor to reconcile the difference between the parameter space area and the actual physical area.
Interactive 3D Calculus Sandbox
Live WebAssembly Render (Rust + Macroquad + Egui)
Figure 1: Live parameterization and integration dashboard. Use mouse to orbit/zoom. Grid cells show mapped coordinate tracking.
02/ Mathematical Foundations
To perform integration over a curved 2D surface $S$ in $\mathbb{R}^3$, we define a vector-valued position function $\vec{r}(s, t)$ that maps a flat parameter coordinate space $T \subset \mathbb{R}^2$ to 3D space:
At any point on the surface, moving infinitesimally in the directions of the parameters $s$ or $t$ defines two tangent vectors along the surface grid curves. These are calculated using partial derivatives:
Taking the cross product of these tangent vectors yields the surface normal vector $\vec{n}(s, t)$, which is perpendicular to the tangent plane at that point:
03/ Local Area Distortion & the Jacobian
When mapping a flat grid $(ds \times dt)$ onto a curved manifold, the area is stretched, compressed, or tilted. For example, mapping a flat grid to a sphere maps the top parameter boundary line to a single point (the pole), compressing the area.
The magnitude of the normal vector represents the local area expansion factor, which serves as the Jacobian scaling factor $J(s, t)$. Geometrically, the area of the differential parallelogram spanned by $\vec{t}_s \, ds$ and $\vec{t}_t \, dt$ is:
Using this relationship, we define the surface integral of a scalar field $f(x, y, z)$ over a parameterized surface $S$ as:
If the scalar field is uniform, $f(x, y, z) = 1$, the integral yields the exact geometric surface area of the manifold:
04/ Numerical Calculus & Grid Discretization
To compute surface integrals programmatically over arbitrary shapes, we subdivide the parameter space $T$ into a grid of cells of size $\Delta s \times \Delta t$. For each cell centered at $(s_i, t_j)$, the simulation performs the following steps:
- Partial Derivatives: Evaluates $\vec{t}_s$ and $\vec{t}_t$ using numerical central differences: $$\frac{\partial \vec{r}}{\partial s} \approx \frac{\vec{r}(s + \epsilon, t) - \vec{r}(s - \epsilon, t)}{2\epsilon}, \quad \epsilon = 10^{-3}$$
- Jacobian Calculation: Computes the local cross product magnitude $J_{i, j} = \|\vec{t}_s \times \vec{t}_t\|$.
- Scalar Field Evaluation: Computes $f(x, y, z)$ at the spatial coordinate $\vec{r}(s_i, t_j)$.
- Riemann Sum Accumulation: Accumulates the discrete sum over all grid subdivisions: $$\iint_S f(x, y, z) \, dS \approx \sum_{i} \sum_{j} f\big(\vec{r}(s_i, t_j)\big) \, J_{i, j} \, \Delta s \, \Delta t$$
05/ Analyzed Geometries & Fields
The interactive simulation provides a diagnostic environment containing five different parametric manifolds:
- Paraboloid (Bowl): $\vec{r}(s, t) = [s\cos t, s\sin t, s^2]^T$ where stretching increases quadratically with radius $s$.
- Hyperbolic Paraboloid (Saddle): $\vec{r}(s, t) = [s, t, s^2 - t^2]^T$, illustrating saddle curves.
- Hemisphere (Dome): $\vec{r}(s, t) = [\cos s\cos t, \sin s\cos t, \sin t]^T$, highlighting spherical coordinate compression near the poles ($t \to \pi/2$).
- Wavy Ripple: $\vec{r}(s, t) = [s, t, A\sin(\omega(s^2+t^2))]^T$, which contains oscillatory derivatives.
- Torus (Donut): $\vec{r}(s, t) = [(R + r\cos t)\cos s, (R + r\cos t)\sin s, r\sin t]^T$, illustrating outer-edge stretching and inner-edge compression.