Dot and Cross productA fast Maple noteWorksheet by Mike May, S.J.- maymk@slu.eduEdited by Russell Blyth - blythrd@slu.eduWe have been studying dot products and cross products. It seems worthwhile to point out the syntax for computing them in Maple. (You can then use Maple as another way to check your work.)First we define some vectors:restart;a := <1, 2, 3>; b := <4, 5, 6>;
v := <v1, v2, v3>; w := <w1, w2, w3>;You can also create vectors with the Vector command, giving the size and a list of components.c := Vector(3,[4,5,6]);Once the vectors have been created, we can use standard syntax for arithmetic operations."a+b, the sum of vectors" = a+b;
"2v, a scalar multiple" = 2*v;
"a+2*b+3*v+4*w, a linear combination" = a+2*b+3*v+4*w;The commands for dot product and cross product are included in 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;Another way to use these commands is to use the "with(LinearAlgebra):" command to load the LinearAlgebra package and 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;