aboutsummaryrefslogtreecommitdiff
path: root/src/hyper/pages/PERMAN.ht
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2007-08-14 05:14:52 +0000
committerdos-reis <gdr@axiomatics.org>2007-08-14 05:14:52 +0000
commitab8cc85adde879fb963c94d15675783f2cf4b183 (patch)
treec202482327f474583b750b2c45dedfc4e4312b1d /src/hyper/pages/PERMAN.ht
downloadopen-axiom-ab8cc85adde879fb963c94d15675783f2cf4b183.tar.gz
Initial population.
Diffstat (limited to 'src/hyper/pages/PERMAN.ht')
-rw-r--r--src/hyper/pages/PERMAN.ht51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/hyper/pages/PERMAN.ht b/src/hyper/pages/PERMAN.ht
new file mode 100644
index 00000000..607de71e
--- /dev/null
+++ b/src/hyper/pages/PERMAN.ht
@@ -0,0 +1,51 @@
+% Copyright The Numerical Algorithms Group Limited 1992-94. All rights reserved.
+% !! DO NOT MODIFY THIS FILE BY HAND !! Created by ht.awk.
+\newcommand{\PermanentXmpTitle}{Permanent}
+\newcommand{\PermanentXmpNumber}{9.62}
+%
+% =====================================================================
+\begin{page}{PermanentXmpPage}{9.62 Permanent}
+% =====================================================================
+\beginscroll
+The package \spadtype{Permanent} provides the function
+\spadfunFrom{permanent}{Permanent} for square matrices.
+%-% \HDindex{matrix!permanent of}{PermanentXmpPage}{9.62}{Permanent}
+The \spadfunFrom{permanent}{Permanent} of a square matrix can be computed
+in the same way as the determinant by expansion of minors except that for
+the permanent the sign for each element is \spad{1}, rather than being
+\spad{1} if the row plus column indices is positive and \spad{-1}
+otherwise.
+This function is much more difficult to compute efficiently than the
+\spadfunFrom{determinant}{Matrix}.
+An example of the use of \spadfunFrom{permanent}{Permanent} is the
+calculation of the \eth{\spad{n}} derangement number, defined to be the number
+of different possibilities for \spad{n} couples to dance but never with
+their own spouse.
+\xtc{
+Consider an \spad{n} by \spad{n} matrix with entries \spad{0} on the diagonal and
+\spad{1} elsewhere.
+Think of the rows as one-half of each couple (for example, the males) and the
+columns the other half.
+The permanent of such a matrix gives the desired derangement number.
+}{
+\begin{spadsrc}[\bound{kn}]
+kn n ==
+ r : MATRIX INT := new(n,n,1)
+ for i in 1..n repeat
+ r.i.i := 0
+ r
+\end{spadsrc}
+}
+\xtc{
+Here are some derangement numbers, which you see grow quite fast.
+}{
+\spadpaste{permanent(kn(5) :: SQMATRIX(5,INT)) \free{kn}}
+}
+\xtc{
+}{
+\spadpaste{[permanent(kn(n) :: SQMATRIX(n,INT)) for n in 1..13] \free{kn}}
+}
+\endscroll
+\autobuttons
+\end{page}
+%