In the vect1 package, there are a number of useful functions for
performing vector operations. Those functions are illustrated here.
First save the package file "vect1.mac" to a folder on your computer.
Use File --> Load Package... (or Ctrl+L) to find and load the package.
(%i1) load("C:/Documents and Settings/Compaq_Owner/My Documents/Maxima/vect1.mac")$
(1)
The norm() function computes the magnitude of a vector.
(%i2)
u: [1,-2,3];
(%i3)
norm( u );
(2)
The normalize() function normalizes a vector.
(%i4)
v: [4,1,-3];
(%i5)
normalize( v );
(%i6)
float(%);
(%i7)
norm(%);
(3)
The dot() function computes the dot product of two vectors.
(%i8)
dot( [1,2], [4,-3] );
(%i9)
u: [1/2,-3,4/3]; v: [-1,2/5,-6];
(%i11)
dot( u, v );
(4)
The cross() function computes the cross products of two 3D vectors.
(%i12)
u: [1,-2,1]; v: [3,-2,2];
(%i14)
cross( u, v );
(%i15)
cross( v, u );
(5)
The angle() function computes the angle between two vectors.
(%i16)
angle( [2,3], [1,0] );
(%i17)
float(%);
(%i18)
u: [4,2,1]; v: [0,4,-5];
(%i20)
angle( u, v );
(%i21)
float(%*180/%pi);
(6)
The allsimp() function attempts to simplify using a variety of techniques.
(%i22)
cos(1)^2+sin(1)^2;
(%i23)
allsimp(%);
(%i24)
1/sqrt(430);
(%i25)
allsimp(%);
(7)
The nabla() function computes the gradient vector.
(%i26)
nabla( 2*x^2+4*y^4, [x,y] );
(%i27)
nabla( x^3*y^2*z + sin(x*y*z), [x,y,z] );