If f (x1, x2,…, xn) is a scalar function of n variables, then the vector
To compute the gradient of the function f (x, y, z) = xyz
Evaluate
∇xyz =yz, xz, xy
![]()
You can also operate on the function value after defining the function. For example, if f is defined by the equation f (x, y, z) = xyz , then you can evaluate ∇f (x, y, z).
Evaluate
∇f (x, y, z) =yz, xz, xy
![]()
Since gradients can be calculated for scalar functions of n arbitrary variables, the gradient operator uses all the variables that appear in the function, assuming that the variables are ordered lexicographically. For this reason, you may have to edit the result if you are representing arbitrary constants with letters. In the following example, if c is a constant parameter, take the answer
Evaluate
∇cuv + v2w
=
uv, cv, cu + 2vw, v2
![]()
and delete the first entry to get
∇cuv + v2w
=
cv, cu + 2vw, v2
![]()
In the preceding example, we regarded a function of four variables as a function of three variables by treating one of the letters as a constant parameter. You can also regard a function of two variables as a function of three variables. In the following example, we regard ∇xy as the value of a function of three variables.
To find the gradient for f (x, y, z) = ∇xy
Note In physics, f represents potential energy, and ∇f represents force.