VectorCalculus - Maple Programming Help

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

VectorCalculus

 CrossProduct
 computes the cross product of Vectors and differential operators

 Calling Sequence CrossProduct(v1,v2) v1 &x v2

Parameters

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

Description

 • The CrossProduct(v1, v2) function (vector product) computes the cross product of v1 and v2, where v1 and v2 can be either three dimensional free Vectors, rooted Vectors, position Vectors, vector fields, Del or Nabla.
 • The function  and can be accessed through  &x or CrossProduct exports.
 • The behavior of cross product is contained in the following table

 $\mathrm{v1}$ coord ($\mathrm{v1}$) $\mathrm{v2}$ coord ($\mathrm{v2}$) $\mathrm{v1}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}&x\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathrm{v2}$ coord ($\mathrm{v1}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}&x\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathrm{v2}$) 1 free Vector cartesian free Vector cartesian free Vector cartesian free Vector curved free Vector any error 2 free Vector cartesian rooted Vector (root2) coord2 rooted Vector (root2) coord2 3 free Vector any vector field any error 4 free Vector cartesian position Vector cartesian free Vector cartesian free Vector curved position Vector cartesian error 5 rooted Vector (root1) coord1 rooted Vector (root1) coord1 rooted Vector coord1 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}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}&x\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathrm{v2}\left(\mathrm{root1}\right)$ coord2 7 rooted Vector (root1) cartesian position Vector cartesian rooted Vector (root1) cartesian 8 vector field coord1 vector field coord1 vector field coord1 vector field coord1 vector field coord2 error 9 vector field coord1 position Vector cartesian error 10 position Vector cartesian position Vector cartesian position Vector cartesian

Examples

 > restart;
 > with(VectorCalculus):

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

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

Take the cross 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}}$ (6)
 > v1:= RootedVector(root=vs, [1,1,1]);
 ${\mathrm{v1}}{≔}\left[\begin{array}{c}{1}\\ {1}\\ {1}\end{array}\right]$ (7)
 > v2:= RootedVector(root=vs, [1,0,1]);
 ${\mathrm{v2}}{≔}\left[\begin{array}{c}{1}\\ {0}\\ {1}\end{array}\right]$ (8)
 > v1 &x v2;
 $\left[\begin{array}{c}{1}\\ {0}\\ {-1}\end{array}\right]$ (9)
 > GetRootPoint(v1 &x v2);
 $\left({1}\right){{e}}_{{r}}{+}\left(\frac{{\mathrm{\pi }}}{{3}}\right){{e}}_{{p}}{+}\left(\frac{{\mathrm{\pi }}}{{3}}\right){{e}}_{{t}}$ (10)

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

 > 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]$ (11)
 > v2:= Vector([0,0,1], coordinates=cartesian[x,y,z]);
 ${\mathrm{v2}}{≔}\left[\begin{array}{c}{0}\\ {0}\\ {1}\end{array}\right]$ (12)
 > v2 &x v1;
 $\left[\begin{array}{c}{-1}\\ {1}\\ {0}\end{array}\right]$ (13)
 > GetRootPoint(v2 &x v1);
 $\left({1}\right){{e}}_{{r}}{+}\left(\frac{{\mathrm{\pi }}}{{4}}\right){{e}}_{{p}}{+}\left({1}\right){{e}}_{{h}}$ (14)
 > GetCoordinates(v2 &x v1);
 ${{\mathrm{cylindrical}}}_{{r}{,}{p}{,}{h}}$ (15)

