VectorCalculus - Maple Programming Help

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

VectorCalculus

 DotProduct
 computes the dot product of Vectors and differential operators

 Calling Sequence DotProduct(v1, v2) v1 . v2

Parameters

 v1 - Vector(algebraic); Vector, Vector-valued procedure, or differential operator v2 - Vector(algebraic); Vector, Vector-valued procedure, or differential operator

Description

 • The DotProduct(v1, v2) command (scalar product) computes the dot product of v1 and v2, where v1 and v2 can be free Vectors, rooted Vectors, position Vectors, vector fields, Del or Nabla.
 • The function can be accessed through  . or DotProduct exports.
 • If v2 is a VectorField, the divergence of v2 can be computed as DotProduct(Del, v2), or $\nabla .\mathrm{v2}$.
 • If v1 is a VectorField, an operator representing the directional derivative in the direction of v1 is obtained as DotProduct(v1, Del), or $\mathrm{v1}.\nabla$.
 • The behavior of the dot product of two Vectors is described by the following table:

 $\mathrm{v1}$ coord ($\mathrm{v1}$) $\mathrm{v2}$ coord ($\mathrm{v2}$) $\mathrm{v1}·\mathrm{v2}$ 1 free Vector cartesian free Vector cartesian scalar free Vector curved free Vector any error 2 free Vector cartesian rooted Vector (root2) coord2 scalar free Vector curved rooted Vector (root2) coord2 error 3 free Vector cartesian vector field cartesian scalar free Vector cartesian vector field curved error free Vector curved vector field any error 4 free Vector cartesian position Vector cartesian scalar 5 rooted Vector (root1) coord1 rooted Vector (root1) coord1 scalar rooted Vector (root1) coord1 rooted Vector (root2) coord1 error rooted Vector (any) coord1 rooted Vector (any) coord2 error 6 rooted Vector (root1) coord1 vector field coord2 $\mathrm{v1}·\mathrm{v2}\left(\mathrm{root1}\right)$ 7 rooted Vector (root1) cartesian position Vector cartesian scalar 8 vector field coord1 vector field coord1 scalar field vector field coord1 vector field coord2 error 9 vector field coord1 position Vector cartesian error 10 position Vector cartesian position Vector cartesian scalar

Examples

 > restart;
 > with(VectorCalculus):

Take the dot product of two free Vectors in cartesian coordinates.

 > <1,1,1> . <-1,-1,1>;
 ${-1}$ (1)
 > v1:= Vector([1,-1,2], coordinates=cartesian[x,y,z]);
 ${\mathrm{v1}}{≔}\left[\begin{array}{c}{1}\\ {-1}\\ {2}\end{array}\right]$ (2)
 > v2:= Vector([0,1,1], coordinates=cartesian[x,y,z]);
 ${\mathrm{v2}}{≔}\left[\begin{array}{c}{0}\\ {1}\\ {1}\end{array}\right]$ (3)
 > DotProduct(v1,v2);
 ${1}$ (4)

