The (scalar) potential of a gradient field

Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.


potential(f, [x1, x2, …], <[y1, y2, …]>, <Test>)


potential(f, x) determines whether the vector field is a gradient field of some scalar potential p with respect to the variables , and computes that potential if it exists.

The potential of a vector field = [f1(x1, x2, …), f2(x1, x2, …), …] exists (locally) if and only if the Jacobian matrix is symmetric in i and j. In 3 space, this is the condition that vanishes.

The potential with is uniquely determined up to an additive constant.

An integral representation of the potential is given by


where is an arbitrary "base point." This is the contour integral of along the straight line from to .

If the Jacobian matrix is not symmetric, the potential of does not exist. In this case, potential returns FALSE.

    Note:   Note that the answer FALSE is not always conclusive. For arbitrary expressions fi, fj, there is no algorithm to decide whether holds mathematically: potential may return FALSE due to insufficient simplification of the partial derivatives.

The representation of the potential depends on the strength of the symbolic integrator int. If int does not manage to find a closed form of the potential, symbolic calls of int may be returned. See Example 3.

If no base point is specified, the potential is only defined up to some additive constant.

potential does not consider irregular points of the vector field and its potential and investigates the potential only locally. The returned potential may be a valid potential only in a neighbourhood of the current point !

If f is a vector, the component ring of f must be a field (i.e., a domain of category Cat::Field) which allows integration.


Example 1

Using the option Test, we check whether a vector field is a gradient field:

f := [x, y, z*exp(z)]:
potential(f, [x, y, z], Test)

Without the option Test, the potential is returned:

potential(f, [x, y, z])

We check the result:

normal(gradient(%, [x, y, z]))

When a `base point' is specified, a suitable constant is added to the potential such that it vanishes at this point:

potential(f, [x, y, z], [0, 0, 0])

potential(f, [x, y, z], [x0, y0, z0])

delete f:

Example 2

The vector field in this example is not a gradient field and has no potential:

potential([x[2], -x[1]], [x[1], x[2]])

Example 3

The vector field in this example is a gradient field and has a potential. However, the symbolic integrator does not find a closed form of the integral representation for the potential and returns a symbolic definite integral:

potential([a + b*x, sin(y^2)*exp(y)], [x, y])

We check the result:

gradient(%, [x, y])



The vector field: a list of arithmetical expressions, or a vector of such expressions. A vector is an n×1 or 1 ×n matrix of a domain of category Cat::Matrix.

x1, x2, …

The variables: identifiers or indexed identifiers

y1, y2, …

The components of the "base point:" arithmetical expressions. If a base point is specified, the returned potential p satisfies .



Check whether the vector field has a potential and return TRUE or FALSE, respectively.

Return Values

Arithmetical expression or a Boolean value.

See Also

MuPAD Functions

Was this topic helpful?