Method on @sym: potential (v)
Method on @sym: potential (v, x)
Method on @sym: potential (v, x, y)

Symbolic potential of a vector field.

Finds the potential of the vector field v with respect to the variables x$. The potential is defined up to an additive constant, unless the third argument is given; in which case the potential is such that p is zero at the point y.

Example:

syms x y z
f = x*y*z;
g = gradient (f)
 ⇒ g = (sym 3×1 matrix)
     ⎡y⋅z⎤
     ⎢   ⎥
     ⎢x⋅z⎥
     ⎢   ⎥
     ⎣x⋅y⎦
potential (g)
 ⇒ (sym) x⋅y⋅z

Return symbolic nan if the field has no potential (based on checking if the Jacobian matrix of the field is nonsymmetric). For example:

syms x y
a = [x; x*y^2];
potential (a)
 ⇒ (sym) nan

See also: @sym/gradient, @sym/jacobian.

Package: symbolic