% math 211 - 21/22 - Linear Algebra MAPLE commands
% - corrected 25.01.14
\documentclass{article}    
\addtolength{\textwidth}{2.5in}
\addtolength{\oddsidemargin}{-1.25in}        
%\addtolength{\topmargin}{-1.0in}
\addtolength{\headsep}{-.5in}
\addtolength{\textheight}{1.0in}
\addtolength{\marginparwidth}{-.75in}
\renewcommand{\thepage}{la--\arabic{page}}
%        
\newcommand{\m}[1]{\marginpar{[#1]}}
\newcommand{\txt}[1]{\mbox{\rm #1}}
\newcommand{\sps}{\vspace{3pt}} %small space
\newcommand{\spm}{\vspace{5pt}} %medium space
\newcommand{\spl}{\vspace{7pt}} %large space
\newcommand{\hsps}{\hspace{5pt}} %small horizontal space
\newcommand{\hspm}{\hspace{10pt}} %medium horizontal space
\newcommand{\ind}{\hspace*{15pt}}%large horizontal space
\newcommand{\hsp}{\hspace{20pt}} %very large horizontal space
\newcommand{\ov}[1]{\overline{#1}}
\newcommand{\bs}{\backslash}
\newcommand{\ifff}{\Longleftrightarrow}
\newcommand{\ra}{\rightarrow}
\newcommand{\rb}{\rangle} %right bracket
\newcommand{\lb}{\langle}
\newcommand{\lm}{\lambda}
\newcommand{\expand}[1]{\renewcommand{\arraystretch}{#1}}
\newcommand{\expcol}[1]{\addtolength{\arraycolsep}{#1}} 
    % expand/contract space between columns of an array (in pts)
    %   -cumulative, in addition to default 
\newcommand{\exprow}[1]{\renewcommand{\arraystretch}{#1}}
    %expand/contract space between rows of an array (1.0 = standard) 
\newcommand{\w}{^{\scriptscriptstyle\wedge}}
%\newcommand{\bmi}{\begin{minipage}[t]{4.95cm}}
%\newcommand{\emi}{\end{minipage}}
\newcounter{seq}
\newcommand{\ctr}{\addtocounter{seq}{1} \arabic{seq}.\ }
            
\newcommand{\nsp}{\hspace*{-5pt}} % negative space

\begin{document}
\begin{center} {\huge\bf Linear Algebra Commands in MAPLE} \end{center} \vspace{5pt}
\begin{center} \large\bf Description of commands in the \emph{LinearAlgebra} Package
\end{center} 
\vspace{10pt}
            
\exprow{1.35}
%  
\setcounter{seq}{0}
\begin{center}
\begin{tabular}{|p{7cm}|p{7cm}|}  \hline
\multicolumn{1}{|c}{Linear Algebra} &
\multicolumn{1}{|c|}{Description} \\ \hline \hline
\multicolumn{2}{|c|}{\ctr General} \\ \hline
with(LinearAlgebra):  & read in the linear algebra package  \\
%matrix commands) \\ 
%evalm$(a)$; & n/a & display the matrix $a$ in matrix form (on the
%screen)\\
type$(expr,\, $Matrix) & gives $true$ if $expr$ has the form of a matrix, else false \\
type($expr$, Vector)  
 & gives $true$ if $expr$ has the form of a vector\\
RowDimension$(a)$  & the number of rows of the matrix $a$ \\ 
ColumnDimension$(a)$ & the number of columns of $a$ \\
Dimensions$(a)$  & the number of rows and columns \\  
Dimension$(v)$ & the dimension of a vector \\ \hline
%
\multicolumn{2}{|c|}{\ctr Constructing matrices and vectors} \\ \hline
%\parbox[t]{5cm}{Matrix$([[a_{11}, \ldots,a_{1n}],\ldots])$; or \\ 
%\parbox{2.8cm}{$<<a_{11}| \ldots |a_{1n}>$},\ldots,
%\parbox{3.1cm}{$<a_{m1}|\ldots|a_{mn}>>$}}; & 
Matrix$([[a_{11}, \ldots,a_{1n}],\ldots,[a_{m1},\ldots, a_{mn}]])$ &
build an $m\times n$ matrix $a = (a_{ij})$ by listing its elements row by row \\
$<<a_{11}, \ldots, a_{m1}>|\ldots |<a_{1n}\ldots|a_{mn}>>$ &
build an $m\times n$ matrix $a = (a_{ij})$ by listing its elements column by column \\
Matrix$(m,n,f)$ & 
build an $m \times n$ matrix whose $ij$-th entry is $f(i,j)$ \\ 
Matrix$(m,n,(i,j) \ra expr)$&  build an $m
\times n$ matrix with $ij$-th entry  $expr(i,j)$ \\
Vector$([a_1,\ldots, a_n])$ or $<a_1,\ldots, a_n>$
& construct a (column) vector with entries $a_1,\ldots,a_n$
 \\ \hline
\iffalse
matrix$(list)$; & Matrix$(list)$; & build a matrix whose $i$-th row is the $i$-th entry in
% the list
$list$ (a list of lists) \\ %of vectors \\
augment$(v_1,\ldots, v_n)$; & $<v_1|\ldots|v_n>$; 
& build a matrix whose $j$-th column is the vector $v_j$   \\ \hline
\fi
\multicolumn{2}{|c|}{\ctr Basic matrix operations} \\ \hline
$a + b$ & the sum of the matrices $a$ and $b$ \\
$c*a$ & multiplying the matrix $a$ by a scalar $c$ \\
$a\,.\,b$\, or Multiply$(a,b)$ & matrix multiplication \\
$a\w n$  & the $n$-th power of a matrix \\
$1/a$ or $a\w(-1)$ & the inverse of a matrix \\
map$(f, a)$ & the matrix obtained by applying the function $f$ to each
entry of $a$ \\   
Transpose$(a)$ or a$\w\%T$  & the transpose of $a$ \\
Determinant$(a)$ & the determinant of $a$  \\
Trace$(a)$ & the trace of $a$ \\ 
Rank$(a)$ & the rank of $a$ \\     
Adjoint$(a)$ &  the adjoint matrix (matrix of minors) of $a$ \\\hline
\end{tabular}
            
%\noindent
\begin{tabular}{|p{7cm}|p{7cm}|}  \hline
\multicolumn{2}{|c|}{\ctr Special matrices} \\ \hline 
ZeroMatrix$(m,n)$ & the $m\times n$ zero matrix \\
DiagonalMatrix$(L)$ & generate a diagonal matrix with the list $L$ as the
diagonal entries \\
IdentityMatrix$(n)$ & generate an $n \times n$ identity matrix \\ 
%alias(Id, \&*()); &  & define Id as the generic identity matrix \\
VandermondeMatrix$(L)$  
& generate a Vandermonde matrix whose 2nd column is the list $L$ \\
%(of length $n$) \\
BandMatrix$(L)$ & create a tri--diagonal matrix (or an arbitrary band matrix) using 
the list $L$ \\
JordanBlockMatrix$([[c,n]])$  & generate an $n \times n$
Jordan block with eigenvalue $c$ \\      
JordanBlockMatrix$([[c_1,n_1],\ldots$, $[c_r,n_r]])$  
 & generate a Jordan matrix with Jordan blocks $(c_1, n_1), \ldots, (c_r,n_r)$ \\      
CompanionMatrix$(p, x)$ & generate the $n \times n$ companion matrix 
associated to a monic po\-ly\-nomial $p(x)$ of degree $n$  \\
 \hline  
%              
\multicolumn{2}{|c|}{\ctr Extracting parts of a matrix} \\ \hline
$a[i,j]$ & the $(i,j)$-th entry of the matrix $a$ \\
Row$(a,i)$ & the $i$-th row of the matrix $a$ \\
Column$(a,j)$ & the $j$-th column of the matrix $a$ \\
%col$(a,j_1..i_2)$; & seq($a[1..-1,j], j=j_1..j_2)$; &
%the list of columns $j_1$ to $j_2$ of $a$ \\ 
%submatrix$(a, [i_1,{\scriptstyle\ldots},i_r], [j_1,{\scriptstyle\ldots},j_s])$;  &
%$a[[i_1,\ldots,i_r], [j_1,\ldots, j_s]]$; or 
\parbox[t]{6.5cm}{SubMatrix$(a, [i_1,\ldots,i_r], [j_1,\ldots, j_s])$ or
$a[[i_1,\ldots,i_r], [j_1,\ldots, j_s]]$}
 & the $r \times s$ submatrix of $a$ with row
indices $i_k$ and column indices $j_k$ \\ 
%submatrix$(a, i_0..i_1, j_0..j_1)$; & \parbox[t]{5cm}{$a[i_0..i_1, j_0..j_1]$; 
%or\\ 
SubMatrix$(a, i_0..i_1, j_0..j_1)$ or $a[i_0..i_1, j_0..j_1]$ 
& the submatrix of $a$ having row and column indices from $i_0$ to $i_1$ and $j_0$ to $j_1$, respectively \\
\hline
%        
\multicolumn{2}{|c|}{\ctr Pasting and altering matrices} \\ \hline
$<a,b, \ldots>$ & join two (or more) matrices $a$, $b$, \ldots vertically
\\
%(to get an $(n_1 + n_2) \times k$ matrix) \\
$<a\mid b\mid\ldots >$ & join two (or more) %$n \times k_i$ 
matrices horizontally  \\   
%to form an $n \times (k_1 + k_2)$ matrix \\
Matrix$(m+r,n+s,[a]$,fill$\,=c)$; & enlarge the $m\times n$ 
matrix $a$ by $r$ additional rows and $s$ additional columns with the value $c$ \\
Matrix$(m,n,L)$ & partition a list $L$ of $mn$ elements into
an $m\times n$ matrix \\ 
DiagonalMatrix$([a_1, a_2,\ldots])$  
 & construct a block diagonal matrix using the (square) matrices $a_1, a_2, \dots$ \\
$a[i,j]$ := $expr$ & replace the $(i,j)$-th entry of matrix $a$
by the expression $expr$ \\ 
DeleteRow$(a, i_1..i_2)$  & delete rows $i_1$ to $i_2$ of $a$
\\
DeleteColumn$(a, i_1..i_2)$ & delete
columns $j_1$ to $j_2$ of $a$ \\ \hline
\iffalse
extend(a, r, s, c);  & Matrix$(m+r,n+s,[a]$,fill$\,=c)$; & enlarge the $m\times n$ 
matrix $a$ by $r$ additional rows and $s$
additional columns with the value $c$ \\
$b$ := evalm$(a)$; & $b$ := copy$(a)$; & copying the entries of matrix $a$ to $b$ \\
copyinto$(a, b, i, j)$; & $b[i..i+m-1, j..j+n-1]:=a$;
& copy the entries of matrix $a$ into matrix $b$ at index
position $(i,j)$ ($b$ is altered) \\
%  &Insert$[a, list, i]$ & insert the vector $list$ at position (row) $i$ \\ 
$a[i,j]$ := $expr$; & $a[i,j]$ := $expr$; & replace the $(i,j)$-th entry of matrix $a$
by the expression $expr$ \\
DeleteRow$(a, i_1..i_2)$  & delete rows $i_1$ to $i_2$ of $a$
\\
DeleteColumn$(a, i_1..i_2)$ & delete
columns $j_1$ to $j_2$ of $a$ \\ \hline
\hline
\fi      
\end{tabular}
              
\noindent\begin{tabular}{|p{7cm}|p{7cm}|}  \hline
\multicolumn{2}{|c|}{\ctr Row and column operations} \\ \hline
RowOperation$(a, [i_2, i_1], c)$ & add $c$ times row
$i_1$ to row $i_2$ (thus, the result is put in row $i_2)$\\
ColumnOperation$(a, [j_2, j_1], c)$ & 
add $c$ times column $j_1$ to col.\ $j_2$\\
RowOperation$(a, i, c)$ &  multiply row $i$ by $c$ \\
ColumnOperation$(a, j, c)$ &  multiply column $j$ by $c$ \\
RowOperation$(a, [i_1, i_2])$ 
 & interchange rows $i_1$ and $i_2$ \\
ColumnOperation$(a, [j_1, j_2])$  
 & interchange columns $j_1$ and $j_2$ \\ \hline
%  
\multicolumn{2}{|c|}{\ctr Row reduction and solutions of linear systems} \\ \hline
LinearSolve$(a, b)$ & find the (general) solution of the matrix
equation $ax = b$ \\   
NullSpace$(a)$ & compute a basis for the nullspace
of a matrix $a$ \\
GaussianElimination$(a)$ & find an upper triangular matrix which is row equivalent
to $a$ \\
BackwardsSubstitution$(a, b)$ 
& solve $ax = b$ by back-sub\-sti\-tu\-tion (if $a$ is upper triangular)  \\
ReducedRowEchelonForm$(a)$ & compute the reduced row echelon form of $a$ \\
\iffalse
pivot($a, i, j$); & Pivot$(a, i, j)$; 
& row-reduce $a$ to make $j^{th}$ column = $0$, except for $(i,j)^{th}$ entry\\ 
\fi
HermiteForm$(a)$ & row reduce the integer matrix $a$ to an upper-$\Delta$ integer matrix \\
SmithForm$(a)$ &  row reduce and column reduce the integer matrix $a$ to a diagonal 
integer matrix  \\ 
\hline
%  
\multicolumn{2}{|c|}{\ctr Eigenvalues, Eigenvectors} \\ \hline
CharacteristicMatrix$(a,x)$ & compute the characteristic
matrix $Ix - a$ ($x$ a variable) \\
CharacteristicPolynomial$(a, x)$ & find the characteristic
polynomial of $a$ \\
MinimalPolynomial$(a, x)$ & find the minimal polynomial of $a$\\
Eigenvalues$(a)$ & compute the eigenvalues of $a$ \\
Eigenvectors$(a)$ & find the eigenvectors of $a$ \\
JordanForm$(a)$ or JordanForm $(a$, 
output\,$ = [$'$J$','$Q$'$])$; 
& compute the Jordan canonical form $J$ of $a$
and the matrix $q$ such that $a = q^{-1}Jq$  \\
FrobeniusForm$(a)$ 
or Frobenius\-Form$(a$, output\, $= [$'$F$', '$Q$']) 
& compute the Frobenius (or rational) canonical form $F$ of $a$;  
find $p$ such that $a = pFp^{-1}$  \\  
%\parbox{4.5cm}{issimilar($a,b$); or \\ \hspace*{5pt}\ issimilar($a, b,`q`$);} & 
IsSimilar$(a,b)$ or IsSimilar$(a,b$, output = ['query', '$C$'])
& determine whether $a$ is similar to $b$; if so, find the matrix 
$q$ such that $a = q^{-1}bq$\\
\hline   
\end{tabular}

\noindent\begin{tabular}{|p{7cm}|p{7cm}|}  \hline
\multicolumn{2}{|c|}{\ctr Vector operations} \\ \hline
%vector($[a_1,\ldots,a_n]$); & \parbox[t]{4.5cm}{Vector($[a_1,\ldots,a_n]$);\hspace{15pt} or\hspace{25pt}\\ \hspace*{5pt}$<a_1,\ldots, a_n>$;} 
%& define a (column) vector by the list $[a_1,\ldots,a_n]$ \\
%vector($[a_1,\ldots,a_n]$); & $<a_1\mid\ldots\mid a_n>$;  
% & define a (row) vector by the list $[a_1,\ldots,a_n]$ \\
%Dimension$(v)$; & the dimension of a vector \\
%type($expr$, Vector);  
% & gives $true$ if $expr$ has the form of a vector\\
%and gives FALSE otherwise\\
%\parbox{4.5cm}{vector([op(convert($v$, list)), \\\hspace*{5pt} op(convert($w$, list)))]); } 
convert$(<v,w>$, Vector) & direct sum of two vectors $v, w$ \\
$v+w$ & add two vectors $v, w$\\
$c*v$ & multiply the vector $v$ by scalar $c$\\
%\parbox[t]{4.0cm}{multiply($a, v$); or \\ \hspace*{5pt}innerprod($a,v$);} & 
$a\;.\;v$ 
& multiply the matrix $a$ by the (column) vector $v$ (on the right)\\
%\parbox[t]{4.0cm}{multiply($v, a$); or \\ \hspace*{5pt}innerprod($v,a$);} & 
Transpose$(v)\,.\, a$ 
& multiply the matrix $a$ by the vector $v$ (on the left)\\ 
$v\;.\;w$ & the dot (scalar) product of $v$ and $w$ \\
Norm($v, 2$) & the length or norm $||v||$  of a vector $v$\\
Normalize($v$) & divide the vector $v$ by its length\\ 
VectorAngle$(v,w)$  & the angle between the vectors $v$ and $w$\\
\hline
%
\multicolumn{2}{|c|}{\ctr Vector spaces} \\ \hline
Basis($L$) &find a basis of the vector space 
  spanned by list $L$ of vectors \\ 
 % \rule[-10pt]{0pt}{20pt}} \\
IntersectionBasis$([L_1, L_2\ldots])$ 
 & \parbox[t]{6.0cm}{find a basis of the intersection of 
   the spaces spanned by the lists $L_1, L_2,\ldots$}\\  
 %\rule[-10pt]{0pt}{20pt}} \\
SumBasis$([L_1, L_2\ldots])$ 
 & \parbox[t]{6.0cm}{find a basis of the sum/union of  the spaces spanned 
  by the lists $L_1, L_2,\ldots$}\\  
RowSpace($a$),  ColumnSpace($a$)
 & find a basis for the row/column space of the matrix $a$ \\
NullSpace$(a)$ & compute a basis for the nullspace of a matrix $a$ \\
GramSchmidt$([v_1, \ldots, v_n])$ 
 & apply the Gram-Schmidt procedure to the vectors $v_1, \ldots, v_n$  \\
\hline
\iffalse
\multicolumn{3}{|c|}{\ctr Vector Calculus} \\ \hline
crossprod & & \\ 
curl &  &   \\
diverge & & \\
grad & &    \\
vectpotent & & \\
laplacian & & \\
jacobian & & \\
hessian  & &  \\
wronskian & & \\
\hline
\fi
%
\multicolumn{2}{|c|}{\ctr Miscellaneous} \\ \hline
%hadamard$(a)$;   & & compute the `Hadamard norm' \\
IsOrthogonal$(a)$ & test whether $a$ is an orthogonal matrix \\
LeastSquares$(a,b)$ & find $x$ such that $\parallel ax - b\parallel$ is minimal  \\
%GramSchmidt$([v_1, \ldots, v_n])$;   & GramSchmidt$([v_1, \ldots, v_n])$; 
%& apply Gram-Schmidt procedure to the vectors $v_1, \ldots, v_n$  \\
Equal$(a,b)$ & test whether matrices $a$ and $b$ are equal\\
convert(evalm(subs$(x=a,f))$, Matrix); &
evaluate the matrix polynomial $f(a)$ (where $f(x)$ is a polynomial) \\ 
\hline
\end{tabular}
                      

%\noindent\begin{tabular}{|p{5cm}|p{5cm}|p{5cm}|}  \hline
%\multicolumn{3}{|c|}{\ctr Vector operations} \\ \hline
%vector(); & & \\
%angle     & & \\
%dotprod   & & \\
%crossprod & & \\ \hline
%\end{tabular}    
              
                    
\end{center}
        
\end{document}  
              
