Div

Div[{f1,,fn},{x1,,xn}]

gives the divergence .

Div[{f1,,fn},{x1,,xn},chart]

gives the divergence in the coordinates chart.

Details

  • Div[f,x] can be input as x.f. The character can be typed as del or \[Del], and the character . is an ordinary period. The list of variables x is entered as a subscript.
  • An empty template . can be entered as del., and moves the cursor from the subscript to the main body.
  • All quantities that do not explicitly depend on the variables given are taken to have zero partial derivative.
  • In Div[f,x], if f is an array of dimensions {n1,,nk-1,nk}, then x must have length nk, and the resulting divergence is an array of dimensions {n1,,nk-1}.
  • In Div[f,{x1,,xn},chart], if f is an array, then it must have dimensions {n,,n}. The components of f are interpreted as being in the orthonormal basis associated with chart.
  • Coordinate charts in the third argument of Div can be specified as triples {coordsys,metric,dim} in the same way as in the first argument of CoordinateChartData. The short form in which dim is omitted may be used.
  • Div works with SparseArray and structured array objects.

Examples

open allclose all

Basic Examples  (4)

Divergence of a vector field in Cartesian coordinates:

Divergence of a vector field in cylindrical coordinates:

Divergence in two-dimensional polar coordinates:

Use del to enter and to enter the list of subscripted variables:

Use del. to enter the template ., fill in the variables, press , and fill in the function:

Scope  (5)

In a curvilinear coordinate system, a vector with constant components may have a nonzero divergence:

Divergence of a rank-2 tensor:

Divergence specifying metric, coordinate system, and parameters:

Div works on curved spaces:

The divergence of the coordinate vector in n dimensions:

Activate the sum to get the simple result:

Applications  (3)

Determine whether a fluid flow is incompressible:

For the function , define the associated conjugate vector field :

The CauchyRiemann equations for are equivalent to being divergence free and curl free:

The divergence of the rank-2 stress tensor equals the force at each point of a static elastic medium:

Properties & Relations  (7)

Div reduces the rank of array by one:

Div[{f1,f2,,fn},{x1,x2,,xn}] is the trace of the gradient of f:

The two-argument form Div[f,vars] is essentially Listable in its first argument:

Div[array,vars,sys] is effectively Grad followed by TensorContract on the last two slots:

However, this operation is not, in general, Listable:

Div contracts the innermost index of the array, which for matrices means acting on rows:

To contract into a different index, use Grad followed by an explicit TensorContract:

In the matrix case, acting on columns can be achieved by first transposing the matrix square:

The divergence of a curl is zero:

Even for non-vector inputs, the result is zero:

This identity is respected by the Inactive form of Div:

Div preserves the structure of SymmetrizedArray objects:

The divergence maintains symmetries not involving the final slot:

Interactive Examples  (1)

View expressions for the divergence of a vector function in different coordinate systems:

Introduced in 2012
 (9.0)
 |
Updated in 2014
 (10.0)