Vectors and Linear Algebra

We set up vectors in a way which is slightly different from how we do it in Maple.


\begin{maximasession}
a: [1,2,3];
b: [2,-1,4];
\maximaoutput*
\i1. a: [1,2,3];...
...\\
\i2. b: [2,-1,4]; \\
\o2. \left[ 2 , -1 , 4 \right] \\
\end{maximasession}

We can do the standard addition and scalar multiplication of vectors.


\begin{maximasession}
3 * a;
a + b;
\maximaoutput*
\i3. 3 * a; \\
\o3. \left[ 3...
...right] \\
\i4. a + b; \\
\o4. \left[ 3 , 1 , 7 \right] \\
\end{maximasession}

The dot product operator is a simple period "." between the vectors.


\begin{maximasession}
a . b;
\maximaoutput*
\i5. a . b; \\
\o5. 12 \\
\end{maximasession}

We can check our answer to make sure it is right.


\begin{maximasession}
1 * 2 + 2 * (-1) + 3 * 4;
\maximaoutput*
\i6. 1 * 2 + 2 * (-1) + 3 * 4; \\
\o6. 12 \\
\end{maximasession}

To do cross products we must load a special package, the vect package, which is included with Maxima.


\begin{maximasession}
load(vect);
\maximaoutput*
\i7. load(vect); \\
\o7. \mbox{{}/usr/local/share/maxima/5.19.2/share/vector/vect.mac{}} \\
\end{maximasession}

The symbol for the cross product is the tilde "~" up on the left corner of the keyboard (you need to do Shift to get it).


\begin{maximasession}
a  b;
express(%);
\maximaoutput*
\i8. a  b; \\
\o8. \l...
...\\
\i9. express(%); \\
\o9. \left[ 11 , 2 , -5 \right] \\
\end{maximasession}

The cross product did not look like anything at the beginning; we had to express the cross product to get something recognizable.

The norm (length) of a vector is the square root of the dot product of the vector with itself.


\begin{maximasession}
sqrt(a . a);
\maximaoutput*
\i10. sqrt(a . a); \\
\o10. \sqrt{14} \\
\end{maximasession}

Putting what we have learned all together we may do vector projections and scalar triple products (we will need another vector c for the STP to make sense).


\begin{maximasession}
(a . b)/(a . a) * a;
c: [-5, 2, 9];
a . (b  c);
express(%...
..., -9 \right] \right) \\
\i14. express(%); \\
\o14. -96 \\
\end{maximasession}

Again, we needed to express the cross product to get anything useful.



G. Jay Kerns 2009-12-01