|\^/| Maple V Release 3 (SUNY at Albany) ._|\| |/|_. Copyright (c) 1981-1994 by Waterloo Maple Software and the \ MAPLE / University of Waterloo. All rights reserved. Maple and Maple V <____ ____> are registered trademarks of Waterloo Maple Software. | Type ? for help.
|We show here different ways for manipulating vectors with Maple. First you need to load the linear algebra package into your maple session. Most of the commands for computing with vectors are defined in the "linalg" package so it is a good idea to always start with:|
Notice that I ended the previous command with ":" instead of ";".
You may want to experiment and try both ways of ending commands.
Do you see the difference? |
Next we need to enter some vectors to maple. The command "vector" will do this. Here are several examples:
> v := vector([x,y,z]);
v := [ x, y, z ]
|The vector is entered as a list and you can access each of its components with v, v, v. So for example,|
2 x + z
which is the sum of the first entry of the vector "v"
plus the square of its third entry. |
If you want a symbolic vector of dimension three you do:
> u := vector(3);
u := array(1 .. 3, )
|If you want to see the entries try:|
[ u, u, u ]
|Notice that just typing "u;" doesn't work the way you expect. For example,|
> uPlusv := u + v;
uPlusv := u + v
|does not evaluate. To see the entries you need to use "evalm" which stands for EVALuate as a Matrix. So now|
[ u + x, u + y, u + z ]
|and you get the components of the sum of the two vectors "u" and "v". There is still one more way to use "vector". This is the function form of the "vector" command.|
> w := vector(7, i -> i^2-1);
w := [ 0, 3, 8, 15, 24, 35, 48 ]
Notice that here, the function is a function of only one variable.
The result contains the 'square minus one' of the first seven
positive integers. |
Multiplication by a scalar is simply done with
> evalm( a*v );
[ a x, a y, a z ]
|Innerproducts are computed with|
x u + y u + z u
|and the angle (in radians) between two vectors is given by|
> angle( [1,1] , [0,1] );
|Notice that it was not necessary to define [1,1] and [0,1] with the vector command. To "convert" to degrees just do:|
|or you can pack it all into one line like:|
> evalf( convert( angle( [-2,sqrt(2),1] , [2,-1,1] ) , degrees ) );
Homework Problem:Velocities have both direction and magnitude and so are vectors. The magnitude of a velocity vector is called speed. Suppose that a wind is blowing from the direction N45W at a speed of 50 km/h. (This means that the direction from which the wind blows is 45 degrees west of the northly direction.) A pilot is steering a plane in the direction N60E at an airspeed (speed in still air) of 250 km/h. The true course, or track, of the plane is the direction of the resultant of the velocity vectors of the plane and the wind. The ground speed of the plane is the magnitude of the resultant. Use maple to find the true course and the ground speed of the plane. Answer