Take the dot product of two rooted vectors if they have the same coordinate system and root point.

 > vs:= VectorSpace([1,Pi/3, Pi/3], spherical[r,p,t]);
 ${\mathrm{vs}}{:=}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{local}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{_origin}}{,}{\mathrm{_coords}}{,}{\mathrm{_coords_dim}}{;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{export}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{GetCoordinates}}{,}{\mathrm{GetRootPoint}}{,}{\mathrm{Vector}}{,}{\mathrm{eval}}{;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (5)
 > v1:= RootedVector(root=vs, [1,1,1]);
 ${\mathrm{v1}}{≔}\left[\begin{array}{c}{1}\\ {1}\\ {1}\end{array}\right]$ (6)
 > v2:= RootedVector(root=vs, [-1,1,0]);
 ${\mathrm{v2}}{≔}\left[\begin{array}{c}{-1}\\ {1}\\ {0}\end{array}\right]$ (7)
 > DotProduct(v1,v2);
 ${0}$ (8)

The dot product of a cartesian free Vector and a rooted Vector is valid.

 > v1 := RootedVector(root=[1,Pi/4,1], [1,1,1], cylindrical[r,p,h]);
 ${\mathrm{v1}}{≔}\left[\begin{array}{c}{1}\\ {1}\\ {1}\end{array}\right]$ (9)
 > v2 := Vector([0,0,1], coordinates=cartesian[x,y,z]);
 ${\mathrm{v2}}{≔}\left[\begin{array}{c}{0}\\ {0}\\ {1}\end{array}\right]$ (10)
 > v2 . v1;
 ${1}$ (11)

The dot product of two vector fields is defined if they are in the same coordinate system.

 > vf1 := VectorField(, spherical[r,phi,theta]);
 ${\mathrm{vf1}}{≔}\left({r}\right){\stackrel{{_}}{{e}}}_{{r}}{+}\left({\mathrm{\phi }}\right){\stackrel{{_}}{{e}}}_{{\mathrm{φ}}}{+}\left({\mathrm{\theta }}\right){\stackrel{{_}}{{e}}}_{{\mathrm{θ}}}$ (12)
 > vf2 := VectorField(, spherical[r,phi,theta]);
 ${\mathrm{vf2}}{≔}\left({{r}}^{{2}}\right){\stackrel{{_}}{{e}}}_{{r}}{+}\left({\mathrm{\phi }}{+}{\mathrm{\theta }}\right){\stackrel{{_}}{{e}}}_{{\mathrm{φ}}}{+}\left({0}\right){\stackrel{{_}}{{e}}}_{{\mathrm{θ}}}$ (13)
 > DotProduct(vf1, vf2);
 ${{r}}^{{3}}{+}{\mathrm{\phi }}{}\left({\mathrm{\phi }}{+}{\mathrm{\theta }}\right)$ (14)

Use differential operators to compute the divergence of a vector field.

 > vf1 := VectorField(, cartesian[x,y,z]);
 ${\mathrm{vf1}}{≔}\left({x}\right){\stackrel{{_}}{{e}}}_{{x}}{+}\left({-}{y}{}{z}\right){\stackrel{{_}}{{e}}}_{{y}}{+}\left({z}\right){\stackrel{{_}}{{e}}}_{{z}}$ (15)
 > Del . vf1;
 ${2}{-}{z}$ (16)
 > vf2 := VectorField(, cylindrical[r,phi,t]);
 ${\mathrm{vf2}}{≔}\left({r}{}{t}\right){\stackrel{{_}}{{e}}}_{{r}}{+}\left({\mathrm{\phi }}\right){\stackrel{{_}}{{e}}}_{{\mathrm{φ}}}{+}\left({t}\right){\stackrel{{_}}{{e}}}_{{t}}$ (17)
 > Del . vf2;
 $\frac{{2}{}{r}{}{t}{+}{r}{+}{1}}{{r}}$ (18)

Construct a directional derivative operator.

 > V := VectorField(, cartesian[x,y,z]);
 ${V}{≔}\left({x}\right){\stackrel{{_}}{{e}}}_{{x}}{+}\left({-}{y}{}{z}\right){\stackrel{{_}}{{e}}}_{{y}}{+}\left({z}\right){\stackrel{{_}}{{e}}}_{{z}}$ (19)
 > W := VectorField(, cartesian[x,y,z]);
 ${W}{≔}\left({y}{}{z}\right){\stackrel{{_}}{{e}}}_{{x}}{+}\left({x}{}{z}\right){\stackrel{{_}}{{e}}}_{{y}}{+}\left({x}{}{y}\right){\stackrel{{_}}{{e}}}_{{z}}$ (20)
 > (V . Del)(W);
 $\left({-}{y}{}{{z}}^{{2}}{+}{y}{}{z}\right){\stackrel{{_}}{{e}}}_{{x}}{+}\left({2}{}{x}{}{z}\right){\stackrel{{_}}{{e}}}_{{y}}{+}\left({-}{y}{}{z}{}{x}{+}{x}{}{y}\right){\stackrel{{_}}{{e}}}_{{z}}$ (21)

The dot product of two position vectors is defined.

 > pv1:= PositionVector([p,p], polar[r,t]);
 ${\mathrm{pv1}}{≔}\left[\begin{array}{c}{p}{}{\mathrm{cos}}{}\left({p}\right)\\ {p}{}{\mathrm{sin}}{}\left({p}\right)\end{array}\right]$ (22)
 > pv2:= PositionVector([1,p], parabolic[u,v]);
 ${\mathrm{pv2}}{≔}\left[\begin{array}{c}\frac{{1}}{{2}}{-}\frac{{{p}}^{{2}}}{{2}}\\ {p}\end{array}\right]$ (23)
 > pv1 . pv2;
 ${p}{}{\mathrm{cos}}{}\left({p}\right){}\left(\frac{{1}}{{2}}{-}\frac{{{p}}^{{2}}}{{2}}\right){+}{{p}}^{{2}}{}{\mathrm{sin}}{}\left({p}\right)$ (24)

The dot product of a cartesian free Vector and a cartesian vector field is defined.

 > vf3 := VectorField(, cartesian[x,y,z]);
 ${\mathrm{vf3}}{≔}\left({y}{}{z}\right){\stackrel{{_}}{{e}}}_{{x}}{+}\left({x}{}{z}\right){\stackrel{{_}}{{e}}}_{{y}}{+}\left({x}{}{y}\right){\stackrel{{_}}{{e}}}_{{z}}$ (25)
 > v3  := Vector([1,2,1], coordinates=cartesian[x,y,z]);
 ${\mathrm{v3}}{≔}\left[\begin{array}{c}{1}\\ {2}\\ {1}\end{array}\right]$ (26)
 > vf3 . v3;
 ${x}{}{y}{+}{2}{}{x}{}{z}{+}{y}{}{z}$ (27)