vectorPotential

Vector potential whose curl is a given divergence-free vector field.

Category: Mathematics > Calculus

Syntax

A = vectorPotential(V, X)

Returns a vector field A of variables X with curl(A, X) == V.

Description

A vector field has a vector potential only when its divergence vanishes. vectorPotential integrates the components of V along the coordinates to build one such A; the answer is not unique, since the gradient of any scalar function can be added to A without changing its curl.

Check a result with curl(A, X).

Input arguments

V
Three-component symbolic vector field. It must have zero divergence.
X
Vector of the three symbolic variables, for example [x y z].

Output arguments

A
Column vector of three symbolic expressions.

Example

Potential of a rotation field

syms x y z
V = [2*y, -2*x, 0];
A = vectorPotential(V, [x y z])
Output
A = 
-2*x*z
-2*y*z
     0

Notes

If the field is not divergence-free MATLAB reports an error, while MatLivre returns NaN entries.

See also

curl divergence gradient potential