The cross 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{θ}}}$ (16)
 > vf2:= VectorField(, spherical[r,phi,theta]);
 ${\mathrm{vf2}}{≔}\left({{r}}^{{2}}\right){\stackrel{{_}}{{e}}}_{{r}}{+}\left({\mathrm{\phi }}\right){\stackrel{{_}}{{e}}}_{{\mathrm{φ}}}{+}\left({\mathrm{\phi }}\right){\stackrel{{_}}{{e}}}_{{\mathrm{θ}}}$ (17)
 > CrossProduct(vf1, vf2);
 $\left({{\mathrm{\phi }}}^{{2}}{-}{\mathrm{\phi }}{}{\mathrm{\theta }}\right){\stackrel{{_}}{{e}}}_{{r}}{+}\left({{r}}^{{2}}{}{\mathrm{\theta }}{-}{\mathrm{\phi }}{}{r}\right){\stackrel{{_}}{{e}}}_{{\mathrm{φ}}}{+}\left({-}{\mathrm{\phi }}{}{{r}}^{{2}}{+}{\mathrm{\phi }}{}{r}\right){\stackrel{{_}}{{e}}}_{{\mathrm{θ}}}$ (18)

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

 > F:= VectorField(<1,-x,y>, cartesian[x,y,z]);
 ${F}{≔}\left({1}\right){\stackrel{{_}}{{e}}}_{{x}}{+}\left({-}{x}\right){\stackrel{{_}}{{e}}}_{{y}}{+}\left({y}\right){\stackrel{{_}}{{e}}}_{{z}}$ (19)
 > Del &x F;
 $\left({1}\right){\stackrel{{_}}{{e}}}_{{x}}{+}\left({0}\right){\stackrel{{_}}{{e}}}_{{y}}{+}\left({-1}\right){\stackrel{{_}}{{e}}}_{{z}}$ (20)
 > G:= VectorField( ,spherical[r,p,t]);
 ${G}{≔}\left({r}\right){\stackrel{{_}}{{e}}}_{{r}}{+}\left({t}\right){\stackrel{{_}}{{e}}}_{{p}}{+}\left({p}\right){\stackrel{{_}}{{e}}}_{{t}}$ (21)
 > Del &x G;
 $\left(\frac{{r}{}{\mathrm{cos}}{}\left({p}\right){}{p}{+}{r}{}{\mathrm{sin}}{}\left({p}\right){-}{r}}{{{r}}^{{2}}{}{\mathrm{sin}}{}\left({p}\right)}\right){\stackrel{{_}}{{e}}}_{{r}}{+}\left({-}\frac{{p}}{{r}}\right){\stackrel{{_}}{{e}}}_{{p}}{+}\left(\frac{{t}}{{r}}\right){\stackrel{{_}}{{e}}}_{{t}}$ (22)

The cross product of two position Vectors is defined. The result is a position Vector.

 > pv1:= PositionVector([1,p,q],spherical[r,phi,theta]);
 ${\mathrm{pv1}}{≔}\left[\begin{array}{c}{\mathrm{sin}}{}\left({p}\right){}{\mathrm{cos}}{}\left({q}\right)\\ {\mathrm{sin}}{}\left({p}\right){}{\mathrm{sin}}{}\left({q}\right)\\ {\mathrm{cos}}{}\left({p}\right)\end{array}\right]$ (23)
 > pv2:= PositionVector([1,p,p], cylindrical[r,phi,h]);
 ${\mathrm{pv2}}{≔}\left[\begin{array}{c}{\mathrm{cos}}{}\left({p}\right)\\ {\mathrm{sin}}{}\left({p}\right)\\ {p}\end{array}\right]$ (24)
 > CrossProduct(pv1,pv2);
 $\left[\begin{array}{c}{\mathrm{sin}}{}\left({p}\right){}{\mathrm{sin}}{}\left({q}\right){}{p}{-}{\mathrm{cos}}{}\left({p}\right){}{\mathrm{sin}}{}\left({p}\right)\\ {-}{\mathrm{sin}}{}\left({p}\right){}{\mathrm{cos}}{}\left({q}\right){}{p}{+}{{\mathrm{cos}}{}\left({p}\right)}^{{2}}\\ {{\mathrm{sin}}{}\left({p}\right)}^{{2}}{}{\mathrm{cos}}{}\left({q}\right){-}{\mathrm{sin}}{}\left({p}\right){}{\mathrm{sin}}{}\left({q}\right){}{\mathrm{cos}}{}\left({p}\right)\end{array}\right]$ (25)
 $\left[\begin{array}{cc}{\mathrm{Type:}}& {\mathrm{Position Vector}}\\ {\mathrm{Components:}}& \left[{\mathrm{sin}}{}\left({p}\right){}{\mathrm{sin}}{}\left({q}\right){}{p}{-}{\mathrm{cos}}{}\left({p}\right){}{\mathrm{sin}}{}\left({p}\right){,}{-}{\mathrm{sin}}{}\left({p}\right){}{\mathrm{cos}}{}\left({q}\right){}{p}{+}{{\mathrm{cos}}{}\left({p}\right)}^{{2}}{,}{{\mathrm{sin}}{}\left({p}\right)}^{{2}}{}{\mathrm{cos}}{}\left({q}\right){-}{\mathrm{sin}}{}\left({p}\right){}{\mathrm{sin}}{}\left({q}\right){}{\mathrm{cos}}{}\left({p}\right)\right]\\ {\mathrm{Coordinates:}}& {\mathrm{cartesian}}\\ {\mathrm{Root Point:}}& \left[{0}{,}{0}{,}{0}\right]\end{array}\right]$ (26)