# vectorPotential

Vector potential of vector field

## Description

vectorPotential(V,X) computes the vector potential of the vector field V with respect to the vector X in Cartesian coordinates. The vector field V and the vector X are both three-dimensional.

example

vectorPotential(V) returns the vector potential V with respect to a vector constructed from the first three symbolic variables found in V by symvar.

## Examples

### Compute Vector Potential of Field

Compute the vector potential of this row vector field with respect to the vector [x, y, z]:

syms x y z
vectorPotential([x^2*y, -1/2*y^2*x, -x*y*z], [x y z])
ans =
-(x*y^2*z)/2
-x^2*y*z
0

Compute the vector potential of this column vector field with respect to the vector [x, y, z]:

syms x y z
f(x,y,z) = 2*y^3 - 4*x*y;
g(x,y,z) = 2*y^2 - 16*z^2+18;
h(x,y,z) = -32*x^2 - 16*x*y^2;
A = vectorPotential([f; g; h], [x y z])
A(x, y, z) =
z*(2*y^2 + 18) - (16*z^3)/3 + (16*x*y*(y^2 + 6*x))/3
2*y*z*(- y^2 + 2*x)
0

### Test if Vector Potential Exists for Field

To check whether the vector potential exists for a particular vector field, compute the divergence of that vector field:

syms x y z
V = [x^2 2*y z];
divergence(V, [x y z])
ans =
2*x + 3

If the divergence is not equal to 0, the vector potential does not exist. In this case, vectorPotential returns the vector with all three components equal to NaN:

vectorPotential(V, [x y z])
ans =
NaN
NaN
NaN

## Input Arguments

collapse all

Vector field, specified as a 3-D vector of symbolic expressions or functions.

Input, specified as a vector of three symbolic variables with respect to which you compute the vector potential.

collapse all

### Vector Potential of a Vector Field

The vector potential of a vector field V is a vector field A, such that:

$V=\nabla ×A=curl\left(A\right)$

## Tips

• The vector potential exists if and only if the divergence of a vector field V with respect to X equals 0. If vectorPotential cannot verify that V has a vector potential, it returns the vector with all three components equal to NaN.

## Version History

Introduced in R2012a