% Hill0.tex

\pagenumbering{roman}
\maketitle

\par\noindent
This August 1994 document accompanies the second edition of Hill's text
`Elementary Linear Algebra with Applications' \cite{Hi}.
\smallskip

Approval has been given (on 18 July 1994) by Harcourt Brace College
Publishers (HB), who publish the above text, for the posting of this
document to the Maple Share Library.  Because the document deliberately
works the same examples as the text and often quotes theorems in the
form given in the text, the author will be making every effort to improve
the document along lines approved by HB and Richard Hill.  The copyright
of items quoted from the text is with HB.

%\noindent Associate authors who have been involved with discussion,
%planning, or classroom testing of this document are listed in the footnote.
%\footnote{Associate Authors/Checkers: }
\smallskip
Neither the author, nor the University of New South Wales,
accept any legal liability for any use beyond that university.

\subsection*{Copyright Notice.}

The copyright for this document belongs to its author.
Subject to conditions given immediately below,
permission is granted to any lecturer with a class for which
\cite{Hi} is the prescribed text to
\smallskip

(i) copy this document and updates from the Maple Share Library,\par
(ii) print, and then copy, paper versions and to distribute these to the class.

\begin{enumerate}
\item This Notice shall be retained and the document shall not be 
  modified in any way without the written permission of the author: 
  additions and modifications to any Worksheet supplement will be provided
  to the author, with permission for him to be redistributed, via the
  Maple Share Library, with the same conditions as in this copyright.
\item No charge shall be made for copies, except to cover the cost
  of the medium on which it is distributed.
  This document shall not be reproduced for commercial purposes.
\item Copies of the printed document may only be provided to persons
  owning a copy of the linear algebra text \cite{Hi} as in the references
  on page~\pageref{References}.
\item All copies of this document that are distributed in printed form shall
  be bound in such a way that the first page shall include the title of the
  document, the name and affiliation of the author, and this Copyright Notice.
\item These conditions shall apply to all persons 
  or institutions receiving copies of this document.
\end{enumerate}

\goodbreak
\subsection*{Note to Instructors.}

As mentioned on the next page, this document is neither an introduction
to Maple nor a linear algebra text, but rather notes to assist students
to use Maple in conjunction with Hill's text.

\noindent These ``Maple and linear algebra" linalg notes presuppose\par
1)\ \ a knowledge of Maple at the level of \cite{EJLS} or of Chapter 0
  of \cite{Jo}.\par
  \quad ({\it First Leaves} \cite{CG92} or Heck's book \cite{He} is
  more than enough);\par
2)\ \ some introduction to linear algebra similar to parts of Chapters 1 and 3 
  of Hill.

\noindent They assume no exposure to Maple's {\tt linalg} package.

\smallskip
Chapter and Section numbers of Hill are those of the 1991
(International) Edition.

The material on determinants (Chapter 2), on orthogonality (Chapter 4),
on eigenvalues (Chapter 5) and the later material can be taught 
with the Maple given at the same time.

\smallskip
There are books which deal with the use of Computer Algebra
(CA) in linear algebra. Their typography and exposition
are better than in a handout such as this. It is strongly recommended
that such books (at least those based on the CA package at the teaching
institution) should be available to students either as prescribed texts
or as reference books in the library. A good example of this is Johnson's
{\em Linear Algebra with Maple V} \cite{Jo}.

\smallskip
I believe that, in the hands of a good instructor, CA can be very
effective in any mathematics course. Not only can the graphics
capabilities of a CA package be used to illustrate ideas graphically,
but its symbolic manipulation and capacity as a `calculator' can relieve
students of the tedium (and errors!) in lengthy calculations and free
them to concentrate on the concepts themselves.
For this reason, I believe that students should also have an exposure to
CA in other areas of Mathematics (such as Calculus).

\smallskip
I would only be too happy to share with those who are interested any
information I have on literature relating to the different CA packages and
their use in Computer Aided Instruction.

\subsection*{Acknowledgements}

Even a cursory glance at this document will reveal its similarity with a
Maple accompaniment, by Grant Keady of the University of Western Australia,
to the text~\cite{AR}. This is no accident. From the beginning, I was
impressed with Grant's aim to provide a series of
Maple supplements for linear algebra texts and was delighted, at Grant's
urging, to adapt his notes to Hill's text (which is the one in use at UNSW).
Since 1991, when Grant first gave me access to his text, he has provided me
with a great deal of encouragement and assistance both in constructive
criticism of this document and in the administrative details involved in
its placement in the Maple share library. It is no exaggeration to say that
without Grant this document would not exist as it does now.

