\section{DET Determinant of a Matrix}

\subsection{Usage}

Calculates the determinant of a matrix.  Note that for all but
very small problems, the determinant is not particularly useful.
The condition number \verb|cond| gives a more reasonable estimate as
to the suitability of a matrix for inversion than comparing \verb|det(A)|
to zero.  In any case, the syntax for its use is
\begin{verbatim}
  y = det(A)
\end{verbatim}
where A is a square matrix.
\subsection{Function Internals}

The determinant is calculated via the \verb|LU| decomposition.  Note that
the determinant of a product of matrices is the product of the 
determinants.  Then, we have that 
\[
  L U = P A
\]
where \verb|L| is lower triangular with 1s on the main diagonal, \verb|U| is
upper triangular, and \verb|P| is a row-permutation matrix.  Taking the
determinant of both sides yields
\[
 |L U| = |L| |U| = |U| = |P A| = |P| |A|
\]
where we have used the fact that the determinant of \verb|L| is 1.  The
determinant of \verb|P| (which is a row exchange matrix) is either 1 or 
-1.
\subsection{Example}

Here we assemble a random matrix and compute its determinant
\begin{verbatim}
--> A = rand(5);
--> det(A)

ans = 

 -5.0277e-02 


\end{verbatim}
Then, we exchange two rows of \verb|A| to demonstrate how the determinant
changes sign (but the magnitude is the same)
\begin{verbatim}
--> B = A([2,1,3,4,5],:);
--> det(B)

ans = 

 5.0277e-02 


\end{verbatim}
