This interactive simulation visualizes the fundamental differential operators of vector calculus in 3D. These operators — Gradient (∇f), Divergence (∇·F), Curl (∇×F), and Laplacian (∇²f) — are essential tools in physics, engineering, and applied mathematics, appearing in Maxwell's equations, fluid dynamics, heat transfer, and quantum mechanics.
Sections
- Mathematical Foundation
- Operators on Scalar Fields f(x, y, z)
- Operators on Vector Fields F(x, y, z) = (Fx, Fy, Fz)
- Numerical Differentiation: Central Difference Method
- Key Identities
- Physical Applications
- Deep Dive: The Physical Meaning of the Laplacian (∇²f)
- Simulation
- Point Info (Hover)
- Usage Instructions
- Scalar Field Presets
- Vector Field Presets
- Understanding the Visualizations
- Mathematical Insights
- Tips for Exploration
- Limitations
Mathematical Foundation
The Del Operator (∇):
The nabla or "del" operator is the fundamental building block of all these operators:
It's a vector of partial derivative operators that can be applied to scalar fields (producing vectors) or combined with vector fields (producing scalars or vectors).
Operators on Scalar Fields f(x, y, z)
Operator |
Definition |
Physical Meaning |
|---|---|---|
Partial Derivative |
∂f/∂x = limh→0 [f(x+h,y,z) - f(x,y,z)] / h |
Rate of change of f in the x-direction, holding y and z constant. The slope of the tangent line along x at a point. |
Gradient |
∇f = (∂f/∂x, ∂f/∂y, ∂f/∂z) |
Vector pointing in the direction of steepest ascent. Its magnitude is the rate of increase. Perpendicular to level surfaces (contour lines). |
Laplacian |
∇²f = ∂²f/∂x² + ∂²f/∂y² + ∂²f/∂z² |
Measures concavity — how much a point differs from the average of its neighbors. Positive = concave up (local minimum), Negative = concave down (local maximum). |
Operators on Vector Fields F(x, y, z) = (Fx, Fy, Fz)
Operator |
Definition |
Physical Meaning |
|---|---|---|
Divergence |
∇·F = ∂Fx/∂x + ∂Fy/∂y + ∂Fz/∂z |
Measures how much a vector field spreads out (source) or converges (sink) at a point. Positive = source (fluid created), Negative = sink (fluid destroyed). |
Curl |
∇×F = ( |
Measures rotation/circulation of a vector field. The curl vector points along the axis of rotation (right-hand rule). Magnitude = rotation intensity. A paddle wheel placed in the field would spin based on curl. |
Numerical Differentiation: Central Difference Method
This simulation computes all derivatives numerically using the central difference approximation, which is more accurate than forward/backward differences:
Second Derivative: f''(x) ≈ [f(x+h) − 2f(x) + f(x−h)] / h²
The step size h = 0.05 provides a good balance between accuracy (smaller h) and numerical stability (avoiding floating-point errors with very small h).
Key Identities
Some fundamental relationships between these operators:
- Curl of Gradient is Zero: ∇ × (∇f) = 0 — gradient fields are irrotational
- Divergence of Curl is Zero: ∇ · (∇×F) = 0 — curl fields are solenoidal (no sources/sinks)
- Laplacian: ∇²f = ∇ · (∇f) — divergence of the gradient
- Vector Laplacian: ∇²F = ∇(∇·F) - ∇×(∇×F)
Physical Applications
Operator |
Physics Application |
|---|---|
Gradient |
Electric field from potential: E = -∇V; Force from potential energy: F = -∇U; Temperature gradient drives heat flow |
Divergence |
Gauss's Law: ∇·E = ρ/ε₀ (charges are sources of electric field); Incompressible flow: ∇·v = 0 |
Curl |
Faraday's Law: ∇×E = -∂B/∂t; Ampère's Law: ∇×B = μ₀J; Vorticity in fluid dynamics |
Laplacian |
Heat equation: ∂T/∂t = α∇²T; Wave equation: ∂²u/∂t² = c²∇²u; Schrödinger equation |
Deep Dive: The Physical Meaning of the Laplacian (∇²f)
Core Insight: The Laplacian measures how much a point's value differs from the average of its neighbors. If you average the values in a small sphere around point P, the Laplacian tells you whether P is above or below that average.
∇²f < 0: Point is HIGHER than neighbors → "Peak" (concave down)
∇²f = 0: Point equals average of neighbors → Harmonic function (equilibrium)
1. Heat Equation: ∂T/∂t = α∇²T
∇²T > 0 |
Point is COLDER than neighbors |
Heat flows IN → Temperature rises |
∇²T < 0 |
Point is HOTTER than neighbors |
Heat flows OUT → Temperature drops |
∇²T = 0 |
Point equals average of neighbors |
Equilibrium — no change |
Intuition: Heat naturally diffuses from hot to cold. The Laplacian tells you the "pressure" driving this diffusion.
2. Navier-Stokes (Viscosity Term): ∂v/∂t + (v·∇)v = -∇p/ρ + ν∇²v
The ν∇²v term is the viscous diffusion of momentum:
- If a fluid particle moves faster than its neighbors (∇²v < 0), viscosity slows it down
- If a fluid particle moves slower than its neighbors (∇²v > 0), viscosity speeds it up
- Effect: Smooths out velocity differences — this is why high-viscosity fluids (honey) flow smoothly, while low-viscosity fluids (water) can form turbulence!
3. Wave Equation: ∂²u/∂t² = c²∇²u
The Laplacian acts as a restoring force:
- If a point on a drum membrane is pushed up (higher than neighbors), ∇²u < 0 creates a force pushing it back down
- This creates oscillation → waves propagate!
4. Electrostatics (Poisson's Equation): ∇²V = -ρ/ε₀
- In charge-free regions: ∇²V = 0 (Laplace's equation)
- Meaning: Electric potential at any point is the exact average of surrounding potentials
- Consequence: You can't have a local max/min of potential in free space (no "voltage traps")
Simulation
The interactive simulator is below. Use the controls to explore the concepts described above.
Green line = tangent in y-direction (slope = ∂f/∂y).
These show the rate of change along each axis at the hover point.
Length = magnitude of gradient = max rate of increase.
Gradient is always perpendicular to contour lines.
Shows where function curves up (local min) vs down (local max).
Shows where fluid is created/destroyed in the flow field.
Rotation speed = curl magnitude at paddle position.
Drag the view to see the paddle spin in rotating fields!
Usage Instructions
- Select Mode: Choose between Scalar Field (height map surface) or Vector Field (3D arrows).
- Choose Equation: Select from preset functions. Each preset demonstrates different operator behaviors:
- Saddle Point (f = x² - y²): Classic saddle shape. ∇²f = 0 everywhere (harmonic function)!
- Paraboloid (f = x² + y²): Bowl shape. ∇²f = 4 everywhere (constant positive Laplacian).
- Rotation Field (F = (-y, x, 0)): Pure rotation. Divergence = 0, Curl = (0, 0, 2).
- Point Source: Radial outward flow. High positive divergence at center.
- Enable Visualizations: Toggle checkboxes to show/hide different operator visualizations.
- Interact:
- Scalar Mode: Hover over the surface to see tangent lines, gradient, and point info.
- Vector Mode: Enable Curl checkbox to spawn a paddle wheel that rotates based on local curl.
- Camera: Use mouse to orbit (drag), zoom (scroll), pan (right-drag). Use camera buttons for preset views.
Scalar Field Presets
Preset |
Equation |
Notable Features |
|---|---|---|
Saddle Point |
f(x,y) = x² - y² |
Hyperbolic paraboloid. Laplacian ∇²f = 2 - 2 = 0 (harmonic). Gradient points along x=y diagonal. |
Paraboloid |
f(x,y) = x² + y² |
Circular bowl. ∇²f = 4 everywhere (constant). Gradient always points radially outward. |
Sin-Cos Wave |
f(x,y) = sin(x)·cos(y) |
Periodic surface. Laplacian = -2f (eigenfunction of Laplacian!). |
Gaussian |
f(x,y) = 2e^{-(x²+y²)/2} |
Bell curve. Maximum at origin with ∇f = 0. Negative Laplacian near center (concave down). |
Ripple |
f(x,y) = sin(2r)/(r+0.5) |
Decaying radial waves. Complex Laplacian pattern with rings of positive/negative. |
Vector Field Presets
Preset |
Equation |
Notable Features |
|---|---|---|
Rotation |
F = (-y, x, 0) |
Pure circular rotation. ∇·F = 0 (incompressible), ∇×F = (0, 0, 2) (constant curl). Paddle spins steadily. |
Point Source |
F = r̂/|r| |
Radial outward flow. High positive divergence near origin (source). Curl = 0 (irrotational). |
Point Sink |
F = -r̂/|r| |
Radial inward flow. Negative divergence near origin (sink). All flow converges to center. |
Vortex |
F = (-y/r, x/r, 0.2) |
Swirling upward spiral. Curl varies with distance. Paddle spins faster near center. |
Uniform Flow |
F = (1, 0.5, 0) |
Constant everywhere. ∇·F = 0, ∇×F = 0. Paddle doesn't spin. |
Shear Flow |
F = (y, 0, 0) |
Velocity increases with y. Zero divergence. Non-zero curl makes paddle spin. |
Understanding the Visualizations
Scalar Field Mode:
- The surface represents f(x,y) — height equals function value.
- Tangent lines show slopes: the red line lies in the x-direction with slope ∂f/∂x; the green line lies in the y-direction with slope ∂f/∂y.
- The gradient arrow points "uphill" — in the direction you'd walk to climb the surface fastest.
- When Laplacian coloring is enabled, red regions are concave down (local maxima), blue regions are concave up (local minima).
Vector Field Mode:
- Arrows show the vector field F(x,y,z) at discrete points. Direction = field direction, color/length = magnitude.
- With Divergence coloring: red arrows are at sources (∇·F > 0), blue arrows are at sinks (∇·F < 0).
- The paddle wheel is a physical intuition tool — if you placed a tiny paddle wheel in the flow, it would spin based on the local curl. The paddle's rotation in the simulation directly shows ∇×F.
Mathematical Insights
Why is the Saddle Point Laplacian Zero?
For f(x,y) = x² - y², we have ∂²f/∂x² = 2 and ∂²f/∂y² = -2, so ∇²f = 2 + (-2) = 0. This makes it a harmonic function — solutions to Laplace's equation ∇²f = 0. These are critical in electrostatics (potential between conductors) and fluid flow.
Why does the Rotation Field have Zero Divergence?
For F = (-y, x, 0), we compute ∂(-y)/∂x = 0 and ∂x/∂y = 0, so ∇·F = 0 + 0 = 0. This means fluid neither accumulates nor depletes anywhere — it's an incompressible flow. Meanwhile, ∇×F = (0, 0, ∂x/∂x - ∂(-y)/∂y) = (0, 0, 2), showing constant rotation.
The Gradient-Curl-Divergence Triad:
These three operators form the foundation of vector calculus. In physics, they separate vector fields into:
- Gradient fields (conservative): F = ∇φ, automatically have ∇×F = 0
- Solenoidal fields: ∇·F = 0, can be written as F = ∇×A
- General fields: Decompose into both (Helmholtz decomposition)
Tips for Exploration
- Saddle Point + Laplacian: Notice the entire surface stays grey/neutral — harmonic functions have zero Laplacian!
- Gaussian + Gradient: The gradient arrows all point away from the peak — gradient is perpendicular to contours.
- Rotation Field + Curl Paddle: The paddle spins at constant speed everywhere — uniform curl field.
- Source/Sink + Divergence: Arrows turn red (source) or blue (sink) dramatically near the origin.
- Compare Paraboloid vs Saddle: Same |gradient| on both, but Laplacian is +4 vs 0!
Limitations
- Numerical derivatives. All operators are computed with central differences at a fixed step (h = 0.05), so results are approximate — sharp features, discontinuities, or very large gradients introduce truncation error rather than the exact analytic value.
- Preset analytic fields. Scalar and vector fields come from a fixed menu of smooth closed-form presets; arbitrary user-defined fields, measured/sampled data, and non-smooth fields are not supported.
- Bounded 3D grid. Fields are sampled on a finite cubic domain; behaviour outside the box and true boundary conditions (for the Laplacian/PDE interpretations) are not modeled.
- Visualization, not a PDE solver. The Heat, Wave, and Navier–Stokes equations are shown to motivate the Laplacian, but the tool does not time-step or solve them — it only displays the operator fields at an instant.
- Discrete sampling artifacts. Arrow density, contour resolution, and colour scaling are chosen for clarity; fine structure between sample points is interpolated, not resolved.
- Teaching tool. Built to give geometric intuition for gradient, divergence, curl, and the Laplacian — not a numerical analysis or field-simulation package.