Div

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

gives the divergence .

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

gives the divergence in the coordinates chart.

Details

  • Div is also known as the contracted covariant derivative.
  • 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.
  • For coordinate charts on Euclidean space, Div[f,{x1,,xn},chart] can be computed by transforming f to Cartesian coordinates, computing the ordinary divergence, and transforming back to chart. »
  • A property of Div is that if chart is defined with metric g, expressed in the orthonormal basis, then Div[g,{x1,,xn]},chart] gives zero. »
  • 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[f,VectorSymbol[]] computes the divergence with respect to the vector symbol. »
  • 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  (6)

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 TemplateBox[{"x", n, TemplateBox[{}, Reals]}, VectorSymbol3] with respect to itself is expressed in terms of SymbolicIdentityArray[{n}]:

Applying TensorExpand gives the expected answer, namely the dimension:

The divergence of a constant affine transformation of TemplateBox[{"x", n, TemplateBox[{}, Reals]}, VectorSymbol3] equals the trace of the linear part:

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  (9)

Div reduces the rank of array by one:

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

Compute Div in a Euclidean coordinate chart c by transforming to and then back from Cartesian coordinates:

The result is the same as directly computing Div[f,{x1,,xn},c]:

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:

If chart is defined with metric g, expressed in the orthonormal basis, Div[g,{x1,,xn},chart] is zero:

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:

Wolfram Research (2012), Div, Wolfram Language function, https://reference.wolfram.com/language/ref/Div.html (updated 2024).

Text

Wolfram Research (2012), Div, Wolfram Language function, https://reference.wolfram.com/language/ref/Div.html (updated 2024).

CMS

Wolfram Language. 2012. "Div." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2024. https://reference.wolfram.com/language/ref/Div.html.

APA

Wolfram Language. (2012). Div. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Div.html

BibTeX

@misc{reference.wolfram_2024_div, author="Wolfram Research", title="{Div}", year="2024", howpublished="\url{https://reference.wolfram.com/language/ref/Div.html}", note=[Accessed: 21-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_div, organization={Wolfram Research}, title={Div}, year={2024}, url={https://reference.wolfram.com/language/ref/Div.html}, note=[Accessed: 21-November-2024 ]}