Defining Vectors and Basic Operations 

 

In Maple, there are several ways to refer to define a vector. We will mainly use one of them, but I'll mention the others here. 

 

When using Maple, not all of the commands are loaded when the program is opened. Sometimes you have to load a package which contains additional commands. This allows the software to use memory more efficiently. Currently, Maple is transitioning some of these packages to improved forms. For this reason, in the current version, older and newer versions of some commands exist. Originally, the 'vector' command was part of the 'linearalgebra' package. This has been replaced by the 'Vector' command which is part of the 'LinearAlgebra' and also the 'VectorCalculus' package. Note the capital letters in the latter names. This is how the programmers have distinguished the old commands from the new commands. We will only use the new commands, but if you look at older code or an older book, you will see the old commands. Beware! They do not behave exactly alike. 

 

Some of the commands in the 'LinearAlgebra' and 'VectorCalculus' packages have the same name, but are slightly different. I will try to point this out as we go. However, your best source for the exact syntax and interpretation of any command is the Maple Help file. This is accessed from the command line by typing a question mark and then the command, or by clicking on 'Maple Help' in the Help menu. Obviously, the first method only works if you know the command, whereas in the second method there are several search options available to you. 

 

We will use the 'VectorCalculus' package first. We load the package by using the 'with' command. 

 

> restart: with(VectorCalculus);
 

 

Then we can use the 'Vector' command to define a vector. We'll also use the assignment operator (:=) to assign the vector to a name. 

> r:=Vector([1,-3,4]);
 

The ex, ey, and ez are the standard unit vectors that we call i, j, and k. Let's define a few more vectors and see how the vector operations are carried out in Maple. 

 

This time, we'll use a shorter command to define a vector. 

> s:=<-2,1,7>;t:=<a,b,c>;
 

You can define vectors using either method. The result is the same. 

 

Note that we can define vectors with unknown components as we have done above for t. We can assign values to these as we go or tell Maple to hold them constant. 

 

 

Now, look back at the output produced by Maple after we entered the 'with(VectorCalculus)' command. Maple tells us all the commands that have been loaded by the package. Note that at the beginning are some simple symbolic commands. Among these are basic vector addition, subtraction, and scalar multiplication. Let's try them out. 

 

Vector addition 

> r+s; r+t;
 

Vector subtraction 

> r-s;
 

Scalar multiplication of a vector 

> 2*r; 5*t; -2*s;
 

The previous operations can be combined together 

> 2*r-8*s;
 

Of course, we can use the assignment operator to assign the result to a new name. 

> u:=2*r-8*s;
 

 

Now that we can define a vector and perform the most basic of operations, let's move on to other, more complex operations.