 VectorCalculus - Maple Programming Help

Home : Support : Online Help : Mathematics : Vector Calculus : VectorCalculus/DirectionalDiff

VectorCalculus

 DirectionalDiff
 computes the directional derivative of a scalar field in the direction given by a vector

 Calling Sequence DirectionalDiff(F,v,c) DirectionalDiff(F,p,dir,c)

Parameters

 F - the scalar or vector field to differentiate v - Vector(algebraic); the direction Vector or vector field p - point=list(algebraic) or point=Vector(algebraic); point where the derivative will be evaluated dir - list(algebraic) or Vector(algebraic); components specifying the direction of the directional derivative in a specified coordinate system c - (optional) list(name) or symbol[name, name, ...]; list of names or name of the coordinate system indexed by the coordinate names

Description

 • The DirectionalDiff(F,v,c) command, where F is a scalar function, computes the directional derivative of F at the location and direction specified by v.  The expression F is interpreted in the coordinate system specified by c, if provided, and otherwise in the current coordinate system.
 • The DirectionalDiff(F,v,c) command, where F is a VectorField, computes the VectorField of directional derivatives of each component of F with respect to v.
 • The argument v can be a free Vector in Cartesian coordinates, a position Vector, a vector field or a rooted Vector.  If v is one of the first three, the result will be a scalar field of all directional derivatives in ${R}^{n}$ in the directions specified by v; this scalar field will be given in the same coordinate system as is used to interpret expression F.  If v is a rooted Vector, the result is the value of the directional derivative of F in the direction of v taken at the root point of v.
 • If F is a scalar function, the Vector v is normalized. If F is a VectorField, the Vector v is not normalized.
 • The DirectionalDiff(F,p,dir,c) command computes the directional derivative of F at the point p in the direction dir, where F is interpreted in the coordinate system specified by c, if provided, and otherwise in the current coordinate system.  The point p can be a list, a free Vector in Cartesian coordinates or a position Vector. The direction dir can be a free Vector in Cartesian coordinates, a position Vector or a vector field.  The result is the value of DirectionalDiff(F,dir,c) evaluated at the point p.
 – If c is a list of names, the directional derivative of F is taken with respect to these names in the current coordinate system.
 – If c is an indexed coordinate system, F is interpreted in the combination of that coordinate system and coordinate names.
 – If c is not specified, F is interpreted in the current coordinate system, whose coordinate name indices define the function's variables.

Note that c has no influence on the interpretation of the direction vector v.

 • An operator implementing the directional derivative with respect to a VectorField can be obtained using the dot operator with Del, as in $V·\mathrm{Del}$.

Examples

 > with(VectorCalculus):

Introductory examples where a coordinate system is specified

 > SetCoordinates(cartesian[x,y]);
 ${{\mathrm{cartesian}}}_{{x}{,}{y}}$ (1)
 > v1 := <1, 2>:
 > DirectionalDiff(r^2, v1, polar[r,t]);
 $\frac{{2}{}{r}{}{\mathrm{cos}}{}\left({t}\right){}\sqrt{{5}}}{{5}}{+}\frac{{4}{}{r}{}{\mathrm{sin}}{}\left({t}\right){}\sqrt{{5}}}{{5}}$ (2)
 > W := VectorField(, cartesian[u,v]);
 ${W}{≔}\left({u}{+}{v}\right){\stackrel{{_}}{{e}}}_{{u}}{+}\left({v}\right){\stackrel{{_}}{{e}}}_{{v}}$ (3)
 > DirectionalDiff(r^2, point=[1,Pi], W, polar[r,t]);
 ${2}$ (4)
 > dd := DirectionalDiff(r^2, W, polar[r,t]):
 > simplify( eval( dd, [r=1, t=Pi] ) );
 ${2}$ (5)
 > dd := DirectionalDiff(VectorField(), W);
 ${\mathrm{dd}}{≔}\left(\frac{{x}{+}{y}}{{y}}{-}\frac{{x}}{{y}}\right){\stackrel{{_}}{{e}}}_{{x}}{+}\left(\left({x}{+}{y}\right){}{y}{+}{y}{}{x}\right){\stackrel{{_}}{{e}}}_{{y}}$ (6)

Examples where a list of variable names is provided

 > DirectionalDiff(p*q, <1,2>, [p,q]);
 $\frac{{q}{}\sqrt{{5}}}{{5}}{+}\frac{{2}{}{p}{}\sqrt{{5}}}{{5}}$ (7)
 > v2 := <1, 0>:
 > SetCoordinates(polar);
 ${\mathrm{polar}}$ (8)
 > dd := DirectionalDiff(r*cos(theta), v2, [r,theta]): # v2 is in cartesian coordinates
 > simplify( dd );
 ${1}$ (9)

Examples where the information is given in the form of a Rooted Vector

 > SetCoordinates(polar[r, t]);
 ${{\mathrm{polar}}}_{{r}{,}{t}}$ (10)
 > vs := VectorSpace([1, Pi/2], polar[r, t]):
 > v3 := vs:-Vector([1, 1]);
 ${\mathrm{v3}}{≔}\left[\begin{array}{c}{1}\\ {1}\end{array}\right]$ (11)
 > v4 := vs:-Vector([0, 1]);
 ${\mathrm{v4}}{≔}\left[\begin{array}{c}{0}\\ {1}\end{array}\right]$ (12)
 > DirectionalDiff(r^2, v3);
 $\sqrt{{2}}$ (13)
 > DirectionalDiff(r^2, v4);
 ${0}$ (14)
 > SetCoordinates(cartesian[x, y]);
 ${{\mathrm{cartesian}}}_{{x}{,}{y}}$ (15)
 > DirectionalDiff(y^2*x^2, point=[1, 2], <0, 1>, cartesian[x, y]);
 ${4}$ (16)
 > DirectionalDiff(y^2*x^2, RootedVector(root=[1, 2], [0, 1]), cartesian[x, y]);
 ${4}$ (17)
 > DirectionalDiff(y^2*x^2, RootedVector(root=[1, Pi/2], [1, 1], polar[r, t]), cartesian[x, y]);
 ${0}$ (18)

Examples using the dot operator to construct a directional derivative operator

 > SetCoordinates(cartesian[x,y,z]);
 ${{\mathrm{cartesian}}}_{{x}{,}{y}{,}{z}}$ (19)
 > V := VectorField();
 ${V}{≔}\left({y}{}{z}\right){\stackrel{{_}}{{e}}}_{{x}}{+}\left({x}{}{z}\right){\stackrel{{_}}{{e}}}_{{y}}{+}\left({y}{}{x}\right){\stackrel{{_}}{{e}}}_{{z}}$ (20)
 > normal( (V.Del)((x*y*z)) );
 $\sqrt{{{y}}^{{2}}{}{{x}}^{{2}}{+}{{x}}^{{2}}{}{{z}}^{{2}}{+}{{y}}^{{2}}{}{{z}}^{{2}}}$ (21)
 > (V.Del)(VectorField(<1/x, 1/y, 1/z>));
 $\left({-}\frac{{y}{}{z}}{{{x}}^{{2}}}\right){\stackrel{{_}}{{e}}}_{{x}}{+}\left({-}\frac{{x}{}{z}}{{{y}}^{{2}}}\right){\stackrel{{_}}{{e}}}_{{y}}{+}\left({-}\frac{{y}{}{x}}{{{z}}^{{2}}}\right){\stackrel{{_}}{{e}}}_{{z}}$ (22)