Divergence Calculator
Calculate the divergence of a vector field from its component partial derivatives. Enter values for instant results with step-by-step formulas.
Reviewed for accuracy by Manoj Kumar, Mathematics Educator
Divergence Calculator
Calculator
Adjust values & calculateEnter your values below. Every result is computed in your browser โ no data is sent to any server.
Formula: div(F) = partial Fx/partial x + partial Fy/partial y + partial Fz/partial z
Worked example โ div(F) = 4 (constant source field, positive divergence everywhere)
Formula
div(F) = partial Fx/partial x + partial Fy/partial y + partial Fz/partial z
The divergence operator (nabla dot F) sums the partial derivatives of each component with respect to its own coordinate axis. It measures the net outward flux per unit volume at each point, indicating sources (positive), sinks (negative), or incompressible flow (zero).
Worked Examples
Example 1: Linear Vector Field
Problem:Find the divergence of F = (2x, -y, 3z) at any point.
Solution:F = (Fx, Fy, Fz) = (2x, -y, 3z) partial Fx / partial x = partial(2x)/partial x = 2 partial Fy / partial y = partial(-y)/partial y = -1 partial Fz / partial z = partial(3z)/partial z = 3 div(F) = 2 + (-1) + 3 = 4 The divergence is constant everywhere (does not depend on position).
Result:div(F) = 4 (constant source field, positive divergence everywhere)
Example 2: Quadratic Field at a Point
Problem:Find the divergence of F = (x squared, y squared, z squared) at point (1, 2, -1).
Solution:F = (x sq, y sq, z sq) partial(x sq)/partial x = 2x = 2(1) = 2 partial(y sq)/partial y = 2y = 2(2) = 4 partial(z sq)/partial z = 2z = 2(-1) = -2 div(F) = 2 + 4 + (-2) = 4 At (1, 2, -1), the divergence is 4.
Result:div(F) at (1, 2, -1) = 4 (source at this point)
Frequently Asked Questions
What is the divergence of a vector field?
The divergence of a vector field is a scalar function that measures the rate at which the field expands or contracts at each point, representing the net outward flux per unit volume from an infinitesimally small region. Mathematically, for a three-dimensional vector field F = (Fx, Fy, Fz), the divergence is the sum of partial derivatives: div(F) = partial Fx / partial x + partial Fy / partial y + partial Fz / partial z. Positive divergence indicates a source where the field radiates outward (like air flowing from a pump), negative divergence indicates a sink where the field converges inward (like water flowing toward a drain), and zero divergence indicates an incompressible or solenoidal field where what flows in equals what flows out.
How is divergence related to the Divergence Theorem?
The Divergence Theorem, also known as Gauss's theorem, establishes a fundamental relationship between the divergence inside a volume and the flux through its boundary surface. It states that the volume integral of the divergence of a vector field equals the surface integral of the field over the closed boundary: the triple integral of div(F) dV equals the double integral of F dot n dS. This theorem converts between a volume calculation (which may be easier for certain fields) and a surface calculation (which may be easier for certain geometries). The theorem is the three-dimensional generalization of the Fundamental Theorem of Calculus and is extensively used in physics for deriving conservation laws from differential equations.
What does it mean when the divergence is zero everywhere?
A vector field with zero divergence everywhere is called solenoidal or divergence-free, and it represents an incompressible flow where no fluid is created or destroyed at any point. This is a fundamental property in several areas of physics: magnetic fields always have zero divergence (one of Maxwell's equations states div(B) = 0, reflecting the absence of magnetic monopoles), and the velocity field of an incompressible fluid satisfies div(v) = 0. A solenoidal field can always be expressed as the curl of another vector field (F = curl(A)), where A is called the vector potential. This property is used extensively in computational electromagnetics and fluid dynamics to ensure physically consistent solutions.
How do I compute divergence in different coordinate systems?
In Cartesian coordinates, divergence is simply the sum of partial derivatives along each axis, but in curvilinear coordinates the formula changes to account for the geometry. In cylindrical coordinates (r, theta, z), divergence is (1/r) partial(r Fr)/partial r + (1/r) partial F_theta/partial theta + partial Fz/partial z. In spherical coordinates (r, theta, phi), it becomes (1/r squared) partial(r squared Fr)/partial r + (1/(r sin theta)) partial(sin theta F_theta)/partial theta + (1/(r sin theta)) partial F_phi/partial phi. The scale factors (like 1/r and 1/(r sin theta)) account for the fact that coordinate surfaces are not equally spaced in curvilinear systems, and forgetting them is one of the most common errors in vector calculus.
What is the physical meaning of divergence in fluid dynamics?
In fluid dynamics, the divergence of the velocity field represents the rate at which fluid volume expands or compresses per unit volume at each point in the flow. A positive divergence means fluid is being created or expanding at that location, such as gas expanding through a nozzle or fluid being injected through a source. Negative divergence indicates fluid compression or removal, such as suction through a drain. For incompressible fluids like water at normal conditions, the divergence of the velocity field is exactly zero everywhere, which is the mathematical statement of the continuity equation for incompressible flow. This constraint is one of the most important in computational fluid dynamics and directly determines the pressure field.
How does divergence relate to electric fields and charges?
Gauss's law in differential form states that the divergence of the electric field equals the charge density divided by the permittivity of free space: div(E) = rho / epsilon_0. This means that electric charges are sources (positive charges) and sinks (negative charges) of the electric field. Where there is no charge, the divergence of E is zero and the electric field lines neither start nor end. A point charge creates a field whose divergence is zero everywhere except at the charge location, where it becomes infinite (mathematically represented by the Dirac delta function). This connection between divergence and source density is fundamental to electrostatics, and the same mathematical structure appears in gravitational fields.
What is the Laplacian and how does it relate to divergence?
The Laplacian is the divergence of the gradient of a scalar field, written as div(grad(f)) or nabla squared f, and it equals the sum of second partial derivatives: partial squared f / partial x squared + partial squared f / partial y squared + partial squared f / partial z squared. The Laplacian measures how much the value of f at a point differs from the average of f in a small surrounding neighborhood. It appears in nearly every branch of physics: Laplace's equation (nabla squared f = 0) describes steady-state heat distribution and electrostatic potentials, Poisson's equation (nabla squared f = rho) adds source terms, and the wave equation and Schrodinger equation both contain the Laplacian. Computing the Laplacian by first finding the gradient and then taking its divergence is a standard technique.
Can a field have divergence at some points but not others?
Yes, most physically realistic vector fields have divergence that varies from point to point, being zero in some regions, positive in others, and negative in others. For example, a velocity field describing fluid flowing from a pipe into a room would have positive divergence near the pipe outlet (source), negative divergence near a return vent (sink), and zero divergence in between (where fluid passes through without expansion or compression). Fields with polynomial components, like F = (x squared, y squared, z squared), have divergence that varies linearly with position (div = 2x + 2y + 2z in this case). Understanding where divergence is nonzero helps identify source and sink locations in physical systems.
How is divergence used in machine learning and data science?
Divergence concepts appear in machine learning through the Kullback-Leibler (KL) divergence, which measures how one probability distribution differs from a reference distribution, though this is a different mathematical concept from vector field divergence. However, true vector field divergence has gained importance in neural networks through physics-informed neural networks (PINNs) that enforce divergence constraints as loss function penalties. In generative models, normalizing flows use the change-of-variables formula involving the divergence of the velocity field. Score-based diffusion models rely on the divergence of the score function for density estimation. These connections demonstrate how classical vector calculus concepts remain relevant in modern computational methods.
What is the relationship between divergence and curl?
Divergence and curl are the two fundamental differential operations on vector fields, measuring complementary aspects of field behavior. Divergence measures the expansion or contraction (source/sink behavior) and produces a scalar, while curl measures the rotation or circulation and produces a vector. A key identity connects them: the divergence of the curl of any vector field is always zero (div(curl(F)) = 0), meaning curl fields are always solenoidal. Similarly, the curl of the gradient of any scalar field is always zero (curl(grad(f)) = 0). These identities are the foundation of the Helmholtz decomposition theorem, which states that any sufficiently smooth vector field can be decomposed into an irrotational (curl-free) component and a solenoidal (divergence-free) component.
References
Reviewed for accuracy by Manoj Kumar, Mathematics Educator ยท Editorial policy
Related Calculators
๐งฎGradient Divergence Curl Calculator
Calculate gradient divergence curl with inputs, formulas, and instant results.
๐งฎAnnulus Area Calculator
Calculate annulus area with inputs, formulas, and instant results.
๐งฎArea Calculator
Calculate area with inputs, formulas, and instant results.
๐งฎArea of a Rectangle Calculator
Calculate the area, perimeter, and diagonal of a rectangle. Find missing sides from known area. Convert between metric and imperial area units.
๐งฎArea of Crescent Calculator
Calculate area of crescent with inputs, formulas, and instant results.
๐งฎCenter of Mass Calculator
Calculate center of mass with inputs, formulas, and instant results.
๐งฎCentroid Calculator
Calculate centroid with inputs, formulas, and instant results.
๐งฎChord Length Calculator
Calculate chord length with inputs, formulas, and instant results.