In multivariable calculus, a vector field assigns a vector to every point in space. For example, the velocity field of a flowing fluid or the magnetic field around a wire are both vector fields. To analyze such fields, two important operators are divergence and curl. They reveal how a field expands, contracts, twists, or circulates. This calculator evaluates those quantities for a general field at a specific point .
The divergence of a vector field, denoted , measures the net rate of outflow from an infinitesimal volume around the point. In Cartesian coordinates it is defined as . If the divergence is positive, the field behaves like a source; if negative, it behaves like a sink. A divergence of zero indicates an incompressible or solenoidal field.
The curl, written as , describes the rotation or swirling strength of the field. Its components are given by . Physically, the curl represents the axis of rotation and its magnitude indicates how strongly the field circulates around that axis.
Divergence and curl appear in many fundamental laws of physics. Gaussโs law for electricity states that the divergence of the electric field is proportional to charge density. Faradayโs law links the curl of the electric field to the rate of change of magnetic flux. When studying fluid dynamics, divergence is related to compressibility, while curl corresponds to vorticity, a measure of how the fluid swirls.
To compute divergence and curl symbolically requires evaluating partial derivatives. This calculator leverages math.js
to differentiate your field components with respect to , , and . You may use standard mathematical syntax such as sin(x)
, y*z
, or x^2
. The expressions are differentiated symbolically, then evaluated at the point you specify.
For example, consider the field , , and . Computing partial derivatives yields and . Evaluating at gives a divergence of and curl components .
When divergence is zero everywhere, we say the field is solenoidal. Magnetic fields are a classic example; Maxwellโs equations imply that magnetic monopoles do not exist, so their divergence is always zero. Similarly, if the curl is zero everywhere, the field is irrotational. Conservative forces in mechanics, such as gravity, have this property in simply connected regions.
Understanding divergence and curl helps visualize fluid flow, electric fields, and more. High divergence indicates fluid being created or removed at a point, while high curl points to strong local rotation. By plotting these quantities across a region, one can identify vortices or sources that might not be obvious from the raw vector field.
This calculator is a quick tool for students and professionals to analyze vector fields without resorting to full symbolic software. Enter the three component formulas and the coordinates of the evaluation point. The script differentiates the components symbolically, substitutes the coordinates, and returns both the divergence and the curl vector. Because math.js
runs in your browser, the computation happens locally, and you can modify the expressions as needed.
The ability to calculate divergence and curl directly fosters experimentation. Try fields that model swirling flows, like . The curl will indicate rotation around the -axis, while the divergence remains zero, corresponding to incompressible circular motion. Through such examples you will develop intuition for how the mathematics connects to physical behavior.
Compute the flux of a vector field through a rectangular box and compare it with the triple integral of its divergence to illustrate Gauss's divergence theorem.
Explore Stokes theorem on the unit disk with a custom vector field. Compute the line integral around the boundary and the surface integral of the curl.
Compute the length of a vector from its components using this client-side vector magnitude calculator.