Dot and Cross product A fast Maple note Worksheet by \302\251 Mike May, S.J. 2006- maymk@slu.edu We have been looking at dot products and cross products in class. It seems worthwhile to point out the syntax for doing them with Maple. (You can then use Maple as another way to check your work.) First we define a bunch of Vectors: restart; a := <1, 2, 3>; b := <4, 5, 6>; v := <v1, v2, v3>; w := <w1, w2, w3>;
<Text-field style="Heading 1" layout="Heading 1">LinearAlgera Commands</Text-field> The commands for dot product and cross product are part of the LinearAlgebra package. The syntax is: LinearAlgebra[DotProduct](vector1, vector2); LinearAlgebra[CrossProduct](vector1, vector2); LinearAlgebra[DotProduct](a, b); LinearAlgebra[CrossProduct](a, b); LinearAlgebra[DotProduct](v, w); LinearAlgebra[CrossProduct](v,w); An alternative syntax for the dot product is to put a dot (or period) between the two vectors. a.b; v.w; An alternative syntax is to use the "with(LinearAlgebra):" command to load the LinearAlgebra package, then use the short form of the command. This way the package only needs to be loaded once in a Maple session. with(LinearAlgebra): DotProduct(a, b); CrossProduct(a, b); DotProduct(v, w); CrossProduct(v, w);; Once the LinearAlgebra package has been loaded the cross product can also be called for with the &x operator. a &x b; v &x w;
<Text-field style="Heading 1" layout="Heading 1">Other packages with dot and cross product</Text-field> The dot and cross product are in a couple of other packages we may use. In particular they are in both the VectorCalculus and the Student[VectorCalculus] packages. As with LinearAlgebra, these commands cam be loaded with the package or called with the long format. VectorCalculus[DotProduct](a,b); VectorCalculus[DotProduct](v,w); VectorCalculus[CrossProduct](a,b); VectorCalculus[CrossProduct](v,w); Student[VectorCalculus][DotProduct](a,b); Student[VectorCalculus][DotProduct](v,w); Student[VectorCalculus][CrossProduct](a,b); Student[VectorCalculus][CrossProduct](v,w); The Student[LinearAlgebra] package also has a vommand to visualize the cross product of two vectors. Student[LinearAlgebra][CrossProductPlot](a,b);