I would like to thank other members of the mathematics staff at UNSW, and
my second year linear algebra class, for their contributions and comments.
In particular, I wish to thank John Steele for improvements to the
$QR$-factorisation and Householder codes in chapter 4, and the (anonymous)
student who suggested the index of Maple commands.

I would also like to thank Richard Hill for his support and encouragement,
and the staff from Saunders College Publishing for their permission
to make this document available in this way.

Last, but not least, thanks are due to Waterloo Maple Software
Incorporated for providing the program which has led to this effort,
for the Share Library which is such an appropriate method
for distribution of materials (like this) which need frequent updating
as the software and texts move through different versions and editions,
and for their encouragement to those using CA in their teaching.
In particular, I would like to thank Keith Geddes and Dave Hare of the
development team who have given me so much helpful advice during their
respective stays in Australia.

\eject

\section*{Introduction}

\smallskip
\headq{Note} These notes refer to the three releases of Maple~V~(1990,92,94).
Although they primarily refer to Release 3 (1994),
comments have been made on where the other releases differ and, if
necessary, alternate code is provided (see, for example, the
definition of `Linear' on page~\pageref{Linear}).

\bigskip
\noindent This document is {\bf not an introduction to Maple}.
If you want such an introduction, you should see one of
\begin{itemize}
\item {\it Maple V Flight Manual} by W.~Ellis et al. \cite{EJLS}.
\item {\it First Leaves: a Tutorial Introduction to Maple V} by B.~Char
  et al. \cite{CG92}.
\item {\it Introduction to Maple} by A. Heck \cite{He}.
\end{itemize}
or, for more advanced reading and reference,
\begin{itemize}
\item M. Monagan {\it Programmming in Maple: the basics}, Maple Share
Library, 1993 (public domain).
\item {\it The Maple Handbook} by D. Redfern \cite{Re}.
\end{itemize}
and the Maple V Language and Library Reference Manuals by B.~Char et al.
\cite{CG91a,CG91b}.

\noindent A good introduction to Maple's {\tt linalg} package is
Johnson's {\em Linear Algebra with Maple V} \cite{Jo}.

\subsection*{Goals of Maple in learning (particularly in this document)}
In your course using Hill's text \cite{Hi} you are being asked to learn
Mathematics (here Linear Algebra) as the main priority.  The use of Maple
is definitely not incompatible with this, but it is the second priority.

A moderate amount of hand calculation is useful (e.g. in understanding
the ideas for theorems), provided that the calculation is correct.
Confusion can be created if your hand calculation is wrong.  One valid
use of Maple is to CHECK your calculations: if the answers from the two
methods differ, sort out why immediately.  You are encouraged to work with
other students, particularly when you are getting started with Maple.

\smallskip
\noindent There are two ways in which Maple can be used. Both are used
in these notes (and there are continual graduations between them).  It is
assumed for now that you are reasonably proficient at the first: later in
the course, proficiency in the second will be desirable, but not essential.

\begin{enumerate}
\item Maple can be used `as a calculator': i.e.~in one or two lines of
  simple code, Maple can be asked to solve some task in mathematics,
  e.g. invert a matrix.  This use of Maple is often given in this document
  in lines such as
  \begin{verbatim}
  > vec:=array([x,y]);
  \end{verbatim}
  (The {\tt >} is the computer's prompt -- it is not something you type.  It
  may well happen that your computer uses a different prompt such as $\bullet$).

\item Maple can be used `as a specialised programming language
  for mathematics applications'.  Knowledge of this use of Maple is
  something which you can (and are encouraged to) gradually acquire.
  In this document (and also in the accompanying files), there are blocks
  of Maple code.  You might find these  useful if you like to `learn by
  example'.  However, to learn to `program in Maple' the other documents
  referred to above are essential,
  as this document merely presents some examples related to linear algebra.
\end{enumerate}

\bigskip
\subsection*{Exact and float computations}
Most scientific and engineering problems come from approximate modelling and
float-approximations to their answers, often with graphical representations
of them where appropriate. Linear problems often occur, either in their own
right or as subproblems (arising, for example, in local linearisations
such as Newton iteration for nonlinear systems).
There are several styles of float-numeric computation.
User-written C or Fortran programs using standard libraries such as
NAG (for general applications) or LAPACK (for numerical linear algebra)
is one style, suitable for larger scale, or less-standardised problems.
Matlab is a good package for interactive numerical linear algebra work. 

Numerical analysis, i.e. the serious study of float-computations, 
is a difficult area.  Numerical linear algebra, which is introduced in
Section 1.7, is treated more fully in Sections 5.8, 6.2, 6.3 and 6.4 of
Hill's text, and much of the earlier work in Hill prepares for this.
While float-numeric computation is scientifically often much more important
than exact solution of linear systems, pedagogically
the exact solution of easier, small-scale problems remains extremely important.

It is also worth mentioning that recent developments aim at the best of both
float-numeric computations and Computer Algebra (CA).
Links between CA systems and NAG library are available.
There is also the MAGNum Toolbox for Matlab which makes the NAG library
easily callable from Matlab: there is a Maple Toolbox for Matlab.
MathCAD is a product with Maple as its `algebra engine',
and some very good Fortran and/or C libraries
underlying its advanced numeric capabilities.
\goodbreak

\subsection*{Introduction to Maple's linalg Package}

The Maple linear algebra package, {\tt linalg}, contains a number of functions
that are useful in the study of matrices and linear transformations,
in the solution of systems of linear equations, and in similar problems. 
See {\it First Leaves}, \S3.14.

\smallskip
\noindent The simplest way to access functions in the {\tt linalg} package is
to use
\begin{verbatim}
> with(linalg):
Warning: new definition for   norm
Warning: new definition for   trace
\end{verbatim}
before using all of the functions you want.

\smallskip
\headq{Notes} (1)\quad Although the above two lines always appear after the
command\quad {\tt with(linalg):}\quad they will be omitted in this document
(together with any timing messages by Maple).
(2)\quad If instead you use the command\quad {\tt with(linalg);}\quad
the functions that are loaded into the Maple environment are
displayed on the screen. If you want only a few of these functions,
you need  only load those you need. This is illustrated below where use
is made of the {\tt vector}\index{vector} function in the {\tt linalg} package.

\medskip
\noindent A vector, being an array of numbers, may be entered using the
{\tt array}\index{array} function.
\begin{verbatim}
> vec:= array( [x,y] );
                                vec := [ x, y ]
\end{verbatim} 

\noindent Alternatively, use can be made of the {\tt vector} function in the
{\tt linalg} package.
\begin{verbatim}
> with(linalg,vector):                           vvec:= vector( [x,y] );
                                vvec := [ x, y ]
\end{verbatim} 

\goodbreak
\noindent Similarly, a matrix may be entered as an array of lists.
\begin{verbatim}
> A:= array( 1..2,1..2,[ [a11,a12], [a21,a22] ]);
                                    [ a11  a12 ]
                               A := [          ]
                                    [ a21  a22 ]
\end{verbatim} 

\goodbreak
\headq{Warning} In Maple, a matrix is not an array of arrays. For example
(assuming {\tt vec} is as above)
\begin{verbatim}
> mat:=array([eval(vec),eval(vec)]):            # NOT a matrix
\end{verbatim}
creates a structure where one addresses individual entries through, 
for example, {\tt mat[1][2]}. With {\tt eval} replaced by {\tt convert/list}
we {\em would} get a matrix (see help on {\tt convert} for the syntax). 

\medskip
The commands for the rest of this section will be treated as a continuous Maple
session. In particular, the next command indicates that most of the functions
are in the {\tt linalg} package.

\smallskip
\noindent A matrix may also be entered using the {\tt matrix}\index{matrix}
function (in the {\tt linalg} package).
\begin{verbatim}
> with(linalg):
> A:= matrix( 2,2,[ [a11,a12], [a21,a22] ]);
                                    [ a11  a12 ]
                               A := [          ]
                                    [ a21  a22 ]
\end{verbatim} 
The first two arguments of this function (or the earlier {\tt array} function)
indicate the row and column dimensions of the array. The third argument is
the set of matrix entries (and we will see below that they are optional). 
The bracketed sets of expressions represent the rows of the matrix. 
To complete the definition of the matrix 
the bracketed row entries are nested inside brackets.

\goodbreak
\noindent Shorter, but still valid Maple, are the following:
\begin{verbatim}
> A:= matrix([ [a11,a12], [a21,a22] ]):
> A:= matrix( 2,2,[a11,a12, a21,a22] ):
\end{verbatim}

\noindent Trying to display the matrix $A$ as you would a scalar
merely results in the letter {\tt A} being shown.
\begin{verbatim}
> A;
                                       A
\end{verbatim}
The array data structure is not displayed, only its name.
The matrix entries can, however, be displayed by using one of the following.
\begin{verbatim}
       print(A);                 op(A);                evalm(A);
\end{verbatim}

\goodbreak
\noindent Maple can interchange the rows of a matrix.\index{swaprow}
\begin{verbatim}
> B:= swaprow( A,1,2 );
                                    [ a21  a22 ]
                               B := [          ]
                                    [ a11  a12 ]
\end{verbatim}
We will consider other row operations in connection with 
Hill Chapter 1, \S1.2. \newline
Similarly, the {\tt swapcol}\index{swapcol} function is used to interchange
two columns.

\medbreak
Arithmetic with matrices can be performed using the {\tt evalm}\index{evalm}
function, which allows users to `overload' the usual + and * symbols in ways
which might appeal to people familiar with Mathematica or Axiom.
(Operator overloading of this kind is used in the languages C++ and FORTRAN90.)

\smallskip \goodbreak \smallskip
\noindent Thus Maple can add two matrices.
\begin{verbatim}
> evalm( A+A ):
\end{verbatim}
Here the matrix $A$ is added to itself.
This matrix can be saved (as the matrix $C$) for later use.
\begin{verbatim}
> C := ";
                                  [ 2 a11  2 a12 ]
                             C := [              ]
                                  [ 2 a21  2 a22 ]
\end{verbatim}

\goodbreak
\noindent A matrix can be multiplied by a scalar.
\begin{verbatim}
> A2:= evalm( 2*A );              #  Note that D  is a reserved word in Maple
                                  [ 2 a11  2 a12 ]
                            A2 := [              ]
                                  [ 2 a21  2 a22 ]
\end{verbatim}
Notice that the last two matrices are the same.
This can also be seen using the {\tt equal}\index{equal} function.
\begin{verbatim}
> equal( C,A2 );
                                      true
\end{verbatim}
This tells you whether the statement ``$C=A2$'' (where $C$ and $A2$ are
matrices) is true or false.

\smallskip \goodbreak \smallskip
\noindent Addition and scalar multiplication can be combined to form linear
combinations.
\begin{verbatim}
> evalm( ca*A+cb*B );
                      [ ca a11 + cb a21  ca a12 + cb a22 ]
                      [                                  ]
                      [ ca a21 + cb a11  ca a22 + cb a12 ]
\end{verbatim}
The entries of $A$ are multiplied by $ca$ and
added to $cb$ times the entries of $B$.

\smallskip \goodbreak \smallskip
\noindent Matrices can be multiplied.
\begin{verbatim}
> evalm( A &* A );
                    [      2                               ]
                    [   a11  + a12 a21   a11 a12 + a12 a22 ]
                    [                                      ]
                    [                                   2  ]
                    [ a21 a11 + a22 a21    a12 a21 + a22   ]
\end{verbatim}
The {\tt \&}\index{\&\*} sign is used to inform Maple that the multiplication is
not commutative (i.e. it may not be true that $AB=BA$). There is a little-used
commutative multiplication of matrices which Maple will perform if the {\tt \&}
is omitted.

\smallskip \goodbreak \smallskip
\noindent Maple can find powers  of matrices
\begin{verbatim}
> equal( evalm(A^2), " );
                                      true
\end{verbatim}
and the inverses of matrices.
\begin{verbatim}
> inverse(A);
                  [         a22                   a12        ]
                  [  -----------------   - ----------------- ]
                  [  a11 a22 - a12 a21     a11 a22 - a12 a21 ]
                  [                                          ]
                  [          a21                 a11         ]
                  [ - -----------------   -----------------  ]
                  [   a11 a22 - a12 a21   a11 a22 - a12 a21  ]
\end{verbatim}
Maple has, cavalierly, assumed $A$ is invertible. 
You can CHECK the inverse computation.
\begin{verbatim}
> evalm( A &* " );
                                    [ 1  0 ]
                                    [      ]
                                    [ 0  1 ]
\end{verbatim}
As you would expect, a $2\times 2$ identity matrix is displayed. 
This is one way to create an identity matrix. Other ways are shown below
(where the {\tt equal} function is used to show they are the same).
\begin{verbatim}
> Id:= diag(1,1);  # The symbol I cannot be used as it is reserved for sqrt(-1)
                                       [ 1  0 ]
                                 Id := [      ]
                                       [ 0  1 ]

# This can be generalised for any  n by n  matrix (Here n is 2):
> n:=2:              diag( 1$n ):        # 1$n is the sequence 1 .. 1 (n times)
> equal( ",Id);
                                      true
\end{verbatim}
\goodbreak
\begin{verbatim}
> array(1..n,1..n,identity):        # This can be done outside linalg
> equal( ",Id);
                                      true

> band( [1],n ):                            equal( ",Id);
                                      true
\end{verbatim}

\goodbreak
\noindent Here is another attempt to compute the inverse of a matrix.
\begin{verbatim}
> E:= evalm( 2*A );                  #  D  is a reserved word in Maple
> C:= evalm( A+B );
> C:= evalm( A+B );
                              [ a11 + a21  a12 + a22 ]
                         C := [                      ]
                              [ a11 + a21  a12 + a22 ]

> inverse(C);
Error, (in inverse) singular matrix
# This error is because the two rows of  C  are the same.
\end{verbatim}

\goodbreak
\noindent Maple can transpose matrices.
\begin{verbatim}
> Atr:= transpose(A);
                                     [ a11  a21 ]
                              Atr := [          ]
                                     [ a12  a22 ]
\end{verbatim}
(The rows of $A$ have become the columns of the transposed matrix.)

\medbreak
There are a number of commands for setting up particular special matrices.
The function {\tt band(b,n)}\index{band} is a useful command for creating
``band" matrices of size $n\times n$, where $n$ is already known to Maple
and {\tt b} is a list of no more than $n$ elements.  For example, 

\goodbreak
\begin{verbatim}
> n:=3:                                             A.n:= band([-1,2,-1],n);
                                   [  2  -1   0 ]
                                   [            ]
                             A3 := [ -1   2  -1 ]
                                   [            ]
                                   [  0  -1   2 ]
\end{verbatim}
We remark that the notation is not standardised.
Hill, and many other linear algebra books, use the word `band' to refer to
matrices which are banded like the above, but where the nonzero entries on
and near the diagonal are not necessarily the same along lines parallel to
the diagonal.  We suggest `banded' for this more general sort of matrix. 

\goodbreak
The band matrix function creates one sort of matrix striped parallel to the
main diagonal.  The {\tt toeplitz}\index{toeplitz} function creates a matrix
which is striped parallel to the main diagonal but which is also symmetric.
Thus the matrix {\tt A3} created with {\tt band} above could also be created
with
\begin{verbatim}
> toeplitz([2,-1,0]):                            equal( ",A3);
                                      true
\end{verbatim}

\goodbreak
The Hilbert matrix is the matrix whose $(i,j)$-th entry is $1/(i+j-1)$.  When
$n$ is known to Maple (for example $n=3$), one can get a Hilbert matrix
{\tt H3}\index{hilbert} by
\begin{verbatim}
> H.n:=hilbert(n);
                                  [  1   1/2  1/3 ]
                                  [               ]
                            H3 := [ 1/2  1/3  1/4 ]
                                  [               ]
                                  [ 1/3  1/4  1/5 ]
\end{verbatim}

\goodbreak
\noindent Given a list of variables or numbers (e.g. {\tt [11,12,13]}),
a Vandermonde matrix is created as follows
\begin{verbatim}
> vandermonde([11,12,13]);
                                 [ 1  11  121 ]
                                 [            ]
                                 [ 1  12  144 ]
                                 [            ]
                                 [ 1  13  169 ]
\end{verbatim}
Both Hilbert and Vandermonde matrices have uses in numerical methods.

\medskip\noindent
The {\tt matrix} function allows a matrix to be defined in terms of any
function you wish.
\begin{verbatim}
# One can set up general matrices in the form given above:
> with(linalg):
> f:= proc(i,j)            a.i.j            end:
> A:= matrix(2,3,f); 
                                  [ a11  a12  a13 ]
                             A := [               ]
                                  [ a21  a22  a23 ]
\end{verbatim}
\headq{EXERCISE} Show how to use this facility to find an alternative way of
creating a Hilbert matrix.

\medbreak
New vectors and matrices can also be formed from old ones.
The {\tt col}\index{col} (or {\tt row}\index{row}) command extracts a column
(or row) from a matrix $A$.  For example (using the above general matrix)
\begin{verbatim}
> col(A,1);
                                  [ a11, a21 ]
\end{verbatim}

\noindent Given lists or ranges {\tt r} of rows and {\tt c} of columns,
a submatrix of $A$ consisting of those rows and columns of $A$ can be extracted.
For example, the submatrix consisting of the first and third columns of $A$ is
\begin{verbatim}
> submatrix( A,1..2,[1,3] );
                                  [ a11  a13 ]
                                  [          ]
                                  [ a21  a23 ]
\end{verbatim}

There are many equivalent ways of setting up matrices and performing
operations on them. As your lecturer may not have the same style 
as the author of this document here are some of the alternatives taken from
part of a table in {\it First Leaves}. 

\bigskip
\index{evalm}\index{add}\index{scalarmul}\index{multiply}\index{inverse}
\index{det}\index{nullspace}\index{kernel}\index{dotprod}\index{crossprod}
\index{linsolve}\index{vectdim} \index{coldim}\index{rowdim}
\begin{tabular}{|| l | l ||}        \hline
  Operation	&Maple notation \\ \hline
  $u + v$  (vector)	     &{\tt add(u,v)} or {\tt evalm(u + v)}\\
  $A + B$ (matrix)	    &{\tt add(A,B)} or {\tt evalm(A + B)}\\
  $ca A$	             &{\tt scalarmul(A,ca)} or {\tt evalm(ca*A)}\\
  $ca A + cb B$	&{\tt add(A,B,ca,cb)}\\
  $A v$		&{\tt multiply(A,v)} or {\tt evalm(A \&*  v)}\\
  $A B$	&{\tt multiply(A,B)} or {\tt evalm(A \&*  B)}\\
  $A^{-1}$	  	&{\tt inverse(A)} or {\tt evalm(1/A)}\\
  $\det(A)$ &{\tt det(A)}\\
  ${\rm nullspace}(A)$ or ${\rm kernel}(A)$	
          &{\tt nullspace(A)} or {\tt kernel(A)}\\
  $u\cdot v$		&{\tt dotprod(u,v)}\\
  $u \times v$	&{\tt crossprod(u,v)}\\
  solve $A x = b$	&{\tt linsolve(A,b)}\\
  number of components of a vector $v$	&{\tt vectdim(v)}\\
  number of columns of a matrix $A$	&{\tt coldim(A)}\\
  number of rows of a matrix $A$	&{\tt rowdim(A)}\\  \hline
\end{tabular}

\bigskip
The preceding applies equally to some Maple versions prior to Maple V. 
In earlier versions of Maple, the dimensions of the matrix 
along with its row entries are displayed, but the output in Maple V is neater. 
Other functions in Maple V's {\tt linalg} can be found by typing
{\tt help(linalg)} and will be introduced as they are needed.

\goodbreak
\subsection*{Working with Vectors and Matrices}

Many Maple functions such as {\tt simplify}, {\tt expand}, which apply
to scalar expressions, may be applied to entries of a matrix, by using
{\tt map}\index{map}.  For example, for a matrix $A$,
\begin{verbatim}
  map( simplify,A );
  map( expand,A );
\end{verbatim}
will apply the {\tt simplify} and {\tt expand} functions 
respectively to the entries of the matrix. For example:
\begin{verbatim}
> with(linalg):
> A:= band( [x,x^2+2*x,-x],3 );
                          [  2                           ]
                          [ x  + 2 x     - x        0    ]
                          [                              ]
                          [            2                 ]
                     A := [     x     x  + 2 x     - x   ]
                          [                              ]
                          [                      2       ]
                          [     0         x     x  + 2 x ]
\end{verbatim}
\goodbreak
\begin{verbatim}
> B:= subs( x=a+b,op(A) ):                            Bs:= map( simplify,B );
              Bs :=     2            2
                      [a  + 2 a b + b  + 2 a + 2 b, - a - b, 0]

                             2            2
                    [a + b, a  + 2 a b + b  + 2 a + 2 b, - a - b]

                                   2            2
                       [0, a + b, a  + 2 a b + b  + 2 a + 2 b]

> Be:= map( expand,B );
              Be :=     2            2
                      [a  + 2 a b + b  + 2 a + 2 b, - a - b, 0]

                             2            2
                    [a + b, a  + 2 a b + b  + 2 a + 2 b, - a - b]

                                   2            2
                       [0, a + b, a  + 2 a b + b  + 2 a + 2 b]

# The entries in Be are, in this case, the same as in Bs.
#
> subs( a=3/10,b=1/10,op(B) ):
> Bf:= map( evalf," );
                     [ .9600000000  -.4000000000        0      ]
                     [                                         ]
               Bf := [ .4000000000   .9600000000  -.4000000000 ]
                     [                                         ]
                     [      0        .4000000000   .9600000000 ]
\end{verbatim}

\goodbreak
\subsection*{Remarks on matrices with general entries}
Besides working with numerical examples we can illustrate the
results of some of the theorems with general matrices of a given,
small, size.  Examples below are usually $2\times 2$ matrices.
\begin{verbatim}
> with(linalg):
# Maple can deal with matrices with general entries.  Set one up as before.
> f:= proc(i,j)            a.i.j            end:
> A:= matrix(2,2,f); 
                                    [ a11  a12 ]
                               A := [          ]
                                    [ a21  a22 ]

> type(A,matrix);
                                      true

> t:= trace(A);                                               d:= det(A);
                                 t := a11 + a22

                             d := a11 a22 - a12 a21

# The following yields a formula which is true for any  2 by 2  matrix
> map( simplify, evalm( A^2 - t*A + d) );
                                    [ 0  0 ]
                                    [      ]
                                    [ 0  0 ]
\end{verbatim}
\nopagebreak
Other examples will be given when considering Section 2.2 of Hill.

\begin{thebibliography}{999}			\label{References}

\bibitem[AR]{AR} H. Anton and C. Rorres, 
{\it Elementary Linear Algebra: Applications Version}, 7th ed. Wiley, 1994.

\bibitem[Au]{Au} J. Auer, {\it Linear Algebra with Applications.}
With companion booklet: {\it Maple Solutions Manual}, Prentice-Hall, 1991, 1992.

\bibitem[BF]{BF} W. Bauldry and J. Fielder, {\it Calculus Laboratories
with Maple}, Brooks-Cole, 1991.

\bibitem[CG91a]{CG91a} B.~Char, K.~Geddes, G.~Gonnet, B.~Leong, M.~Monagan
and S.~Watt, {\it Maple V Language Reference Manual}, Springer, 1991.

\bibitem[CG91b]{CG91b} B.~Char, K.~Geddes, G.~Gonnet, B.~Leong, M.~Monagan
and S.~Watt, {\it Maple V Library Reference Manual}, Springer, 1991.

\bibitem[CG92]{CG92} B.~Char, K.~Geddes, G.~Gonnet, B.~Leong, M.~Monagan
and S.~Watt, {\it First Leaves: a Tutorial Introduction to Maple V},
Springer, 1992.

\bibitem[EJLS]{EJLS} W. Ellis, E. Johnson, E. Lodi and D. Schwalbe, 
{\it Maple V Flight Manual}, Brooks-Cole, 1992.

\bibitem[He]{He} A. Heck, {\it Introduction to Maple}, Springer, 1993.

\bibitem[Hi]{Hi} R.O. Hill Jr, {\it Elementary Linear Algebra with
Applications}, Harcourt Brace Jovanovitch, 1991.

\bibitem[Jo]{Jo} E. Johnson, {\it Linear Algebra with Maple V},
Brooks/Cole, 1993.

\bibitem[ND]{ND} B. Noble and J.W. Daniel, {\it Applied linear algebra},
Prentice-Hall, 1977.

\bibitem[Re]{Re} D. Redfern, {\it The Maple Handbook}, Springer, 1993.

\end{thebibliography}

\vfill
\eject
