\ProvidesPackage{linalgjh}[2001/06/08 Mathematics material for _Linear Algebra_ JH]
% linalgjh
%
%  Misc math that comes in handy for linear algebra.
%
% HISTORY
% 2001-Jun-08 Jim Hefferon  Cleaned up.

% input all the math packages
\RequirePackage{mathrsfs}
% AMS math 
\RequirePackage[reqno]{amsmath}
\RequirePackage[psamsfonts]{amsfonts} %for Y&Y BSR AMS fonts
\RequirePackage{amssymb}
\RequirePackage[text]{amsthm}
\RequirePackage{array}
\RequirePackage{amscd}


%--------linsys
%  Use as \begin{linsys}{3}
%           x &+ &3y &+ &a &= &7 \\
%           x &- &3y &+ &a &= &7 
%         \end{linsys}
% Remark: TeXbook pp. 167-170 says to put a medmuskip around a +; and that's
% 4/18-ths of an em.  Why does 2/18-ths of an em work?  I don't know, but
% comparing to a regular displayed equation suggests it is right.
% (darseneau says LaTeX puts in half an \arraycolsep.)
\newenvironment{linsys}[2][m]{%
\setlength{\arraycolsep}{.1111em} % p. 170 TeXbook; a medmuskip
\begin{array}[#1]{@{}*{#2}{rc}r@{}} 
}{%
\end{array}}



%--------grstep
% For denoting a Gauss' reduction step.
% Use as: \grstep{\rho_1+\rho_3} or \grstep[2\rho_5 \\ 3\rho_6]{\rho_1+\rho_3}
\newcommand{\grstep}[2][\relax]{%
   \ensuremath{\mathrel{
       \mathop{\longrightarrow}\limits^{#2\mathstrut}_{
                                     \begin{subarray}{l} #1 \end{subarray}}}}}
\newcommand{\swap}{\leftrightarrow}


%-------------amatrix
% Augmented matrix.  Usage (note the argument does not count the aug col):
% \begin{amatrix}{2}
%   1  2  3 \\  4  5  6
% \end{amatrix}
\newenvironment{amatrix}[1]{%
  \left(\begin{array}{@{}*{#1}{c}|c@{}}
}{%
  \end{array}\right)
}



%-------------pmat
% For matrices with arguments.
% Usage: \begin{pmat}{c|c|c} 1 &2 &3 \end{pmat}
\newenvironment{pmat}[1]{
  \left(\begin{array}{@{}#1@{}}
}{\end{array}\right)
}



%-------------misc matrices
\newenvironment{mat}{\left(\begin{array}}{\end{array}\right)}
\newenvironment{detmat}{\left|\begin{array}}{\end{array}\right|}
\newcommand{\deter}[1]{ \mathchoice{\left|#1\right|}{|#1|}{|#1|}{|#1|} }
\newcommand{\generalmatrix}[3]{ %arg1: low-case letter, arg2: rows, arg3: cols 
               \left(
                  \begin{array}{cccc}
                    #1_{1,1}  &#1_{1,2}  &\ldots  &#1_{1,#2}  \\
                    #1_{2,1}  &#1_{2,2}  &\ldots  &#1_{2,#2}  \\
                              &\vdots                         \\
                    #1_{#3,1} &#1_{#3,2} &\ldots  &#1_{#3,#2}
                  \end{array}
               \right)  }


%------------colvec and rowvec
% Column vector and row vector.  Usage:
%  \colvec{1  \\ 2 \\ 3 \\ 4} and \rowvec{1  &2  &3}
\newcommand{\colvec}[1]{\begin{pmatrix} #1 \end{pmatrix}}
\newcommand{\rowvec}[1]{\begin{pmatrix} #1 \end{pmatrix}}


%-------------making aligned columns
% Usage: \begin{aligncolondecimal}{2} 1.2 \\ .33 \end{aligncolondecimal}
% (negative argument centers decimal pt in column).  Also Usage:
% \begin{aligncolondecimal}[0em]{2} 1.2 \\ .33 \end{aligncolondecimal}
% to make the left and right LaTeX-array padding disappear.
\RequirePackage{array}\RequirePackage{dcolumn}
\newenvironment{aligncolondecimal}[2][.1111em]{%
\setlength{\arraycolsep}{#1}
\newcolumntype{.}{D{.}{.}{#2}}\begin{array}{.}}{%
\end{array}}



%=============================================
% misc math definitions
%
\DeclareMathOperator{\trace}{trace}
\DeclareMathOperator{\rank}{rank}
\DeclareMathOperator{\nullity}{nullity}
\newcommand{\isomorphicto}{\cong}
\newcommand{\rangespace}[1]{ \mathscr{R}(#1) }
\newcommand{\nullspace}[1]{ \mathscr{N}(#1) }
\newcommand{\genrangespace}[1]{ \mathscr{R}_\infty(#1) }
\newcommand{\gennullspace}[1]{ \mathscr{N}_\infty(#1) }
\newcommand{\zero}{ \vec{0} }
\newcommand{\polyspace}{\mathcal{P}}
\newcommand{\matspace}{\mathcal{M}}
\DeclareMathOperator{\size}{size}
\DeclareMathOperator{\adj}{adj}
\DeclareMathOperator{\sgn}{sgn}

% The term being defined.
\newcommand{\definend}[1]{\emph{#1}}

% Blackboard bold letters
\renewcommand{\Re}{\mathbb{R}}
\newcommand{\C}{\mathbb{C}}
\newcommand{\N}{\mathbb{N}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\Z}{\mathbb{Z}}

% a field
\newcommand{\F}{\mathcal{F}}

% functions
\newcommand{\map}[3]{\mbox{$#1\colon #2\to #3$}}
\newcommand{\mapsunder}[1]{\stackrel{#1}{\longmapsto}}
\newcommand{\composed}[2]{#1\mathbin\circ #2}
\newcommand{\identity}{\mbox{id}}
\newcommand{\restrictionmap}[2]{{#1}\mathpunct\upharpoonright\hbox{}_{#2}}

% emptyset
\renewcommand{\emptyset}{\varnothing}
% sets
\newcommand{\set}[1]{\mbox{$\{#1\}$}} \newcommand{\suchthat}{\bigm|}
\newcommand{\union}{\cup}
\newcommand{\intersection}{\cap}

%\newcommand{\implies}{\Longrightarrow}
\newcommand{\isimpliedby}{\Longleftarrow}

\newcommand{\sequence}[1]{ \langle#1\rangle }  
%\newcommand{\complement}[1]{\overline{#1}}
\newcommand{\cat}[2]{#1\!\mathbin{\raise.6ex\hbox{\( {}^\frown \)}}\!#2}
\newenvironment{strings}{\arraycolsep=.222em \begin{array}[t]}{\end{array}}

% sometimes want to have a bunch of equations
%  a = b
%  c = d
%    \vdots   <-- these should be cnetered on the `='
%  e = f
\newlength{\equalsignwd} \settowidth{\equalsignwd}{$=$}
\newcommand{\alignedvdots}[1][10pt]{\mskip2.5mu\makebox[.5\equalsignwd][r]{}%
                            \smash{\vdots}\rule{0pt}{#1}}

\newcommand{\stdbasis}{{\cal E}}
\newcommand{\basis}[2]{\sequence{\vec{#1}_1,\ldots,\vec{#1}_{#2}}}
\newcommand{\rowspace}[1]{ \mathop{{\mbox{Rowspace}}}(#1) }
\newcommand{\colspace}[1]{ \mathop{{\mbox{Columnspace}}}(#1) }
\newcommand{\linmaps}[2]{ \mathop{{\cal L}}(#1,#2) }
\newcommand{\lincombo}[2]{
      #1_1#2_1+#1_2#2_2+\cdots +#1_n#2_n}
\newcommand{\rep}[2]{ {\rm Rep}_{#2}(#1) }
\newcommand{\wrt}[1]{{\mbox{\scriptsize w.r.t. \( #1 \)} }}
\newcommand{\trans}[1]{ {{#1}^{\rm trans}} }
\newcommand{\proj}[2]{\mbox{proj}_{#2}({#1}) }

\newcommand{\spanof}[1]{\relax [#1\relax ]} % no optional argument!
\newcommand{\directsum}{\oplus}
\newcommand{\norm}[1]{\|#1\|}
\DeclareMathOperator{\dist}{dist}
\newcommand{\absval}[1]{|#1|}

% dot product
%  I like to use a slightly different circle for dot product, for
% a visual distinction.
%  The AtBeginDocument makes pdflatex happier
\AtBeginDocument{\newlength{\heightofcdot}
\newlength{\widthofcdot}
\settoheight{\heightofcdot}{$\cdot$}
\settowidth{\widthofcdot}{$\cdot$}
\newsavebox{\dotprodcircle}       
\savebox{\dotprodcircle}{\includegraphics{dotprod.1}} 
\newcommand{\dotprod}{\mathbin{\raisebox{.5\heightofcdot}{%
          \makebox[\widthofcdot]{$\smash{\usebox{\dotprodcircle}}$}}}}}

\newcommand{\nbyn}[1]{#1 \! \times \! #1 }       % \! is negative thinspace
\newcommand{\nbym}[2]{#1 \! \times \! #2 }       % Use in math mode.

% degrees
\newcommand{\degs}[1]{#1^\circ\relax}

% for the voting material
\newcommand{\votepreflist}[3]{\colvec{#1 \\ #2 \\ #3}}
\newcommand{\voteprefloop}[3]{%      #1 at 10 o'clock, #2 at 6, #3 at 2 o'clock
   \raisebox{.16in}{\scriptsize #1}%
   {\renewcommand{\arraystretch}{1.0}
   \begin{tabular}{@{}c@{}}
     \makebox[.32in]{\includegraphics{ch2.20}} \\[-.075in]
     \makebox[.1in]{{\scriptsize #2}}
   \end{tabular}}
   \raisebox{.16in}{\scriptsize #3}%
}
\newcommand{\votinggraphic}[1]{\hspace{.8em}\mathord{\raisebox{-.2in}[.3in][.2in]{\includegraphics{voting.#1}}}\hspace{.8em}}


% for the networks topic
\newcommand{\circuitfont}{\sffamily}

% for the Nilpotence material
\newcommand{\digitinsq}[1]{\fbox{\( #1 \)} }
\newlength{\widthofdigitinsq}
\settowidth{\widthofdigitinsq}{\digitinsq{1}}
\newcommand{\digitincirc}[1]{%\mbox{\( #1 \)}
                             \makebox[\widthofdigitinsq]{%
                                \setlength{\unitlength}{1pt}%
                                \begin{picture}(0,0)(0,-3)
                                   \thinlines
                                    \put(0,0){\circle{12}}
                                    \put(0,-3){\makebox[0pt]{#1}}
                               \end{picture}}}



% from ltugboat.cls 2000-Apr-27 for making dashes.
% Really for 10 pt only.
%\def\thinskip{\hskip 0.16667em\relax}
%\def\endash{--}
%\def\emdash{\endash-}
%\def\d@sh#1#2{\unskip#1\thinskip#2\thinskip\ignorespaces}
%\def\dash{\d@sh\nobreak\endash}
%\def\Dash{\d@sh\nobreak\emdash}
%\def\ldash{\d@sh\empty{\hbox{\endash}\nobreak}}
%\def\rdash{\d@sh\nobreak\endash}
%\def\Ldash{\d@sh\empty{\hbox{\emdash}\nobreak}}
%\def\Rdash{\d@sh\nobreak\emdash}


%---------------------hyphenations
\hyphenation{range-space}
\hyphenation{range-spaces}
\hyphenation{null-space}
\hyphenation{null-spaces}
\hyphenation{re-la-tion}
\hyphenation{re-la-tions}
\hyphenation{re-la-tion-ship}

\endinput
