Divergence Calculator

Compute divergence of 2D/3D vector fields analytically. Step‑by‑step partial derivatives, symbolic results, and interactive visualization.

Definition: For F = (P, Q, R), divergence = ∂P/∂x + ∂Q/∂y + ∂R/∂z (3D) ; for 2D: ∂P/∂x + ∂Q/∂y.

2D: (x², y²)
2D: (x, y)
3D: (x, y, z)
3D: (sin(x), cos(y), z)
3D: (x/r³, y/r³, z/r³)
Computing partial derivatives...

Understanding Divergence

In vector calculus, the divergence of a vector field F is a scalar measure of the field's tendency to originate from or converge into a point. Physically, it represents the net flux per unit volume.

Mathematical definition (Cartesian):

∇·F = ∂P/∂x + ∂Q/∂y + ∂R/∂z

For 2D fields: ∇·F = ∂P/∂x + ∂Q/∂y

Interpretation & Applications

1
Positive divergence → source (fluid expanding, outward flux).
2
Negative divergence → sink (fluid compressing, inward flux).
3
Zero divergence → incompressible flow (solenoidal field).

Divergence Theorem

Also known as Gauss's theorem, it relates the flux through a closed surface to the volume integral of divergence:

S F·dS = ∭V (∇·F) dV

This calculator: Uses symbolic differentiation (nerdamer) to compute exact partial derivatives. Handles polynomials, trig, exponentials, logarithms, and compositions. Displays step‑by‑step derivatives and the final divergence expression.

Frequently Asked Questions

Use sqrt(x^2+y^2+z^2) or r as a variable (if you define r). The symbolic engine can handle expressions like x / sqrt(x^2+y^2+z^2). Example: inverse‑square field (x/r³, y/r³, z/r³) can be entered as x/(x^2+y^2+z^2)^(3/2).

After computing the symbolic divergence ∇·F(x,y,z), we fix y = y₀ and z = z₀, then plot its value along the x‑axis. This shows how divergence changes in the x‑direction through your point. The red dot marks the divergence at x₀.

Currently Cartesian only. For cylindrical/spherical, you would need to transform your field to Cartesian or use specialized tools. We plan to add curvilinear coordinates in a future update.