diff --git a/books/bookvol10.3.pamphlet b/books/bookvol10.3.pamphlet
index 83ea807..57e113b 100644
--- a/books/bookvol10.3.pamphlet
+++ b/books/bookvol10.3.pamphlet
@@ -283,6 +283,223 @@ November 10, 2003 ((iHy))
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \chapter{Chapter A}
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain ALGFF AlgebraicFunctionField}
+\pagehead{AlgebraicFunctionField}{ALGFF}
+\pagepic{ps/v103algebraicfunctionfield.ps}{ALGFF}{1.00}
+<<domain ALGFF AlgebraicFunctionField>>=
+)abbrev domain ALGFF AlgebraicFunctionField
+++ Function field defined by f(x, y) = 0
+++ Author: Manuel Bronstein
+++ Date Created: 3 May 1988
+++ Date Last Updated: 24 Jul 1990
+++ Keywords: algebraic, curve, function, field.
+++ Description: Function field defined by f(x, y) = 0.
+++ Examples: )r ALGFF INPUT
+AlgebraicFunctionField(F, UP, UPUP, modulus): Exports == Impl where
+  F      : Field
+  UP     : UnivariatePolynomialCategory F
+  UPUP   : UnivariatePolynomialCategory Fraction UP
+  modulus: UPUP
+
+  N   ==> NonNegativeInteger
+  Z   ==> Integer
+  RF  ==> Fraction UP
+  QF  ==> Fraction UPUP
+  UP2 ==> SparseUnivariatePolynomial UP
+  SAE ==> SimpleAlgebraicExtension(RF, UPUP, modulus)
+  INIT ==> if (deref brandNew?) then startUp false
+
+  Exports ==> FunctionFieldCategory(F, UP, UPUP) with
+    knownInfBasis: N -> Void
+	++ knownInfBasis(n) \undocumented{}
+
+  Impl ==> SAE add
+    import ChangeOfVariable(F, UP, UPUP)
+    import InnerCommonDenominator(UP, RF, Vector UP, Vector RF)
+    import MatrixCommonDenominator(UP, RF)
+    import UnivariatePolynomialCategoryFunctions2(RF, UPUP, UP, UP2)
+
+    startUp    : Boolean -> Void
+    vect       : Matrix RF -> Vector $
+    getInfBasis: () -> Void
+
+    brandNew?:Reference(Boolean) := ref true
+    infBr?:Reference(Boolean) := ref true
+    discPoly:Reference(RF) := ref 0
+    n  := degree modulus
+    n1 := (n - 1)::N
+    ibasis:Matrix(RF)     := zero(n, n)
+    invibasis:Matrix(RF)  := copy ibasis
+    infbasis:Matrix(RF)   := copy ibasis
+    invinfbasis:Matrix(RF):= copy ibasis
+
+    branchPointAtInfinity?()   == (INIT; infBr?())
+    discriminant()             == (INIT; discPoly())
+    integralBasis()            == (INIT; vect ibasis)
+    integralBasisAtInfinity()  == (INIT; vect infbasis)
+    integralMatrix()           == (INIT; ibasis)
+    inverseIntegralMatrix()    == (INIT; invibasis)
+    integralMatrixAtInfinity() == (INIT; infbasis)
+    branchPoint?(a:F)          == zero?((retract(discriminant())@UP) a)
+    definingPolynomial()       == modulus
+    inverseIntegralMatrixAtInfinity() == (INIT; invinfbasis)
+
+    vect m ==
+      [represents row(m, i) for i in minRowIndex m .. maxRowIndex m]
+
+    integralCoordinates f ==
+      splitDenominator(coordinates(f) * inverseIntegralMatrix())
+
+    knownInfBasis d ==
+      if deref brandNew? then
+        alpha := [monomial(1, d * i)$UP :: RF for i in 0..n1]$Vector(RF)
+        ib := diagonalMatrix
+          [inv qelt(alpha, i) for i in minIndex alpha .. maxIndex alpha]
+        invib := diagonalMatrix alpha
+        for i in minRowIndex ib .. maxRowIndex ib repeat
+          for j in minColIndex ib .. maxColIndex ib repeat
+            infbasis(i, j)    := qelt(ib, i, j)
+            invinfbasis(i, j) := invib(i, j)
+      void
+
+    getInfBasis() ==
+      x           := inv(monomial(1, 1)$UP :: RF)
+      invmod      := map(#1 x, modulus)
+      r           := mkIntegral invmod
+      degree(r.poly) ^= n => error "Should not happen"
+      ninvmod:UP2 := map(retract(#1)@UP, r.poly)
+      alpha       := [(r.coef ** i) x for i in 0..n1]$Vector(RF)
+      invalpha := [inv qelt(alpha, i)
+                   for i in minIndex alpha .. maxIndex alpha]$Vector(RF)
+      invib       := integralBasis()$FunctionFieldIntegralBasis(UP, UP2,
+                             SimpleAlgebraicExtension(UP, UP2, ninvmod))
+      for i in minRowIndex ibasis .. maxRowIndex ibasis repeat
+        for j in minColIndex ibasis .. maxColIndex ibasis repeat
+          infbasis(i, j)    := ((invib.basis)(i,j) / invib.basisDen) x
+          invinfbasis(i, j) := ((invib.basisInv) (i, j)) x
+      ib2    := infbasis * diagonalMatrix alpha
+      invib2 := diagonalMatrix(invalpha) * invinfbasis
+      for i in minRowIndex ib2 .. maxRowIndex ib2 repeat
+        for j in minColIndex ibasis .. maxColIndex ibasis repeat
+          infbasis(i, j)    := qelt(ib2, i, j)
+          invinfbasis(i, j) := invib2(i, j)
+      void
+
+    startUp b ==
+      brandNew?() := b
+      nmod:UP2    := map(retract, modulus)
+      ib          := integralBasis()$FunctionFieldIntegralBasis(UP, UP2,
+                                SimpleAlgebraicExtension(UP, UP2, nmod))
+      for i in minRowIndex ibasis .. maxRowIndex ibasis repeat
+        for j in minColIndex ibasis .. maxColIndex ibasis repeat
+          qsetelt_!(ibasis, i, j, (ib.basis)(i, j) / ib.basisDen)
+          invibasis(i, j) := ((ib.basisInv) (i, j))::RF
+      if zero?(infbasis(minRowIndex infbasis, minColIndex infbasis))
+        then getInfBasis()
+      ib2    := coordinates normalizeAtInfinity vect ibasis
+      invib2 := inverse(ib2)::Matrix(RF)
+      for i in minRowIndex ib2 .. maxRowIndex ib2 repeat
+        for j in minColIndex ib2 .. maxColIndex ib2 repeat
+          ibasis(i, j)    := qelt(ib2, i, j)
+          invibasis(i, j) := invib2(i, j)
+      dsc  := resultant(modulus, differentiate modulus)
+      dsc0 := dsc * determinant(infbasis) ** 2
+      degree(numer dsc0) > degree(denom dsc0) =>error "Shouldn't happen"
+      infBr?() := degree(numer dsc0) < degree(denom dsc0)
+      dsc := dsc * determinant(ibasis) ** 2
+      discPoly() := primitivePart(numer dsc) / denom(dsc)
+      void
+
+    integralDerivationMatrix d ==
+      w := integralBasis()
+      splitDenominator(coordinates([differentiate(w.i, d)
+          for i in minIndex w .. maxIndex w]$Vector($))
+               * inverseIntegralMatrix())
+
+    integralRepresents(v, d) ==
+      represents(coordinates(represents(v, d)) * integralMatrix())
+
+    branchPoint?(p:UP) ==
+      INIT
+      (r:=retractIfCan(p)@Union(F,"failed")) case F =>branchPoint?(r::F)
+      not ground? gcd(retract(discriminant())@UP, p)
+
+@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain AN AlgebraicNumber}
+<<dot>>=
+"AN" -> "ES"
+"AlgebraicNumber()" -> "ExpressionSpace()"
+"AN" -> "ACF"
+"AlgebraicNumber()" -> "AlgebraicallyClosedField()"
+"AN" -> "RETRACT"
+"AlgebraicNumber()" -> "RetractableTo(Integer)"
+"AlgebraicNumber()" -> "RetractableTo(Fraction(Integer))"
+"AN" -> "LINEXP"
+"AlgebraicNumber()" -> "LinearlyExplicitRingOver(Integer)"
+"AlgebraicNumber()" -> "LinearlyExplicitRingOver(Fraction(Integer))"
+"AN" -> "REAL"
+"AlgebraicNumber()" -> "RealConstant()"
+"AN" -> "CHARZ"
+"AlgebraicNumber()" -> "CharacteristicZero()"
+"AN" -> "KONVERT"
+"AlgebraicNumber()" -> "ConvertibleTo(Complex(Float))"
+"AN" -> "DIFRING"
+"AlgebraicNumber()" -> "DifferentialRing()"
+@
+\pagehead{AlgebraicNumber}{AN}
+\pagepic{ps/v103algebraicnumber.ps}{AN}{1.00}
+<<domain AN AlgebraicNumber>>=
+)abbrev domain AN AlgebraicNumber
+++ Algebraic closure of the rational numbers
+++ Author: James Davenport
+++ Date Created: 9 October 1995
+++ Date Last Updated: 10 October 1995 (JHD)
+++ Description: Algebraic closure of the rational numbers, with mathematical =
+++ Keywords: algebraic, number.
+AlgebraicNumber(): Exports == Implementation where
+  Z   ==> Integer
+  P   ==> SparseMultivariatePolynomial(Z, Kernel %)
+  SUP ==>  SparseUnivariatePolynomial
+
+  Exports ==> Join(ExpressionSpace, AlgebraicallyClosedField,
+                   RetractableTo Z, RetractableTo Fraction Z,
+                   LinearlyExplicitRingOver Z, RealConstant,
+                   LinearlyExplicitRingOver Fraction Z,
+                   CharacteristicZero,
+                   ConvertibleTo Complex Float, DifferentialRing) with
+    coerce : P -> %
+      ++ coerce(p) returns p viewed as an algebraic number.
+    numer  : % -> P
+      ++ numer(f) returns the numerator of f viewed as a
+      ++ polynomial in the kernels over Z.
+    denom  : % -> P
+      ++ denom(f) returns the denominator of f viewed as a
+      ++ polynomial in the kernels over Z.
+    reduce : % -> %
+      ++ reduce(f) simplifies all the unreduced algebraic numbers
+      ++ present in f by applying their defining relations.
+    norm : (SUP(%),Kernel %) -> SUP(%)
+      ++ norm(p,k) computes the norm of the polynomial p
+      ++ with respect to the extension generated by kernel k
+    norm : (SUP(%),List Kernel %) -> SUP(%)
+      ++ norm(p,l) computes the norm of the polynomial p
+      ++ with respect to the extension generated by kernels l
+    norm : (%,Kernel %) -> %
+      ++ norm(f,k) computes the norm of the algebraic number f
+      ++ with respect to the extension generated by kernel k
+    norm : (%,List Kernel %) -> %
+      ++ norm(f,l) computes the norm of the algebraic number f
+      ++ with respect to the extension generated by kernels l
+  Implementation ==> InnerAlgebraicNumber add
+    Rep:=InnerAlgebraicNumber
+    a,b:%
+    zero? a == trueEqual(a::Rep,0::Rep)
+    one? a == trueEqual(a::Rep,1::Rep)
+    a=b == trueEqual((a-b)::Rep,0::Rep)
+
+@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \section{domain ANY Any}
 <<dot>>=
 "ANY" -> "SETCAT"
@@ -4858,6 +5075,4088 @@ Boolean(): Join(OrderedSet, Finite, Logic, ConvertibleTo InputForm) with
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \chapter{Chapter C}
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain CARD CardinalNumber}
+<<CardinalNumber.input>>=
+-- card.spad.pamphlet CardinalNumber.input
+)spool CardinalNumber.output
+)set message test on
+)set message auto off
+)clear all
+--S 1 of 20
+c0 := 0 :: CardinalNumber
+--R 
+--R
+--R   (1)  0
+--R                                                         Type: CardinalNumber
+--E 1
+
+--S 2 of 20
+c1 := 1 :: CardinalNumber
+--R 
+--R
+--R   (2)  1
+--R                                                         Type: CardinalNumber
+--E 2
+
+--S 3 of 20
+c2 := 2 :: CardinalNumber
+--R 
+--R
+--R   (3)  2
+--R                                                         Type: CardinalNumber
+--E 3
+
+--S 4 of 20
+c3 := 3 :: CardinalNumber
+--R 
+--R
+--R   (4)  3
+--R                                                         Type: CardinalNumber
+--E 4
+
+--S 5 of 20
+A0 := Aleph 0
+--R 
+--R
+--R   (5)  Aleph(0)
+--R                                                         Type: CardinalNumber
+--E 5
+
+--S 6 of 20
+A1 := Aleph 1
+--R 
+--R
+--R   (6)  Aleph(1)
+--R                                                         Type: CardinalNumber
+--E 6
+
+--S 7 of 20
+finite? c2
+--R 
+--R
+--R   (7)  true
+--R                                                                Type: Boolean
+--E 7
+
+--S 8 of 20
+finite? A0
+--R 
+--R
+--R   (8)  false
+--R                                                                Type: Boolean
+--E 8
+
+--S 9 of 20
+countable? c2
+--R 
+--R
+--R   (9)  true
+--R                                                                Type: Boolean
+--E 9
+
+--S 10 of 20
+countable? A0
+--R 
+--R
+--R   (10)  true
+--R                                                                Type: Boolean
+--E 10
+
+--S 11 of 20
+countable? A1
+--R 
+--R
+--R   (11)  false
+--R                                                                Type: Boolean
+--E 11
+
+--S 12 of 20
+[c2 + c2, c2 + A1]
+--R 
+--R
+--R   (12)  [4,Aleph(1)]
+--R                                                    Type: List CardinalNumber
+--E 12
+
+--S 13 of 20
+[c0*c2, c1*c2, c2*c2, c0*A1, c1*A1, c2*A1, A0*A1]
+--R 
+--R
+--R   (13)  [0,2,4,0,Aleph(1),Aleph(1),Aleph(1)]
+--R                                                    Type: List CardinalNumber
+--E 13
+
+--S 14 of 20
+[c2**c0, c2**c1, c2**c2, A1**c0, A1**c1, A1**c2]
+--R 
+--R
+--R   (14)  [1,2,4,1,Aleph(1),Aleph(1)]
+--R                                                    Type: List CardinalNumber
+--E 14
+
+--S 15 of 20
+[c2-c1, c2-c2, c2-c3, A1-c2, A1-A0, A1-A1]
+--R 
+--R
+--R   (15)  [1,0,"failed",Aleph(1),Aleph(1),"failed"]
+--R                                    Type: List Union(CardinalNumber,"failed")
+--E 15
+
+--S 16 of 20
+generalizedContinuumHypothesisAssumed true
+--R 
+--R
+--R   (16)  true
+--R                                                                Type: Boolean
+--E 16
+
+--S 17 of 20
+[c0**A0, c1**A0, c2**A0, A0**A0, A0**A1, A1**A0, A1**A1]
+--R 
+--R
+--R   (17)  [0,1,Aleph(1),Aleph(1),Aleph(2),Aleph(1),Aleph(2)]
+--R                                                    Type: List CardinalNumber
+--E 17
+
+--S 18 of 20
+a := Aleph 0
+--R 
+--R
+--R   (18)  Aleph(0)
+--R                                                         Type: CardinalNumber
+--E 18
+
+--S 19 of 20
+c := 2**a
+--R 
+--R
+--R   (19)  Aleph(1)
+--R                                                         Type: CardinalNumber
+--E 19
+
+--S 20 of 20
+f := 2**c
+--R 
+--R
+--R   (20)  Aleph(2)
+--R                                                         Type: CardinalNumber
+--E 20
+)spool
+)lisp (bye)
+@
+<<CardinalNumber.help>>=
+====================================================================
+CardinalNumber examples
+====================================================================
+
+The CardinalNumber domain can be used for values indicating the
+cardinality of sets, both finite and infinite.  For example, the
+dimension operation in the category VectorSpace returns a cardinal
+number.
+
+The non-negative integers have a natural construction as cardinals
+
+  0 = #{ }, 1 = {0}, 2 = {0, 1}, ..., n = {i | 0 <= i < n}.
+
+The fact that 0 acts as a zero for the multiplication of cardinals is
+equivalent to the axiom of choice.
+
+Cardinal numbers can be created by conversion from non-negative integers.
+
+  c0 := 0 :: CardinalNumber
+   0 
+                      Type: CardinalNumber
+
+  c1 := 1 :: CardinalNumber
+   1 
+                      Type: CardinalNumber
+
+  c2 := 2 :: CardinalNumber
+   2 
+                      Type: CardinalNumber
+
+  c3 := 3 :: CardinalNumber
+   3 
+                      Type: CardinalNumber
+
+They can also be obtained as the named cardinal Aleph(n).
+
+  A0 := Aleph 0
+   Aleph(0)
+                      Type: CardinalNumber
+
+  A1 := Aleph 1
+   Aleph(1)
+                      Type: CardinalNumber
+
+The finite? operation tests whether a value is a finite cardinal, that
+is, a non-negative integer.
+
+  finite? c2
+   true
+                      Type: Boolean
+
+  finite? A0
+   false
+                      Type: Boolean
+
+Similarly, the countable?  operation determines whether a value is a
+countable cardinal, that is, finite or Aleph(0).
+
+  countable? c2
+   true
+                      Type: Boolean
+
+  countable? A0
+   true
+                      Type: Boolean
+
+  countable? A1
+   false
+                      Type: Boolean
+
+Arithmetic operations are defined on cardinal numbers as follows:
+If x = #X  and y = #Y then
+
+  x+y  = #(X+Y) cardinality of the disjoint union
+  x-y  = #(X-Y) cardinality of the relative complement
+  x*y  = #(X*Y) cardinality of the Cartesian product
+  x**y = #(X**Y) cardinality of the set of maps from Y to X
+
+Here are some arithmetic examples.
+
+  [c2 + c2, c2 + A1]
+   [4, Aleph(1)]
+                      Type: List CardinalNumber
+
+  [c0*c2, c1*c2, c2*c2, c0*A1, c1*A1, c2*A1, A0*A1]
+   [0, 2, 4, 0, Aleph(1), Aleph(1), Aleph(1)]
+                      Type: List CardinalNumber
+
+  [c2**c0, c2**c1, c2**c2, A1**c0, A1**c1, A1**c2]
+   [1, 2, 4, 1, Aleph(1), Aleph(1)]
+                      Type: List CardinalNumber
+
+Subtraction is a partial operation: it is not defined when subtracting
+a larger cardinal from a smaller one, nor when subtracting two equal
+infinite cardinals.
+
+  [c2-c1, c2-c2, c2-c3, A1-c2, A1-A0, A1-A1]
+   [1, 0, "failed", Aleph(1), Aleph(1), "failed"]
+                      Type: List Union(CardinalNumber,"failed")
+
+The generalized continuum hypothesis asserts that
+
+  2**Aleph i = Aleph(i+1)
+
+and is independent of the axioms of set theory.
+
+(reference: Goedel, The consistency of the continuum hypothesis,
+Ann. Math. Studies, Princeton Univ. Press, 1940.)
+
+The CardinalNumber domain provides an operation to assert whether the
+hypothesis is to be assumed.
+
+  generalizedContinuumHypothesisAssumed true
+   true
+                      Type: Boolean
+
+When the generalized continuum hypothesis is assumed, exponentiation
+to a transfinite power is allowed.
+
+  [c0**A0, c1**A0, c2**A0, A0**A0, A0**A1, A1**A0, A1**A1]
+   [0, 1, Aleph(1), Aleph(1), Aleph(2), Aleph(1), Aleph(2)]
+                      Type: List CardinalNumber
+
+Three commonly encountered cardinal numbers are
+
+  a = #Z countable infinity
+  c = #R the continuum
+  f = #{g| g: [0,1] -> R}
+
+In this domain, these values are obtained under the generalized
+continuum hypothesis in this way.
+
+  a := Aleph 0
+   Aleph(0)
+                      Type: CardinalNumber
+
+  c := 2**a
+   Aleph(1)
+                      Type: CardinalNumber
+
+  f := 2**c
+   Aleph(2)
+                      Type: CardinalNumber
+
+See Also:
+o )show CardinalNumber
+o $AXIOM/doc/src/algebra/card.spad.dvi
+
+@
+<<dot>>=
+"CARD" -> "ORDSET"
+"CardinalNumber()" -> "OrderedSet()"
+"CARD" -> "ABELMON"
+"CardinalNumber()" -> "AbelianMonoid()"
+"CARD" -> "MONOID"
+"CardinalNumber()" -> "Monoid()" 
+"CARD" -> "RETRACT"
+"CardinalNumber()" -> "RetractableTo(NonNegativeInteger)"
+@
+\pagehead{CardinalNumber}{CARD}
+\pagepic{ps/v103cardinalnumber.ps}{CARD}{1.00}
+<<domain CARD CardinalNumber>>=
+)abbrev domain CARD CardinalNumber
+++ Author: S.M. Watt
+++ Date Created: June 1986
+++ Date Last Updated: May 1990
+++ Basic Operations: Aleph, +, -, *, **
+++ Related Domains: 
+++ Also See:
+++ AMS Classifications:
+++ Keywords: cardinal number, transfinite arithmetic
+++ Examples:
+++ References:
+++   Goedel, "The consistency of the continuum hypothesis",
+++   Ann. Math. Studies, Princeton Univ. Press, 1940
+++ Description:
+++   Members of the domain CardinalNumber are values indicating the
+++   cardinality of sets, both finite and infinite.  Arithmetic operations
+++   are defined on cardinal numbers as follows.
+++
+++   If \spad{x = #X}  and  \spad{y = #Y} then
+++     \spad{x+y  = #(X+Y)}   \tab{30}disjoint union
+++     \spad{x-y  = #(X-Y)}   \tab{30}relative complement
+++     \spad{x*y  = #(X*Y)}   \tab{30}cartesian product
+++     \spad{x**y = #(X**Y)}  \tab{30}\spad{X**Y = \{g| g:Y->X\}}
+++
+++   The non-negative integers have a natural construction as cardinals
+++     \spad{0 = #\{\}}, \spad{1 = \{0\}}, \spad{2 = \{0, 1\}}, ..., \spad{n = \{i| 0 <= i < n\}}.
+++
+++   That \spad{0} acts as a zero for the multiplication of cardinals is
+++   equivalent to the axiom of choice.
+++
+++   The generalized continuum hypothesis asserts 
+++   \center{\spad{2**Aleph i = Aleph(i+1)}}
+++   and is independent of the axioms of set theory [Goedel 1940].
+++
+++   Three commonly encountered cardinal numbers are
+++      \spad{a = #Z}       \tab{30}countable infinity
+++      \spad{c = #R}       \tab{30}the continuum
+++      \spad{f = #\{g| g:[0,1]->R\}}
+++
+++   In this domain, these values are obtained using
+++      \spad{a := Aleph 0}, \spad{c := 2**a}, \spad{f := 2**c}.
+++
+CardinalNumber: Join(OrderedSet, AbelianMonoid, Monoid,
+                        RetractableTo NonNegativeInteger) with
+        commutative "*"
+            ++ a domain D has \spad{commutative("*")} if it has an operation
+            ++ \spad{"*": (D,D) -> D} which is commutative.
+
+        "-": (%,%) -> Union(%,"failed")
+            ++ \spad{x - y} returns an element z such that 
+            ++ \spad{z+y=x} or "failed" if no such element exists.
+            ++
+            ++X c2:=2::CardinalNumber
+            ++X c2-c2
+            ++X A1:=Aleph 1
+            ++X A1-c2
+
+        "**": (%, %) -> %
+            ++ \spad{x**y} returns \spad{#(X**Y)} where \spad{X**Y} is defined
+            ++  as \spad{\{g| g:Y->X\}}.
+            ++
+            ++X c2:=2::CardinalNumber
+            ++X c2**c2
+            ++X A1:=Aleph 1
+            ++X A1**c2
+            ++X generalizedContinuumHypothesisAssumed true
+            ++X A1**A1
+
+        Aleph: NonNegativeInteger -> %
+            ++ Aleph(n) provides the named (infinite) cardinal number.
+            ++
+            ++X A0:=Aleph 0
+
+        finite?: % -> Boolean
+            ++ finite?(\spad{a}) determines whether 
+            ++ \spad{a} is a finite cardinal, i.e. an integer.
+            ++
+            ++X c2:=2::CardinalNumber
+            ++X finite? c2
+            ++X A0:=Aleph 0
+            ++X finite? A0
+
+        countable?: % -> Boolean
+            ++ countable?(\spad{a}) determines 
+            ++ whether \spad{a} is a countable cardinal,
+            ++ i.e. an integer or \spad{Aleph 0}.
+            ++
+            ++X c2:=2::CardinalNumber
+            ++X countable? c2
+            ++X A0:=Aleph 0
+            ++X countable? A0
+            ++X A1:=Aleph 1
+            ++X countable? A1
+
+        generalizedContinuumHypothesisAssumed?: () -> Boolean
+            ++ generalizedContinuumHypothesisAssumed?()
+            ++ tests if the hypothesis is currently assumed.
+            ++
+            ++X generalizedContinuumHypothesisAssumed?
+
+        generalizedContinuumHypothesisAssumed:  Boolean -> Boolean
+            ++ generalizedContinuumHypothesisAssumed(bool)
+            ++ is used to dictate whether the hypothesis is to be assumed.
+            ++
+            ++X generalizedContinuumHypothesisAssumed true
+            ++X a:=Aleph 0
+            ++X c:=2**a
+            ++X f:=2**c
+    == add
+        NNI ==> NonNegativeInteger
+        FINord   ==> -1
+        DUMMYval ==> -1
+ 
+        Rep := Record(order: Integer, ival: Integer)
+ 
+        GCHypothesis: Reference(Boolean) := ref false
+ 
+        -- Creation
+        0           == [FINord, 0]
+        1           == [FINord, 1]
+        coerce(n:NonNegativeInteger):% == [FINord, n]
+        Aleph n     == [n, DUMMYval]
+ 
+        -- Output
+        ALEPHexpr := "Aleph"::OutputForm
+ 
+        coerce(x: %): OutputForm ==
+            x.order = FINord => (x.ival)::OutputForm
+            prefix(ALEPHexpr, [(x.order)::OutputForm])
+ 
+        -- Manipulation
+        x = y ==
+            x.order ^= y.order => false
+            finite? x          => x.ival = y.ival
+            true     -- equal transfinites
+        x < y ==
+            x.order < y.order => true
+            x.order > y.order => false
+            finite? x         => x.ival < y.ival
+            false    -- equal transfinites
+        x:% + y:% ==
+            finite? x and finite? y => [FINord, x.ival+y.ival]
+            max(x, y)
+        x - y ==
+            x < y     => "failed"
+            finite? x => [FINord, x.ival-y.ival]
+            x > y     => x
+            "failed" -- equal transfinites
+        x:% * y:% ==
+            finite? x and finite? y => [FINord, x.ival*y.ival]
+            x = 0 or y = 0          => 0
+            max(x, y)
+        n:NonNegativeInteger * x:% ==
+            finite? x => [FINord, n*x.ival]
+            n = 0     => 0
+            x
+        x**y ==
+            y = 0 =>
+                x ^= 0 => 1
+                error "0**0 not defined for cardinal numbers."
+            finite? y =>
+                not finite? x => x
+                [FINord,x.ival**(y.ival):NNI]
+            x = 0 => 0
+            x = 1 => 1
+            GCHypothesis() => [max(x.order-1, y.order) + 1, DUMMYval]
+            error "Transfinite exponentiation only implemented under GCH"
+ 
+        finite? x    == x.order = FINord
+        countable? x == x.order < 1
+ 
+        retract(x:%):NonNegativeInteger ==
+          finite? x => (x.ival)::NNI
+          error "Not finite"
+ 
+        retractIfCan(x:%):Union(NonNegativeInteger, "failed") ==
+          finite? x => (x.ival)::NNI
+          "failed"
+ 
+        -- State manipulation
+        generalizedContinuumHypothesisAssumed?() == GCHypothesis()
+        generalizedContinuumHypothesisAssumed b == (GCHypothesis() := b)
+
+@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain CLIF CliffordAlgebra\cite{7,12}}
+\subsection{Vector (linear) spaces}
+This information is originally from Paul Leopardi's presentation on
+the {\sl Introduction to Clifford Algebras} and is included here as
+an outline with his permission. Further details are based on the book
+by Doran and Lasenby called {\sl Geometric Algebra for Physicists}.
+
+Consider the various kinds of products that can occur between vectors.
+There are scalar and vector products from 3D geometry. There are the
+complex and quaterion products. There is also
+the {\sl outer} or {\sl exterior} product.
+
+Vector addition commutes:
+\[a + b = b + a\]
+Vector addtion is associative:
+\[a + (b + c) = (a + b) + c\]
+The identity vector exists:
+\[a + 0 = a\]
+Every vector has an inverse:
+\[a + (-a) = 0\]
+
+If we consider vectors to be directed line segments, thus establishing
+a geometric meaning for a vector, then each of these properties has a
+geometric meaning.
+
+A multiplication operator exists between scalars and vectors with
+the properties:
+\[\lambda(a + b) = \lambda a + \lambda b\]
+\[(\lambda + \mu)a = \lambda a + \mu a\]
+\[(\lambda\mu)a = \lambda(\mu a)\]
+\[{\rm If\ }1\lambda = \lambda{\rm\ for\ all\ scalars\ }\lambda
+{\rm\ then\ }1a=a{\rm\ for\ all\ vectors\ }a\]
+
+These properties completely define a vector (linear) space. The
+$+$ operation for scalar arithmetic is not the same as the $+$
+operation for vectors.
+
+{\bf Definition: Isomorphic} The vector space $A$ is isomorphic to
+the vector space $B$ if their exists a one-to-one correspondence
+between their elements which preserves sums and there is a one-to-one
+correspondence between the scalars which preserves sums and products.
+
+{\bf Definition: Subspace} Vector space $B$ is a subspace of vector
+space $A$ if all of the elements of $B$ are contained in $A$ and
+they share the same scalars.
+
+{\bf Definition: Linear Combination} Given vectors $a_1,\ldots,a_n$
+the vector $b$ is a linear combination of the vectors if we can find
+scalars $\lambda_i$ such that
+\[b = \lambda_1 a_1+\ldots+\lambda_n a_n = \sum_{k=1}^n \lambda_i a_i\]
+
+{\bf Definition: Linearly Independent} If there exists scalars $\lambda_i$
+such that
+\[\lambda_1 a_1 + \ldots + \lambda_n a_n = 0\]
+and at least one of the $\lambda_i$ is not zero
+then the vectors $a_1,\ldots,a_n$ are linearly dependent. If no such
+scalars exist then the vectors are linearly independent.
+
+{\bf Definition: Span} If every vector can be written as a linear
+combination of a fixed set of vectors $a_1,\ldots,a_n$ then this set
+of vectors is said to span the vector space.
+
+{\bf Definition: Basis} If a set of vectors $a_1,\ldots,a_n$ is linearly
+independent and spans a vector space $A$ then the vectors form a basis
+for $A$.
+
+{\bf Definition: Dimension} The dimension of a vector space is the 
+number of basis elements, which is unique since all bases of a 
+vector space have the same number of elements.
+\subsection{Quadratic Forms\cite{1}}
+For vector space $\mathbb{V}$ over field $\mathbb{F}$, characteristic 
+$\ne 2$:
+\begin{list}{}
+\item Map $f:\mathbb{V} \rightarrow \mathbb{F}$, with
+$$f(\lambda x)=\lambda^2f(x),\forall \lambda \in \mathbb{F}, x \in \mathbb{V}$$
+\item $f(x) = b(x,x)$, where
+$$b:\mathbb{V}{\rm\ x\ }\mathbb{V} \rightarrow \mathbb{F}{\rm\ ,given\ by\ }$$
+$$b(x,y):=\frac{1}{2}(f(x+y)-f(x)=f(y))$$
+is a symmetric bilinear form
+\end{list}
+\subsection{Quadratic spaces, Clifford Maps\cite{1,2}}
+\begin{list}{}
+\item A quadratic space is the pair($\mathbb{V}$,$f$), where $f$ is a 
+quadratic form on $\mathbb{V}$
+\item A Clifford map is a vector space homomorphism
+$$\rho : \mathbb{V} \rightarrow \mathbb{A}$$
+where $\mathbb{A}$ is an associated algebra, and
+$$(\rho v)^2 = f(v),{\rm\ \ \ } \forall v \in \mathbb{V}$$
+\end{list}
+\subsection{Universal Clifford algebras\cite{1}}
+\begin{list}{}
+\item The {\sl universal Clifford algebra} $Cl(f)$ for the quadratic space
+$(\mathbb{V},f)$ is the algebra generated by the image of the Clifford
+map $\phi_f$ such that $Cl(f)$ is the universal initial object such
+that $\forall$ suitable algebra $\mathbb{A}$ with Clifford map
+$\phi_{\mathbb{A}} \exists$ a homomorphism
+$$P_\mathbb{A}:Cl(f) \rightarrow \mathbb{A}$$
+$$\rho_\mathbb{A} = P_\mathbb{A}\circ\rho_f$$
+\end{list}
+\subsection{Real Clifford algebras $\mathbb{R}_{p,q}$\cite{2}}
+\begin{list}{}
+\item The real quadratic space $\mathbb{R}^{p,q}$ is $\mathbb{R}^{p+q}$ with
+$$\phi(x):=-\sum_{k:=-q}^{-1}{x_k^2}+\sum_{k=1}^p{x_k^2}$$
+\item For each $p,q \in \mathbb{N}$, the real universal Clifford algebra
+for $\mathbb{R}^{p,q}$ is called $\mathbb{R}_{p,q}$
+\item $\mathbb{R}_{p,q}$ is isomorphic to some matrix algebra over one of:
+$\mathbb{R}$,$\mathbb{R}\oplus\mathbb{R}$,$\mathbb{C}$,
+$\mathbb{H}$,$\mathbb{H}\oplus\mathbb{H}$ 
+\item For example, $\mathbb{R}_{1,1} \cong \mathbb{R}(2)$ 
+\end{list}
+\subsection{Notation for integer sets}
+\begin{list}{}
+\item For $S \subseteq \mathbb{Z}$, define
+$$\sum_{k \in S}{f_k}:=\sum_{k={\rm min\ }S, k \in S}^{{\rm max\ } S}{f_k}$$
+$$\prod_{k \in S}{f_k}:=\prod_{k={\rm min\ }S, k \in S}^{{\rm max\ } S}{f_k}$$
+$$\mathbb{P}(S):={\rm\ the\ }\ power\ set\ {\rm\ of\ }S$$
+\item For $m \le n \in \mathbb{Z}$, define
+$$\zeta(m,n):=\{m,m+1,\ldots,n-1,n\}\backslash\{0\}$$
+\end{list}
+\subsection{Frames for Clifford algebras\cite{9,10,11}}
+\begin{list}{}
+\item A {\sl frame} is an ordered basis $(\gamma_{-q},\ldots,\gamma_p)$
+for $\mathbb{R}^{p,q}$ which puts a quadratic form into the canonical
+form $\phi$
+\item For $p,q \in \mathbb{N}$, embed the frame for $\mathbb{R}^{p,q}$
+into $\mathbb{R}_{p,q}$ via the maps
+$$\gamma:\zeta(-q,p) \rightarrow \mathbb{R}^{p,q}$$
+$$\rho:\mathbb{R}^{p,q} \rightarrow \mathbb{R}_{p,q}$$
+$$(\rho\gamma k)^2 = \phi\gamma k = {\rm\ sgn\ }k$$
+\end{list}
+\subsection{Real frame groups\cite{5,6}}
+\begin{list}{}
+\item For $p,q \in \mathbb{N}$, define the real {\sl frame group} $\mathbb{G}_{p,q}$
+via the map
+$$g:\zeta(-q,p) \rightarrow \mathbb{G}_{p,q}$$
+with generators and relations
+$$\langle \mu,g_k | \mu g_k = g_k \mu,{\rm\ \ \ }\mu^2 = 1,$$
+$$(g_k)^2 = 
+\left\{
+\begin{array}{lcc}
+\mu,&{\rm\ \ }&{\rm\ if\ }k < 0\\
+1&{\rm\ \ }&{\rm\ if\ }k > 0
+\end{array}
+\right.$$
+$$g_kg_m = \mu g_mg_k{\rm\ \ \ }\forall k \ne m\rangle$$
+\end{list}
+\subsection{Canonical products\cite{1,3,4}}
+\begin{list}{}
+\item The real frame group $\mathbb{G}_{p,q}$ has order $2^{p+q+1}$
+\item Each member $w$ can be expressed as the canonically ordered product
+$$w=\mu^a\prod_{k \in T}{g_k}$$
+$$\ =\mu^a\prod_{k=-q,k\ne0}^p{g_k^{b_k}}$$
+where $T \subseteq \zeta(-q,p),a,b_k \in \{0,1\}$
+\end{list}
+\subsection{Clifford algebra of frame group\cite{1,4,5,6}}
+\begin{list}{}
+\item For $p,q \in \mathbb{N}$ embed $\mathbb{G}_{p,q}$ into 
+$\mathbb{R}_{p,q}$ via the map
+$$\alpha  \mathbb{G}_{p,q} \rightarrow \mathbb{R}_{p,q}$$
+$$\alpha 1 := 1,{\rm\ \ \ \ \ } \alpha\mu := -1$$
+$$\alpha g_k := \rho\gamma_k, {\rm \ \ \ \ \ }
+\alpha(gh) := (\alpha g)(\alpha h)$$
+\item Define {\sl basis elements} via the map
+$$e:\mathbb{P}\zeta(-q,p) \rightarrow \mathbb{R}_{p,q}, 
+{\rm \ \ \ \ \ }e_T := \alpha \prod_{k \in T}{g_k}$$
+\item Each $a \in \mathbb{R}_{p,q}$ can be expressed as
+$$a = \sum_{T \subseteq \zeta(-q,p)}{a_T e_T}$$
+\end{list} 
+\subsection{Neutral matrix representations\cite{1,2,8}}
+The {\sl representation map} $P_m$ and {\sl representation matrix} $R_m$
+make the following diagram commute:
+\begin{tabular}{ccc}
+               &   coord   &           \\
+$\mathbb{R}_{m,m}$      & --------$>$ & $\mathbb{R}^{4^m}$ \\
+    $|$          &           &    $|$      \\
+    $|$          &           &    $|$      \\
+  $P_m$        &           &  $R_m$    \\ 
+    $|$          &           &    $|$      \\
+    $|$          &           &    $|$      \\
+    V          &           &    V      \\
+ $\mathbb{R}(2^m)$      & --------$>$ &  $\mathbb{R}^{4^m}$\\
+               &  reshape  &           \\
+\end{tabular}
+<<CliffordAlgebra.input>>=
+-- clifford.spad.pamphlet CliffordAlgebra.input
+)spool CliffordAlgebra.output
+)set message test on
+)set message auto off
+)clear all
+--S 1 of 36
+K := Fraction Polynomial Integer
+--R 
+--R
+--R   (1)  Fraction Polynomial Integer
+--R                                                                 Type: Domain
+--E 1
+
+--S 2 of 36
+m := matrix [ [-1] ]
+--R 
+--R
+--R   (2)  [- 1]
+--R                                                         Type: Matrix Integer
+--E 2
+
+--S 3 of 36
+C := CliffordAlgebra(1, K, quadraticForm m)
+--R 
+--R
+--R   (3)  CliffordAlgebra(1,Fraction Polynomial Integer,MATRIX)
+--R                                                                 Type: Domain
+--E 3
+
+--S 4 of 36
+i: C := e(1)
+--R 
+--R
+--R   (4)  e
+--R         1
+--R                  Type: CliffordAlgebra(1,Fraction Polynomial Integer,MATRIX)
+--E 4
+
+--S 5 of 36
+x := a + b * i
+--R 
+--R
+--R   (5)  a + b e
+--R               1
+--R                  Type: CliffordAlgebra(1,Fraction Polynomial Integer,MATRIX)
+--E 5
+
+--S 6 of 36
+y := c + d * i
+--R 
+--R
+--R   (6)  c + d e
+--R               1
+--R                  Type: CliffordAlgebra(1,Fraction Polynomial Integer,MATRIX)
+--E 6
+
+--S 7 of 36
+x * y
+--R 
+--R
+--R   (7)  - b d + a c + (a d + b c)e
+--R                                  1
+--R                  Type: CliffordAlgebra(1,Fraction Polynomial Integer,MATRIX)
+--E 7
+)clear all
+ 
+--S 8 of 36
+K := Fraction Polynomial Integer
+--R 
+--R
+--R   (1)  Fraction Polynomial Integer
+--R                                                                 Type: Domain
+--E 8
+
+--S 9 of 36
+m := matrix [ [-1,0],[0,-1] ]
+--R 
+--R
+--R        +- 1   0 +
+--R   (2)  |        |
+--R        + 0   - 1+
+--R                                                         Type: Matrix Integer
+--E 9
+
+--S 10 of 36
+H  := CliffordAlgebra(2, K, quadraticForm m)
+--R 
+--R
+--R   (3)  CliffordAlgebra(2,Fraction Polynomial Integer,MATRIX)
+--R                                                                 Type: Domain
+--E 10
+
+--S 11 of 36
+i: H  := e(1)
+--R 
+--R
+--R   (4)  e
+--R         1
+--R                  Type: CliffordAlgebra(2,Fraction Polynomial Integer,MATRIX)
+--E 11
+
+--S 12 of 36
+j: H  := e(2)
+--R 
+--R
+--R   (5)  e
+--R         2
+--R                  Type: CliffordAlgebra(2,Fraction Polynomial Integer,MATRIX)
+--E 12
+
+--S 13 of 36
+k: H  := i * j
+--R 
+--R
+--R   (6)  e e
+--R         1 2
+--R                  Type: CliffordAlgebra(2,Fraction Polynomial Integer,MATRIX)
+--E 13
+
+--S 14 of 36
+x := a + b * i + c * j + d * k
+--R 
+--R
+--R   (7)  a + b e  + c e  + d e e
+--R               1      2      1 2
+--R                  Type: CliffordAlgebra(2,Fraction Polynomial Integer,MATRIX)
+--E 14
+
+--S 15 of 36
+y := e + f * i + g * j + h * k 
+--R 
+--R
+--R   (8)  e + f e  + g e  + h e e
+--R               1      2      1 2
+--R                  Type: CliffordAlgebra(2,Fraction Polynomial Integer,MATRIX)
+--E 15
+
+--S 16 of 36
+x + y
+--R 
+--R
+--R   (9)  e + a + (f + b)e  + (g + c)e  + (h + d)e e
+--R                        1           2           1 2
+--R                  Type: CliffordAlgebra(2,Fraction Polynomial Integer,MATRIX)
+--E 16
+
+--S 17 of 36
+x * y
+--R 
+--R
+--R   (10)
+--R     - d h - c g - b f + a e + (c h - d g + a f + b e)e
+--R                                                       1
+--R   + 
+--R     (- b h + a g + d f + c e)e  + (a h + b g - c f + d e)e e
+--R                               2                           1 2
+--R                  Type: CliffordAlgebra(2,Fraction Polynomial Integer,MATRIX)
+--E 17
+
+--S 18 of 36
+y * x
+--R 
+--R
+--R   (11)
+--R     - d h - c g - b f + a e + (- c h + d g + a f + b e)e
+--R                                                         1
+--R   + 
+--R     (b h + a g - d f + c e)e  + (a h - b g + c f + d e)e e
+--R                             2                           1 2
+--R                  Type: CliffordAlgebra(2,Fraction Polynomial Integer,MATRIX)
+--E 18
+)clear all
+ 
+--S 19 of 36
+K := Fraction Polynomial Integer
+--R 
+--R
+--R   (1)  Fraction Polynomial Integer
+--R                                                                 Type: Domain
+--E 19
+
+--S 20 of 36
+Ext := CliffordAlgebra(3, K, quadraticForm 0)
+--R 
+--R
+--R   (2)  CliffordAlgebra(3,Fraction Polynomial Integer,MATRIX)
+--R                                                                 Type: Domain
+--E 20
+
+--S 21 of 36
+i: Ext := e(1)
+--R 
+--R
+--R   (3)  e
+--R         1
+--R                  Type: CliffordAlgebra(3,Fraction Polynomial Integer,MATRIX)
+--E 21
+
+--S 22 of 36
+j: Ext := e(2)
+--R 
+--R
+--R   (4)  e
+--R         2
+--R                  Type: CliffordAlgebra(3,Fraction Polynomial Integer,MATRIX)
+--E 22
+
+--S 23 of 36
+k: Ext := e(3)
+--R 
+--R
+--R   (5)  e
+--R         3
+--R                  Type: CliffordAlgebra(3,Fraction Polynomial Integer,MATRIX)
+--E 23
+
+--S 24 of 36
+x := x1*i + x2*j + x3*k
+--R 
+--R
+--R   (6)  x1 e  + x2 e  + x3 e
+--R            1       2       3
+--R                  Type: CliffordAlgebra(3,Fraction Polynomial Integer,MATRIX)
+--E 24
+
+--S 25 of 36
+y := y1*i + y2*j + y3*k
+--R 
+--R
+--R   (7)  y1 e  + y2 e  + y3 e
+--R            1       2       3
+--R                  Type: CliffordAlgebra(3,Fraction Polynomial Integer,MATRIX)
+--E 25
+
+--S 26 of 36
+x + y
+--R 
+--R
+--R   (8)  (y1 + x1)e  + (y2 + x2)e  + (y3 + x3)e
+--R                  1             2             3
+--R                  Type: CliffordAlgebra(3,Fraction Polynomial Integer,MATRIX)
+--E 26
+
+--S 27 of 36
+x * y + y * x
+--R 
+--R
+--R   (9)  0
+--R                  Type: CliffordAlgebra(3,Fraction Polynomial Integer,MATRIX)
+--E 27
+
+--S 28 of 36
+dual2 a == coefficient(a,[2,3]) * i + coefficient(a,[3,1]) * j + coefficient(a,[1,2]) * k 
+--R 
+--R                                                                   Type: Void
+--E 28
+
+--S 29 of 36
+dual2(x*y)
+--R 
+--R   Compiling function dual2 with type CliffordAlgebra(3,Fraction 
+--R      Polynomial Integer,MATRIX) -> CliffordAlgebra(3,Fraction 
+--R      Polynomial Integer,MATRIX) 
+--R
+--R   (11)  (x2 y3 - x3 y2)e  + (- x1 y3 + x3 y1)e  + (x1 y2 - x2 y1)e
+--R                         1                     2                   3
+--R                  Type: CliffordAlgebra(3,Fraction Polynomial Integer,MATRIX)
+--E 29
+)clear all
+ 
+--S 30 of 36
+K := Fraction Integer
+--R 
+--R
+--R   (1)  Fraction Integer
+--R                                                                 Type: Domain
+--E 30
+
+--S 31 of 36
+g := matrix [ [1,0,0,0], [0,-1,0,0], [0,0,-1,0], [0,0,0,-1] ]
+--R 
+--R
+--R        +1   0    0    0 +
+--R        |                |
+--R        |0  - 1   0    0 |
+--R   (2)  |                |
+--R        |0   0   - 1   0 |
+--R        |                |
+--R        +0   0    0   - 1+
+--R                                                         Type: Matrix Integer
+--E 31
+
+--S 32 of 36
+D := CliffordAlgebra(4,K, quadraticForm g)
+--R 
+--R
+--R   (3)  CliffordAlgebra(4,Fraction Integer,MATRIX)
+--R                                                                 Type: Domain
+--E 32
+
+--S 33 of 36
+gam := [e(i)$D for i in 1..4]
+--R 
+--R
+--R   (4)  [e ,e ,e ,e ]
+--R          1  2  3  4
+--R                        Type: List CliffordAlgebra(4,Fraction Integer,MATRIX)
+--E 33
+
+--S 34 of 36
+m := 1; n:= 2; r := 3; s := 4;
+--R 
+--R
+--R                                                        Type: PositiveInteger
+--E 34
+
+--S 35 of 36
+lhs := reduce(+, [reduce(+, [ g(l,t)*gam(l)*gam(m)*gam(n)*gam(r)*gam(s)*gam(t) for l in 1..4]) for t in 1..4])
+--R 
+--R
+--R   (6)  - 4e e e e
+--R            1 2 3 4
+--R                             Type: CliffordAlgebra(4,Fraction Integer,MATRIX)
+--E 35
+
+--S 36 of 36
+rhs := 2*(gam s * gam m*gam n*gam r + gam r*gam n*gam m*gam s) 
+--R 
+--R
+--R   (7)  - 4e e e e
+--R            1 2 3 4
+--R                             Type: CliffordAlgebra(4,Fraction Integer,MATRIX)
+--E 36
+)spool
+)lisp (bye)
+@
+<<CliffordAlgebra.help>>=
+====================================================================
+CliffordAlgebra examples
+====================================================================
+
+CliffordAlgebra(n,K,Q) defines a vector space of dimension 2^n over
+the field K with a given quadratic form Q.  If {e1..en} is a basis for
+K^n then
+
+
+{ 1,
+  e(i)         1 <= i <= n,
+  e(i1)*e(i2)  1 <= i1 < i2 <=n,
+  ...,
+  e(1)*e(2)*...*e(n) }
+
+is a basis for the Clifford algebra. The algebra is defined by the relations
+
+  e(i)*e(i) = Q(e(i))
+  e(i)*e(j) = -e(j)*e(i),  for i ^= j
+
+Examples of Clifford Algebras are gaussians (complex numbers),
+quaternions, exterior algebras and spin algebras.
+
+====================================================================
+The Complex Numbers as a Clifford Algebra
+====================================================================
+
+This is the field over which we will work, rational functions with
+integer coefficients.
+
+  K := Fraction Polynomial Integer
+   Fraction Polynomial Integer
+                         Type: Domain
+
+We use this matrix for the quadratic form.
+
+  m := matrix [ [-1] ]
+   [- 1]
+                         Type: Matrix Integer
+
+We get complex arithmetic by using this domain.
+
+  C := CliffordAlgebra(1, K, quadraticForm m)
+   CliffordAlgebra(1,Fraction Polynomial Integer,MATRIX)
+                         Type: Domain
+
+Here is i, the usual square root of -1.
+
+  i: C := e(1)
+   e
+    1
+               Type: CliffordAlgebra(1,Fraction Polynomial Integer,MATRIX)
+
+Here are some examples of the arithmetic.
+
+  x := a + b * i
+   a + b e
+          1
+               Type: CliffordAlgebra(1,Fraction Polynomial Integer,MATRIX)
+
+  y := c + d * i
+   c + d e
+          1
+               Type: CliffordAlgebra(1,Fraction Polynomial Integer,MATRIX)
+
+  x * y
+   - b d + a c + (a d + b c)e
+                             1
+               Type: CliffordAlgebra(1,Fraction Polynomial Integer,MATRIX)
+
+====================================================================
+The Quaternion Numbers as a Clifford Algebra
+====================================================================
+
+This is the field over which we will work, rational functions with
+integer coefficients.
+
+  K := Fraction Polynomial Integer
+   Fraction Polynomial Integer
+                      Type: Domain
+
+We use this matrix for the quadratic form.
+
+  m := matrix [ [-1,0],[0,-1] ]
+   +- 1   0 +
+   |        |
+   + 0   - 1+
+                      Type: Matrix Integer
+
+The resulting domain is the quaternions.
+
+  H  := CliffordAlgebra(2, K, quadraticForm m)
+   CliffordAlgebra(2,Fraction Polynomial Integer,MATRIX)
+                      Type: Domain
+
+We use Hamilton's notation for i, j, k.
+
+  i: H  := e(1)
+   e
+    1
+              Type: CliffordAlgebra(2,Fraction Polynomial Integer,MATRIX)
+
+  j: H  := e(2)
+   e
+    2
+              Type: CliffordAlgebra(2,Fraction Polynomial Integer,MATRIX)
+
+  k: H  := i * j
+   e e
+    1 2
+              Type: CliffordAlgebra(2,Fraction Polynomial Integer,MATRIX)
+
+  x := a + b * i + c * j + d * k
+   a + b e  + c e  + d e e
+          1      2      1 2
+              Type: CliffordAlgebra(2,Fraction Polynomial Integer,MATRIX)
+
+  y := e + f * i + g * j + h * k 
+   e + f e  + g e  + h e e
+          1      2      1 2
+              Type: CliffordAlgebra(2,Fraction Polynomial Integer,MATRIX)
+
+  x + y
+   e + a + (f + b)e  + (g + c)e  + (h + d)e e
+                   1           2           1 2
+              Type: CliffordAlgebra(2,Fraction Polynomial Integer,MATRIX)
+
+  x * y
+   - d h - c g - b f + a e + (c h - d g + a f + b e)e
+                                                     1
+   + 
+     (- b h + a g + d f + c e)e  + (a h + b g - c f + d e)e e
+                               2                           1 2
+              Type: CliffordAlgebra(2,Fraction Polynomial Integer,MATRIX)
+
+  y * x
+   - d h - c g - b f + a e + (- c h + d g + a f + b e)e
+                                                       1
+   + 
+     (b h + a g - d f + c e)e  + (a h - b g + c f + d e)e e
+                             2                           1 2
+                  Type: CliffordAlgebra(2,Fraction Polynomial Integer,MATRIX)
+
+====================================================================
+The Exterior Algebra on a Three Space
+====================================================================
+
+This is the field over which we will work, rational functions with
+integer coefficients.
+
+  K := Fraction Polynomial Integer
+   Fraction Polynomial Integer
+                  Type: Domain
+
+If we chose the three by three zero quadratic form, we obtain
+the exterior algebra on e(1),e(2),e(3).
+
+  Ext := CliffordAlgebra(3, K, quadraticForm 0)
+   CliffordAlgebra(3,Fraction Polynomial Integer,MATRIX)
+                  Type: Domain
+
+This is a three dimensional vector algebra.  We define i, j, k as the
+unit vectors.
+
+  i: Ext := e(1)
+   e
+    1
+             Type: CliffordAlgebra(3,Fraction Polynomial Integer,MATRIX)
+
+  j: Ext := e(2)
+   e
+    2
+             Type: CliffordAlgebra(3,Fraction Polynomial Integer,MATRIX)
+
+  k: Ext := e(3)
+   e
+    3
+             Type: CliffordAlgebra(3,Fraction Polynomial Integer,MATRIX)
+
+Now it is possible to do arithmetic.
+
+  x := x1*i + x2*j + x3*k
+   x1 e  + x2 e  + x3 e
+       1       2       3
+             Type: CliffordAlgebra(3,Fraction Polynomial Integer,MATRIX)
+
+  y := y1*i + y2*j + y3*k
+   y1 e  + y2 e  + y3 e
+       1       2       3
+             Type: CliffordAlgebra(3,Fraction Polynomial Integer,MATRIX)
+
+  x + y
+   (y1 + x1)e  + (y2 + x2)e  + (y3 + x3)e
+             1             2             3
+             Type: CliffordAlgebra(3,Fraction Polynomial Integer,MATRIX)
+
+  x * y + y * x
+   0
+             Type: CliffordAlgebra(3,Fraction Polynomial Integer,MATRIX)
+
+On an n space, a grade p form has a dual n-p form.  In particular, in
+three space the dual of a grade two element identifies 
+ 
+  e1*e2 -> e3, e2*e3 -> e1, e3*e1 -> e2.
+
+  dual2 a == coefficient(a,[2,3]) * i + coefficient(a,[3,1]) * j + coefficient(a,[1,2]) * k 
+                      Type: Void
+
+The vector cross product is then given by this.
+
+  dual2(x*y)
+   (x2 y3 - x3 y2)e  + (- x1 y3 + x3 y1)e  + (x1 y2 - x2 y1)e
+                   1                     2                   3
+           Type: CliffordAlgebra(3,Fraction Polynomial Integer,MATRIX)
+
+====================================================================
+The Dirac Spin Algebra
+====================================================================
+
+In this section we will work over the field of rational numbers.
+
+  K := Fraction Integer
+   Fraction Integer
+                       Type: Domain
+
+We define the quadratic form to be the Minkowski space-time metric.
+
+  g := matrix [ [1,0,0,0], [0,-1,0,0], [0,0,-1,0], [0,0,0,-1] ]
+   +1   0    0    0 +
+   |                |
+   |0  - 1   0    0 |
+   |                |
+   |0   0   - 1   0 |
+   |                |
+   +0   0    0   - 1+
+                       Type: Matrix Integer
+
+We obtain the Dirac spin algebra used in Relativistic Quantum Field Theory.
+
+  D := CliffordAlgebra(4,K, quadraticForm g)
+   CliffordAlgebra(4,Fraction Integer,MATRIX)
+                       Type: Domain
+
+The usual notation for the basis is gamma with a superscript.  For
+Axiom input we will use gam(i):
+
+  gam := [e(i)$D for i in 1..4]
+   [e ,e ,e ,e ]
+     1  2  3  4
+                 Type: List CliffordAlgebra(4,Fraction Integer,MATRIX)
+
+There are various contraction identities of the form
+
+  g(l,t)*gam(l)*gam(m)*gam(n)*gam(r)*gam(s)*gam(t) =
+      2*(gam(s)gam(m)gam(n)gam(r) + gam(r)*gam(n)*gam(m)*gam(s))
+
+where a sum over l and t is implied.
+
+Verify this identity for particular values of m,n,r,s.
+
+  m := 1; n:= 2; r := 3; s := 4;
+                      Type: PositiveInteger
+
+  lhs := reduce(+, [reduce(+, [ g(l,t)*gam(l)*gam(m)*gam(n)*gam(r)*gam(s)*gam(t) for l in 1..4]) for t in 1..4])
+   - 4e e e e
+       1 2 3 4
+                      Type: CliffordAlgebra(4,Fraction Integer,MATRIX)
+
+  rhs := 2*(gam s * gam m*gam n*gam r + gam r*gam n*gam m*gam s) 
+   - 4e e e e
+       1 2 3 4
+                      Type: CliffordAlgebra(4,Fraction Integer,MATRIX)
+
+See Also:
+o )help Complex
+o )help Quaternion
+o )show CliffordAlgebra
+o $AXIOM/doc/src/algebra/clifford.spad
+
+@
+<<dot>>=
+"CLIF" -> "RING"
+"CliffordAlgebra(a:PositiveInteger,b:Field,c:QuadraticForm(a,b))" ->
+    "Ring()"
+"CLIF" -> "ALGEBRA"
+"CliffordAlgebra(a:PositiveInteger,b:Field,c:QuadraticForm(a,b))" ->
+    "Algebra(a:Field)"
+"CLIF" -> "VSPACE"
+"CliffordAlgebra(a:PositiveInteger,b:Field,c:QuadraticForm(a,b))" ->
+    "VectorSpace(a:Field)"
+@
+\pagehead{CliffordAlgebra}{CLIF}
+\pagepic{ps/v103cliffordalgebra.ps}{CLIF}{1.00}
+<<domain CLIF CliffordAlgebra>>=
+)abbrev domain CLIF CliffordAlgebra
+++ Author: Stephen M. Watt
+++ Date Created: August 1988
+++ Date Last Updated: May 17, 1991
+++ Basic Operations: wholeRadix, fractRadix, wholeRagits, fractRagits
+++ Related Domains: QuadraticForm, Quaternion, Complex
+++ Also See:
+++ AMS Classifications:
+++ Keywords: clifford algebra, grassman algebra, spin algebra
+++ Examples:
+++ References:
+++
+++ Description:
+++  CliffordAlgebra(n, K, Q) defines a vector space of dimension \spad{2**n}
+++  over K, given a quadratic form Q on \spad{K**n}.
+++
+++  If \spad{e[i]}, \spad{1<=i<=n} is a basis for \spad{K**n} then
+++     1, \spad{e[i]} (\spad{1<=i<=n}), \spad{e[i1]*e[i2]} 
+++  (\spad{1<=i1<i2<=n}),...,\spad{e[1]*e[2]*..*e[n]}
+++  is a basis for the Clifford Algebra.
+++
+++  The algebra is defined by the relations
+++     \spad{e[i]*e[j] = -e[j]*e[i]}  (\spad{i \~~= j}),
+++     \spad{e[i]*e[i] = Q(e[i])}
+++
+++  Examples of Clifford Algebras are: gaussians, quaternions, exterior 
+++  algebras and spin algebras.
+ 
+CliffordAlgebra(n, K, Q): T == Impl where
+    n: PositiveInteger
+    K: Field
+    Q: QuadraticForm(n, K)
+ 
+    PI ==> PositiveInteger
+    NNI==> NonNegativeInteger
+ 
+    T ==> Join(Ring, Algebra(K), VectorSpace(K)) with
+        e: PI -> %
+          ++ e(n) produces the appropriate unit element.
+        monomial: (K, List PI) -> %
+          ++ monomial(c,[i1,i2,...,iN]) produces the value given by
+          ++ \spad{c*e(i1)*e(i2)*...*e(iN)}.
+        coefficient:  (%, List PI) -> K
+          ++ coefficient(x,[i1,i2,...,iN])  extracts the coefficient of
+          ++ \spad{e(i1)*e(i2)*...*e(iN)} in x.
+        recip: % -> Union(%, "failed")
+          ++ recip(x) computes the multiplicative inverse of x or "failed"
+          ++ if x is not invertible.
+ 
+    Impl ==> add
+        Qeelist :=  [Q unitVector(i::PositiveInteger) for i in 1..n]
+        dim     :=  2**n
+ 
+        Rep     := PrimitiveArray K
+ 
+        New     ==> new(dim, 0$K)$Rep
+ 
+        x, y, z: %
+        c: K
+        m: Integer
+ 
+        characteristic() == characteristic()$K
+        dimension()      == dim::CardinalNumber
+ 
+        x = y ==
+            for i in 0..dim-1 repeat
+                if x.i ^= y.i then return false
+            true
+ 
+        x + y == (z := New; for i in 0..dim-1 repeat z.i := x.i + y.i; z)
+        x - y == (z := New; for i in 0..dim-1 repeat z.i := x.i - y.i; z)
+        - x   == (z := New; for i in 0..dim-1 repeat z.i := - x.i; z)
+        m * x == (z := New; for i in 0..dim-1 repeat z.i := m*x.i; z)
+        c * x == (z := New; for i in 0..dim-1 repeat z.i := c*x.i; z)
+ 
+        0            == New
+        1            == (z := New; z.0 := 1; z)
+        coerce(m): % == (z := New; z.0 := m::K; z)
+        coerce(c): % == (z := New; z.0 := c; z)
+ 
+        e b ==
+            b::NNI > n => error "No such basis element"
+            iz := 2**((b-1)::NNI)
+            z := New; z.iz := 1; z
+ 
+        -- The ei*ej products could instead be precomputed in
+        -- a (2**n)**2 multiplication table.
+        addMonomProd(c1: K, b1: NNI, c2: K, b2: NNI, z: %): % ==
+            c  := c1 * c2
+            bz := b2
+            for i in 0..n-1 | bit?(b1,i) repeat
+                -- Apply rule  ei*ej = -ej*ei for i^=j
+                k := 0
+                for j in i+1..n-1 | bit?(b1, j) repeat k := k+1
+                for j in 0..i-1   | bit?(bz, j) repeat k := k+1
+                if odd? k then c := -c
+                -- Apply rule  ei**2 = Q(ei)
+                if bit?(bz,i) then
+                    c := c * Qeelist.(i+1)
+                    bz:= (bz - 2**i)::NNI
+                else
+                    bz:= bz + 2**i
+            z.bz := z.bz + c
+            z
+ 
+        x * y ==
+            z := New
+            for ix in 0..dim-1 repeat
+                if x.ix ^= 0 then for iy in 0..dim-1 repeat
+                    if y.iy ^= 0 then addMonomProd(x.ix,ix,y.iy,iy,z)
+            z
+ 
+        canonMonom(c: K, lb: List PI): Record(coef: K, basel: NNI) ==
+            -- 0. Check input
+            for b in lb repeat b > n => error "No such basis element"
+ 
+            -- 1. Apply identity ei*ej = -ej*ei, i^=j.
+            -- The Rep assumes n is small so bubble sort is ok.
+            -- Using bubble sort keeps the exchange info obvious.
+            wasordered   := false
+            exchanges := 0
+            while not wasordered repeat
+                wasordered := true
+                for i in 1..#lb-1 repeat
+                    if lb.i > lb.(i+1) then
+                        t := lb.i; lb.i := lb.(i+1); lb.(i+1) := t
+                        exchanges := exchanges + 1
+                        wasordered := false
+            if odd? exchanges then c := -c
+ 
+            -- 2. Prepare the basis element
+            -- Apply identity ei*ei = Q(ei).
+            bz := 0
+            for b in lb repeat
+                bn := (b-1)::NNI
+                if bit?(bz, bn) then
+                    c := c * Qeelist bn
+                    bz:= ( bz - 2**bn )::NNI
+                else
+                    bz:= bz + 2**bn
+            [c, bz::NNI]
+ 
+        monomial(c, lb) ==
+            r := canonMonom(c, lb)
+            z := New
+            z r.basel := r.coef
+            z
+        coefficient(z, lb) ==
+            r := canonMonom(1, lb)
+            r.coef = 0 => error "Cannot take coef of 0"
+            z r.basel/r.coef
+ 
+        Ex ==> OutputForm
+ 
+        coerceMonom(c: K, b: NNI): Ex ==
+            b = 0 => c::Ex
+            ml := [sub("e"::Ex, i::Ex) for i in 1..n | bit?(b,i-1)]
+            be := reduce("*", ml)
+            c = 1 => be
+            c::Ex * be
+        coerce(x): Ex ==
+            tl := [coerceMonom(x.i,i) for i in 0..dim-1 | x.i^=0]
+            null tl => "0"::Ex
+            reduce("+", tl)
+
+
+	localPowerSets(j:NNI): List(List(PI)) ==
+	  l: List List PI := list []
+	  j = 0 => l
+	  Sm := localPowerSets((j-1)::NNI)
+          Sn: List List PI := []
+	  for x in Sm repeat Sn := cons(cons(j pretend PI, x),Sn)
+	  append(Sn, Sm)
+
+	powerSets(j:NNI):List List PI == map(reverse, localPowerSets j)
+
+	Pn:List List PI := powerSets(n)
+
+	recip(x: %): Union(%, "failed") ==
+	  one:% := 1
+	  -- tmp:c := x*yC - 1$C
+	  rhsEqs : List K := []
+	  lhsEqs: List List K := []
+	  lhsEqi: List K
+	  for pi in Pn repeat
+	    rhsEqs := cons(coefficient(one, pi), rhsEqs)
+
+	    lhsEqi := []
+	    for pj in Pn repeat
+		lhsEqi := cons(coefficient(x*monomial(1,pj),pi),lhsEqi)
+	    lhsEqs := cons(reverse(lhsEqi),lhsEqs)
+	  ans := particularSolution(matrix(lhsEqs),
+            vector(rhsEqs))$LinearSystemMatrixPackage(K, Vector K, Vector K, Matrix K)
+          ans case "failed" => "failed"
+	  ansP := parts(ans)
+	  ansC:% := 0
+	  for pj in Pn repeat
+	    cj:= first ansP
+	    ansP := rest ansP
+	    ansC := ansC + cj*monomial(1,pj)
+	  ansC
+
+@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain CARTEN CartesianTensor}
+<<CartesianTensor.input>>=
+-- carten.spad.pamphlet CartesianTensor.input
+)spool CartesianTensor.output
+)set message test on
+)set message auto off
+)clear all
+--S 1 of 48
+CT := CARTEN(i0 := 1, 2, Integer)
+--R 
+--R
+--R   (1)  CartesianTensor(1,2,Integer)
+--R                                                                 Type: Domain
+--E 1
+
+--S 2 of 48
+t0: CT := 8
+--R 
+--R
+--R   (2)  8
+--R                                           Type: CartesianTensor(1,2,Integer)
+--E 2
+
+--S 3 of 48
+rank t0
+--R 
+--R
+--R   (3)  0
+--R                                                     Type: NonNegativeInteger
+--E 3
+
+--S 4 of 48
+v: DirectProduct(2, Integer) := directProduct [3,4]
+--R 
+--R
+--R   (4)  [3,4]
+--R                                               Type: DirectProduct(2,Integer)
+--E 4
+
+--S 5 of 48
+Tv: CT := v
+--R 
+--R
+--R   (5)  [3,4]
+--R                                           Type: CartesianTensor(1,2,Integer)
+--E 5
+
+--S 6 of 48
+m: SquareMatrix(2, Integer) := matrix [ [1,2],[4,5] ]
+--R 
+--R
+--R        +1  2+
+--R   (6)  |    |
+--R        +4  5+
+--R                                                Type: SquareMatrix(2,Integer)
+--E 6
+
+--S 7 of 48
+Tm: CT := m
+--R 
+--R
+--R        +1  2+
+--R   (7)  |    |
+--R        +4  5+
+--R                                           Type: CartesianTensor(1,2,Integer)
+--E 7
+
+--S 8 of 48
+n: SquareMatrix(2, Integer) := matrix [ [2,3],[0,1] ]
+--R 
+--R
+--R        +2  3+
+--R   (8)  |    |
+--R        +0  1+
+--R                                                Type: SquareMatrix(2,Integer)
+--E 8
+
+--S 9 of 48
+Tn: CT := n
+--R 
+--R
+--R        +2  3+
+--R   (9)  |    |
+--R        +0  1+
+--R                                           Type: CartesianTensor(1,2,Integer)
+--E 9
+
+--S 10 of 48
+t1: CT := [2, 3]
+--R 
+--R
+--R   (10)  [2,3]
+--R                                           Type: CartesianTensor(1,2,Integer)
+--E 10
+
+--S 11 of 48
+rank t1
+--R 
+--R
+--R   (11)  1
+--R                                                        Type: PositiveInteger
+--E 11
+
+--S 12 of 48
+t2: CT := [t1, t1]
+--R 
+--R
+--R         +2  3+
+--R   (12)  |    |
+--R         +2  3+
+--R                                           Type: CartesianTensor(1,2,Integer)
+--E 12
+
+--S 13 of 48
+t3: CT := [t2, t2]
+--R 
+--R
+--R          +2  3+ +2  3+
+--R   (13)  [|    |,|    |]
+--R          +2  3+ +2  3+
+--R                                           Type: CartesianTensor(1,2,Integer)
+--E 13
+
+--S 14 of 48
+tt: CT := [t3, t3]; tt := [tt, tt]
+--R 
+--R
+--R          ++2  3+  +2  3++ ++2  3+  +2  3++
+--R          ||    |  |    || ||    |  |    ||
+--R          |+2  3+  +2  3+| |+2  3+  +2  3+|
+--R   (14)  [|              |,|              |]
+--R          |+2  3+  +2  3+| |+2  3+  +2  3+|
+--R          ||    |  |    || ||    |  |    ||
+--R          ++2  3+  +2  3++ ++2  3+  +2  3++
+--R                                           Type: CartesianTensor(1,2,Integer)
+--E 14
+
+--S 15 of 48
+rank tt
+--R 
+--R
+--R   (15)  5
+--R                                                        Type: PositiveInteger
+--E 15
+
+--S 16 of 48
+Tmn := product(Tm, Tn)
+--R 
+--R
+--R         ++2  3+    +4  6+ +
+--R         ||    |    |    | |
+--R         |+0  1+    +0  2+ |
+--R   (16)  |                 |
+--R         |+8  12+  +10  15+|
+--R         ||     |  |      ||
+--R         ++0  4 +  +0   5 ++
+--R                                           Type: CartesianTensor(1,2,Integer)
+--E 16
+
+--S 17 of 48
+Tmv := contract(Tm,2,Tv,1)
+--R 
+--R
+--R   (17)  [11,32]
+--R                                           Type: CartesianTensor(1,2,Integer)
+--E 17
+
+--S 18 of 48
+Tm*Tv
+--R 
+--R
+--R   (18)  [11,32]
+--R                                           Type: CartesianTensor(1,2,Integer)
+--E 18
+
+--S 19 of 48
+Tmv = m * v
+--R 
+--R
+--R   (19)  [11,32]= [11,32]
+--R                                  Type: Equation CartesianTensor(1,2,Integer)
+--E 19
+
+--S 20 of 48
+t0()
+--R 
+--R
+--R   (20)  8
+--R                                                        Type: PositiveInteger
+--E 20
+
+--S 21 of 48
+t1(1+1)
+--R 
+--R
+--R   (21)  3
+--R                                                        Type: PositiveInteger
+--E 21
+
+--S 22 of 48
+t2(2,1)
+--R 
+--R
+--R   (22)  2
+--R                                                        Type: PositiveInteger
+--E 22
+
+--S 23 of 48
+t3(2,1,2)
+--R 
+--R
+--R   (23)  3
+--R                                                        Type: PositiveInteger
+--E 23
+
+--S 24 of 48
+Tmn(2,1,2,1)
+--R 
+--R
+--R   (24)  0
+--R                                                     Type: NonNegativeInteger
+--E 24
+
+--S 25 of 48
+t0[]
+--R 
+--R
+--R   (25)  8
+--R                                                        Type: PositiveInteger
+--E 25
+
+--S 26 of 48
+t1[2]
+--R 
+--R
+--R   (26)  3
+--R                                                        Type: PositiveInteger
+--E 26
+
+--S 27 of 48
+t2[2,1]
+--R 
+--R
+--R   (27)  2
+--R                                                        Type: PositiveInteger
+--E 27
+
+--S 28 of 48
+t3[2,1,2]
+--R 
+--R
+--R   (28)  3
+--R                                                        Type: PositiveInteger
+--E 28
+
+--S 29 of 48
+Tmn[2,1,2,1]
+--R 
+--R
+--R   (29)  0
+--R                                                     Type: NonNegativeInteger
+--E 29
+
+--S 30 of 48
+cTmn := contract(Tmn,1,2)
+--R 
+--R
+--R         +12  18+
+--R   (30)  |      |
+--R         +0   6 +
+--R                                           Type: CartesianTensor(1,2,Integer)
+--E 30
+
+--S 31 of 48
+trace(m) * n
+--R 
+--R
+--R         +12  18+
+--R   (31)  |      |
+--R         +0   6 +
+--R                                                Type: SquareMatrix(2,Integer)
+--E 31
+
+--S 32 of 48
+contract(Tmn,1,2) = trace(m) * n
+--R 
+--R
+--R         +12  18+  +12  18+
+--R   (32)  |      |= |      |
+--R         +0   6 +  +0   6 +
+--R                                  Type: Equation CartesianTensor(1,2,Integer)
+--E 32
+
+--S 33 of 48
+contract(Tmn,1,3) = transpose(m) * n
+--R 
+--R
+--R         +2  7 +  +2  7 +
+--R   (33)  |     |= |     |
+--R         +4  11+  +4  11+
+--R                                  Type: Equation CartesianTensor(1,2,Integer)
+--E 33
+
+--S 34 of 48
+contract(Tmn,1,4) = transpose(m) * transpose(n)
+--R 
+--R
+--R         +14  4+  +14  4+
+--R   (34)  |     |= |     |
+--R         +19  5+  +19  5+
+--R                                  Type: Equation CartesianTensor(1,2,Integer)
+--E 34
+
+--S 35 of 48
+contract(Tmn,2,3) = m * n
+--R 
+--R
+--R         +2  5 +  +2  5 +
+--R   (35)  |     |= |     |
+--R         +8  17+  +8  17+
+--R                                  Type: Equation CartesianTensor(1,2,Integer)
+--E 35
+
+--S 36 of 48
+contract(Tmn,2,4) = m * transpose(n)
+--R 
+--R
+--R         +8   2+  +8   2+
+--R   (36)  |     |= |     |
+--R         +23  5+  +23  5+
+--R                                  Type: Equation CartesianTensor(1,2,Integer)
+--E 36
+
+--S 37 of 48
+contract(Tmn,3,4) = trace(n) * m
+--R 
+--R
+--R         +3   6 +  +3   6 +
+--R   (37)  |      |= |      |
+--R         +12  15+  +12  15+
+--R                                  Type: Equation CartesianTensor(1,2,Integer)
+--E 37
+
+--S 38 of 48
+tTmn := transpose(Tmn,1,3)
+--R 
+--R
+--R         ++2  3 +  +4   6 ++
+--R         ||     |  |      ||
+--R         |+8  12+  +10  15+|
+--R   (38)  |                 |
+--R         |+0  1+    +0  2+ |
+--R         ||    |    |    | |
+--R         ++0  4+    +0  5+ +
+--R                                           Type: CartesianTensor(1,2,Integer)
+--E 38
+
+--S 39 of 48
+transpose Tmn
+--R 
+--R
+--R         ++2  8+   +4  10++
+--R         ||    |   |     ||
+--R         |+0  0+   +0  0 +|
+--R   (39)  |                |
+--R         |+3  12+  +6  15+|
+--R         ||     |  |     ||
+--R         ++1  4 +  +2  5 ++
+--R                                           Type: CartesianTensor(1,2,Integer)
+--E 39
+
+--S 40 of 48
+transpose Tm = transpose m
+--R 
+--R
+--R         +1  4+  +1  4+
+--R   (40)  |    |= |    |
+--R         +2  5+  +2  5+
+--R                                  Type: Equation CartesianTensor(1,2,Integer)
+--E 40
+
+--S 41 of 48
+rTmn := reindex(Tmn, [1,4,2,3])
+--R 
+--R
+--R         ++2  0+   +3  1+ +
+--R         ||    |   |    | |
+--R         |+4  0+   +6  2+ |
+--R   (41)  |                |
+--R         |+8   0+  +12  4+|
+--R         ||     |  |     ||
+--R         ++10  0+  +15  5++
+--R                                           Type: CartesianTensor(1,2,Integer)
+--E 41
+
+--S 42 of 48
+tt := transpose(Tm)*Tn - Tn*transpose(Tm)
+--R 
+--R
+--R         +- 6  - 16+
+--R   (42)  |         |
+--R         + 2    6  +
+--R                                           Type: CartesianTensor(1,2,Integer)
+--E 42
+
+--S 43 of 48
+Tv*(tt+Tn)
+--R 
+--R
+--R   (43)  [- 4,- 11]
+--R                                           Type: CartesianTensor(1,2,Integer)
+--E 43
+
+--S 44 of 48
+reindex(product(Tn,Tn),[4,3,2,1])+3*Tn*product(Tm,Tm)
+--R 
+--R
+--R         ++46   84 +  +57   114++
+--R         ||        |  |        ||
+--R         |+174  212+  +228  285+|
+--R   (44)  |                      |
+--R         | +18  24+    +17  30+ |
+--R         | |      |    |      | |
+--R         + +57  63+    +63  76+ +
+--R                                           Type: CartesianTensor(1,2,Integer)
+--E 44
+
+--S 45 of 48
+delta:  CT := kroneckerDelta()
+--R 
+--R
+--R         +1  0+
+--R   (45)  |    |
+--R         +0  1+
+--R                                           Type: CartesianTensor(1,2,Integer)
+--E 45
+
+--S 46 of 48
+contract(Tmn, 2, delta, 1) = reindex(Tmn, [1,3,4,2])
+--R 
+--R
+--R         + +2  4+   +0  0++  + +2  4+   +0  0++
+--R         | |    |   |    ||  | |    |   |    ||
+--R         | +3  6+   +1  2+|  | +3  6+   +1  2+|
+--R   (46)  |                |= |                |
+--R         |+8   10+  +0  0+|  |+8   10+  +0  0+|
+--R         ||      |  |    ||  ||      |  |    ||
+--R         ++12  15+  +4  5++  ++12  15+  +4  5++
+--R                                  Type: Equation CartesianTensor(1,2,Integer)
+--E 46
+
+--S 47 of 48
+epsilon:CT := leviCivitaSymbol()
+--R 
+--R
+--R         + 0   1+
+--R   (47)  |      |
+--R         +- 1  0+
+--R                                           Type: CartesianTensor(1,2,Integer)
+--E 47
+
+--S 48 of 48
+contract(epsilon*Tm*epsilon, 1,2) = 2 * determinant m
+--R 
+--R
+--R   (48)  - 6= - 6
+--R                                  Type: Equation CartesianTensor(1,2,Integer)
+--E 48
+)spool
+)lisp (bye)
+@
+<<CartesianTensor.help>>=
+====================================================================
+CartesianTensor examples
+====================================================================
+
+CartesianTensor(i0,dim,R) provides Cartesian tensors with components
+belonging to a commutative ring R.  Tensors can be described as a
+generalization of vectors and matrices.  This gives a concise tensor
+algebra for multilinear objects supported by the CartesianTensor
+domain.  You can form the inner or outer product of any two tensors
+and you can add or subtract tensors with the same number of components.  
+Additionally, various forms of traces and transpositions are useful.
+
+The CartesianTensor constructor allows you to specify the minimum
+index for subscripting.  In what follows we discuss in detail how to
+manipulate tensors.
+
+Here we construct the domain of Cartesian tensors of dimension 2 over the
+integers, with indices starting at 1.
+
+  CT := CARTEN(i0 := 1, 2, Integer)
+   CartesianTensor(1,2,Integer) 
+                      Type: Domain
+
+====================================================================
+Forming tensors
+====================================================================
+
+Scalars can be converted to tensors of rank zero.
+
+  t0: CT := 8
+   8 
+                      Type: CartesianTensor(1,2,Integer)
+
+  rank t0
+   0 
+                      Type: NonNegativeInteger
+
+Vectors (mathematical direct products, rather than one dimensional array
+structures) can be converted to tensors of rank one.
+
+  v: DirectProduct(2, Integer) := directProduct [3,4]
+   [3, 4]
+                      Type: DirectProduct(2,Integer)
+
+  Tv: CT := v
+   [3, 4]
+                      Type: CartesianTensor(1,2,Integer)
+
+Matrices can be converted to tensors of rank two.
+
+  m: SquareMatrix(2, Integer) := matrix [ [1,2],[4,5] ]
+   +1  2+
+   |    |
+   +4  5+
+                      Type: SquareMatrix(2,Integer)
+
+  Tm: CT := m
+   +1  2+
+   |    |
+   +4  5+
+                      Type: CartesianTensor(1,2,Integer)
+
+  n: SquareMatrix(2, Integer) := matrix [ [2,3],[0,1] ]
+   +2  3+
+   |    |
+   +0  1+
+                      Type: SquareMatrix(2,Integer)
+
+  Tn: CT := n
+   +2  3+
+   |    |
+   +0  1+
+                      Type: CartesianTensor(1,2,Integer)
+
+In general, a tensor of rank k can be formed by making a list of
+rank k-1 tensors or, alternatively, a k-deep nested list of lists.
+
+  t1: CT := [2, 3]
+   [2, 3]
+                      Type: CartesianTensor(1,2,Integer)
+
+  rank t1
+   1 
+                      Type: PositiveInteger
+
+  t2: CT := [t1, t1]
+   +2  3+
+   |    |
+   +2  3+
+                      Type: CartesianTensor(1,2,Integer)
+
+  t3: CT := [t2, t2]
+
+    +2  3+ +2  3+
+   [|    |,|    |]
+    +2  3+ +2  3+
+                      Type: CartesianTensor(1,2,Integer)
+
+  tt: CT := [t3, t3]; tt := [tt, tt]
+    ++2  3+  +2  3++ ++2  3+  +2  3++
+    ||    |  |    || ||    |  |    ||
+    |+2  3+  +2  3+| |+2  3+  +2  3+|
+   [|              |,|              |]
+    |+2  3+  +2  3+| |+2  3+  +2  3+|
+    ||    |  |    || ||    |  |    ||
+    ++2  3+  +2  3++ ++2  3+  +2  3++
+                      Type: CartesianTensor(1,2,Integer)
+
+  rank tt
+   5 
+                      Type: PositiveInteger
+
+====================================================================
+Multiplication
+====================================================================
+
+Given two tensors of rank k1 and k2, the outer product forms a new
+tensor of rank k1+k2. Here
+
+  Tmn(i,j,k,l) = Tm(i,j)Tn(k,l)
+
+  Tmn := product(Tm, Tn)
+    ++2  3+    +4  6+ +
+    ||    |    |    | |
+    |+0  1+    +0  2+ |
+    |                 |
+    |+8  12+  +10  15+|
+    ||     |  |      ||
+    ++0  4 +  +0   5 ++
+                      Type: CartesianTensor(1,2,Integer)
+
+The inner product (contract) forms a tensor of rank k1+k2-2.  This
+product generalizes the vector dot product and matrix-vector product
+by summing component products along two indices.
+
+Here we sum along the second index of Tm and the first index of Tv. Here 
+
+ Tmv = sum {j=1..dim} Tm(i,j) Tv(j)
+
+ Tmv := contract(Tm,2,Tv,1)
+   [11,32]
+                      Type: CartesianTensor(1,2,Integer)
+
+The multiplication operator * is scalar multiplication or an inner
+product depending on the ranks of the arguments.
+
+If either argument is rank zero it is treated as scalar multiplication.  
+Otherwise, a*b is the inner product summing the last index of a with the 
+first index of b.
+
+  Tm*Tv
+   [11,32]
+                     Type: CartesianTensor(1,2,Integer)
+
+This definition is consistent with the inner product on matrices
+and vectors.
+
+  Tmv = m * v
+   [11,32] = [11,32]
+                     Type: Equation CartesianTensor(1,2,Integer)
+
+====================================================================
+Selecting Components
+====================================================================
+
+For tensors of low rank (that is, four or less), components can be selected
+by applying the tensor to its indices.
+
+  t0()
+   8
+                     Type: PositiveInteger
+
+  t1(1+1)
+   3
+                     Type: PositiveInteger
+
+  t2(2,1)
+   2
+                     Type: PositiveInteger
+
+  t3(2,1,2)
+    3
+                     Type: PositiveInteger
+
+  Tmn(2,1,2,1)
+    0
+                     Type: NonNegativeInteger
+
+A general indexing mechanism is provided for a list of indices.
+
+  t0[]
+    8
+                     Type: PositiveInteger
+
+  t1[2]
+    3
+                     Type: PositiveInteger
+
+  t2[2,1]
+    2
+                     Type: PositiveInteger
+
+The general mechanism works for tensors of arbitrary rank, but is
+somewhat less efficient since the intermediate index list must be created.
+
+  t3[2,1,2]
+    3
+                     Type: PositiveInteger
+
+  Tmn[2,1,2,1]
+    0
+                     Type: NonNegativeInteger
+
+====================================================================
+Contraction
+====================================================================
+
+A "contraction" between two tensors is an inner product, as we have
+seen above.  You can also contract a pair of indices of a single
+tensor.  This corresponds to a "trace" in linear algebra.  The
+expression contract(t,k1,k2) forms a new tensor by summing the
+diagonal given by indices in position k1 and k2.
+
+This is the tensor given by
+  xTmn = sum{k=1..dim} Tmn(k,k,i,j)
+
+  cTmn := contract(Tmn,1,2)
+    +12  18+
+    |      |
+    +0   6 +
+                         Type: CartesianTensor(1,2,Integer)
+
+Since Tmn is the outer product of matrix m and matrix n, the above is
+equivalent to this.
+
+  trace(m) * n
+    +12  18+
+    |      |
+    +0   6 +
+                         Type: SquareMatrix(2,Integer)
+
+In this and the next few examples, we show all possible contractions
+of Tmn and their matrix algebra equivalents.
+
+  contract(Tmn,1,2) = trace(m) * n
+   +12  18+  +12  18+
+   |      |= |      |
+   +0   6 +  +0   6 +
+                          Type: Equation CartesianTensor(1,2,Integer)
+
+  contract(Tmn,1,3) = transpose(m) * n
+   +2  7 +  +2  7 +
+   |     |= |     |
+   +4  11+  +4  11+
+                          Type: Equation CartesianTensor(1,2,Integer)
+
+  contract(Tmn,1,4) = transpose(m) * transpose(n)
+   +14  4+  +14  4+
+   |     |= |     |
+   +19  5+  +19  5+
+                          Type: Equation CartesianTensor(1,2,Integer)
+
+  contract(Tmn,2,3) = m * n
+   +2  5 +  +2  5 +
+   |     |= |     |
+   +8  17+  +8  17+
+                          Type: Equation CartesianTensor(1,2,Integer)
+
+  contract(Tmn,2,4) = m * transpose(n)
+   +8   2+  +8   2+
+   |     |= |     |
+   +23  5+  +23  5+
+                          Type: Equation CartesianTensor(1,2,Integer)
+
+  contract(Tmn,3,4) = trace(n) * m
+   +3   6 +  +3   6 +
+   |      |= |      |
+   +12  15+  +12  15+
+                          Type: Equation CartesianTensor(1,2,Integer)
+
+====================================================================
+Transpositions
+====================================================================
+
+You can exchange any desired pair of indices using the transpose
+operation.
+
+Here the indices in positions one and three are exchanged, that is,
+  tTmn(i,j,k,l) = Tmn(k,j,i,l)
+
+  tTmn := transpose(Tmn,1,3)
+   ++2  3 +  +4   6 ++
+   ||     |  |      ||
+   |+8  12+  +10  15+|
+   |                 |
+   |+0  1+    +0  2+ |
+   ||    |    |    | |
+   ++0  4+    +0  5+ +
+                             Type: CartesianTensor(1,2,Integer)
+
+If no indices are specified, the first and last index are exchanged.
+
+  transpose Tmn
+   ++2  8+   +4  10++
+   ||    |   |     ||
+   |+0  0+   +0  0 +|
+   |                |
+   |+3  12+  +6  15+|
+   ||     |  |     ||
+   ++1  4 +  +2  5 ++
+                             Type: CartesianTensor(1,2,Integer)
+
+This is consistent with the matrix transpose.
+
+  transpose Tm = transpose m
+   +1  4+  +1  4+
+   |    |= |    |
+   +2  5+  +2  5+
+                             Type: Equation CartesianTensor(1,2,Integer)
+
+
+If a more complicated reordering of the indices is required, then the
+reindex operation can be used.  This operation allows the indices to
+be arbitrarily permuted.
+
+  rTmn(i,j,k,l) = Tmn(i,l,j,k)
+
+  rTmn := reindex(Tmn, [1,4,2,3])
+   ++2  0+   +3  1+ +
+   ||    |   |    | |
+   |+4  0+   +6  2+ |
+   |                |
+   |+8   0+  +12  4+|
+   ||     |  |     ||
+   ++10  0+  +15  5++
+                              Type: CartesianTensor(1,2,Integer)
+
+====================================================================
+Arithmetic
+====================================================================
+
+Tensors of equal rank can be added or subtracted so arithmetic
+expressions can be used to produce new tensors.
+
+  tt := transpose(Tm)*Tn - Tn*transpose(Tm)
+   +- 6  - 16+
+   |         |
+   + 2    6  +
+                              Type: CartesianTensor(1,2,Integer)
+
+
+  Tv*(tt+Tn)
+   [- 4,- 11]
+                              Type: CartesianTensor(1,2,Integer)
+
+  reindex(product(Tn,Tn),[4,3,2,1])+3*Tn*product(Tm,Tm)
+   ++46   84 +  +57   114++
+   ||        |  |        ||
+   |+174  212+  +228  285+|
+   |                      |
+   | +18  24+    +17  30+ |
+   | |      |    |      | |
+   + +57  63+    +63  76+ +
+                              Type: CartesianTensor(1,2,Integer)
+
+====================================================================
+Specific Tensors
+====================================================================
+
+Two specific tensors have properties which depend only on the dimension.
+
+The Kronecker delta satisfies
+
+             +-              -+
+             |   1  if i  = j |
+delta(i,j) = |                |
+             |   0  if i ^= j |
+             +-              -+
+
+
+  delta:  CT := kroneckerDelta()
+   +1  0+
+   |    |
+   +0  1+
+                              Type: CartesianTensor(1,2,Integer)
+
+This can be used to reindex via contraction.
+
+  contract(Tmn, 2, delta, 1) = reindex(Tmn, [1,3,4,2])
+   + +2  4+   +0  0++  + +2  4+   +0  0++
+   | |    |   |    ||  | |    |   |    ||
+   | +3  6+   +1  2+|  | +3  6+   +1  2+|
+   |                |= |                |
+   |+8   10+  +0  0+|  |+8   10+  +0  0+|
+   ||      |  |    ||  ||      |  |    ||
+   ++12  15+  +4  5++  ++12  15+  +4  5++
+                             Type: Equation CartesianTensor(1,2,Integer)
+
+The Levi Civita symbol determines the sign of a permutation of indices.
+
+  epsilon:CT := leviCivitaSymbol()
+   + 0   1+
+   |      |
+   +- 1  0+
+                              Type: CartesianTensor(1,2,Integer)
+
+Here we have:
+
+  epsilon(i1,...,idim)
+     = +1  if i1,...,idim is an even permutation of i0,...,i0+dim-1
+     = -1  if i1,...,idim is an  odd permutation of i0,...,i0+dim-1
+     =  0  if i1,...,idim is not   a permutation of i0,...,i0+dim-1
+
+This property can be used to form determinants.
+
+  contract(epsilon*Tm*epsilon, 1,2) = 2 * determinant m
+   - 6= - 6
+                            Type: Equation CartesianTensor(1,2,Integer)
+
+
+====================================================================
+Properties of the CartesianTensor domain
+====================================================================
+
+GradedModule(R,E) denotes "E-graded R-module", that is, a collection
+of R-modules indexed by an abelian monoid E. An element g of G[s] for
+some specific s in E is said to be an element of G with degree s.
+Sums are defined in each module G[s] so two elements of G can be added
+if they have the same degree.  Morphisms can be defined and composed
+by degree to give the mathematical category of graded modules.
+
+GradedAlgebra(R,E) denotes "E-graded R-algebra".  A graded algebra is
+a graded module together with a degree preserving R-bilinear map,
+called the product.
+
+  degree(product(a,b))    = degree(a) + degree(b)
+
+  product(r*a,b)          = product(a,r*b) = r*product(a,b)
+  product(a1+a2,b)        = product(a1,b) + product(a2,b)
+  product(a,b1+b2)        = product(a,b1) + product(a,b2)
+  product(a,product(b,c)) = product(product(a,b),c)
+
+The domain CartesianTensor(i0, dim, R) belongs to the category
+GradedAlgebra(R, NonNegativeInteger).  The non-negative integer degree
+is the tensor rank and the graded algebra product is the tensor outer
+product.  The graded module addition captures the notion that only
+tensors of equal rank can be added.
+
+If V is a vector space of dimension dim over R, then the tensor module
+T[k](V) is defined as
+
+ T[0](V) = R
+  T[k](V) = T[k-1](V) * V
+
+where * denotes the R-module tensor product. CartesianTensor(i0,dim,R) 
+is the graded algebra in which the degree k module is T[k](V).
+
+====================================================================
+Tensor Calculus
+====================================================================
+
+It should be noted here that often tensors are used in the context of
+tensor-valued manifold maps.  This leads to the notion of covariant
+and contravariant bases with tensor component functions transforming
+in specific ways under a change of coordinates on the manifold.  This
+is no more directly supported by the CartesianTensor domain than it is
+by the Vector domain.  However, it is possible to have the components
+implicitly represent component maps by choosing a polynomial or
+expression type for the components.  In this case, it is up to the
+user to satisfy any constraints which arise on the basis of this
+interpretation.
+
+See Also
+o )show CartesianTensor
+o $AXIOM/doc/src/algebra/carten.spad.dvi
+
+@
+<<dot>>=
+"CARTEN" -> "GRALG"
+"CartesianTensor(a:Integer,b:NonNegativeInteger,c:CommutativeRing)" ->
+    "GradedAlgebra(a:CommutativeRing,b:NonNegativeInteger)"
+"CARTEN" -> "GRMOD"
+"CartesianTensor(a:Integer,b:NonNegativeInteger,c:CommutativeRing)" ->
+    "GradedModule(a:Integer,b:NonNegativeInteger)"
+@
+\pagehead{CartesianTensor}{CARTEN}
+\pagepic{ps/v103cartesiantensor.ps}{CARTEN}{1.00}
+<<domain CARTEN CartesianTensor>>=
+)abbrev domain CARTEN CartesianTensor
+++ Author: Stephen M. Watt
+++ Date Created: December 1986
+++ Date Last Updated: May 15, 1991
+++ Basic Operations:
+++ Related Domains:
+++ Also See:
+++ AMS Classifications:
+++ Keywords: tensor, graded algebra
+++ Examples:
+++ References:
+++ Description:
+++   CartesianTensor(minix,dim,R) provides Cartesian tensors with
+++   components belonging to a commutative ring R.  These tensors
+++   can have any number of indices.  Each index takes values from
+++   \spad{minix} to \spad{minix + dim - 1}.
+
+CartesianTensor(minix, dim, R): Exports == Implementation where
+    NNI ==> NonNegativeInteger
+    I   ==> Integer
+    DP  ==> DirectProduct
+    SM  ==> SquareMatrix
+
+    minix: Integer
+    dim: NNI
+    R: CommutativeRing
+
+    Exports ==> Join(GradedAlgebra(R, NNI), GradedModule(I, NNI)) with
+
+        coerce: DP(dim, R) -> %
+            ++ coerce(v) views a vector as a rank 1 tensor.
+            ++
+            ++X v:DirectProduct(2,Integer):=directProduct [3,4]
+            ++X tv:CartesianTensor(1,2,Integer):=v
+
+        coerce: SM(dim, R)  -> %
+            ++ coerce(m) views a matrix as a rank 2 tensor.
+            ++
+            ++X v:SquareMatrix(2,Integer):=[[1,2],[3,4]]
+            ++X tv:CartesianTensor(1,2,Integer):=v
+
+        coerce: List R -> %
+            ++ coerce([r_1,...,r_dim]) allows tensors to be constructed
+            ++ using lists.
+            ++
+            ++X v:=[2,3]
+            ++X tv:CartesianTensor(1,2,Integer):=v
+
+        coerce: List % -> %
+            ++ coerce([t_1,...,t_dim]) allows tensors to be constructed
+            ++ using lists.
+            ++
+            ++X v:=[2,3]
+            ++X tv:CartesianTensor(1,2,Integer):=v
+            ++X tm:CartesianTensor(1,2,Integer):=[tv,tv]
+
+        rank: % -> NNI
+            ++ rank(t) returns the tensorial rank of t (that is, the
+            ++ number of indices).  This is the same as the graded module
+            ++ degree.
+            ++
+            ++X CT:=CARTEN(1,2,Integer)
+            ++X t0:CT:=8
+            ++X rank t0
+
+        elt: (%) -> R
+            ++ elt(t) gives the component of a rank 0 tensor.
+            ++
+            ++X tv:CartesianTensor(1,2,Integer):=8
+            ++X elt(tv)
+            ++X tv[]
+
+        elt: (%, I) -> R
+            ++ elt(t,i) gives a component of a rank 1 tensor.
+            ++
+            ++X v:=[2,3]
+            ++X tv:CartesianTensor(1,2,Integer):=v
+            ++X elt(tv,2)
+            ++X tv[2]
+
+        elt: (%, I, I) -> R
+            ++ elt(t,i,j) gives a component of a rank 2 tensor.
+            ++
+            ++X v:=[2,3]
+            ++X tv:CartesianTensor(1,2,Integer):=v
+            ++X tm:CartesianTensor(1,2,Integer):=[tv,tv]
+            ++X elt(tm,2,2)
+            ++X tm[2,2]
+
+        elt: (%, I, I, I) -> R
+            ++ elt(t,i,j,k) gives a component of a rank 3 tensor.
+            ++
+            ++X v:=[2,3]
+            ++X tv:CartesianTensor(1,2,Integer):=v
+            ++X tm:CartesianTensor(1,2,Integer):=[tv,tv]
+            ++X tn:CartesianTensor(1,2,Integer):=[tm,tm]
+            ++X elt(tn,2,2,2)
+            ++X tn[2,2,2]
+
+        elt: (%, I, I, I, I) -> R
+            ++ elt(t,i,j,k,l) gives a component of a rank 4 tensor.
+            ++
+            ++X v:=[2,3]
+            ++X tv:CartesianTensor(1,2,Integer):=v
+            ++X tm:CartesianTensor(1,2,Integer):=[tv,tv]
+            ++X tn:CartesianTensor(1,2,Integer):=[tm,tm]
+            ++X tp:CartesianTensor(1,2,Integer):=[tn,tn]
+            ++X elt(tp,2,2,2,2)
+            ++X tp[2,2,2,2]
+
+        elt: (%, List I) -> R
+            ++ elt(t,[i1,...,iN]) gives a component of a rank \spad{N} tensor.
+            ++
+            ++X v:=[2,3]
+            ++X tv:CartesianTensor(1,2,Integer):=v
+            ++X tm:CartesianTensor(1,2,Integer):=[tv,tv]
+            ++X tn:CartesianTensor(1,2,Integer):=[tm,tm]
+            ++X tp:CartesianTensor(1,2,Integer):=[tn,tn]
+            ++X tq:CartesianTensor(1,2,Integer):=[tp,tp]
+            ++X elt(tq,[2,2,2,2,2])
+
+        -- This specializes the documentation from GradedAlgebra.
+        product: (%,%) -> %
+            ++ product(s,t) is the outer product of the tensors s and t.
+            ++ For example, if \spad{r = product(s,t)} for rank 2 tensors 
+            ++ s and t, then \spad{r} is a rank 4 tensor given by
+            ++     \spad{r(i,j,k,l) = s(i,j)*t(k,l)}.
+            ++
+            ++X m:SquareMatrix(2,Integer):=matrix [[1,2],[4,5]]
+            ++X Tm:CartesianTensor(1,2,Integer):=m
+            ++X n:SquareMatrix(2,Integer):=matrix [[2,3],[0,1]]
+            ++X Tn:CartesianTensor(1,2,Integer):=n
+            ++X Tmn:=product(Tm,Tn)
+
+        "*": (%, %) -> %
+            ++ s*t is the inner product of the tensors s and t which contracts
+            ++ the last index of s with the first index of t, i.e.
+            ++     \spad{t*s = contract(t,rank t, s, 1)}
+            ++     \spad{t*s = sum(k=1..N, t[i1,..,iN,k]*s[k,j1,..,jM])}
+            ++ This is compatible with the use of \spad{M*v} to denote
+            ++ the matrix-vector inner product.
+            ++
+            ++X m:SquareMatrix(2,Integer):=matrix [[1,2],[4,5]]
+            ++X Tm:CartesianTensor(1,2,Integer):=m
+            ++X v:DirectProduct(2,Integer):=directProduct [3,4]
+            ++X Tv:CartesianTensor(1,2,Integer):=v
+            ++X Tm*Tv
+
+        contract:  (%, Integer, %, Integer) -> %
+            ++ contract(t,i,s,j) is the inner product of tenors s and t
+            ++ which sums along the \spad{k1}-th index of
+            ++ t and the \spad{k2}-th index of s.
+            ++ For example, if \spad{r = contract(s,2,t,1)} for rank 3 tensors
+            ++ rank 3 tensors \spad{s} and \spad{t}, then \spad{r} is
+            ++ the rank 4 \spad{(= 3 + 3 - 2)} tensor  given by
+            ++     \spad{r(i,j,k,l) = sum(h=1..dim,s(i,h,j)*t(h,k,l))}.
+            ++
+            ++X m:SquareMatrix(2,Integer):=matrix [[1,2],[4,5]]
+            ++X Tm:CartesianTensor(1,2,Integer):=m
+            ++X v:DirectProduct(2,Integer):=directProduct [3,4]
+            ++X Tv:CartesianTensor(1,2,Integer):=v
+            ++X Tmv:=contract(Tm,2,Tv,1)
+
+        contract:  (%, Integer, Integer)    -> %
+            ++ contract(t,i,j) is the contraction of tensor t which
+            ++ sums along the \spad{i}-th and \spad{j}-th indices.
+            ++ For example,  if
+            ++ \spad{r = contract(t,1,3)} for a rank 4 tensor t, then
+            ++ \spad{r} is the rank 2 \spad{(= 4 - 2)} tensor given by
+            ++     \spad{r(i,j) = sum(h=1..dim,t(h,i,h,j))}.
+            ++
+            ++X m:SquareMatrix(2,Integer):=matrix [[1,2],[4,5]]
+            ++X Tm:CartesianTensor(1,2,Integer):=m
+            ++X v:DirectProduct(2,Integer):=directProduct [3,4]
+            ++X Tv:CartesianTensor(1,2,Integer):=v
+            ++X Tmv:=contract(Tm,2,1)
+
+        transpose: % -> %
+            ++ transpose(t) exchanges the first and last indices of t.
+            ++ For example, if \spad{r = transpose(t)} for a rank 4 
+            ++ tensor t, then \spad{r} is the rank 4 tensor given by
+            ++     \spad{r(i,j,k,l) = t(l,j,k,i)}.
+            ++
+            ++X m:SquareMatrix(2,Integer):=matrix [[1,2],[4,5]]
+            ++X Tm:CartesianTensor(1,2,Integer):=m
+            ++X transpose(Tm)
+
+        transpose: (%, Integer, Integer) -> %
+            ++ transpose(t,i,j) exchanges the \spad{i}-th and \spad{j}-th 
+            ++ indices of t. For example, if \spad{r = transpose(t,2,3)} 
+            ++ for a rank 4 tensor t, then \spad{r} is the rank 4 tensor 
+            ++ given by
+            ++     \spad{r(i,j,k,l) = t(i,k,j,l)}.
+            ++
+            ++X m:SquareMatrix(2,Integer):=matrix [[1,2],[4,5]]
+            ++X tm:CartesianTensor(1,2,Integer):=m
+            ++X tn:CartesianTensor(1,2,Integer):=[tm,tm]
+            ++X transpose(tn,1,2)
+
+        reindex: (%, List Integer) -> %
+            ++ reindex(t,[i1,...,idim]) permutes the indices of t.
+            ++ For example, if \spad{r = reindex(t, [4,1,2,3])}
+            ++ for a rank 4 tensor t,
+            ++ then \spad{r} is the rank for tensor given by
+            ++     \spad{r(i,j,k,l) = t(l,i,j,k)}.
+            ++ 
+            ++X n:SquareMatrix(2,Integer):=matrix [[2,3],[0,1]]
+            ++X tn:CartesianTensor(1,2,Integer):=n
+            ++X p:=product(tn,tn)
+            ++X reindex(p,[4,3,2,1])
+ 
+        kroneckerDelta:  () -> %
+            ++ kroneckerDelta() is the rank 2 tensor defined by
+            ++    \spad{kroneckerDelta()(i,j)}
+            ++       \spad{= 1  if i = j}
+            ++       \spad{= 0 if  i \^= j}
+            ++ 
+            ++X delta:CartesianTensor(1,2,Integer):=kroneckerDelta()
+
+        leviCivitaSymbol: () -> %
+            ++ leviCivitaSymbol() is the rank \spad{dim} tensor defined by
+            ++ \spad{leviCivitaSymbol()(i1,...idim) = +1/0/-1}
+            ++ if \spad{i1,...,idim} is an even/is nota /is an odd permutation
+            ++ of \spad{minix,...,minix+dim-1}.
+            ++ 
+            ++X lcs:CartesianTensor(1,2,Integer):=leviCivitaSymbol()
+
+        ravel:     % -> List R
+            ++ ravel(t) produces a list of components from a tensor such that
+            ++   \spad{unravel(ravel(t)) = t}.
+            ++ 
+            ++X n:SquareMatrix(2,Integer):=matrix [[2,3],[0,1]]
+            ++X tn:CartesianTensor(1,2,Integer):=n
+            ++X ravel tn
+
+        unravel:   List R -> %
+            ++ unravel(t) produces a tensor from a list of
+            ++ components such that
+            ++   \spad{unravel(ravel(t)) = t}.
+
+        sample:    () -> %
+            ++ sample() returns an object of type %.
+
+    Implementation ==> add
+
+        PERM  ==> Vector Integer  -- 1-based entries from 1..n
+        INDEX ==> Vector Integer  -- 1-based entries from minix..minix+dim-1
+
+
+        get   ==> elt$Rep
+        set_! ==> setelt$Rep
+
+        -- Use row-major order:
+        --   x[h,i,j] <-> x[(h-minix)*dim**2+(i-minix)*dim+(j-minix)]
+
+        Rep := IndexedVector(R,0)
+
+        n:     Integer
+        r,s:   R
+        x,y,z: %
+
+        ---- Local stuff
+        dim2: NNI := dim**2
+        dim3: NNI := dim**3
+        dim4: NNI := dim**4
+
+	sample()==kroneckerDelta()$%
+        int2index(n: Integer, indv: INDEX): INDEX ==
+            n < 0 => error "Index error (too small)"
+            rnk := #indv
+            for i in 1..rnk repeat
+                qr := divide(n, dim)
+                n  := qr.quotient
+                indv.((rnk-i+1) pretend NNI) := qr.remainder + minix
+            n ^= 0 => error "Index error (too big)"
+            indv
+
+        index2int(indv: INDEX): Integer ==
+            n: I := 0
+            for i in 1..#indv repeat
+                ix := indv.i - minix
+                ix<0 or ix>dim-1 => error "Index error (out of range)"
+                n := dim*n + ix
+            n
+
+        lengthRankOrElse(v: Integer): NNI ==
+            v = 1    => 0
+            v = dim  => 1
+            v = dim2 => 2
+            v = dim3 => 3
+            v = dim4 => 4
+            rx := 0
+            while v ^= 0 repeat
+                qr := divide(v, dim)
+                v  := qr.quotient
+                if v ^= 0 then
+                    qr.remainder ^= 0 => error "Rank is not a whole number"
+                    rx := rx + 1
+            rx
+
+        -- l must be a list of the numbers 1..#l
+        mkPerm(n: NNI, l: List Integer): PERM ==
+            #l ^= n =>
+                error "The list is not a permutation."
+            p:    PERM           := new(n, 0)
+            seen: Vector Boolean := new(n, false)
+            for i in 1..n for e in l repeat
+                e < 1 or e > n => error "The list is not a permutation."
+                p.i    := e
+                seen.e := true
+            for e in 1..n repeat
+                not seen.e => error "The list is not a permutation."
+            p
+
+        -- permute s according to p into result t.
+        permute_!(t: INDEX, s: INDEX, p: PERM): INDEX ==
+            for i in 1..#p repeat t.i := s.(p.i)
+            t
+
+        -- permsign!(v) = 1, 0, or -1  according as
+        -- v is an even, is not, or is an odd permutation of minix..minix+#v-1.
+        permsign_!(v: INDEX): Integer ==
+            -- sum minix..minix+#v-1.
+            maxix := minix+#v-1
+            psum  := (((maxix+1)*maxix - minix*(minix-1)) exquo 2)::Integer
+            -- +/v ^= psum => 0
+            n := 0
+            for i in 1..#v repeat n := n + v.i
+            n ^= psum => 0
+            -- Bubble sort!  This is pretty grotesque.
+            totTrans: Integer := 0
+            nTrans:   Integer := 1
+            while nTrans ^= 0 repeat
+                nTrans := 0
+                for i in 1..#v-1 for j in 2..#v repeat
+                    if v.i > v.j then
+                        nTrans := nTrans + 1
+                        e := v.i; v.i := v.j; v.j := e
+                totTrans := totTrans + nTrans
+            for i in 1..dim repeat
+                if v.i ^= minix+i-1 then return 0
+            odd? totTrans => -1
+            1
+
+
+        ---- Exported functions
+        ravel x ==
+            [get(x,i) for i in 0..#x-1]
+
+        unravel l ==
+            -- lengthRankOrElse #l gives sytnax error
+            nz: NNI := # l
+            lengthRankOrElse nz
+            z := new(nz, 0)
+            for i in 0..nz-1 for r in l repeat set_!(z, i, r)
+            z
+
+        kroneckerDelta() ==
+            z := new(dim2, 0)
+            for i in 1..dim for zi in 0.. by (dim+1) repeat set_!(z, zi, 1)
+            z
+        leviCivitaSymbol() ==
+            nz := dim**dim
+            z  := new(nz, 0)
+            indv: INDEX := new(dim, 0)
+            for i in 0..nz-1 repeat
+                set_!(z, i, permsign_!(int2index(i, indv))::R)
+            z
+
+        -- from GradedModule
+        degree x ==
+            rank x
+
+        rank x ==
+            n := #x
+            lengthRankOrElse n
+
+        elt(x) ==
+            #x ^= 1    => error "Index error (the rank is not 0)"
+            get(x,0)
+        elt(x, i: I) ==
+            #x ^= dim  => error "Index error (the rank is not 1)"
+            get(x,(i-minix))
+        elt(x, i: I, j: I) ==
+            #x ^= dim2 => error "Index error (the rank is not 2)"
+            get(x,(dim*(i-minix) + (j-minix)))
+        elt(x, i: I, j: I, k: I) ==
+            #x ^= dim3 => error "Index error (the rank is not 3)"
+            get(x,(dim2*(i-minix) + dim*(j-minix) + (k-minix)))
+        elt(x, i: I, j: I, k: I, l: I) ==
+            #x ^= dim4 => error "Index error (the rank is not 4)"
+            get(x,(dim3*(i-minix)+dim2*(j-minix)+dim*(k-minix)+(l-minix)))
+
+        elt(x, i: List I) ==
+            #i ^= rank x => error "Index error (wrong rank)"
+            n: I := 0
+            for ii in i repeat
+                ix := ii - minix
+                ix<0 or ix>dim-1 => error "Index error (out of range)"
+                n := dim*n + ix
+            get(x,n)
+
+        coerce(lr: List R): % ==
+            #lr ^= dim => error "Incorrect number of components"
+            z := new(dim, 0)
+            for r in lr for i in 0..dim-1 repeat set_!(z, i, r)
+            z
+        coerce(lx: List %): % ==
+            #lx ^= dim => error "Incorrect number of slices"
+            rx := rank first lx
+            for x in lx repeat
+                rank x ^= rx => error "Inhomogeneous slice ranks"
+            nx := # first lx
+            z  := new(dim * nx, 0)
+            for x in lx for offz in 0.. by nx repeat
+                for i in 0..nx-1 repeat set_!(z, offz + i, get(x,i))
+            z
+
+        retractIfCan(x:%):Union(R,"failed") ==
+            zero? rank(x) => x()
+            "failed"
+        Outf ==> OutputForm
+
+        mkOutf(x:%, i0:I, rnk:NNI): Outf ==
+            odd? rnk =>
+                rnk1  := (rnk-1) pretend NNI
+                nskip := dim**rnk1
+                [mkOutf(x, i0+nskip*i, rnk1) for i in 0..dim-1]::Outf
+            rnk = 0 =>
+                get(x,i0)::Outf
+            rnk1  := (rnk-2) pretend NNI
+            nskip := dim**rnk1
+            matrix [[mkOutf(x, i0+nskip*(dim*i + j), rnk1)
+                             for j in 0..dim-1] for i in 0..dim-1]
+        coerce(x): Outf ==
+            mkOutf(x, 0, rank x)
+
+        0 == 0$R::Rep
+        1 == 1$R::Rep
+
+        --coerce(n: I): % == new(1, n::R)
+        coerce(r: R): % == new(1,r)
+
+        coerce(v: DP(dim,R)): % ==
+            z := new(dim, 0)
+            for i in 0..dim-1 for j in minIndex v .. maxIndex v repeat
+                set_!(z, i, v.j)
+            z
+        coerce(m: SM(dim,R)): % ==
+            z := new(dim**2, 0)
+            offz := 0
+            for i in 0..dim-1 repeat
+                for j in 0..dim-1 repeat
+                    set_!(z, offz + j, m(i+1,j+1))
+                offz := offz + dim
+            z
+
+        x = y ==
+            #x ^= #y => false
+            for i in 0..#x-1 repeat
+               if get(x,i) ^= get(y,i) then return false
+            true
+        x + y ==
+            #x ^= #y => error "Rank mismatch"
+            -- z := [xi + yi for xi in x for yi in y]
+            z := new(#x, 0)
+            for i in 0..#x-1 repeat set_!(z, i, get(x,i) + get(y,i))
+            z
+        x - y ==
+            #x ^= #y => error "Rank mismatch"
+            -- [xi - yi for xi in x for yi in y]
+            z := new(#x, 0)
+            for i in 0..#x-1 repeat set_!(z, i, get(x,i) - get(y,i))
+            z
+        - x ==
+            -- [-xi for xi in x]
+            z := new(#x, 0)
+            for i in 0..#x-1 repeat set_!(z, i, -get(x,i))
+            z
+        n * x ==
+            -- [n * xi for xi in x]
+            z := new(#x, 0)
+            for i in 0..#x-1 repeat set_!(z, i, n * get(x,i))
+            z
+        x * n ==
+            -- [n * xi for xi in x]
+            z := new(#x, 0)
+            for i in 0..#x-1 repeat set_!(z, i, n* get(x,i))  -- Commutative!!
+            z
+        r * x ==
+            -- [r * xi for xi in x]
+            z := new(#x, 0)
+            for i in 0..#x-1 repeat set_!(z, i, r * get(x,i))
+            z
+        x * r ==
+            -- [xi*r for xi in x]
+            z := new(#x, 0)
+            for i in 0..#x-1 repeat set_!(z, i, r* get(x,i))  -- Commutative!!
+            z
+        product(x, y) ==
+            nx := #x; ny := #y
+            z  := new(nx * ny, 0)
+            for i in 0..nx-1 for ioff in 0.. by ny repeat
+                for j in 0..ny-1 repeat
+                    set_!(z, ioff + j, get(x,i) * get(y,j))
+            z
+        x * y ==
+            rx := rank x
+            ry := rank y
+            rx = 0 => get(x,0) * y
+            ry = 0 => x * get(y,0)
+            contract(x, rx, y, 1)
+
+        contract(x, i, j) ==
+            rx := rank x
+            i < 1 or i > rx or j < 1 or j > rx or i = j =>
+                error "Improper index for contraction"
+            if i > j then (i,j) := (j,i)
+
+            rl:= (rx- j) pretend NNI; nl:= dim**rl; zol:= 1;     xol:= zol
+            rm:= (j-i-1) pretend NNI; nm:= dim**rm; zom:= nl;    xom:= zom*dim
+            rh:= (i - 1) pretend NNI; nh:= dim**rh; zoh:= nl*nm
+            xoh:= zoh*dim**2
+            xok := nl*(1 + nm*dim)
+            z   := new(nl*nm*nh, 0)
+            for h in 1..nh _
+            for xh in 0.. by xoh for zh in 0.. by zoh repeat
+                for m in 1..nm _
+                for xm in xh.. by xom for zm in zh.. by zom repeat
+                    for l in 1..nl _
+                    for xl in xm.. by xol for zl in zm.. by zol repeat
+                        set_!(z, zl, 0)
+                        for k in 1..dim for xk in xl.. by xok repeat
+                            set_!(z, zl, get(z,zl) + get(x,xk))
+            z
+
+        contract(x, i, y, j) ==
+            rx := rank x
+            ry := rank y
+
+            i < 1 or i > rx or j < 1 or j > ry =>
+                error "Improper index for contraction"
+
+            rly:= (ry-j) pretend NNI;  nly:= dim**rly;  oly:= 1;    zoly:= 1
+            rhy:= (j -1) pretend NNI; nhy:= dim**rhy 
+            ohy:= nly*dim; zohy:= zoly*nly
+            rlx:= (rx-i) pretend NNI;  nlx:= dim**rlx  
+            olx:= 1;        zolx:= zohy*nhy
+            rhx:= (i -1) pretend NNI;  nhx:= dim**rhx
+            ohx:= nlx*dim;  zohx:= zolx*nlx
+
+            z := new(nlx*nhx*nly*nhy, 0)
+
+            for dxh in 1..nhx _
+            for xh in 0.. by ohx for zhx in 0.. by zohx repeat
+                for dxl in 1..nlx _
+                for xl in xh.. by olx for zlx in zhx.. by zolx repeat
+                    for dyh in 1..nhy _
+                    for yh in 0.. by ohy for zhy in zlx.. by zohy repeat
+                        for dyl in 1..nly _
+                        for yl in yh.. by oly for zly in zhy.. by zoly repeat
+                            set_!(z, zly, 0)
+                            for k in 1..dim _
+                            for xk in xl.. by nlx for yk in yl.. by nly repeat
+                                set_!(z, zly, get(z,zly)+get(x,xk)*get(y,yk))
+            z
+
+        transpose x ==
+            transpose(x, 1, rank x)
+        transpose(x, i, j) ==
+            rx := rank x
+            i < 1 or i > rx or j < 1 or j > rx or i = j =>
+                error "Improper indicies for transposition"
+            if i > j then (i,j) := (j,i)
+
+            rl:= (rx- j) pretend NNI; nl:= dim**rl; zol:= 1;      zoi := zol*nl
+            rm:= (j-i-1) pretend NNI; nm:= dim**rm; zom:= nl*dim; zoj := zom*nm
+            rh:= (i - 1) pretend NNI; nh:= dim**rh; zoh:= nl*nm*dim**2
+            z   := new(#x, 0)
+            for h in 1..nh for zh in 0..  by zoh repeat _
+            for m in 1..nm for zm in zh.. by zom repeat _
+            for l in 1..nl for zl in zm.. by zol repeat _
+                for p in 1..dim _
+                for zp in zl.. by zoi for xp in zl.. by zoj repeat
+                    for q in 1..dim _
+                    for zq in zp.. by zoj for xq in xp.. by zoi repeat
+                        set_!(z, zq, get(x,xq))
+            z
+
+        reindex(x, l) ==
+            nx := #x
+            z: % := new(nx, 0)
+
+            rx := rank x
+            p  := mkPerm(rx, l)
+            xiv: INDEX := new(rx, 0)
+            ziv: INDEX := new(rx, 0)
+
+            -- Use permutation
+            for i in 0..#x-1 repeat
+                pi := index2int(permute_!(ziv, int2index(i,xiv),p))
+                set_!(z, pi, get(x,i))
+            z
+
+@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain COLOR Color}
+<<dot>>=
+"COLOR" -> "ABELSG"
+"Color()" -> "AbelianSemiGroup()"
+@
+\pagehead{Color}{COLOR}
+\pagepic{ps/v103color.ps}{COLOR}{1.00}
+<<domain COLOR Color>>=
+)abbrev domain COLOR Color
+++ Author: Jim Wen
+++ Date Created: 10 May 1989
+++ Date Last Updated: 19 Mar 1991 by Jon Steinbach
+++ Basic Operations: red, yellow, green, blue, hue, numberOfHues, color, +, *, =
+++ Related Constructors:
+++ Also See:
+++ AMS Classifications:
+++ Keywords: 
+++ References:
+++ Description: Color() specifies a domain of 27 colors provided in the 
+++ \Language{} system (the colors mix additively).
+ 
+
+Color(): Exports == Implementation where
+  I      ==> Integer
+  PI     ==> PositiveInteger
+  SF     ==> DoubleFloat
+ 
+  Exports ==> AbelianSemiGroup with
+    "*"    : (PI, %) -> %
+      ++ s * c, returns the color c, whose weighted shade has been scaled by s.
+    "*"    : (SF, %) -> %
+      ++ s * c, returns the color c, whose weighted shade has been scaled by s.
+    "+"    : (%, %) -> %
+      ++ c1 + c2 additively mixes the two colors c1 and c2.
+    red    : ()      -> %
+      ++ red() returns the position of the red hue from total hues.
+    yellow : ()      -> %
+      ++ yellow() returns the position of the yellow hue from total hues.
+    green  : ()      -> %
+      ++ green() returns the position of the green hue from total hues.
+    blue   : ()      -> %
+      ++ blue() returns the position of the blue hue from total hues.
+    hue    : %       -> I
+      ++ hue(c) returns the hue index of the indicated color c.
+    numberOfHues : ()    -> PI
+      ++ numberOfHues() returns the number of total hues, set in totalHues.
+    color  : Integer -> %
+      ++ color(i) returns a color of the indicated hue i.
+  
+  Implementation ==> add
+    totalHues   ==> 27  --see  (header.h file) for the current number
+
+    Rep := Record(hue:I, weight:SF)
+ 
+
+    f:SF * c:% ==
+      -- s * c returns the color c, whose weighted shade has been scaled by s
+      zero? f => c
+      -- 0 is the identitly function...or maybe an error is better?
+      [c.hue, f * c.weight]
+ 
+    x + y ==
+     x.hue = y.hue => [x.hue, x.weight + y.weight]
+     if y.weight > x.weight then  -- let x be color with bigger weight
+       c := x
+       x := y
+       y := c
+     diff := x.hue - y.hue
+     if (xHueSmaller:= (diff < 0)) then diff := -diff
+     if (moreThanHalf:=(diff > totalHues quo 2)) then diff := totalHues-diff
+     offset : I := wholePart(round (diff::SF/(2::SF)**(x.weight/y.weight)) )
+     if (xHueSmaller and ^moreThanHalf) or (^xHueSmaller and moreThanHalf) then
+       ans := x.hue + offset
+     else
+       ans := x.hue - offset
+     if (ans < 0) then ans := totalHues + ans
+     else if (ans > totalHues) then ans := ans - totalHues
+     [ans,1]
+ 
+    x = y     == (x.hue = y.hue) and (x.weight = y.weight)
+    red()     == [1,1]
+    yellow()  == [11::I,1]
+    green()   == [14::I,1]
+    blue()    == [22::I,1]
+    sample()  == red()
+    hue c     == c.hue
+    i:PositiveInteger * c:% == i::SF * c
+    numberOfHues() == totalHues 
+
+    color i ==
+      if (i<0) or (i>totalHues) then
+       error concat("Color should be in the range 1..",totalHues::String)
+      [i::I, 1]
+ 
+    coerce(c:%):OutputForm ==
+      hconcat ["Hue: "::OutputForm, (c.hue)::OutputForm,
+               "  Weight: "::OutputForm, (c.weight)::OutputForm]
+
+@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain CONTFRAC ContinuedFraction}
+<<ContinuedFraction.input>>=
+-- contfrac.spad.pamphlet ContinuedFraction.input
+)spool ContinuedFraction.output
+)set message test on
+)set message auto off
+)clear all
+--S 1 of 22
+c := continuedFraction(314159/100000)
+--R 
+--R
+--R              1 |     1  |     1 |     1  |     1 |     1 |     1 |
+--R   (1)  3 + +---+ + +----+ + +---+ + +----+ + +---+ + +---+ + +---+
+--R            | 7     | 15     | 1     | 25     | 1     | 7     | 4
+--R                                              Type: ContinuedFraction Integer
+--E 1
+
+--S 2 of 22
+partialQuotients c
+--R 
+--R
+--R   (2)  [3,7,15,1,25,1,7,4]
+--R                                                         Type: Stream Integer
+--E 2
+
+--S 3 of 22
+convergents c
+--R 
+--R
+--R           22 333 355 9208 9563 76149 314159
+--R   (3)  [3,--,---,---,----,----,-----,------]
+--R            7 106 113 2931 3044 24239 100000
+--R                                                Type: Stream Fraction Integer
+--E 3
+
+--S 4 of 22
+approximants c
+--R 
+--R
+--R                                      ______
+--R           22 333 355 9208 9563 76149 314159
+--R   (4)  [3,--,---,---,----,----,-----,------]
+--R            7 106 113 2931 3044 24239 100000
+--R                                                Type: Stream Fraction Integer
+--E 4
+
+--S 5 of 22
+pq := partialQuotients(1/c)
+--R 
+--R
+--R   (5)  [0,3,7,15,1,25,1,7,4]
+--R                                                         Type: Stream Integer
+--E 5
+
+--S 6 of 22
+continuedFraction(first pq,repeating [1],rest pq)
+--R 
+--R
+--R          1 |     1 |     1  |     1 |     1  |     1 |     1 |     1 |
+--R   (6)  +---+ + +---+ + +----+ + +---+ + +----+ + +---+ + +---+ + +---+
+--R        | 3     | 7     | 15     | 1     | 25     | 1     | 7     | 4
+--R                                              Type: ContinuedFraction Integer
+--E 6
+
+--S 7 of 22
+z:=continuedFraction(3,repeating [1],repeating [3,6])
+--R 
+--R
+--R   (7)
+--R           1 |     1 |     1 |     1 |     1 |     1 |     1 |     1 |     1 |
+--R     3 + +---+ + +---+ + +---+ + +---+ + +---+ + +---+ + +---+ + +---+ + +---+
+--R         | 3     | 6     | 3     | 6     | 3     | 6     | 3     | 6     | 3
+--R   + 
+--R       1 |
+--R     +---+ + ...
+--R     | 6
+--R                                              Type: ContinuedFraction Integer
+--E 7
+
+--S 8 of 22
+dens:Stream Integer := cons(1,generate((x+->x+4),6))
+--R 
+--R
+--R   (8)  [1,6,10,14,18,22,26,30,34,38,...]
+--R                                                         Type: Stream Integer
+--E 8
+
+--S 9 of 22
+cf := continuedFraction(0,repeating [1],dens)
+--R 
+--R
+--R   (9)
+--R       1 |     1 |     1  |     1  |     1  |     1  |     1  |     1  |
+--R     +---+ + +---+ + +----+ + +----+ + +----+ + +----+ + +----+ + +----+
+--R     | 1     | 6     | 10     | 14     | 18     | 22     | 26     | 30
+--R   + 
+--R       1  |     1  |
+--R     +----+ + +----+ + ...
+--R     | 34     | 38
+--R                                              Type: ContinuedFraction Integer
+--E 9
+
+--S 10 of 22
+ccf := convergents cf
+--R 
+--R
+--R              6 61  860 15541 342762  8927353 268163352  9126481321
+--R   (10)  [0,1,-,--,----,-----,------,--------,---------,-----------,...]
+--R              7 71 1001 18089 398959 10391023 312129649 10622799089
+--R                                                Type: Stream Fraction Integer
+--E 10
+
+--S 11 of 22
+eConvergents := [2*e + 1 for e in ccf]
+--R 
+--R
+--R              19 193 2721 49171 1084483 28245729 848456353 28875761731
+--R   (11)  [1,3,--,---,----,-----,-------,--------,---------,-----------,...]
+--R               7  71 1001 18089  398959 10391023 312129649 10622799089
+--R                                                Type: Stream Fraction Integer
+--E 11
+
+--S 12 of 22
+eConvergents :: Stream Float
+--R 
+--R
+--R   (12)
+--R   [1.0, 3.0, 2.7142857142 857142857, 2.7183098591 549295775,
+--R    2.7182817182 817182817, 2.7182818287 356957267, 2.7182818284 585634113,
+--R    2.7182818284 590458514, 2.7182818284 590452348, 2.7182818284 590452354,
+--R    ...]
+--R                                                           Type: Stream Float
+--E 12
+
+--S 13 of 22
+exp 1.0
+--R 
+--R
+--R   (13)  2.7182818284 590452354
+--R                                                                  Type: Float
+--E 13
+
+--S 14 of 22
+cf := continuedFraction(1,[(2*i+1)**2 for i in 0..],repeating [2])
+--R 
+--R
+--R   (14)
+--R           1 |     9 |     25 |     49 |     81 |     121 |     169 |     225 |
+--R     1 + +---+ + +---+ + +----+ + +----+ + +----+ + +-----+ + +-----+ + +-----+
+--R         | 2     | 2     | 2      | 2      | 2      |  2      |  2      |  2
+--R   + 
+--R       289 |     361 |
+--R     +-----+ + +-----+ + ...
+--R     |  2      |  2
+--R                                              Type: ContinuedFraction Integer
+--E 14
+
+--S 15 of 22
+ccf := convergents cf
+--R 
+--R
+--R            3 15 105 315 3465 45045 45045 765765 14549535
+--R   (15)  [1,-,--,---,---,----,-----,-----,------,--------,...]
+--R            2 13  76 263 2578 36979 33976 622637 11064338
+--R                                                Type: Stream Fraction Integer
+--E 15
+
+--S 16 of 22
+piConvergents := [4/p for p in ccf] 
+--R 
+--R
+--R            8 52 304 1052 10312 147916 135904 2490548 44257352
+--R   (16)  [4,-,--,---,----,-----,------,------,-------,--------,...]
+--R            3 15 105  315  3465  45045  45045  765765 14549535
+--R                                                Type: Stream Fraction Integer
+--E 16
+
+--S 17 of 22
+piConvergents :: Stream Float
+--R 
+--R
+--R   (17)
+--R   [4.0, 2.6666666666 666666667, 3.4666666666 666666667,
+--R    2.8952380952 380952381, 3.3396825396 825396825, 2.9760461760 461760462,
+--R    3.2837384837 384837385, 3.0170718170 718170718, 3.2523659347 188758953,
+--R    3.0418396189 294022111, ...]
+--R                                                           Type: Stream Float
+--E 17
+
+--S 18 of 22
+continuedFraction((- 122 + 597*%i)/(4 - 4*%i))
+--R 
+--R
+--R                            1    |         1     |
+--R   (18)  - 90 + 59%i + +---------+ + +-----------+
+--R                       | 1 - 2%i     | - 1 + 2%i
+--R                                      Type: ContinuedFraction Complex Integer
+--E 18
+
+--S 19 of 22
+r : Fraction UnivariatePolynomial(x,Fraction Integer) 
+--R 
+--R                                                                   Type: Void
+--E 19
+
+--S 20 of 22
+r := ((x - 1) * (x - 2)) / ((x-3) * (x-4))
+--R 
+--R
+--R           2
+--R          x  - 3x + 2
+--R   (20)  ------------
+--R          2
+--R         x  - 7x + 12
+--R                      Type: Fraction UnivariatePolynomial(x,Fraction Integer)
+--E 20
+
+--S 21 of 22
+continuedFraction r 
+--R 
+--R
+--R                  1    |         1     |
+--R   (21)  1 + +---------+ + +-----------+
+--R             | 1     9     | 16     40
+--R             | - x - -     | -- x - --
+--R             | 4     8     |  3      3
+--R             Type: ContinuedFraction UnivariatePolynomial(x,Fraction Integer)
+--E 21
+
+--S 22 of 22
+[i*i for i in convergents(z) :: Stream Float] 
+--R 
+--R
+--R   (22)
+--R   [9.0, 11.1111111111 11111111, 10.9944598337 9501385, 11.0002777777 77777778,
+--R    10.9999860763 98799786, 11.0000006979 29731039, 10.9999999650 15834446,
+--R    11.0000000017 53603304, 10.9999999999 12099531, 11.0000000000 04406066,
+--R    ...]
+--R                                                           Type: Stream Float
+--E 22
+)spool
+)lisp (bye)
+@
+<<ContinuedFraction.help>>=
+====================================================================
+ContinuedFraction examples
+====================================================================
+
+Continued fractions have been a fascinating and useful tool in
+mathematics for well over three hundred years.  Axiom implements
+continued fractions for fractions of any Euclidean domain.  In
+practice, this usually means rational numbers.  In this section we
+demonstrate some of the operations available for manipulating both
+finite and infinite continued fractions.  
+
+The ContinuedFraction domain is a field and therefore you can add,
+subtract, multiply and divide the fractions.
+
+The continuedFraction operation converts its fractional argument to a
+continued fraction.
+
+  c := continuedFraction(314159/100000)
+         1 |     1  |     1 |     1  |     1 |     1 |     1 |
+   3 + +---+ + +----+ + +---+ + +----+ + +---+ + +---+ + +---+
+       | 7     | 15     | 1     | 25     | 1     | 7     | 4
+                        Type: ContinuedFraction Integer
+
+This display is a compact form of the bulkier
+
+        3 +                 1
+            -------------------------------
+            7 +               1
+                ---------------------------
+                15 +            1
+                     ----------------------
+                     1 +          1
+                         ------------------
+                         25 +       1
+                              -------------
+                              1 +     1
+                                  ---------
+                                  7 +   1
+                                      -----
+                                        4
+
+You can write any rational number in a similar form.  The fraction
+will be finite and you can always take the "numerators" to be 1.
+That is, any rational number can be written as a simple, finite
+continued fraction of the form
+
+        a(1) +           1
+               -------------------------
+               a(2) +          1
+                      --------------------
+                      a(3) +
+                             .
+                              .
+                               .
+                                     1
+                               -------------
+                               a(n-1) +  1
+                                        ----
+                                        a(n)
+
+
+The a(i) are called partial quotients and the operation partialQuotients 
+creates a stream of them.
+
+  partialQuotients c
+   [3,7,15,1,25,1,7,4]
+                        Type: Stream Integer
+
+By considering more and more of the fraction, you get the convergents.
+For example, the first convergent is a(1), the second is a(1) + 1/a(2)
+and so on.
+
+  convergents c
+      22 333 355 9208 9563 76149 314159
+   [3,--,---,---,----,----,-----,------]
+       7 106 113 2931 3044 24239 100000
+                         Type: Stream Fraction Integer
+
+Since this is a finite continued fraction, the last convergent is the
+original rational number, in reduced form.  The result of approximants
+is always an infinite stream, though it may just repeat the "last" value.
+
+  approximants c
+                                 ______
+      22 333 355 9208 9563 76149 314159
+   [3,--,---,---,----,----,-----,------]
+       7 106 113 2931 3044 24239 100000
+                         Type: Stream Fraction Integer
+
+Inverting c only changes the partial quotients of its fraction by
+inserting a 0 at the beginning of the list.
+
+  pq := partialQuotients(1/c)
+   [0,3,7,15,1,25,1,7,4]
+                         Type: Stream Integer
+
+Do this to recover the original continued fraction from this list of
+partial quotients.  The three-argument form of the continuedFraction
+operation takes an element which is the whole part of the fraction, a
+stream of elements which are the numerators of the fraction, and a
+stream of elements which are the denominators of the fraction.
+
+  continuedFraction(first pq,repeating [1],rest pq)
+     1 |     1 |     1  |     1 |     1  |     1 |     1 |     1 |
+   +---+ + +---+ + +----+ + +---+ + +----+ + +---+ + +---+ + +---+
+   | 3     | 7     | 15     | 1     | 25     | 1     | 7     | 4
+                         Type: ContinuedFraction Integer
+
+The streams need not be finite for continuedFraction.  Can you guess
+which irrational number has the following continued fraction?  See the
+end of this section for the answer.
+
+  z:=continuedFraction(3,repeating [1],repeating [3,6])
+           1 |     1 |     1 |     1 |     1 |     1 |     1 |     1 |     1 |
+     3 + +---+ + +---+ + +---+ + +---+ + +---+ + +---+ + +---+ + +---+ + +---+
+         | 3     | 6     | 3     | 6     | 3     | 6     | 3     | 6     | 3
+   + 
+       1 |
+     +---+ + ...
+     | 6
+                         Type: ContinuedFraction Integer
+
+In 1737 Euler discovered the infinite continued fraction expansion
+
+        e - 1             1
+        ----- = ---------------------
+          2     1 +         1
+                    -----------------
+                    6 +       1
+                        -------------
+                        10 +    1
+                             --------
+                             14 + ...
+
+
+We use this expansion to compute rational and floating point
+approximations of e. For this and other interesting expansions, see
+C. D. Olds, Continued Fractions, New Mathematical Library, (New York:
+Random House, 1963), pp.  134--139.}
+
+By looking at the above expansion, we see that the whole part is 0 and
+the numerators are all equal to 1.  This constructs the stream of
+denominators.
+
+  dens:Stream Integer := cons(1,generate((x+->x+4),6))
+   [1,6,10,14,18,22,26,30,34,38,...]
+                        Type: Stream Integer
+
+Therefore this is the continued fraction expansion for (e - 1) / 2.
+
+  cf := continuedFraction(0,repeating [1],dens)
+       1 |     1 |     1  |     1  |     1  |     1  |     1  |     1  |
+     +---+ + +---+ + +----+ + +----+ + +----+ + +----+ + +----+ + +----+
+     | 1     | 6     | 10     | 14     | 18     | 22     | 26     | 30
+   + 
+       1  |     1  |
+     +----+ + +----+ + ...
+     | 34     | 38
+                    Type: ContinuedFraction Integer
+
+These are the rational number convergents.
+
+  ccf := convergents cf
+        6 61  860 15541 342762  8927353 268163352  9126481321
+   [0,1,-,--,----,-----,------,--------,---------,-----------,...]
+        7 71 1001 18089 398959 10391023 312129649 10622799089
+                    Type: Stream Fraction Integer
+
+You can get rational convergents for e by multiplying by 2 and adding 1.
+
+  eConvergents := [2*e + 1 for e in ccf]
+         19 193 2721 49171 1084483 28245729 848456353 28875761731
+    [1,3,--,---,----,-----,-------,--------,---------,-----------,...]
+          7  71 1001 18089  398959 10391023 312129649 10622799089
+                    Type: Stream Fraction Integer
+
+You can also compute the floating point approximations to these convergents.
+
+  eConvergents :: Stream Float
+   [1.0, 3.0, 2.7142857142 857142857, 2.7183098591 549295775,
+    2.7182817182 817182817, 2.7182818287 356957267, 2.7182818284 585634113,
+    2.7182818284 590458514, 2.7182818284 590452348, 2.7182818284 590452354,
+    ...]
+                       Type: Stream Float
+
+Compare this to the value of e computed by the exp operation in Float.
+
+  exp 1.0
+   2.7182818284 590452354
+                       Type: Float
+
+In about 1658, Lord Brouncker established the following expansion
+for 4 / pi,
+
+        1 +            1
+            -----------------------
+            2 +          9
+                -------------------
+                2 +        25
+                    ---------------
+                    2 +      49
+                        -----------
+                        2 +    81
+                            -------
+                            2 + ...
+
+Let's use this expansion to compute rational and floating point
+approximations for pi.
+
+  cf := continuedFraction(1,[(2*i+1)**2 for i in 0..],repeating [2])
+           1 |     9 |     25 |     49 |     81 |     121 |     169 |     225 |
+     1 + +---+ + +---+ + +----+ + +----+ + +----+ + +-----+ + +-----+ + +-----+
+         | 2     | 2     | 2      | 2      | 2      |  2      |  2      |  2
+   + 
+       289 |     361 |
+     +-----+ + +-----+ + ...
+     |  2      |  2
+                       Type: ContinuedFraction Integer
+
+  ccf := convergents cf
+      3 15 105 315 3465 45045 45045 765765 14549535
+   [1,-,--,---,---,----,-----,-----,------,--------,...]
+      2 13  76 263 2578 36979 33976 622637 11064338
+                       Type: Stream Fraction Integer
+
+  piConvergents := [4/p for p in ccf] 
+      8 52 304 1052 10312 147916 135904 2490548 44257352
+   [4,-,--,---,----,-----,------,------,-------,--------,...]
+      3 15 105  315  3465  45045  45045  765765 14549535
+                       Type: Stream Fraction Integer
+
+As you can see, the values are converging to
+pi = 3.14159265358979323846..., but not very quickly.
+
+  piConvergents :: Stream Float
+   [4.0, 2.6666666666 666666667, 3.4666666666 666666667,
+    2.8952380952 380952381, 3.3396825396 825396825, 2.9760461760 461760462,
+    3.2837384837 384837385, 3.0170718170 718170718, 3.2523659347 188758953,
+    3.0418396189 294022111, ...]
+                      Type: Stream Float
+
+You need not restrict yourself to continued fractions of integers.
+Here is an expansion for a quotient of Gaussian integers.
+
+  continuedFraction((- 122 + 597*%i)/(4 - 4*%i))
+                      1    |         1     |
+   - 90 + 59%i + +---------+ + +-----------+
+                 | 1 - 2%i     | - 1 + 2%i
+                      Type: ContinuedFraction Complex Integer
+
+This is an expansion for a quotient of polynomials in one variable
+with rational number coefficients.
+
+  r : Fraction UnivariatePolynomial(x,Fraction Integer) 
+                      Type: Void
+
+  r := ((x - 1) * (x - 2)) / ((x-3) * (x-4))
+     2
+    x  - 3x + 2
+   ------------
+    2
+   x  - 7x + 12
+                      Type: Fraction UnivariatePolynomial(x,Fraction Integer)
+
+  continuedFraction r 
+            1    |         1     |
+   1 + +---------+ + +-----------+
+       | 1     9     | 16     40
+       | - x - -     | -- x - --
+       | 4     8     |  3      3
+             Type: ContinuedFraction UnivariatePolynomial(x,Fraction Integer)
+
+To conclude this section, we give you evidence that
+
+    z = 3 +            1
+            -----------------------
+            3 +          1
+                -------------------
+                6 +        1
+                    ---------------
+                    3 +      1
+                        -----------
+                        6 +    1
+                            -------
+                            3 + ...
+
+is the expansion of sqrt(11).
+
+  [i*i for i in convergents(z) :: Stream Float] 
+   [9.0, 11.1111111111 11111111, 10.9944598337 9501385, 11.0002777777 77777778,
+    10.9999860763 98799786, 11.0000006979 29731039, 10.9999999650 15834446,
+    11.0000000017 53603304, 10.9999999999 12099531, 11.0000000000 04406066,
+    ...]
+                        Type: Stream Float
+
+See Also:
+o )help Stream
+o )show ContinuedFraction
+o $AXIOM/doc/src/algebra/contrac.spad.dvi
+
+@
+<<dot>>=
+"CONTFRAC" -> "ALGEBRA"
+"ContinuedFraction(a:EuclideanDomain)" -> "Algebra(a:EuclideanDomain)"
+"ContinuedFraction(a:EuclideanDomain)" ->
+    "Algebra(a:Fraction(EuclideanDomain))"
+"CONTFRAC" -> "FIELD"
+"ContinuedFraction(a:EuclideanDomain)" -> "Field()"
+@
+\pagehead{ContinuedFraction}{CONTFRAC}
+\pagepic{ps/v103continuedfraction.ps}{CONTFRAC}{1.00}
+<<domain CONTFRAC ContinuedFraction>>=
+)abbrev domain CONTFRAC ContinuedFraction
+++ Author: Stephen M. Watt
+++ Date Created: January 1987
+++ Change History:
+++   11 April   1990
+++    7 October 1991 -- SMW: Treat whole part specially.  Added comments.
+++ Basic Operations:
+++   (Field), (Algebra),
+++   approximants, complete, continuedFraction, convergents, denominators,
+++   extend, numerators, partialDenominators, partialNumerators,
+++   partialQuotients, reducedContinuedFraction, reducedForm, wholePart
+++ Related Constructors:
+++ Also See: Fraction
+++ AMS Classifications: 11A55 11J70 11K50 11Y65 30B70 40A15
+++ Keywords: continued fraction, convergent
+++ References:
+++ Description:  \spadtype{ContinuedFraction} implements general
+++   continued fractions.  This version is not restricted to simple,
+++   finite fractions and uses the \spadtype{Stream} as a
+++   representation.  The arithmetic functions assume that the
+++   approximants alternate below/above the convergence point.
+++   This is enforced by ensuring the partial numerators and partial
+++   denominators are greater than 0 in the Euclidean domain view of \spad{R}
+++   (i.e. \spad{sizeLess?(0, x)}). 
+ContinuedFraction(R): Exports == Implementation where
+  R :     EuclideanDomain
+  Q   ==> Fraction R
+  MT  ==> MoebiusTransform Q
+  OUT ==> OutputForm
+
+  Exports ==> Join(Algebra R,Algebra Q,Field) with
+    continuedFraction:        Q -> %
+      ++ continuedFraction(r) converts the fraction \spadvar{r} with
+      ++ components of type \spad{R} to a continued fraction over
+      ++ \spad{R}.
+
+    continuedFraction:        (R, Stream R, Stream R) -> %
+      ++ continuedFraction(b0,a,b) constructs a continued fraction in
+      ++ the following way:  if \spad{a = [a1,a2,...]} and \spad{b =
+      ++ [b1,b2,...]} then the result is the continued fraction
+      ++ \spad{b0 + a1/(b1 + a2/(b2 + ...))}.
+
+    reducedContinuedFraction: (R, Stream R) -> %
+      ++ reducedContinuedFraction(b0,b) constructs a continued
+      ++ fraction in the following way:  if \spad{b = [b1,b2,...]}
+      ++ then the result is the continued fraction \spad{b0 + 1/(b1 +
+      ++ 1/(b2 + ...))}.  That is, the result is the same as
+      ++ \spad{continuedFraction(b0,[1,1,1,...],[b1,b2,b3,...])}.
+
+    partialNumerators:   % -> Stream R
+      ++ partialNumerators(x) extracts the numerators in \spadvar{x}.
+      ++ That is, if \spad{x = continuedFraction(b0, [a1,a2,a3,...],
+      ++ [b1,b2,b3,...])}, then \spad{partialNumerators(x) =
+      ++ [a1,a2,a3,...]}.
+
+    partialDenominators: % -> Stream R
+      ++ partialDenominators(x) extracts the denominators in
+      ++ \spadvar{x}.  That is, if \spad{x = continuedFraction(b0,
+      ++ [a1,a2,a3,...], [b1,b2,b3,...])}, then
+      ++ \spad{partialDenominators(x) = [b1,b2,b3,...]}.
+
+    partialQuotients:    % -> Stream R
+      ++ partialQuotients(x) extracts the partial quotients in
+      ++ \spadvar{x}.  That is, if \spad{x = continuedFraction(b0,
+      ++ [a1,a2,a3,...], [b1,b2,b3,...])}, then
+      ++ \spad{partialQuotients(x) = [b0,b1,b2,b3,...]}.
+
+    wholePart:           % -> R
+      ++ wholePart(x) extracts the whole part of \spadvar{x}.  That
+      ++ is, if \spad{x = continuedFraction(b0, [a1,a2,a3,...],
+      ++ [b1,b2,b3,...])}, then \spad{wholePart(x) = b0}.
+
+    reducedForm:         % -> %
+      ++ reducedForm(x) puts the continued fraction \spadvar{x} in
+      ++ reduced form, i.e.  the function returns an equivalent
+      ++ continued fraction of the form
+      ++ \spad{continuedFraction(b0,[1,1,1,...],[b1,b2,b3,...])}.
+
+    approximants:        % -> Stream Q
+      ++ approximants(x) returns the stream of approximants of the
+      ++ continued fraction \spadvar{x}. If the continued fraction is
+      ++ finite, then the stream will be infinite and periodic with
+      ++ period 1.
+
+    convergents:         % -> Stream Q
+      ++ convergents(x) returns the stream of the convergents of the
+      ++ continued fraction \spadvar{x}. If the continued fraction is
+      ++ finite, then the stream will be finite.
+
+    numerators:          % -> Stream R
+      ++ numerators(x) returns the stream of numerators of the
+      ++ approximants of the continued fraction \spadvar{x}. If the
+      ++ continued fraction is finite, then the stream will be finite.
+
+    denominators:        % -> Stream R
+      ++ denominators(x) returns the stream of denominators of the
+      ++ approximants of the continued fraction \spadvar{x}. If the
+      ++ continued fraction is finite, then the stream will be finite.
+
+    extend:              (%,Integer) -> %
+      ++ extend(x,n) causes the first \spadvar{n} entries in the
+      ++ continued fraction \spadvar{x} to be computed.  Normally
+      ++ entries are only computed as needed.
+
+    complete:            % -> %
+      ++ complete(x) causes all entries in \spadvar{x} to be computed.
+      ++ Normally entries are only computed as needed.  If \spadvar{x}
+      ++ is an infinite continued fraction, a user-initiated interrupt is
+      ++ necessary to stop the computation.
+
+  Implementation ==> add
+
+ -- isOrdered  ==> R is Integer
+    isOrdered  ==> R has OrderedRing and R has multiplicativeValuation
+    canReduce? ==> isOrdered or R has additiveValuation
+
+    Rec ==> Record(num: R, den: R)
+    Str ==> Stream Rec
+    Rep :=  Record(value: Record(whole: R, fract: Str), reduced?: Boolean)
+
+    import Str
+
+    genFromSequence:     Stream Q -> %
+    genReducedForm:      (Q, Stream Q, MT)    -> Stream Rec
+    genFractionA:        (Stream R,Stream R)  -> Stream Rec
+    genFractionB:        (Stream R,Stream R)  -> Stream Rec
+    genNumDen:           (R,R, Stream Rec)    -> Stream R
+
+    genApproximants:     (R,R,R,R,Stream Rec) -> Stream Q
+    genConvergents:      (R,R,R,R,Stream Rec) -> Stream Q
+    iGenApproximants:    (R,R,R,R,Stream Rec) -> Stream Q
+    iGenConvergents:     (R,R,R,R,Stream Rec) -> Stream Q
+
+    reducedForm c == 
+        c.reduced? => c
+        explicitlyFinite? c.value.fract =>
+                      continuedFraction last complete convergents c
+        canReduce? => genFromSequence approximants c
+        error "Reduced form not defined for this continued fraction."
+
+    eucWhole(a: Q): R == numer a quo denom a
+
+    eucWhole0(a: Q): R ==
+        isOrdered =>
+            n := numer a
+            d := denom a
+            q := n quo d
+            r := n - q*d
+            if r < 0 then q := q - 1
+            q
+        eucWhole a
+
+    x = y ==
+        x := reducedForm x
+        y := reducedForm y
+
+        x.value.whole ^= y.value.whole => false
+
+        xl := x.value.fract; yl := y.value.fract
+
+        while not empty? xl and not empty? yl repeat
+            frst.xl.den ^= frst.yl.den => return false
+            xl := rst xl; yl := rst yl
+        empty? xl and empty? yl
+
+    continuedFraction q == q :: %
+
+    if isOrdered then
+        continuedFraction(wh,nums,dens) == [[wh,genFractionA(nums,dens)],false]
+
+        genFractionA(nums,dens) ==
+            empty? nums or empty? dens => empty()
+            n := frst nums
+            d := frst dens
+            n < 0 => error "Numerators must be greater than 0."
+            d < 0 => error "Denominators must be greater than 0."
+            concat([n,d]$Rec, delay genFractionA(rst nums,rst dens))
+    else
+        continuedFraction(wh,nums,dens) == [[wh,genFractionB(nums,dens)],false]
+
+        genFractionB(nums,dens) ==
+            empty? nums or empty? dens => empty()
+            n := frst nums
+            d := frst dens
+            concat([n,d]$Rec, delay genFractionB(rst nums,rst dens))
+
+    reducedContinuedFraction(wh,dens) ==
+        continuedFraction(wh, repeating [1], dens)
+
+    coerce(n:Integer):% == [[n::R,empty()], true]
+    coerce(r:R):%       == [[r,   empty()], true]
+
+    coerce(a: Q): % ==
+      wh := eucWhole0 a
+      fr := a - wh::Q
+      zero? fr => [[wh, empty()], true]
+
+      l : List Rec := empty()
+      n := numer fr
+      d := denom fr
+      while not zero? d repeat
+        qr := divide(n,d)
+        l  := concat([1,qr.quotient],l)
+        n  := d
+        d  := qr.remainder
+      [[wh, construct rest reverse_! l], true]
+
+    characteristic() == characteristic()$Q
+
+
+    genFromSequence apps ==
+        lo := first apps; apps := rst apps
+        hi := first apps; apps := rst apps
+        while eucWhole0 lo ^= eucWhole0 hi repeat
+            lo := first apps; apps := rst apps
+            hi := first apps; apps := rst apps
+        wh := eucWhole0 lo
+        [[wh, genReducedForm(wh::Q, apps, moebius(1,0,0,1))], canReduce?]
+
+    genReducedForm(wh0, apps, mt) ==
+        lo: Q := first apps - wh0; apps := rst apps
+        hi: Q := first apps - wh0; apps := rst apps
+        lo = hi and zero? eval(mt, lo) => empty()
+        mt  := recip mt
+        wlo := eucWhole eval(mt, lo)
+        whi := eucWhole eval(mt, hi)
+        while wlo ^= whi repeat
+            wlo := eucWhole eval(mt, first apps - wh0); apps := rst apps
+            whi := eucWhole eval(mt, first apps - wh0); apps := rst apps
+        concat([1,wlo], delay genReducedForm(wh0, apps, shift(mt, -wlo::Q)))
+
+    wholePart c           == c.value.whole
+    partialNumerators c   == map(#1.num, c.value.fract)$StreamFunctions2(Rec,R)
+    partialDenominators c == map(#1.den, c.value.fract)$StreamFunctions2(Rec,R)
+    partialQuotients c    == concat(c.value.whole, partialDenominators c)
+
+    approximants c ==
+      empty? c.value.fract => repeating [c.value.whole::Q]
+      genApproximants(1,0,c.value.whole,1,c.value.fract)
+    convergents c ==
+      empty? c.value.fract => concat(c.value.whole::Q, empty())
+      genConvergents (1,0,c.value.whole,1,c.value.fract)
+    numerators c ==
+      empty? c.value.fract => concat(c.value.whole, empty())
+      genNumDen(1,c.value.whole,c.value.fract)
+    denominators c ==
+      genNumDen(0,1,c.value.fract)
+
+    extend(x,n) == (extend(x.value.fract,n); x)
+    complete(x) == (complete(x.value.fract); x)
+
+    iGenApproximants(pm2,qm2,pm1,qm1,fr) == delay
+      nd := frst fr
+      pm := nd.num*pm2 + nd.den*pm1
+      qm := nd.num*qm2 + nd.den*qm1
+      genApproximants(pm1,qm1,pm,qm,rst fr)
+
+    genApproximants(pm2,qm2,pm1,qm1,fr) ==
+      empty? fr => repeating [pm1/qm1]
+      concat(pm1/qm1,iGenApproximants(pm2,qm2,pm1,qm1,fr))
+
+    iGenConvergents(pm2,qm2,pm1,qm1,fr) == delay
+      nd := frst fr
+      pm := nd.num*pm2 + nd.den*pm1
+      qm := nd.num*qm2 + nd.den*qm1
+      genConvergents(pm1,qm1,pm,qm,rst fr)
+
+    genConvergents(pm2,qm2,pm1,qm1,fr) ==
+      empty? fr => concat(pm1/qm1, empty())
+      concat(pm1/qm1,iGenConvergents(pm2,qm2,pm1,qm1,fr))
+
+    genNumDen(m2,m1,fr) ==
+      empty? fr => concat(m1,empty())
+      concat(m1,delay genNumDen(m1,m2*frst(fr).num + m1*frst(fr).den,rst fr))
+
+    gen  ==> genFromSequence
+    apx  ==> approximants
+
+    c, d: %
+    a: R
+    q: Q
+    n: Integer
+
+    0 == (0$R) :: %
+    1 == (1$R) :: %
+
+    c + d   == genFromSequence map(#1 + #2, apx c, apx d)
+    c - d   == genFromSequence map(#1 - #2, apx c, rest apx d)
+    - c     == genFromSequence map(   - #1, rest apx c)
+    c * d   == genFromSequence map(#1 * #2, apx c, apx d)
+    a * d   == genFromSequence map( a * #1, apx d)
+    q * d   == genFromSequence map( q * #1, apx d)
+    n * d   == genFromSequence map( n * #1, apx d)
+    c / d   == genFromSequence map(#1 / #2, apx c, rest apx d)
+    recip c ==(c = 0 => "failed";
+	       genFromSequence map( 1 / #1, rest apx c))
+
+    showAll?: () -> Boolean
+    showAll?() ==
+      NULL(_$streamsShowAll$Lisp)$Lisp => false
+      true
+
+    zagRec(t:Rec):OUT == zag(t.num :: OUT,t.den :: OUT)
+
+    coerce(c:%): OUT ==
+      wh := c.value.whole
+      fr := c.value.fract
+      empty? fr => wh :: OUT
+      count : NonNegativeInteger := _$streamCount$Lisp
+      l : List OUT := empty()
+      for n in 1..count while not empty? fr repeat
+        l  := concat(zagRec frst fr,l)
+        fr := rst fr
+      if showAll?() then
+        for n in (count + 1).. while explicitEntries? fr repeat
+          l  := concat(zagRec frst fr,l)
+          fr := rst fr
+      if not explicitlyEmpty? fr then l := concat("..." :: OUT,l)
+      l := reverse_! l
+      e := reduce("+",l)
+      zero? wh => e
+      (wh :: OUT) + e
+
+@
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \chapter{Chapter D}
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -7747,6 +12046,171 @@ IndexedTwoDimensionalArray(R,mnRow,mnCol):Exports == Implementation where
 
 @
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain IAN InnerAlgebraicNumber}
+<<dot>>=
+"IAN" -> "ES"
+"InnerAlgebraicNumber()" -> "ExpressionSpace()"
+"IAN" -> "ACF"
+"InnerAlgebraicNumber()" -> "AlgebraicallyClosedField()"
+"IAN" -> "RETRACT"
+"InnerAlgebraicNumber()" -> "RetractableTo(Integer)"
+"InnerAlgebraicNumber()" -> "RetractableTo(Fraction(Integer))"
+"IAN" -> "LINEXP"
+"InnerAlgebraicNumber()" -> "LinearlyExplicitRingOver(Integer)"
+"InnerAlgebraicNumber()" -> "LinearlyExplicitRingOver(Fraction(Integer))"
+"IAN" -> "REAL"
+"InnerAlgebraicNumber()" -> "RealConstant()"
+"IAN" -> "CHARZ"
+"InnerAlgebraicNumber()" -> "CharacteristicZero()"
+"IAN" -> "KONVERT"
+"InnerAlgebraicNumber()" -> "ConvertibleTo(Complex(Float))"
+"IAN" -> "DIFRING"
+"InnerAlgebraicNumber()" -> "DifferentialRing()"
+@
+\pagehead{InnerAlgebraicNumber}{IAN}
+\pagepic{ps/v103inneralgebraicnumber.ps}{IAN}{1.00}
+<<domain IAN InnerAlgebraicNumber>>=
+)abbrev domain IAN InnerAlgebraicNumber
+++ Algebraic closure of the rational numbers
+++ Author: Manuel Bronstein
+++ Date Created: 22 March 1988
+++ Date Last Updated: 4 October 1995 (JHD)
+++ Description: Algebraic closure of the rational numbers.
+++ Keywords: algebraic, number.
+InnerAlgebraicNumber(): Exports == Implementation where
+  Z   ==> Integer
+  FE  ==> Expression Z
+  K   ==> Kernel %
+  P   ==> SparseMultivariatePolynomial(Z, K)
+  ALGOP ==> "%alg"
+  SUP ==>  SparseUnivariatePolynomial
+
+  Exports ==> Join(ExpressionSpace, AlgebraicallyClosedField,
+                   RetractableTo Z, RetractableTo Fraction Z,
+                   LinearlyExplicitRingOver Z, RealConstant,
+                   LinearlyExplicitRingOver Fraction Z,
+                   CharacteristicZero,
+                   ConvertibleTo Complex Float, DifferentialRing) with
+    coerce : P -> %
+      ++ coerce(p) returns p viewed as an algebraic number.
+    numer  : % -> P
+      ++ numer(f) returns the numerator of f viewed as a
+      ++ polynomial in the kernels over Z.
+    denom  : % -> P
+      ++ denom(f) returns the denominator of f viewed as a
+      ++ polynomial in the kernels over Z.
+    reduce : % -> %
+      ++ reduce(f) simplifies all the unreduced algebraic numbers
+      ++ present in f by applying their defining relations.
+    trueEqual : (%,%) -> Boolean
+      ++ trueEqual(x,y) tries to determine if the two numbers are equal
+    norm : (SUP(%),Kernel %) -> SUP(%)
+      ++ norm(p,k) computes the norm of the polynomial p
+      ++ with respect to the extension generated by kernel k
+    norm : (SUP(%),List Kernel %) -> SUP(%)
+      ++ norm(p,l) computes the norm of the polynomial p
+      ++ with respect to the extension generated by kernels l
+    norm : (%,Kernel %) -> %
+      ++ norm(f,k) computes the norm of the algebraic number f
+      ++ with respect to the extension generated by kernel k
+    norm : (%,List Kernel %) -> %
+      ++ norm(f,l) computes the norm of the algebraic number f
+      ++ with respect to the extension generated by kernels l
+  Implementation ==> FE add
+
+    Rep := FE
+
+    -- private
+    mainRatDenom(f:%):% ==
+       ratDenom(f::Rep::FE)$AlgebraicManipulations(Integer, FE)::Rep::%
+--        mv:= mainVariable denom f
+--        mv case "failed" => f
+--        algv:=mv::K
+--	q:=univariate(f, algv, minPoly(algv))_
+--       $PolynomialCategoryQuotientFunctions(IndexedExponents K,K,Integer,P,%)
+--	q(algv::%)
+
+    findDenominator(z:SUP %):Record(num:SUP %,den:%) ==
+       zz:=z
+       while not(zz=0) repeat
+          dd:=(denom leadingCoefficient zz)::%
+          not(dd=1) =>
+             rec:=findDenominator(dd*z)
+             return [rec.num,rec.den*dd]
+          zz:=reductum zz
+       [z,1]
+    makeUnivariate(p:P,k:Kernel %):SUP % ==
+      map(#1::%,univariate(p,k))$SparseUnivariatePolynomialFunctions2(P,%)
+    -- public
+    a,b:%
+    differentiate(x:%):% == 0
+    zero? a == zero? numer a
+--    one? a == one? numer a and one? denom a
+    one? a == (numer a = 1) and (denom a = 1)
+    x:% / y:%        == mainRatDenom(x /$Rep y)
+    x:% ** n:Integer ==
+      n < 0 => mainRatDenom (x **$Rep n)
+      x **$Rep n
+    trueEqual(a,b) ==
+       -- if two algebraic numbers have the same norm (after deleting repeated
+       -- roots, then they are certainly conjugates. Note that we start with a
+       -- monic polynomial, so don't have to check for constant factors.
+       -- this will be fooled by sqrt(2) and -sqrt(2), but the = in
+       -- AlgebraicNumber knows what to do about this.
+       ka:=reverse tower a
+       kb:=reverse tower b
+       empty? ka and empty? kb => retract(a)@Fraction Z = retract(b)@Fraction Z
+       pa,pb:SparseUnivariatePolynomial %
+       pa:=monomial(1,1)-monomial(a,0)
+       pb:=monomial(1,1)-monomial(b,0)
+       na:=map(retract,norm(pa,ka))_
+         $SparseUnivariatePolynomialFunctions2(%,Fraction Z)
+       nb:=map(retract,norm(pb,kb))_
+         $SparseUnivariatePolynomialFunctions2(%,Fraction Z)
+       (sa:=squareFreePart(na)) = (sb:=squareFreePart(nb)) => true
+       g:=gcd(sa,sb)
+       (dg:=degree g) = 0 => false
+       -- of course, if these have a factor in common, then the
+       -- answer is really ambiguous, so we ought to be using Duval-type
+       -- technology
+       dg = degree sa or dg = degree sb => true
+       false
+    norm(z:%,k:Kernel %): % ==
+       p:=minPoly k
+       n:=makeUnivariate(numer z,k)
+       d:=makeUnivariate(denom z,k)
+       resultant(n,p)/resultant(d,p)
+    norm(z:%,l:List Kernel %): % ==
+       for k in l repeat
+           z:=norm(z,k)
+       z
+    norm(z:SUP %,k:Kernel %):SUP % ==
+       p:=map(#1::SUP %,minPoly k)_
+         $SparseUnivariatePolynomialFunctions2(%,SUP %)
+       f:=findDenominator z
+       zz:=map(makeUnivariate(numer #1,k),f.num)_
+         $SparseUnivariatePolynomialFunctions2( %,SUP %)
+       zz:=swap(zz)$CommuteUnivariatePolynomialCategory(%,SUP %,SUP SUP %)
+       resultant(p,zz)/norm(f.den,k)
+    norm(z:SUP %,l:List Kernel %): SUP % ==
+       for k in l repeat
+           z:=norm(z,k)
+       z
+    belong? op           == belong?(op)$ExpressionSpace_&(%) or has?(op, ALGOP)
+
+    convert(x:%):Float ==
+      retract map(#1::Float, x pretend FE)$ExpressionFunctions2(Z,Float)
+
+    convert(x:%):DoubleFloat ==
+      retract map(#1::DoubleFloat,
+                  x pretend FE)$ExpressionFunctions2(Z, DoubleFloat)
+
+    convert(x:%):Complex(Float) ==
+      retract map(#1::Complex(Float),
+                  x pretend FE)$ExpressionFunctions2(Z, Complex Float)
+
+@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \section{domain IIARRAY2 InnerIndexedTwoDimensionalArray}
 This is an internal type which provides an implementation of
 2-dimensional arrays as PrimitiveArray's of PrimitiveArray's.
@@ -8398,8 +12862,322 @@ OneDimensionalArray(S:Type): Exports == Implementation where
 
 @
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain ONECOMP OnePointCompletion}
+<<dot>>=
+"ONECOMP" -> "SETCAT"
+"OnePointCompletion(a:SetCategory)" -> "SetCategory()"
+"ONECOMP" -> "FRETRCT"
+"OnePointCompletion(a:SetCategory)" -> "FullyRetractableTo(a:SetCategory)"
+@
+\pagehead{OnePointCompletion}{ONECOMP}
+\pagepic{ps/v103onepointcompletion.ps}{ONECOMP}{1.00}
+<<domain ONECOMP OnePointCompletion>>=
+)abbrev domain ONECOMP OnePointCompletion
+++ Completion with infinity
+++ Author: Manuel Bronstein
+++ Description: Adjunction of a complex infinity to a set.
+++ Date Created: 4 Oct 1989
+++ Date Last Updated: 1 Nov 1989
+OnePointCompletion(R:SetCategory): Exports == Implementation where
+  B ==> Boolean
+
+  Exports ==> Join(SetCategory, FullyRetractableTo R) with
+    infinity : () -> %
+      ++  infinity() returns infinity.
+    finite?  : %  -> B
+      ++ finite?(x) tests if x is finite.
+    infinite?: %  -> B
+      ++ infinite?(x) tests if x is infinite.
+    if R has AbelianGroup then AbelianGroup
+    if R has OrderedRing then OrderedRing
+    if R has IntegerNumberSystem then
+      rational?: % -> Boolean
+        ++ rational?(x) tests if x is a finite rational number.
+      rational : % -> Fraction Integer
+        ++ rational(x) returns x as a finite rational number.
+        ++ Error: if x is not a rational number.
+      rationalIfCan: % -> Union(Fraction Integer, "failed")
+        ++ rationalIfCan(x) returns x as a finite rational number if
+        ++ it is one, "failed" otherwise.
+
+  Implementation ==> add
+    Rep := Union(R, "infinity")
+
+    coerce(r:R):%          == r
+    retract(x:%):R         == (x case R => x::R; error "Not finite")
+    finite? x              == x case R
+    infinite? x            == x case "infinity"
+    infinity()             == "infinity"
+    retractIfCan(x:%):Union(R, "failed") == (x case R => x::R; "failed")
+
+    coerce(x:%):OutputForm ==
+      x case "infinity" => "infinity"::OutputForm
+      x::R::OutputForm
+
+    x = y ==
+      x case "infinity" => y case "infinity"
+      y case "infinity" => false
+      x::R = y::R
+
+    if R has AbelianGroup then
+      0 == 0$R
+
+      n:Integer * x:% ==
+        x case "infinity" =>
+          zero? n => error "Undefined product"
+          infinity()
+        n * x::R
+
+      - x ==
+        x case "infinity" => error "Undefined inverse"
+        - (x::R)
+
+      x + y ==
+        x case "infinity" => x
+        y case "infinity" => y
+        x::R + y::R
+
+    if R has OrderedRing then
+      fininf: R -> %
+
+      1                == 1$R
+      characteristic() == characteristic()$R
+
+      fininf r ==
+        zero? r => error "Undefined product"
+        infinity()
+
+      x:% * y:% ==
+        x case "infinity" =>
+          y case "infinity" => y
+          fininf(y::R)
+        y case "infinity" => fininf(x::R)
+        x::R * y::R
+
+      recip x ==
+        x case "infinity" => 0
+        zero?(x::R) => infinity()
+        (u := recip(x::R)) case "failed" => "failed"
+        u::R::%
+
+      x < y ==
+        x case "infinity" => false     -- do not change the order
+        y case "infinity" => true      -- of those two tests
+        x::R < y::R
+
+    if R has IntegerNumberSystem then
+      rational? x == finite? x
+      rational  x == rational(retract(x)@R)
+
+      rationalIfCan x ==
+        (r:= retractIfCan(x)@Union(R,"failed")) case "failed" =>"failed"
+        rational(r::R)
+
+@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain ORDCOMP OrderedCompletion}
+<<dot>>=
+"ORDCOMP" -> "SETCAT"
+"OrderedCompletion(a:SetCategory)" -> "SetCategory()"
+"ORDCOMP" -> "FRETRCT"
+"OrderedCompletion(a:SetCategory)" -> "FullyRetractableTo(a:SetCategory)"
+@
+\pagehead{OrderedCompletion}{ORDCOMP}
+\pagepic{ps/v103orderedcompletion.ps}{ORDCOMP}{1.00}
+<<domain ORDCOMP OrderedCompletion>>=
+)abbrev domain ORDCOMP OrderedCompletion
+++ Completion with + and - infinity
+++ Author: Manuel Bronstein
+++ Description: Adjunction of two real infinites quantities to a set.
+++ Date Created: 4 Oct 1989
+++ Date Last Updated: 1 Nov 1989
+OrderedCompletion(R:SetCategory): Exports == Implementation where
+  B ==> Boolean
+
+  Exports ==> Join(SetCategory, FullyRetractableTo R) with
+    plusInfinity : () -> %        ++ plusInfinity() returns +infinity.
+    minusInfinity: () -> %        ++ minusInfinity() returns  -infinity.
+    finite?      : %  -> B
+      ++ finite?(x) tests if x is finite.
+    infinite?    : %  -> B
+      ++ infinite?(x) tests if x is +infinity or -infinity,
+    whatInfinity : %  -> SingleInteger
+      ++ whatInfinity(x) returns 0 if x is finite,
+      ++ 1 if x is +infinity, and -1 if x is -infinity.
+    if R has AbelianGroup then AbelianGroup
+    if R has OrderedRing then OrderedRing
+    if R has IntegerNumberSystem then
+      rational?: % -> Boolean
+        ++ rational?(x) tests if x is a finite rational number.
+      rational : % -> Fraction Integer
+        ++ rational(x) returns x as a finite rational number.
+        ++ Error: if x cannot be so converted.
+      rationalIfCan: % -> Union(Fraction Integer, "failed")
+        ++ rationalIfCan(x) returns x as a finite rational number if
+        ++ it is one and "failed" otherwise.
+
+  Implementation ==> add
+    Rep := Union(fin:R, inf:B)  -- true = +infinity, false = -infinity
+
+    coerce(r:R):%          == [r]
+    retract(x:%):R         == (x case fin => x.fin; error "Not finite")
+    finite? x              == x case fin
+    infinite? x            == x case inf
+    plusInfinity()         == [true]
+    minusInfinity()        == [false]
+
+    retractIfCan(x:%):Union(R, "failed") ==
+      x case fin => x.fin
+      "failed"
+
+    coerce(x:%):OutputForm ==
+      x case fin => (x.fin)::OutputForm
+      e := "infinity"::OutputForm
+      x.inf => empty() + e
+      - e
+
+    whatInfinity x ==
+      x case fin => 0
+      x.inf => 1
+      -1
+
+    x = y ==
+      x case inf =>
+        y case inf => not xor(x.inf, y.inf)
+        false
+      y case inf => false
+      x.fin = y.fin
+
+    if R has AbelianGroup then
+      0 == [0$R]
+
+      n:Integer * x:% ==
+        x case inf =>
+          n > 0 => x
+          n < 0 => [not(x.inf)]
+          error "Undefined product"
+        [n * x.fin]
+
+      - x ==
+        x case inf => [not(x.inf)]
+        [- (x.fin)]
+
+      x + y ==
+        x case inf =>
+          y case fin => x
+          xor(x.inf, y.inf) => error "Undefined sum"
+          x
+        y case inf => y
+        [x.fin + y.fin]
+
+    if R has OrderedRing then
+      fininf: (B, R) -> %
+
+      1                == [1$R]
+      characteristic() == characteristic()$R
+
+      fininf(b, r) ==
+        r > 0 => [b]
+        r < 0 => [not b]
+        error "Undefined product"
+
+      x:% * y:% ==
+        x case inf =>
+          y case inf =>
+            xor(x.inf, y.inf) => minusInfinity()
+            plusInfinity()
+          fininf(x.inf, y.fin)
+        y case inf => fininf(y.inf, x.fin)
+        [x.fin * y.fin]
+
+      recip x ==
+        x case inf => 0
+        (u := recip(x.fin)) case "failed" => "failed"
+        [u::R]
+
+      x < y ==
+        x case inf =>
+          y case inf =>
+            xor(x.inf, y.inf) => y.inf
+            false
+          not(x.inf)
+        y case inf => y.inf
+        x.fin < y.fin
+
+    if R has IntegerNumberSystem then
+      rational? x == finite? x
+      rational  x == rational(retract(x)@R)
+
+      rationalIfCan x ==
+        (r:= retractIfCan(x)@Union(R,"failed")) case "failed" =>"failed"
+        rational(r::R)
+
+@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \chapter{Chapter P}
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain PALETTE Palette}
+<<dot>>=
+"PALETTE" -> "SETCAT"
+"Palette()" -> "SetCategory()"
+@
+\pagehead{Palette}{PALETTE}
+\pagepic{ps/v103palette.ps}{PALETTE}{1.00}
+<<domain PALETTE Palette>>=
+)abbrev domain PALETTE Palette
+++ Author: Jim Wen
+++ Date Created: May 10th 1989
+++ Date Last Updated: Jan 19th 1990
+++ Basic Operations: dark, dim, bright, pastel, light, hue, shade, coerce
+++ Related Constructors:
+++ Also See:
+++ AMS Classifications:
+++ Keywords: dim,bright,pastel,coerce
+++ References:
+++ Description: This domain describes four groups of color shades (palettes).
+ 
+Palette(): Exports == Implementation where
+  I      ==> Integer
+  C      ==> Color
+  SHADE  ==> ["Dark","Dim","Bright","Pastel","Light"]
+
+  Exports ==> SetCategory with
+    dark   : C  -> %
+      ++ dark(c) sets the shade of the indicated hue of c to it's lowest value.
+    dim    : C  -> %
+      ++ dim(c) sets the shade of a hue, c,  above dark, but below bright.
+    bright : C  -> %
+      ++ bright(c) sets the shade of a hue, c, above dim, but below pastel.
+    pastel : C  -> %
+      ++ pastel(c) sets the shade of a hue, c,  above bright, but below light.
+    light  : C  -> %
+      ++ light(c) sets the shade of a hue, c,  to it's highest value.
+    hue    : %  -> C
+      ++ hue(p) returns the hue field of the indicated palette p.
+    shade  : %  -> I
+      ++ shade(p) returns the shade index of the indicated palette p.
+    coerce : C  -> %
+      ++ coerce(c) sets the average shade for the palette to that of the 
+      ++ indicated color c.
+ 
+  Implementation ==> add
+    Rep := Record(shadeField:I, hueField:C)
+
+    dark   c == [1,c]
+    dim    c == [2,c]  
+    bright c == [3,c]  
+    pastel c == [4,c]  
+    light  c == [5,c]  
+    hue    p == p.hueField
+    shade  p == p.shadeField
+    sample() == bright(sample())
+    coerce(c:Color):% == bright c
+    coerce(p:%):OutputForm ==
+      hconcat ["[",coerce(p.hueField),"] from the ",_
+               SHADE.(p.shadeField)," palette"]
+
+@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \section{domain ACPLOT PlaneAlgebraicCurvePlot}
 <<PlaneAlgebraicCurvePlot.input>>=
 -- acplot.spad.pamphlet PlaneAlgebraicCurvePlot.input
@@ -9687,6 +14465,56 @@ PrimitiveArray(S:Type): OneDimensionalArrayAggregate S == add
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \chapter{Chapter Q}
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain QFORM QuadraticForm}
+<<dot>>=
+"QFORM" -> "ABELGRP"
+"QuadraticForm(a:PositiveInteger,b:Field)" -> "AbelianGroup()"
+@
+\pagehead{QuadraticForm}{QFORM}
+\pagepic{ps/v103quadraticform.ps}{QFORM}{1.00}
+<<domain QFORM QuadraticForm>>=
+)abbrev domain QFORM QuadraticForm
+++ Author: Stephen M. Watt
+++ Date Created: August 1988
+++ Date Last Updated: May 17, 1991
+++ Basic Operations: quadraticForm, elt
+++ Related Domains: Matrix, SquareMatrix
+++ Also See:
+++ AMS Classifications:
+++ Keywords: quadratic form
+++ Examples:
+++ References:
+++
+++ Description:
+++   This domain provides modest support for quadratic forms.
+QuadraticForm(n, K): T == Impl where
+    n: PositiveInteger
+    K: Field
+    SM ==> SquareMatrix
+    V  ==> DirectProduct
+ 
+    T ==> AbelianGroup with
+        quadraticForm: SM(n, K) -> %
+            ++ quadraticForm(m) creates a quadratic form from a symmetric,
+            ++ square matrix m.
+        matrix: % -> SM(n, K)
+            ++ matrix(qf) creates a square matrix from the quadratic form qf.
+        elt: (%, V(n, K)) -> K
+            ++ elt(qf,v) evaluates the quadratic form qf on the vector v, 
+            ++ producing a scalar.
+ 
+    Impl ==> SM(n,K) add
+        Rep := SM(n,K)
+ 
+        quadraticForm m ==
+            not symmetric? m =>
+                error "quadraticForm requires a symmetric matrix"
+            m::%
+        matrix q == q pretend SM(n,K)
+        elt(q,v) == dot(v, (matrix q * v))
+
+@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \section{domain QEQUAT QueryEquation}
 <<dot>>=
 "QEQUAT" -> "KOERCE"
@@ -9770,6 +14598,219 @@ Queue(S:SetCategory): QueueAggregate S with
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \chapter{Chapter R}
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\section{domain RADFF RadicalFunctionField}
+<<dot>>=
+"RADFF" -> "FFCAT"
+"RadicalFunctionField(a:UFD,b:UPOLYC(a),c:UPOLYC(FRAC(b)),d:FRAC(b))"
+   -> "FunctionFieldCategory(a:UFD,b:UPOLYC(a),c:UPOLYC(FRAC(b)))"
+"RADFF" -> "SAE"
+"RadicalFunctionField(a:UFD,b:UPOLYC(a),c:UPOLYC(FRAC(b)),d:FRAC(b))"
+   -> 
+"SimpleAlgebraicExtension(a:FRAC(UPOLYC(UFD)),b:UPOLYC(FRAC(UPOLYC(UFD))))"
+@
+\pagehead{RadicalFunctionField}{RADFF}
+\pagepic{ps/v103radicalfunctionfield.ps}{RADFF}{1.00}
+<<domain RADFF RadicalFunctionField>>=
+)abbrev domain RADFF RadicalFunctionField
+++ Function field defined by y**n = f(x)
+++ Author: Manuel Bronstein
+++ Date Created: 1987
+++ Date Last Updated: 27 July 1993
+++ Keywords: algebraic, curve, radical, function, field.
+++ Description: Function field defined by y**n = f(x);
+++ Examples: )r RADFF INPUT
+RadicalFunctionField(F, UP, UPUP, radicnd, n): Exports == Impl where
+  F       : UniqueFactorizationDomain
+  UP      : UnivariatePolynomialCategory F
+  UPUP    : UnivariatePolynomialCategory Fraction UP
+  radicnd : Fraction UP
+  n       : NonNegativeInteger
+
+  N   ==> NonNegativeInteger
+  Z   ==> Integer
+  RF  ==> Fraction UP
+  QF  ==> Fraction UPUP
+  UP2 ==> SparseUnivariatePolynomial UP
+  REC ==> Record(factor:UP, exponent:Z)
+  MOD ==> monomial(1, n)$UPUP - radicnd::UPUP
+  INIT ==> if (deref brandNew?) then startUp false
+
+  Exports ==> FunctionFieldCategory(F, UP, UPUP)
+
+  Impl ==> SimpleAlgebraicExtension(RF, UPUP, MOD) add
+    import ChangeOfVariable(F, UP, UPUP)
+    import InnerCommonDenominator(UP, RF, Vector UP, Vector RF)
+    import UnivariatePolynomialCategoryFunctions2(RF, UPUP, UP, UP2)
+
+    diag        : Vector RF -> Vector $
+    startUp     : Boolean -> Void
+    fullVector  : (Factored UP, N) -> PrimitiveArray UP
+    iBasis      : (UP, N) -> Vector UP
+    inftyBasis  : (RF, N) -> Vector RF
+    basisvec    : () -> Vector RF
+    char0StartUp: () -> Void
+    charPStartUp: () -> Void
+    getInfBasis : () -> Void
+    radcand     : () -> UP
+    charPintbas : (UPUP, RF, Vector RF, Vector RF) -> Void
+
+    brandNew?:Reference(Boolean) := ref true
+    discPoly:Reference(RF) := ref(0$RF)
+    newrad:Reference(UP) := ref(0$UP)
+    n1 := (n - 1)::N
+    modulus := MOD
+    ibasis:Vector(RF)     := new(n, 0)
+    invibasis:Vector(RF)  := new(n, 0)
+    infbasis:Vector(RF)   := new(n, 0)
+    invinfbasis:Vector(RF):= new(n, 0)
+    mini := minIndex ibasis
+
+    discriminant()                   == (INIT; discPoly())
+    radcand()                        == (INIT; newrad())
+    integralBasis()                  == (INIT; diag ibasis)
+    integralBasisAtInfinity()        == (INIT; diag infbasis)
+    basisvec()                       == (INIT; ibasis)
+    integralMatrix()                 == diagonalMatrix basisvec()
+    integralMatrixAtInfinity()       == (INIT; diagonalMatrix infbasis)
+    inverseIntegralMatrix()          == (INIT; diagonalMatrix invibasis)
+    inverseIntegralMatrixAtInfinity()==(INIT;diagonalMatrix invinfbasis)
+    definingPolynomial()             == modulus
+    ramified?(point:F)               == zero?(radcand() point)
+    branchPointAtInfinity?()  == (degree(radcand()) exquo n) case "failed"
+    elliptic()     == (n = 2 and degree(radcand()) = 3 => radcand(); "failed")
+    hyperelliptic() == (n=2 and odd? degree(radcand()) => radcand(); "failed")
+    diag v == [reduce monomial(qelt(v,i+mini), i) for i in 0..n1]
+
+    integralRepresents(v, d) ==
+      ib := basisvec()
+      represents
+        [qelt(ib, i) * (qelt(v, i) /$RF d) for i in mini .. maxIndex ib]
+
+    integralCoordinates f ==
+      v  := coordinates f
+      ib := basisvec()
+      splitDenominator
+        [qelt(v,i) / qelt(ib,i) for i in mini .. maxIndex ib]$Vector(RF)
+
+    integralDerivationMatrix d ==
+      dlogp := differentiate(radicnd, d) / (n * radicnd)
+      v := basisvec()
+      cd := splitDenominator(
+                [(i - mini) * dlogp + differentiate(qelt(v, i), d) / qelt(v, i)
+                                         for i in mini..maxIndex v]$Vector(RF))
+      [diagonalMatrix(cd.num), cd.den]
+
+-- return (d0,...,d(n-1)) s.t. (1/d0, y/d1,...,y**(n-1)/d(n-1))
+-- is an integral basis for the curve y**d = p
+-- requires that p has no factor of multiplicity >= d
+    iBasis(p, d) ==
+      pl := fullVector(squareFree p, d)
+      d1 := (d - 1)::N
+      [*/[pl.j ** ((i * j) quo d) for j in 0..d1] for i in 0..d1]
+
+-- returns a vector [a0,a1,...,a_{m-1}] of length m such that
+-- p = a0^0 a1^1 ... a_{m-1}^{m-1}
+    fullVector(p, m) ==
+      ans:PrimitiveArray(UP) := new(m, 0)
+      ans.0 := unit p
+      l := factors p
+      for i in 1..maxIndex ans repeat
+        ans.i :=
+          (u := find(#1.exponent = i, l)) case "failed" => 1
+          (u::REC).factor
+      ans
+
+-- return (f0,...,f(n-1)) s.t. (f0, y f1,..., y**(n-1) f(n-1))
+-- is a local integral basis at infinity for the curve y**d = p
+    inftyBasis(p, m) ==
+      rt := rootPoly(p(x := inv(monomial(1, 1)$UP :: RF)), m)
+      m ^= rt.exponent =>
+        error "Curve not irreducible after change of variable 0 -> infinity"
+      a    := (rt.coef) x
+      b:RF := 1
+      v    := iBasis(rt.radicand, m)
+      w:Vector(RF) := new(m, 0)
+      for i in mini..maxIndex v repeat
+        qsetelt_!(w, i, b / ((qelt(v, i)::RF) x))
+        b := b * a
+      w
+
+    charPintbas(p, c, v, w) ==
+      degree(p) ^= n => error "charPintbas: should not happen"
+      q:UP2 := map(retract(#1)@UP, p)
+      ib := integralBasis()$FunctionFieldIntegralBasis(UP, UP2,
+                                          SimpleAlgebraicExtension(UP, UP2, q))
+      not diagonal?(ib.basis)=> 
+         error "charPintbas: integral basis not diagonal"
+      a:RF := 1
+      for i in minRowIndex(ib.basis) .. maxRowIndex(ib.basis)
+        for j in minColIndex(ib.basis) .. maxColIndex(ib.basis)
+          for k in mini .. maxIndex v repeat
+            qsetelt_!(v, k, (qelt(ib.basis, i, j) / ib.basisDen) * a)
+            qsetelt_!(w, k, qelt(ib.basisInv, i, j) * inv a)
+            a := a * c
+      void
+
+    charPStartUp() ==
+      r      := mkIntegral modulus
+      charPintbas(r.poly, r.coef, ibasis, invibasis)
+      x      := inv(monomial(1, 1)$UP :: RF)
+      invmod := monomial(1, n)$UPUP - (radicnd x)::UPUP
+      r      := mkIntegral invmod
+      charPintbas(r.poly, (r.coef) x, infbasis, invinfbasis)
+
+    startUp b ==
+      brandNew?() := b
+      if zero?(p := characteristic()$F) or p > n then char0StartUp()
+                                                 else charPStartUp()
+      dsc:RF := ((-1)$Z ** ((n *$N n1) quo 2::N) * (n::Z)**n)$Z *
+               radicnd ** n1 *
+                  */[qelt(ibasis, i) ** 2 for i in mini..maxIndex ibasis]
+      discPoly() := primitivePart(numer dsc) / denom(dsc)
+      void
+
+    char0StartUp() ==
+      rp          := rootPoly(radicnd, n)
+      rp.exponent ^= n => 
+         error "RadicalFunctionField: curve is not irreducible"
+      newrad()    := rp.radicand
+      ib          := iBasis(newrad(), n)
+      infb        := inftyBasis(radicnd, n)
+      invden:RF   := 1
+      for i in mini..maxIndex ib repeat
+        qsetelt_!(invibasis, i, a := qelt(ib, i) * invden)
+        qsetelt_!(ibasis, i, inv a)
+        invden := invden / rp.coef        -- always equals 1/rp.coef**(i-mini)
+        qsetelt_!(infbasis, i, a := qelt(infb, i))
+        qsetelt_!(invinfbasis, i, inv a)
+      void
+
+    ramified?(p:UP) ==
+      (r := retractIfCan(p)@Union(F, "failed")) case F =>
+        singular?(r::F)
+      (radcand() exquo p) case UP
+
+    singular?(p:UP) ==
+      (r := retractIfCan(p)@Union(F, "failed")) case F =>
+        singular?(r::F)
+      (radcand() exquo(p**2)) case UP
+
+    branchPoint?(p:UP) ==
+      (r := retractIfCan(p)@Union(F, "failed")) case F =>
+        branchPoint?(r::F)
+      ((q := (radcand() exquo p)) case UP) and
+        ((q::UP exquo p) case "failed")
+
+    singular?(point:F) ==
+      zero?(radcand()  point) and
+        zero?(((radcand() exquo (monomial(1,1)$UP-point::UP))::UP) point)
+
+    branchPoint?(point:F) ==
+      zero?(radcand()  point) and not
+        zero?(((radcand() exquo (monomial(1,1)$UP-point::UP))::UP) point)
+
+@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \section{domain REF Reference}
 <<dot>>=
 "REF" -> "TYPE"
@@ -11172,6 +16213,8 @@ Note that this code is not included in the generated catdef.spad file.
 \chapter{Chunk collections}
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 <<algebra>>=
+<<domain ALGFF AlgebraicFunctionField>>
+<<domain AN AlgebraicNumber>>
 <<domain ANY Any>>
 <<domain ASTACK ArrayStack>>
 <<domain ASP1 Asp1>>
@@ -11207,6 +16250,12 @@ Note that this code is not included in the generated catdef.spad file.
 <<domain BITS Bits>>
 <<domain BOOLEAN Boolean>>
 
+<<domain CARD CardinalNumber>>
+<<domain CARTEN CartesianTensor>>
+<<domain CLIF CliffordAlgebra>>
+<<domain COLOR Color>>
+<<domain CONTFRAC ContinuedFraction>>
+
 <<domain DHMATRIX DenavitHartenbergMatrix>>
 <<domain DBASE Database>>
 <<domain DLIST DataList>>
@@ -11221,6 +16270,7 @@ Note that this code is not included in the generated catdef.spad file.
 <<domain IFARRAY IndexedFlexibleArray>>
 <<domain IARRAY1 IndexedOneDimensionalArray>>
 <<domain IARRAY2 IndexedTwoDimensionalArray>>
+<<domain IAN InnerAlgebraicNumber>>
 <<domain IIARRAY2 InnerIndexedTwoDimensionalArray>>
 
 <<domain NONE None>>
@@ -11231,13 +16281,18 @@ Note that this code is not included in the generated catdef.spad file.
 <<domain PDEPROB NumericalPDEProblem>>
 
 <<domain ARRAY1 OneDimensionalArray>>
+<<domain ONECOMP OnePointCompletion>>
+<<domain ORDCOMP OrderedCompletion>>
 
 <<domain ACPLOT PlaneAlgebraicCurvePlot>>
+<<domain PALETTE Palette>>
 <<domain PRIMARR PrimitiveArray>>
 
+<<domain QFORM QuadraticForm>> 
 <<domain QEQUAT QueryEquation>>
 <<domain QUEUE Queue>>
 
+<<domain RADFF RadicalFunctionField>>
 <<domain REF Reference>>
 
 <<domain SAE SimpleAlgebraicExtension>>
@@ -11247,6 +16302,60 @@ Note that this code is not included in the generated catdef.spad file.
 <<domain ARRAY2 TwoDimensionalArray>>
 @
 \begin{thebibliography}{99}
+\bibitem{1} Lounesto, P.
+"Clifford algebras and spinors",
+2nd edition, Cambridge University Press (2001)
+\bibitem{2} Porteous, I.,
+"Clifford algebras and the classical groups",
+Cambridge University Press (1995)
+Van Nostrand Reinhold, (1969)
+\bibitem{3} Bergdolt, G.
+"Orthonormal basis sets in Clifford algebras",
+in \cite{16} (1996)
+\bibitem{4} Dorst, Leo, 
+"Honing geometric algebra for its use in the computer sciences",
+pp127-152 from \cite{15} (2001)
+\bibitem{5} Braden, H.W., 
+"N-dimensional spinors: Their properties in terms of finite groups",
+American Institute of Physics,
+J. Math. Phys. 26(4), April 1985
+\bibitem{6} Lam, T.Y. and Smith, Tara L.,
+"On the Clifford-Littlewood-Eckmann groups: a new look at periodicity mod 8",
+Rocky Mountains Journal of Mathematics, vol 19, no. 3, (Summer 1989)
+\bibitem{7} Leopardi, Paul "Quick Introduction to Clifford Algebras"\\
+{\bf http://web.maths.unsw.edu.au/~leopardi/clifford-2003-06-05.pdf}
+\bibitem{8} Cartan, Elie and Study, Eduard
+"Nombres Complexes",
+Encyclopaedia Sciences Math\'ematique, \'edition fran\c caise, 15, (1908),
+d'apr\`es l'article allemand de Eduard Study, pp329-468. Reproduced as
+pp107-246 of \cite{17} 
+\bibitem{9} Hestenes, David and Sobczyck, Garret
+"Clifford algebra to geometric calculus: a unified language for 
+mathematics and physics", D. Reidel, (1984)
+\bibitem{10} Wene, G.P.,
+"The Idempotent structure of an infinite dimensional Clifford algebra",
+pp161-164 of \cite{13} (1995)
+\bibitem{11} Ashdown, M. 
+"GA Package for Maple V",\\
+http://www.mrao.cam.ac.uk/~clifford/software/GA/GAhelp5.html
+\bibitem{12} Doran, Chris and Lasenby, Anthony, 
+"Geometric Algebra for Physicists" 
+Cambridge University Press (2003) ISBN 0-521-48022-1
+\bibitem{13} Micali, A., Boudet, R., Helmstetter, J. (eds),
+"Clifford algebras and their applications in mathematical physics:
+proceedings of second workshop held at Montpellier, France, 1989",
+Kluwer Academic Publishers (1992)
+\bibitem{14} Porteous, I.,
+"Topological geometry"
+Van Nostrand Reinhold, (1969)
+\bibitem{15} Sommer, G. (editor),
+"Geometric Computing with Clifford Algebras",
+Springer, (2001)
+\bibitem{16} Ablamowicz, R., Lounesto, P., Parra, J.M. (eds)
+"Clifford algebras with numeric and symbolic computations",
+Birkh\"auser (1996)
+\bibitem{17} Cartan, Elie and Montel, P. (eds), 
+"\OE uvres Compl\`etes" Gauthier-Villars, (1953)
 \end{thebibliography}
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \chapter{Index}
diff --git a/books/ps/v103algebraicfunctionfield.ps b/books/ps/v103algebraicfunctionfield.ps
new file mode 100644
index 0000000..10c7254
--- /dev/null
+++ b/books/ps/v103algebraicfunctionfield.ps
@@ -0,0 +1,248 @@
+%!PS-Adobe-2.0
+%%Creator: dot version 2.8 (Thu Sep 14 20:34:11 UTC 2006)
+%%For: (root) root
+%%Title: pic
+%%Pages: (atend)
+%%BoundingBox: 36 36 194 80
+%%EndComments
+save
+%%BeginProlog
+/DotDict 200 dict def
+DotDict begin
+
+/setupLatin1 {
+mark
+/EncodingVector 256 array def
+ EncodingVector 0
+
+ISOLatin1Encoding 0 255 getinterval putinterval
+EncodingVector 45 /hyphen put
+
+% Set up ISO Latin 1 character encoding
+/starnetISO {
+        dup dup findfont dup length dict begin
+        { 1 index /FID ne { def }{ pop pop } ifelse
+        } forall
+        /Encoding EncodingVector def
+        currentdict end definefont
+} def
+/Times-Roman starnetISO def
+/Times-Italic starnetISO def
+/Times-Bold starnetISO def
+/Times-BoldItalic starnetISO def
+/Helvetica starnetISO def
+/Helvetica-Oblique starnetISO def
+/Helvetica-Bold starnetISO def
+/Helvetica-BoldOblique starnetISO def
+/Courier starnetISO def
+/Courier-Oblique starnetISO def
+/Courier-Bold starnetISO def
+/Courier-BoldOblique starnetISO def
+cleartomark
+} bind def
+
+%%BeginResource: procset graphviz 0 0
+/coord-font-family /Times-Roman def
+/default-font-family /Times-Roman def
+/coordfont coord-font-family findfont 8 scalefont def
+
+/InvScaleFactor 1.0 def
+/set_scale {
+	dup 1 exch div /InvScaleFactor exch def
+	dup scale
+} bind def
+
+% styles
+/solid { [] 0 setdash } bind def
+/dashed { [9 InvScaleFactor mul dup ] 0 setdash } bind def
+/dotted { [1 InvScaleFactor mul 6 InvScaleFactor mul] 0 setdash } bind def
+/invis {/fill {newpath} def /stroke {newpath} def /show {pop newpath} def} bind def
+/bold { 2 setlinewidth } bind def
+/filled { } bind def
+/unfilled { } bind def
+/rounded { } bind def
+/diagonals { } bind def
+
+% hooks for setting color 
+/nodecolor { sethsbcolor } bind def
+/edgecolor { sethsbcolor } bind def
+/graphcolor { sethsbcolor } bind def
+/nopcolor {pop pop pop} bind def
+
+/beginpage {	% i j npages
+	/npages exch def
+	/j exch def
+	/i exch def
+	/str 10 string def
+	npages 1 gt {
+		gsave
+			coordfont setfont
+			0 0 moveto
+			(\() show i str cvs show (,) show j str cvs show (\)) show
+		grestore
+	} if
+} bind def
+
+/set_font {
+	findfont exch
+	scalefont setfont
+} def
+
+% draw aligned label in bounding box aligned to current point
+/alignedtext {			% width adj text
+	/text exch def
+	/adj exch def
+	/width exch def
+	gsave
+		width 0 gt {
+			text stringwidth pop adj mul 0 rmoveto
+		} if
+		[] 0 setdash
+		text show
+	grestore
+} def
+
+/boxprim {				% xcorner ycorner xsize ysize
+		4 2 roll
+		moveto
+		2 copy
+		exch 0 rlineto
+		0 exch rlineto
+		pop neg 0 rlineto
+		closepath
+} bind def
+
+/ellipse_path {
+	/ry exch def
+	/rx exch def
+	/y exch def
+	/x exch def
+	matrix currentmatrix
+	newpath
+	x y translate
+	rx ry scale
+	0 0 1 0 360 arc
+	setmatrix
+} bind def
+
+/endpage { showpage } bind def
+/showpage { } def
+
+/layercolorseq
+	[	% layer color sequence - darkest to lightest
+		[0 0 0]
+		[.2 .8 .8]
+		[.4 .8 .8]
+		[.6 .8 .8]
+		[.8 .8 .8]
+	]
+def
+
+/layerlen layercolorseq length def
+
+/setlayer {/maxlayer exch def /curlayer exch def
+	layercolorseq curlayer 1 sub layerlen mod get
+	aload pop sethsbcolor
+	/nodecolor {nopcolor} def
+	/edgecolor {nopcolor} def
+	/graphcolor {nopcolor} def
+} bind def
+
+/onlayer { curlayer ne {invis} if } def
+
+/onlayers {
+	/myupper exch def
+	/mylower exch def
+	curlayer mylower lt
+	curlayer myupper gt
+	or
+	{invis} if
+} def
+
+/curlayer 0 def
+
+%%EndResource
+%%EndProlog
+%%BeginSetup
+14 default-font-family set_font
+1 setmiterlimit
+% /arrowlength 10 def
+% /arrowwidth 5 def
+
+% make sure pdfmark is harmless for PS-interpreters other than Distiller
+/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse
+% make '<<' and '>>' safe on PS Level 1 devices
+/languagelevel where {pop languagelevel}{1} ifelse
+2 lt {
+    userdict (<<) cvn ([) cvn load put
+    userdict (>>) cvn ([) cvn load put
+} if
+
+%%EndSetup
+%%Page: 1 1
+%%PageBoundingBox: 36 36 194 80
+%%PageOrientation: Portrait
+gsave
+36 36 158 44 boxprim clip newpath
+36 36 translate
+0 0 1 beginpage
+1.0000 set_scale
+4 4 translate 0 rotate
+0.167 0.600 1.000 graphcolor
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+156 42 lineto
+156 -6 lineto
+closepath
+fill
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+156 42 lineto
+156 -6 lineto
+closepath
+stroke
+0.000 0.000 0.000 graphcolor
+14.00 /Times-Roman set_font
+% AlgebraicFunctionField
+[ /Rect [ 0 0 150 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=ALGFF) >>
+  /Subtype /Link
+/ANN pdfmark
+gsave 10 dict begin
+filled
+0.537 0.247 0.902 nodecolor
+0.537 0.247 0.902 nodecolor
+newpath 150 36 moveto
+0 36 lineto
+0 0 lineto
+150 0 lineto
+closepath
+fill
+0.537 0.247 0.902 nodecolor
+newpath 150 36 moveto
+0 36 lineto
+0 0 lineto
+150 0 lineto
+closepath
+stroke
+gsave 10 dict begin
+0.000 0.000 0.000 nodecolor
+8 13 moveto
+(AlgebraicFunctionField)
+[10.08 3.84 6.72 6.24 6.96 4.8 6.24 3.84 6.24 7.44 6.96 6.96 6.24 3.84 3.84 6.96 6.96 7.44 3.84 6.24 3.84 6.96]
+xshow
+end grestore
+end grestore
+endpage
+showpage
+grestore
+%%PageTrailer
+%%EndPage: 1
+%%Trailer
+%%Pages: 1
+end
+restore
+%%EOF
diff --git a/books/ps/v103algebraicnumber.ps b/books/ps/v103algebraicnumber.ps
new file mode 100644
index 0000000..e8e4f69
--- /dev/null
+++ b/books/ps/v103algebraicnumber.ps
@@ -0,0 +1,248 @@
+%!PS-Adobe-2.0
+%%Creator: dot version 2.8 (Thu Sep 14 20:34:11 UTC 2006)
+%%For: (root) root
+%%Title: pic
+%%Pages: (atend)
+%%BoundingBox: 36 36 162 80
+%%EndComments
+save
+%%BeginProlog
+/DotDict 200 dict def
+DotDict begin
+
+/setupLatin1 {
+mark
+/EncodingVector 256 array def
+ EncodingVector 0
+
+ISOLatin1Encoding 0 255 getinterval putinterval
+EncodingVector 45 /hyphen put
+
+% Set up ISO Latin 1 character encoding
+/starnetISO {
+        dup dup findfont dup length dict begin
+        { 1 index /FID ne { def }{ pop pop } ifelse
+        } forall
+        /Encoding EncodingVector def
+        currentdict end definefont
+} def
+/Times-Roman starnetISO def
+/Times-Italic starnetISO def
+/Times-Bold starnetISO def
+/Times-BoldItalic starnetISO def
+/Helvetica starnetISO def
+/Helvetica-Oblique starnetISO def
+/Helvetica-Bold starnetISO def
+/Helvetica-BoldOblique starnetISO def
+/Courier starnetISO def
+/Courier-Oblique starnetISO def
+/Courier-Bold starnetISO def
+/Courier-BoldOblique starnetISO def
+cleartomark
+} bind def
+
+%%BeginResource: procset graphviz 0 0
+/coord-font-family /Times-Roman def
+/default-font-family /Times-Roman def
+/coordfont coord-font-family findfont 8 scalefont def
+
+/InvScaleFactor 1.0 def
+/set_scale {
+	dup 1 exch div /InvScaleFactor exch def
+	dup scale
+} bind def
+
+% styles
+/solid { [] 0 setdash } bind def
+/dashed { [9 InvScaleFactor mul dup ] 0 setdash } bind def
+/dotted { [1 InvScaleFactor mul 6 InvScaleFactor mul] 0 setdash } bind def
+/invis {/fill {newpath} def /stroke {newpath} def /show {pop newpath} def} bind def
+/bold { 2 setlinewidth } bind def
+/filled { } bind def
+/unfilled { } bind def
+/rounded { } bind def
+/diagonals { } bind def
+
+% hooks for setting color 
+/nodecolor { sethsbcolor } bind def
+/edgecolor { sethsbcolor } bind def
+/graphcolor { sethsbcolor } bind def
+/nopcolor {pop pop pop} bind def
+
+/beginpage {	% i j npages
+	/npages exch def
+	/j exch def
+	/i exch def
+	/str 10 string def
+	npages 1 gt {
+		gsave
+			coordfont setfont
+			0 0 moveto
+			(\() show i str cvs show (,) show j str cvs show (\)) show
+		grestore
+	} if
+} bind def
+
+/set_font {
+	findfont exch
+	scalefont setfont
+} def
+
+% draw aligned label in bounding box aligned to current point
+/alignedtext {			% width adj text
+	/text exch def
+	/adj exch def
+	/width exch def
+	gsave
+		width 0 gt {
+			text stringwidth pop adj mul 0 rmoveto
+		} if
+		[] 0 setdash
+		text show
+	grestore
+} def
+
+/boxprim {				% xcorner ycorner xsize ysize
+		4 2 roll
+		moveto
+		2 copy
+		exch 0 rlineto
+		0 exch rlineto
+		pop neg 0 rlineto
+		closepath
+} bind def
+
+/ellipse_path {
+	/ry exch def
+	/rx exch def
+	/y exch def
+	/x exch def
+	matrix currentmatrix
+	newpath
+	x y translate
+	rx ry scale
+	0 0 1 0 360 arc
+	setmatrix
+} bind def
+
+/endpage { showpage } bind def
+/showpage { } def
+
+/layercolorseq
+	[	% layer color sequence - darkest to lightest
+		[0 0 0]
+		[.2 .8 .8]
+		[.4 .8 .8]
+		[.6 .8 .8]
+		[.8 .8 .8]
+	]
+def
+
+/layerlen layercolorseq length def
+
+/setlayer {/maxlayer exch def /curlayer exch def
+	layercolorseq curlayer 1 sub layerlen mod get
+	aload pop sethsbcolor
+	/nodecolor {nopcolor} def
+	/edgecolor {nopcolor} def
+	/graphcolor {nopcolor} def
+} bind def
+
+/onlayer { curlayer ne {invis} if } def
+
+/onlayers {
+	/myupper exch def
+	/mylower exch def
+	curlayer mylower lt
+	curlayer myupper gt
+	or
+	{invis} if
+} def
+
+/curlayer 0 def
+
+%%EndResource
+%%EndProlog
+%%BeginSetup
+14 default-font-family set_font
+1 setmiterlimit
+% /arrowlength 10 def
+% /arrowwidth 5 def
+
+% make sure pdfmark is harmless for PS-interpreters other than Distiller
+/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse
+% make '<<' and '>>' safe on PS Level 1 devices
+/languagelevel where {pop languagelevel}{1} ifelse
+2 lt {
+    userdict (<<) cvn ([) cvn load put
+    userdict (>>) cvn ([) cvn load put
+} if
+
+%%EndSetup
+%%Page: 1 1
+%%PageBoundingBox: 36 36 162 80
+%%PageOrientation: Portrait
+gsave
+36 36 126 44 boxprim clip newpath
+36 36 translate
+0 0 1 beginpage
+1.0000 set_scale
+4 4 translate 0 rotate
+0.167 0.600 1.000 graphcolor
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+124 42 lineto
+124 -6 lineto
+closepath
+fill
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+124 42 lineto
+124 -6 lineto
+closepath
+stroke
+0.000 0.000 0.000 graphcolor
+14.00 /Times-Roman set_font
+% AlgebraicNumber
+[ /Rect [ 0 0 118 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=AN) >>
+  /Subtype /Link
+/ANN pdfmark
+gsave 10 dict begin
+filled
+0.537 0.247 0.902 nodecolor
+0.537 0.247 0.902 nodecolor
+newpath 118 36 moveto
+0 36 lineto
+0 0 lineto
+118 0 lineto
+closepath
+fill
+0.537 0.247 0.902 nodecolor
+newpath 118 36 moveto
+0 36 lineto
+0 0 lineto
+118 0 lineto
+closepath
+stroke
+gsave 10 dict begin
+0.000 0.000 0.000 nodecolor
+8 13 moveto
+(AlgebraicNumber)
+[10.08 3.84 6.72 6.24 6.96 4.8 6.24 3.84 6.24 9.84 6.96 10.8 6.96 6.24 4.8]
+xshow
+end grestore
+end grestore
+endpage
+showpage
+grestore
+%%PageTrailer
+%%EndPage: 1
+%%Trailer
+%%Pages: 1
+end
+restore
+%%EOF
diff --git a/books/ps/v103cardinalnumber.ps b/books/ps/v103cardinalnumber.ps
new file mode 100644
index 0000000..9663b71
--- /dev/null
+++ b/books/ps/v103cardinalnumber.ps
@@ -0,0 +1,248 @@
+%!PS-Adobe-2.0
+%%Creator: dot version 2.8 (Thu Sep 14 20:34:11 UTC 2006)
+%%For: (root) root
+%%Title: pic
+%%Pages: (atend)
+%%BoundingBox: 36 36 154 80
+%%EndComments
+save
+%%BeginProlog
+/DotDict 200 dict def
+DotDict begin
+
+/setupLatin1 {
+mark
+/EncodingVector 256 array def
+ EncodingVector 0
+
+ISOLatin1Encoding 0 255 getinterval putinterval
+EncodingVector 45 /hyphen put
+
+% Set up ISO Latin 1 character encoding
+/starnetISO {
+        dup dup findfont dup length dict begin
+        { 1 index /FID ne { def }{ pop pop } ifelse
+        } forall
+        /Encoding EncodingVector def
+        currentdict end definefont
+} def
+/Times-Roman starnetISO def
+/Times-Italic starnetISO def
+/Times-Bold starnetISO def
+/Times-BoldItalic starnetISO def
+/Helvetica starnetISO def
+/Helvetica-Oblique starnetISO def
+/Helvetica-Bold starnetISO def
+/Helvetica-BoldOblique starnetISO def
+/Courier starnetISO def
+/Courier-Oblique starnetISO def
+/Courier-Bold starnetISO def
+/Courier-BoldOblique starnetISO def
+cleartomark
+} bind def
+
+%%BeginResource: procset graphviz 0 0
+/coord-font-family /Times-Roman def
+/default-font-family /Times-Roman def
+/coordfont coord-font-family findfont 8 scalefont def
+
+/InvScaleFactor 1.0 def
+/set_scale {
+	dup 1 exch div /InvScaleFactor exch def
+	dup scale
+} bind def
+
+% styles
+/solid { [] 0 setdash } bind def
+/dashed { [9 InvScaleFactor mul dup ] 0 setdash } bind def
+/dotted { [1 InvScaleFactor mul 6 InvScaleFactor mul] 0 setdash } bind def
+/invis {/fill {newpath} def /stroke {newpath} def /show {pop newpath} def} bind def
+/bold { 2 setlinewidth } bind def
+/filled { } bind def
+/unfilled { } bind def
+/rounded { } bind def
+/diagonals { } bind def
+
+% hooks for setting color 
+/nodecolor { sethsbcolor } bind def
+/edgecolor { sethsbcolor } bind def
+/graphcolor { sethsbcolor } bind def
+/nopcolor {pop pop pop} bind def
+
+/beginpage {	% i j npages
+	/npages exch def
+	/j exch def
+	/i exch def
+	/str 10 string def
+	npages 1 gt {
+		gsave
+			coordfont setfont
+			0 0 moveto
+			(\() show i str cvs show (,) show j str cvs show (\)) show
+		grestore
+	} if
+} bind def
+
+/set_font {
+	findfont exch
+	scalefont setfont
+} def
+
+% draw aligned label in bounding box aligned to current point
+/alignedtext {			% width adj text
+	/text exch def
+	/adj exch def
+	/width exch def
+	gsave
+		width 0 gt {
+			text stringwidth pop adj mul 0 rmoveto
+		} if
+		[] 0 setdash
+		text show
+	grestore
+} def
+
+/boxprim {				% xcorner ycorner xsize ysize
+		4 2 roll
+		moveto
+		2 copy
+		exch 0 rlineto
+		0 exch rlineto
+		pop neg 0 rlineto
+		closepath
+} bind def
+
+/ellipse_path {
+	/ry exch def
+	/rx exch def
+	/y exch def
+	/x exch def
+	matrix currentmatrix
+	newpath
+	x y translate
+	rx ry scale
+	0 0 1 0 360 arc
+	setmatrix
+} bind def
+
+/endpage { showpage } bind def
+/showpage { } def
+
+/layercolorseq
+	[	% layer color sequence - darkest to lightest
+		[0 0 0]
+		[.2 .8 .8]
+		[.4 .8 .8]
+		[.6 .8 .8]
+		[.8 .8 .8]
+	]
+def
+
+/layerlen layercolorseq length def
+
+/setlayer {/maxlayer exch def /curlayer exch def
+	layercolorseq curlayer 1 sub layerlen mod get
+	aload pop sethsbcolor
+	/nodecolor {nopcolor} def
+	/edgecolor {nopcolor} def
+	/graphcolor {nopcolor} def
+} bind def
+
+/onlayer { curlayer ne {invis} if } def
+
+/onlayers {
+	/myupper exch def
+	/mylower exch def
+	curlayer mylower lt
+	curlayer myupper gt
+	or
+	{invis} if
+} def
+
+/curlayer 0 def
+
+%%EndResource
+%%EndProlog
+%%BeginSetup
+14 default-font-family set_font
+1 setmiterlimit
+% /arrowlength 10 def
+% /arrowwidth 5 def
+
+% make sure pdfmark is harmless for PS-interpreters other than Distiller
+/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse
+% make '<<' and '>>' safe on PS Level 1 devices
+/languagelevel where {pop languagelevel}{1} ifelse
+2 lt {
+    userdict (<<) cvn ([) cvn load put
+    userdict (>>) cvn ([) cvn load put
+} if
+
+%%EndSetup
+%%Page: 1 1
+%%PageBoundingBox: 36 36 154 80
+%%PageOrientation: Portrait
+gsave
+36 36 118 44 boxprim clip newpath
+36 36 translate
+0 0 1 beginpage
+1.0000 set_scale
+4 4 translate 0 rotate
+0.167 0.600 1.000 graphcolor
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+116 42 lineto
+116 -6 lineto
+closepath
+fill
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+116 42 lineto
+116 -6 lineto
+closepath
+stroke
+0.000 0.000 0.000 graphcolor
+14.00 /Times-Roman set_font
+% CardinalNumber
+[ /Rect [ 0 0 110 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=CARD) >>
+  /Subtype /Link
+/ANN pdfmark
+gsave 10 dict begin
+filled
+0.537 0.247 0.902 nodecolor
+0.537 0.247 0.902 nodecolor
+newpath 110 36 moveto
+0 36 lineto
+0 0 lineto
+110 0 lineto
+closepath
+fill
+0.537 0.247 0.902 nodecolor
+newpath 110 36 moveto
+0 36 lineto
+0 0 lineto
+110 0 lineto
+closepath
+stroke
+gsave 10 dict begin
+0.000 0.000 0.000 nodecolor
+8 13 moveto
+(CardinalNumber)
+[9.36 6.24 4.56 6.96 3.84 6.96 6.24 3.84 9.84 6.96 10.8 6.96 6.24 4.8]
+xshow
+end grestore
+end grestore
+endpage
+showpage
+grestore
+%%PageTrailer
+%%EndPage: 1
+%%Trailer
+%%Pages: 1
+end
+restore
+%%EOF
diff --git a/books/ps/v103cartesiantensor.ps b/books/ps/v103cartesiantensor.ps
new file mode 100644
index 0000000..cd497e3
--- /dev/null
+++ b/books/ps/v103cartesiantensor.ps
@@ -0,0 +1,248 @@
+%!PS-Adobe-2.0
+%%Creator: dot version 2.8 (Thu Sep 14 20:34:11 UTC 2006)
+%%For: (root) root
+%%Title: pic
+%%Pages: (atend)
+%%BoundingBox: 36 36 150 80
+%%EndComments
+save
+%%BeginProlog
+/DotDict 200 dict def
+DotDict begin
+
+/setupLatin1 {
+mark
+/EncodingVector 256 array def
+ EncodingVector 0
+
+ISOLatin1Encoding 0 255 getinterval putinterval
+EncodingVector 45 /hyphen put
+
+% Set up ISO Latin 1 character encoding
+/starnetISO {
+        dup dup findfont dup length dict begin
+        { 1 index /FID ne { def }{ pop pop } ifelse
+        } forall
+        /Encoding EncodingVector def
+        currentdict end definefont
+} def
+/Times-Roman starnetISO def
+/Times-Italic starnetISO def
+/Times-Bold starnetISO def
+/Times-BoldItalic starnetISO def
+/Helvetica starnetISO def
+/Helvetica-Oblique starnetISO def
+/Helvetica-Bold starnetISO def
+/Helvetica-BoldOblique starnetISO def
+/Courier starnetISO def
+/Courier-Oblique starnetISO def
+/Courier-Bold starnetISO def
+/Courier-BoldOblique starnetISO def
+cleartomark
+} bind def
+
+%%BeginResource: procset graphviz 0 0
+/coord-font-family /Times-Roman def
+/default-font-family /Times-Roman def
+/coordfont coord-font-family findfont 8 scalefont def
+
+/InvScaleFactor 1.0 def
+/set_scale {
+	dup 1 exch div /InvScaleFactor exch def
+	dup scale
+} bind def
+
+% styles
+/solid { [] 0 setdash } bind def
+/dashed { [9 InvScaleFactor mul dup ] 0 setdash } bind def
+/dotted { [1 InvScaleFactor mul 6 InvScaleFactor mul] 0 setdash } bind def
+/invis {/fill {newpath} def /stroke {newpath} def /show {pop newpath} def} bind def
+/bold { 2 setlinewidth } bind def
+/filled { } bind def
+/unfilled { } bind def
+/rounded { } bind def
+/diagonals { } bind def
+
+% hooks for setting color 
+/nodecolor { sethsbcolor } bind def
+/edgecolor { sethsbcolor } bind def
+/graphcolor { sethsbcolor } bind def
+/nopcolor {pop pop pop} bind def
+
+/beginpage {	% i j npages
+	/npages exch def
+	/j exch def
+	/i exch def
+	/str 10 string def
+	npages 1 gt {
+		gsave
+			coordfont setfont
+			0 0 moveto
+			(\() show i str cvs show (,) show j str cvs show (\)) show
+		grestore
+	} if
+} bind def
+
+/set_font {
+	findfont exch
+	scalefont setfont
+} def
+
+% draw aligned label in bounding box aligned to current point
+/alignedtext {			% width adj text
+	/text exch def
+	/adj exch def
+	/width exch def
+	gsave
+		width 0 gt {
+			text stringwidth pop adj mul 0 rmoveto
+		} if
+		[] 0 setdash
+		text show
+	grestore
+} def
+
+/boxprim {				% xcorner ycorner xsize ysize
+		4 2 roll
+		moveto
+		2 copy
+		exch 0 rlineto
+		0 exch rlineto
+		pop neg 0 rlineto
+		closepath
+} bind def
+
+/ellipse_path {
+	/ry exch def
+	/rx exch def
+	/y exch def
+	/x exch def
+	matrix currentmatrix
+	newpath
+	x y translate
+	rx ry scale
+	0 0 1 0 360 arc
+	setmatrix
+} bind def
+
+/endpage { showpage } bind def
+/showpage { } def
+
+/layercolorseq
+	[	% layer color sequence - darkest to lightest
+		[0 0 0]
+		[.2 .8 .8]
+		[.4 .8 .8]
+		[.6 .8 .8]
+		[.8 .8 .8]
+	]
+def
+
+/layerlen layercolorseq length def
+
+/setlayer {/maxlayer exch def /curlayer exch def
+	layercolorseq curlayer 1 sub layerlen mod get
+	aload pop sethsbcolor
+	/nodecolor {nopcolor} def
+	/edgecolor {nopcolor} def
+	/graphcolor {nopcolor} def
+} bind def
+
+/onlayer { curlayer ne {invis} if } def
+
+/onlayers {
+	/myupper exch def
+	/mylower exch def
+	curlayer mylower lt
+	curlayer myupper gt
+	or
+	{invis} if
+} def
+
+/curlayer 0 def
+
+%%EndResource
+%%EndProlog
+%%BeginSetup
+14 default-font-family set_font
+1 setmiterlimit
+% /arrowlength 10 def
+% /arrowwidth 5 def
+
+% make sure pdfmark is harmless for PS-interpreters other than Distiller
+/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse
+% make '<<' and '>>' safe on PS Level 1 devices
+/languagelevel where {pop languagelevel}{1} ifelse
+2 lt {
+    userdict (<<) cvn ([) cvn load put
+    userdict (>>) cvn ([) cvn load put
+} if
+
+%%EndSetup
+%%Page: 1 1
+%%PageBoundingBox: 36 36 150 80
+%%PageOrientation: Portrait
+gsave
+36 36 114 44 boxprim clip newpath
+36 36 translate
+0 0 1 beginpage
+1.0000 set_scale
+4 4 translate 0 rotate
+0.167 0.600 1.000 graphcolor
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+112 42 lineto
+112 -6 lineto
+closepath
+fill
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+112 42 lineto
+112 -6 lineto
+closepath
+stroke
+0.000 0.000 0.000 graphcolor
+14.00 /Times-Roman set_font
+% CartesianTensor
+[ /Rect [ 0 0 106 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=CARTEN) >>
+  /Subtype /Link
+/ANN pdfmark
+gsave 10 dict begin
+filled
+0.537 0.247 0.902 nodecolor
+0.537 0.247 0.902 nodecolor
+newpath 106 36 moveto
+0 36 lineto
+0 0 lineto
+106 0 lineto
+closepath
+fill
+0.537 0.247 0.902 nodecolor
+newpath 106 36 moveto
+0 36 lineto
+0 0 lineto
+106 0 lineto
+closepath
+stroke
+gsave 10 dict begin
+0.000 0.000 0.000 nodecolor
+7 13 moveto
+(CartesianTensor)
+[9.36 6.24 5.04 3.84 6.24 5.52 3.84 6.24 6.24 7.44 6.24 6.96 5.52 6.96 4.8]
+xshow
+end grestore
+end grestore
+endpage
+showpage
+grestore
+%%PageTrailer
+%%EndPage: 1
+%%Trailer
+%%Pages: 1
+end
+restore
+%%EOF
diff --git a/books/ps/v103cliffordalgebra.ps b/books/ps/v103cliffordalgebra.ps
new file mode 100644
index 0000000..6372a9f
--- /dev/null
+++ b/books/ps/v103cliffordalgebra.ps
@@ -0,0 +1,248 @@
+%!PS-Adobe-2.0
+%%Creator: dot version 2.8 (Thu Sep 14 20:34:11 UTC 2006)
+%%For: (root) root
+%%Title: pic
+%%Pages: (atend)
+%%BoundingBox: 36 36 150 80
+%%EndComments
+save
+%%BeginProlog
+/DotDict 200 dict def
+DotDict begin
+
+/setupLatin1 {
+mark
+/EncodingVector 256 array def
+ EncodingVector 0
+
+ISOLatin1Encoding 0 255 getinterval putinterval
+EncodingVector 45 /hyphen put
+
+% Set up ISO Latin 1 character encoding
+/starnetISO {
+        dup dup findfont dup length dict begin
+        { 1 index /FID ne { def }{ pop pop } ifelse
+        } forall
+        /Encoding EncodingVector def
+        currentdict end definefont
+} def
+/Times-Roman starnetISO def
+/Times-Italic starnetISO def
+/Times-Bold starnetISO def
+/Times-BoldItalic starnetISO def
+/Helvetica starnetISO def
+/Helvetica-Oblique starnetISO def
+/Helvetica-Bold starnetISO def
+/Helvetica-BoldOblique starnetISO def
+/Courier starnetISO def
+/Courier-Oblique starnetISO def
+/Courier-Bold starnetISO def
+/Courier-BoldOblique starnetISO def
+cleartomark
+} bind def
+
+%%BeginResource: procset graphviz 0 0
+/coord-font-family /Times-Roman def
+/default-font-family /Times-Roman def
+/coordfont coord-font-family findfont 8 scalefont def
+
+/InvScaleFactor 1.0 def
+/set_scale {
+	dup 1 exch div /InvScaleFactor exch def
+	dup scale
+} bind def
+
+% styles
+/solid { [] 0 setdash } bind def
+/dashed { [9 InvScaleFactor mul dup ] 0 setdash } bind def
+/dotted { [1 InvScaleFactor mul 6 InvScaleFactor mul] 0 setdash } bind def
+/invis {/fill {newpath} def /stroke {newpath} def /show {pop newpath} def} bind def
+/bold { 2 setlinewidth } bind def
+/filled { } bind def
+/unfilled { } bind def
+/rounded { } bind def
+/diagonals { } bind def
+
+% hooks for setting color 
+/nodecolor { sethsbcolor } bind def
+/edgecolor { sethsbcolor } bind def
+/graphcolor { sethsbcolor } bind def
+/nopcolor {pop pop pop} bind def
+
+/beginpage {	% i j npages
+	/npages exch def
+	/j exch def
+	/i exch def
+	/str 10 string def
+	npages 1 gt {
+		gsave
+			coordfont setfont
+			0 0 moveto
+			(\() show i str cvs show (,) show j str cvs show (\)) show
+		grestore
+	} if
+} bind def
+
+/set_font {
+	findfont exch
+	scalefont setfont
+} def
+
+% draw aligned label in bounding box aligned to current point
+/alignedtext {			% width adj text
+	/text exch def
+	/adj exch def
+	/width exch def
+	gsave
+		width 0 gt {
+			text stringwidth pop adj mul 0 rmoveto
+		} if
+		[] 0 setdash
+		text show
+	grestore
+} def
+
+/boxprim {				% xcorner ycorner xsize ysize
+		4 2 roll
+		moveto
+		2 copy
+		exch 0 rlineto
+		0 exch rlineto
+		pop neg 0 rlineto
+		closepath
+} bind def
+
+/ellipse_path {
+	/ry exch def
+	/rx exch def
+	/y exch def
+	/x exch def
+	matrix currentmatrix
+	newpath
+	x y translate
+	rx ry scale
+	0 0 1 0 360 arc
+	setmatrix
+} bind def
+
+/endpage { showpage } bind def
+/showpage { } def
+
+/layercolorseq
+	[	% layer color sequence - darkest to lightest
+		[0 0 0]
+		[.2 .8 .8]
+		[.4 .8 .8]
+		[.6 .8 .8]
+		[.8 .8 .8]
+	]
+def
+
+/layerlen layercolorseq length def
+
+/setlayer {/maxlayer exch def /curlayer exch def
+	layercolorseq curlayer 1 sub layerlen mod get
+	aload pop sethsbcolor
+	/nodecolor {nopcolor} def
+	/edgecolor {nopcolor} def
+	/graphcolor {nopcolor} def
+} bind def
+
+/onlayer { curlayer ne {invis} if } def
+
+/onlayers {
+	/myupper exch def
+	/mylower exch def
+	curlayer mylower lt
+	curlayer myupper gt
+	or
+	{invis} if
+} def
+
+/curlayer 0 def
+
+%%EndResource
+%%EndProlog
+%%BeginSetup
+14 default-font-family set_font
+1 setmiterlimit
+% /arrowlength 10 def
+% /arrowwidth 5 def
+
+% make sure pdfmark is harmless for PS-interpreters other than Distiller
+/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse
+% make '<<' and '>>' safe on PS Level 1 devices
+/languagelevel where {pop languagelevel}{1} ifelse
+2 lt {
+    userdict (<<) cvn ([) cvn load put
+    userdict (>>) cvn ([) cvn load put
+} if
+
+%%EndSetup
+%%Page: 1 1
+%%PageBoundingBox: 36 36 150 80
+%%PageOrientation: Portrait
+gsave
+36 36 114 44 boxprim clip newpath
+36 36 translate
+0 0 1 beginpage
+1.0000 set_scale
+4 4 translate 0 rotate
+0.167 0.600 1.000 graphcolor
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+112 42 lineto
+112 -6 lineto
+closepath
+fill
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+112 42 lineto
+112 -6 lineto
+closepath
+stroke
+0.000 0.000 0.000 graphcolor
+14.00 /Times-Roman set_font
+% CliffordAlgebra
+[ /Rect [ 0 0 106 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=CLIF) >>
+  /Subtype /Link
+/ANN pdfmark
+gsave 10 dict begin
+filled
+0.537 0.247 0.902 nodecolor
+0.537 0.247 0.902 nodecolor
+newpath 106 36 moveto
+0 36 lineto
+0 0 lineto
+106 0 lineto
+closepath
+fill
+0.537 0.247 0.902 nodecolor
+newpath 106 36 moveto
+0 36 lineto
+0 0 lineto
+106 0 lineto
+closepath
+stroke
+gsave 10 dict begin
+0.000 0.000 0.000 nodecolor
+8 13 moveto
+(CliffordAlgebra)
+[9.36 3.84 3.84 4.56 4.08 6.96 4.56 6.96 10.08 3.84 6.72 6.24 6.96 4.8 6.24]
+xshow
+end grestore
+end grestore
+endpage
+showpage
+grestore
+%%PageTrailer
+%%EndPage: 1
+%%Trailer
+%%Pages: 1
+end
+restore
+%%EOF
diff --git a/books/ps/v103color.ps b/books/ps/v103color.ps
new file mode 100644
index 0000000..e6b83dd
--- /dev/null
+++ b/books/ps/v103color.ps
@@ -0,0 +1,248 @@
+%!PS-Adobe-2.0
+%%Creator: dot version 2.8 (Thu Sep 14 20:34:11 UTC 2006)
+%%For: (root) root
+%%Title: pic
+%%Pages: (atend)
+%%BoundingBox: 36 36 98 80
+%%EndComments
+save
+%%BeginProlog
+/DotDict 200 dict def
+DotDict begin
+
+/setupLatin1 {
+mark
+/EncodingVector 256 array def
+ EncodingVector 0
+
+ISOLatin1Encoding 0 255 getinterval putinterval
+EncodingVector 45 /hyphen put
+
+% Set up ISO Latin 1 character encoding
+/starnetISO {
+        dup dup findfont dup length dict begin
+        { 1 index /FID ne { def }{ pop pop } ifelse
+        } forall
+        /Encoding EncodingVector def
+        currentdict end definefont
+} def
+/Times-Roman starnetISO def
+/Times-Italic starnetISO def
+/Times-Bold starnetISO def
+/Times-BoldItalic starnetISO def
+/Helvetica starnetISO def
+/Helvetica-Oblique starnetISO def
+/Helvetica-Bold starnetISO def
+/Helvetica-BoldOblique starnetISO def
+/Courier starnetISO def
+/Courier-Oblique starnetISO def
+/Courier-Bold starnetISO def
+/Courier-BoldOblique starnetISO def
+cleartomark
+} bind def
+
+%%BeginResource: procset graphviz 0 0
+/coord-font-family /Times-Roman def
+/default-font-family /Times-Roman def
+/coordfont coord-font-family findfont 8 scalefont def
+
+/InvScaleFactor 1.0 def
+/set_scale {
+	dup 1 exch div /InvScaleFactor exch def
+	dup scale
+} bind def
+
+% styles
+/solid { [] 0 setdash } bind def
+/dashed { [9 InvScaleFactor mul dup ] 0 setdash } bind def
+/dotted { [1 InvScaleFactor mul 6 InvScaleFactor mul] 0 setdash } bind def
+/invis {/fill {newpath} def /stroke {newpath} def /show {pop newpath} def} bind def
+/bold { 2 setlinewidth } bind def
+/filled { } bind def
+/unfilled { } bind def
+/rounded { } bind def
+/diagonals { } bind def
+
+% hooks for setting color 
+/nodecolor { sethsbcolor } bind def
+/edgecolor { sethsbcolor } bind def
+/graphcolor { sethsbcolor } bind def
+/nopcolor {pop pop pop} bind def
+
+/beginpage {	% i j npages
+	/npages exch def
+	/j exch def
+	/i exch def
+	/str 10 string def
+	npages 1 gt {
+		gsave
+			coordfont setfont
+			0 0 moveto
+			(\() show i str cvs show (,) show j str cvs show (\)) show
+		grestore
+	} if
+} bind def
+
+/set_font {
+	findfont exch
+	scalefont setfont
+} def
+
+% draw aligned label in bounding box aligned to current point
+/alignedtext {			% width adj text
+	/text exch def
+	/adj exch def
+	/width exch def
+	gsave
+		width 0 gt {
+			text stringwidth pop adj mul 0 rmoveto
+		} if
+		[] 0 setdash
+		text show
+	grestore
+} def
+
+/boxprim {				% xcorner ycorner xsize ysize
+		4 2 roll
+		moveto
+		2 copy
+		exch 0 rlineto
+		0 exch rlineto
+		pop neg 0 rlineto
+		closepath
+} bind def
+
+/ellipse_path {
+	/ry exch def
+	/rx exch def
+	/y exch def
+	/x exch def
+	matrix currentmatrix
+	newpath
+	x y translate
+	rx ry scale
+	0 0 1 0 360 arc
+	setmatrix
+} bind def
+
+/endpage { showpage } bind def
+/showpage { } def
+
+/layercolorseq
+	[	% layer color sequence - darkest to lightest
+		[0 0 0]
+		[.2 .8 .8]
+		[.4 .8 .8]
+		[.6 .8 .8]
+		[.8 .8 .8]
+	]
+def
+
+/layerlen layercolorseq length def
+
+/setlayer {/maxlayer exch def /curlayer exch def
+	layercolorseq curlayer 1 sub layerlen mod get
+	aload pop sethsbcolor
+	/nodecolor {nopcolor} def
+	/edgecolor {nopcolor} def
+	/graphcolor {nopcolor} def
+} bind def
+
+/onlayer { curlayer ne {invis} if } def
+
+/onlayers {
+	/myupper exch def
+	/mylower exch def
+	curlayer mylower lt
+	curlayer myupper gt
+	or
+	{invis} if
+} def
+
+/curlayer 0 def
+
+%%EndResource
+%%EndProlog
+%%BeginSetup
+14 default-font-family set_font
+1 setmiterlimit
+% /arrowlength 10 def
+% /arrowwidth 5 def
+
+% make sure pdfmark is harmless for PS-interpreters other than Distiller
+/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse
+% make '<<' and '>>' safe on PS Level 1 devices
+/languagelevel where {pop languagelevel}{1} ifelse
+2 lt {
+    userdict (<<) cvn ([) cvn load put
+    userdict (>>) cvn ([) cvn load put
+} if
+
+%%EndSetup
+%%Page: 1 1
+%%PageBoundingBox: 36 36 98 80
+%%PageOrientation: Portrait
+gsave
+36 36 62 44 boxprim clip newpath
+36 36 translate
+0 0 1 beginpage
+1.0000 set_scale
+4 4 translate 0 rotate
+0.167 0.600 1.000 graphcolor
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+60 42 lineto
+60 -6 lineto
+closepath
+fill
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+60 42 lineto
+60 -6 lineto
+closepath
+stroke
+0.000 0.000 0.000 graphcolor
+14.00 /Times-Roman set_font
+% Color
+[ /Rect [ 0 0 54 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=COLOR) >>
+  /Subtype /Link
+/ANN pdfmark
+gsave 10 dict begin
+filled
+0.537 0.247 0.902 nodecolor
+0.537 0.247 0.902 nodecolor
+newpath 54 36 moveto
+0 36 lineto
+0 0 lineto
+54 0 lineto
+closepath
+fill
+0.537 0.247 0.902 nodecolor
+newpath 54 36 moveto
+0 36 lineto
+0 0 lineto
+54 0 lineto
+closepath
+stroke
+gsave 10 dict begin
+0.000 0.000 0.000 nodecolor
+10 13 moveto
+(Color)
+[9.36 6.96 3.84 6.96 4.8]
+xshow
+end grestore
+end grestore
+endpage
+showpage
+grestore
+%%PageTrailer
+%%EndPage: 1
+%%Trailer
+%%Pages: 1
+end
+restore
+%%EOF
diff --git a/books/ps/v103continuedfraction.ps b/books/ps/v103continuedfraction.ps
new file mode 100644
index 0000000..07aaaf3
--- /dev/null
+++ b/books/ps/v103continuedfraction.ps
@@ -0,0 +1,248 @@
+%!PS-Adobe-2.0
+%%Creator: dot version 2.8 (Thu Sep 14 20:34:11 UTC 2006)
+%%For: (root) root
+%%Title: pic
+%%Pages: (atend)
+%%BoundingBox: 36 36 164 80
+%%EndComments
+save
+%%BeginProlog
+/DotDict 200 dict def
+DotDict begin
+
+/setupLatin1 {
+mark
+/EncodingVector 256 array def
+ EncodingVector 0
+
+ISOLatin1Encoding 0 255 getinterval putinterval
+EncodingVector 45 /hyphen put
+
+% Set up ISO Latin 1 character encoding
+/starnetISO {
+        dup dup findfont dup length dict begin
+        { 1 index /FID ne { def }{ pop pop } ifelse
+        } forall
+        /Encoding EncodingVector def
+        currentdict end definefont
+} def
+/Times-Roman starnetISO def
+/Times-Italic starnetISO def
+/Times-Bold starnetISO def
+/Times-BoldItalic starnetISO def
+/Helvetica starnetISO def
+/Helvetica-Oblique starnetISO def
+/Helvetica-Bold starnetISO def
+/Helvetica-BoldOblique starnetISO def
+/Courier starnetISO def
+/Courier-Oblique starnetISO def
+/Courier-Bold starnetISO def
+/Courier-BoldOblique starnetISO def
+cleartomark
+} bind def
+
+%%BeginResource: procset graphviz 0 0
+/coord-font-family /Times-Roman def
+/default-font-family /Times-Roman def
+/coordfont coord-font-family findfont 8 scalefont def
+
+/InvScaleFactor 1.0 def
+/set_scale {
+	dup 1 exch div /InvScaleFactor exch def
+	dup scale
+} bind def
+
+% styles
+/solid { [] 0 setdash } bind def
+/dashed { [9 InvScaleFactor mul dup ] 0 setdash } bind def
+/dotted { [1 InvScaleFactor mul 6 InvScaleFactor mul] 0 setdash } bind def
+/invis {/fill {newpath} def /stroke {newpath} def /show {pop newpath} def} bind def
+/bold { 2 setlinewidth } bind def
+/filled { } bind def
+/unfilled { } bind def
+/rounded { } bind def
+/diagonals { } bind def
+
+% hooks for setting color 
+/nodecolor { sethsbcolor } bind def
+/edgecolor { sethsbcolor } bind def
+/graphcolor { sethsbcolor } bind def
+/nopcolor {pop pop pop} bind def
+
+/beginpage {	% i j npages
+	/npages exch def
+	/j exch def
+	/i exch def
+	/str 10 string def
+	npages 1 gt {
+		gsave
+			coordfont setfont
+			0 0 moveto
+			(\() show i str cvs show (,) show j str cvs show (\)) show
+		grestore
+	} if
+} bind def
+
+/set_font {
+	findfont exch
+	scalefont setfont
+} def
+
+% draw aligned label in bounding box aligned to current point
+/alignedtext {			% width adj text
+	/text exch def
+	/adj exch def
+	/width exch def
+	gsave
+		width 0 gt {
+			text stringwidth pop adj mul 0 rmoveto
+		} if
+		[] 0 setdash
+		text show
+	grestore
+} def
+
+/boxprim {				% xcorner ycorner xsize ysize
+		4 2 roll
+		moveto
+		2 copy
+		exch 0 rlineto
+		0 exch rlineto
+		pop neg 0 rlineto
+		closepath
+} bind def
+
+/ellipse_path {
+	/ry exch def
+	/rx exch def
+	/y exch def
+	/x exch def
+	matrix currentmatrix
+	newpath
+	x y translate
+	rx ry scale
+	0 0 1 0 360 arc
+	setmatrix
+} bind def
+
+/endpage { showpage } bind def
+/showpage { } def
+
+/layercolorseq
+	[	% layer color sequence - darkest to lightest
+		[0 0 0]
+		[.2 .8 .8]
+		[.4 .8 .8]
+		[.6 .8 .8]
+		[.8 .8 .8]
+	]
+def
+
+/layerlen layercolorseq length def
+
+/setlayer {/maxlayer exch def /curlayer exch def
+	layercolorseq curlayer 1 sub layerlen mod get
+	aload pop sethsbcolor
+	/nodecolor {nopcolor} def
+	/edgecolor {nopcolor} def
+	/graphcolor {nopcolor} def
+} bind def
+
+/onlayer { curlayer ne {invis} if } def
+
+/onlayers {
+	/myupper exch def
+	/mylower exch def
+	curlayer mylower lt
+	curlayer myupper gt
+	or
+	{invis} if
+} def
+
+/curlayer 0 def
+
+%%EndResource
+%%EndProlog
+%%BeginSetup
+14 default-font-family set_font
+1 setmiterlimit
+% /arrowlength 10 def
+% /arrowwidth 5 def
+
+% make sure pdfmark is harmless for PS-interpreters other than Distiller
+/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse
+% make '<<' and '>>' safe on PS Level 1 devices
+/languagelevel where {pop languagelevel}{1} ifelse
+2 lt {
+    userdict (<<) cvn ([) cvn load put
+    userdict (>>) cvn ([) cvn load put
+} if
+
+%%EndSetup
+%%Page: 1 1
+%%PageBoundingBox: 36 36 164 80
+%%PageOrientation: Portrait
+gsave
+36 36 128 44 boxprim clip newpath
+36 36 translate
+0 0 1 beginpage
+1.0000 set_scale
+4 4 translate 0 rotate
+0.167 0.600 1.000 graphcolor
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+126 42 lineto
+126 -6 lineto
+closepath
+fill
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+126 42 lineto
+126 -6 lineto
+closepath
+stroke
+0.000 0.000 0.000 graphcolor
+14.00 /Times-Roman set_font
+% ContinuedFraction
+[ /Rect [ 0 0 120 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=CONTFRAC) >>
+  /Subtype /Link
+/ANN pdfmark
+gsave 10 dict begin
+filled
+0.537 0.247 0.902 nodecolor
+0.537 0.247 0.902 nodecolor
+newpath 120 36 moveto
+0 36 lineto
+0 0 lineto
+120 0 lineto
+closepath
+fill
+0.537 0.247 0.902 nodecolor
+newpath 120 36 moveto
+0 36 lineto
+0 0 lineto
+120 0 lineto
+closepath
+stroke
+gsave 10 dict begin
+0.000 0.000 0.000 nodecolor
+7 13 moveto
+(ContinuedFraction)
+[9.36 6.96 6.96 3.84 3.84 6.96 6.96 6.24 6.96 7.44 4.8 6.24 6.24 3.84 3.84 6.96 6.96]
+xshow
+end grestore
+end grestore
+endpage
+showpage
+grestore
+%%PageTrailer
+%%EndPage: 1
+%%Trailer
+%%Pages: 1
+end
+restore
+%%EOF
diff --git a/books/ps/v103inneralgebraicnumber.ps b/books/ps/v103inneralgebraicnumber.ps
new file mode 100644
index 0000000..7157907
--- /dev/null
+++ b/books/ps/v103inneralgebraicnumber.ps
@@ -0,0 +1,248 @@
+%!PS-Adobe-2.0
+%%Creator: dot version 2.8 (Thu Sep 14 20:34:11 UTC 2006)
+%%For: (root) root
+%%Title: pic
+%%Pages: (atend)
+%%BoundingBox: 36 36 192 80
+%%EndComments
+save
+%%BeginProlog
+/DotDict 200 dict def
+DotDict begin
+
+/setupLatin1 {
+mark
+/EncodingVector 256 array def
+ EncodingVector 0
+
+ISOLatin1Encoding 0 255 getinterval putinterval
+EncodingVector 45 /hyphen put
+
+% Set up ISO Latin 1 character encoding
+/starnetISO {
+        dup dup findfont dup length dict begin
+        { 1 index /FID ne { def }{ pop pop } ifelse
+        } forall
+        /Encoding EncodingVector def
+        currentdict end definefont
+} def
+/Times-Roman starnetISO def
+/Times-Italic starnetISO def
+/Times-Bold starnetISO def
+/Times-BoldItalic starnetISO def
+/Helvetica starnetISO def
+/Helvetica-Oblique starnetISO def
+/Helvetica-Bold starnetISO def
+/Helvetica-BoldOblique starnetISO def
+/Courier starnetISO def
+/Courier-Oblique starnetISO def
+/Courier-Bold starnetISO def
+/Courier-BoldOblique starnetISO def
+cleartomark
+} bind def
+
+%%BeginResource: procset graphviz 0 0
+/coord-font-family /Times-Roman def
+/default-font-family /Times-Roman def
+/coordfont coord-font-family findfont 8 scalefont def
+
+/InvScaleFactor 1.0 def
+/set_scale {
+	dup 1 exch div /InvScaleFactor exch def
+	dup scale
+} bind def
+
+% styles
+/solid { [] 0 setdash } bind def
+/dashed { [9 InvScaleFactor mul dup ] 0 setdash } bind def
+/dotted { [1 InvScaleFactor mul 6 InvScaleFactor mul] 0 setdash } bind def
+/invis {/fill {newpath} def /stroke {newpath} def /show {pop newpath} def} bind def
+/bold { 2 setlinewidth } bind def
+/filled { } bind def
+/unfilled { } bind def
+/rounded { } bind def
+/diagonals { } bind def
+
+% hooks for setting color 
+/nodecolor { sethsbcolor } bind def
+/edgecolor { sethsbcolor } bind def
+/graphcolor { sethsbcolor } bind def
+/nopcolor {pop pop pop} bind def
+
+/beginpage {	% i j npages
+	/npages exch def
+	/j exch def
+	/i exch def
+	/str 10 string def
+	npages 1 gt {
+		gsave
+			coordfont setfont
+			0 0 moveto
+			(\() show i str cvs show (,) show j str cvs show (\)) show
+		grestore
+	} if
+} bind def
+
+/set_font {
+	findfont exch
+	scalefont setfont
+} def
+
+% draw aligned label in bounding box aligned to current point
+/alignedtext {			% width adj text
+	/text exch def
+	/adj exch def
+	/width exch def
+	gsave
+		width 0 gt {
+			text stringwidth pop adj mul 0 rmoveto
+		} if
+		[] 0 setdash
+		text show
+	grestore
+} def
+
+/boxprim {				% xcorner ycorner xsize ysize
+		4 2 roll
+		moveto
+		2 copy
+		exch 0 rlineto
+		0 exch rlineto
+		pop neg 0 rlineto
+		closepath
+} bind def
+
+/ellipse_path {
+	/ry exch def
+	/rx exch def
+	/y exch def
+	/x exch def
+	matrix currentmatrix
+	newpath
+	x y translate
+	rx ry scale
+	0 0 1 0 360 arc
+	setmatrix
+} bind def
+
+/endpage { showpage } bind def
+/showpage { } def
+
+/layercolorseq
+	[	% layer color sequence - darkest to lightest
+		[0 0 0]
+		[.2 .8 .8]
+		[.4 .8 .8]
+		[.6 .8 .8]
+		[.8 .8 .8]
+	]
+def
+
+/layerlen layercolorseq length def
+
+/setlayer {/maxlayer exch def /curlayer exch def
+	layercolorseq curlayer 1 sub layerlen mod get
+	aload pop sethsbcolor
+	/nodecolor {nopcolor} def
+	/edgecolor {nopcolor} def
+	/graphcolor {nopcolor} def
+} bind def
+
+/onlayer { curlayer ne {invis} if } def
+
+/onlayers {
+	/myupper exch def
+	/mylower exch def
+	curlayer mylower lt
+	curlayer myupper gt
+	or
+	{invis} if
+} def
+
+/curlayer 0 def
+
+%%EndResource
+%%EndProlog
+%%BeginSetup
+14 default-font-family set_font
+1 setmiterlimit
+% /arrowlength 10 def
+% /arrowwidth 5 def
+
+% make sure pdfmark is harmless for PS-interpreters other than Distiller
+/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse
+% make '<<' and '>>' safe on PS Level 1 devices
+/languagelevel where {pop languagelevel}{1} ifelse
+2 lt {
+    userdict (<<) cvn ([) cvn load put
+    userdict (>>) cvn ([) cvn load put
+} if
+
+%%EndSetup
+%%Page: 1 1
+%%PageBoundingBox: 36 36 192 80
+%%PageOrientation: Portrait
+gsave
+36 36 156 44 boxprim clip newpath
+36 36 translate
+0 0 1 beginpage
+1.0000 set_scale
+4 4 translate 0 rotate
+0.167 0.600 1.000 graphcolor
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+154 42 lineto
+154 -6 lineto
+closepath
+fill
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+154 42 lineto
+154 -6 lineto
+closepath
+stroke
+0.000 0.000 0.000 graphcolor
+14.00 /Times-Roman set_font
+% InnerAlgebraicNumber
+[ /Rect [ 0 0 148 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=IAN) >>
+  /Subtype /Link
+/ANN pdfmark
+gsave 10 dict begin
+filled
+0.537 0.247 0.902 nodecolor
+0.537 0.247 0.902 nodecolor
+newpath 148 36 moveto
+0 36 lineto
+0 0 lineto
+148 0 lineto
+closepath
+fill
+0.537 0.247 0.902 nodecolor
+newpath 148 36 moveto
+0 36 lineto
+0 0 lineto
+148 0 lineto
+closepath
+stroke
+gsave 10 dict begin
+0.000 0.000 0.000 nodecolor
+8 13 moveto
+(InnerAlgebraicNumber)
+[4.56 6.96 6.96 6.24 4.8 10.08 3.84 6.72 6.24 6.96 4.8 6.24 3.84 6.24 9.84 6.96 10.8 6.96 6.24 4.8]
+xshow
+end grestore
+end grestore
+endpage
+showpage
+grestore
+%%PageTrailer
+%%EndPage: 1
+%%Trailer
+%%Pages: 1
+end
+restore
+%%EOF
diff --git a/books/ps/v103onepointcompletion.ps b/books/ps/v103onepointcompletion.ps
new file mode 100644
index 0000000..c295afe
--- /dev/null
+++ b/books/ps/v103onepointcompletion.ps
@@ -0,0 +1,248 @@
+%!PS-Adobe-2.0
+%%Creator: dot version 2.8 (Thu Sep 14 20:34:11 UTC 2006)
+%%For: (root) root
+%%Title: pic
+%%Pages: (atend)
+%%BoundingBox: 36 36 178 80
+%%EndComments
+save
+%%BeginProlog
+/DotDict 200 dict def
+DotDict begin
+
+/setupLatin1 {
+mark
+/EncodingVector 256 array def
+ EncodingVector 0
+
+ISOLatin1Encoding 0 255 getinterval putinterval
+EncodingVector 45 /hyphen put
+
+% Set up ISO Latin 1 character encoding
+/starnetISO {
+        dup dup findfont dup length dict begin
+        { 1 index /FID ne { def }{ pop pop } ifelse
+        } forall
+        /Encoding EncodingVector def
+        currentdict end definefont
+} def
+/Times-Roman starnetISO def
+/Times-Italic starnetISO def
+/Times-Bold starnetISO def
+/Times-BoldItalic starnetISO def
+/Helvetica starnetISO def
+/Helvetica-Oblique starnetISO def
+/Helvetica-Bold starnetISO def
+/Helvetica-BoldOblique starnetISO def
+/Courier starnetISO def
+/Courier-Oblique starnetISO def
+/Courier-Bold starnetISO def
+/Courier-BoldOblique starnetISO def
+cleartomark
+} bind def
+
+%%BeginResource: procset graphviz 0 0
+/coord-font-family /Times-Roman def
+/default-font-family /Times-Roman def
+/coordfont coord-font-family findfont 8 scalefont def
+
+/InvScaleFactor 1.0 def
+/set_scale {
+	dup 1 exch div /InvScaleFactor exch def
+	dup scale
+} bind def
+
+% styles
+/solid { [] 0 setdash } bind def
+/dashed { [9 InvScaleFactor mul dup ] 0 setdash } bind def
+/dotted { [1 InvScaleFactor mul 6 InvScaleFactor mul] 0 setdash } bind def
+/invis {/fill {newpath} def /stroke {newpath} def /show {pop newpath} def} bind def
+/bold { 2 setlinewidth } bind def
+/filled { } bind def
+/unfilled { } bind def
+/rounded { } bind def
+/diagonals { } bind def
+
+% hooks for setting color 
+/nodecolor { sethsbcolor } bind def
+/edgecolor { sethsbcolor } bind def
+/graphcolor { sethsbcolor } bind def
+/nopcolor {pop pop pop} bind def
+
+/beginpage {	% i j npages
+	/npages exch def
+	/j exch def
+	/i exch def
+	/str 10 string def
+	npages 1 gt {
+		gsave
+			coordfont setfont
+			0 0 moveto
+			(\() show i str cvs show (,) show j str cvs show (\)) show
+		grestore
+	} if
+} bind def
+
+/set_font {
+	findfont exch
+	scalefont setfont
+} def
+
+% draw aligned label in bounding box aligned to current point
+/alignedtext {			% width adj text
+	/text exch def
+	/adj exch def
+	/width exch def
+	gsave
+		width 0 gt {
+			text stringwidth pop adj mul 0 rmoveto
+		} if
+		[] 0 setdash
+		text show
+	grestore
+} def
+
+/boxprim {				% xcorner ycorner xsize ysize
+		4 2 roll
+		moveto
+		2 copy
+		exch 0 rlineto
+		0 exch rlineto
+		pop neg 0 rlineto
+		closepath
+} bind def
+
+/ellipse_path {
+	/ry exch def
+	/rx exch def
+	/y exch def
+	/x exch def
+	matrix currentmatrix
+	newpath
+	x y translate
+	rx ry scale
+	0 0 1 0 360 arc
+	setmatrix
+} bind def
+
+/endpage { showpage } bind def
+/showpage { } def
+
+/layercolorseq
+	[	% layer color sequence - darkest to lightest
+		[0 0 0]
+		[.2 .8 .8]
+		[.4 .8 .8]
+		[.6 .8 .8]
+		[.8 .8 .8]
+	]
+def
+
+/layerlen layercolorseq length def
+
+/setlayer {/maxlayer exch def /curlayer exch def
+	layercolorseq curlayer 1 sub layerlen mod get
+	aload pop sethsbcolor
+	/nodecolor {nopcolor} def
+	/edgecolor {nopcolor} def
+	/graphcolor {nopcolor} def
+} bind def
+
+/onlayer { curlayer ne {invis} if } def
+
+/onlayers {
+	/myupper exch def
+	/mylower exch def
+	curlayer mylower lt
+	curlayer myupper gt
+	or
+	{invis} if
+} def
+
+/curlayer 0 def
+
+%%EndResource
+%%EndProlog
+%%BeginSetup
+14 default-font-family set_font
+1 setmiterlimit
+% /arrowlength 10 def
+% /arrowwidth 5 def
+
+% make sure pdfmark is harmless for PS-interpreters other than Distiller
+/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse
+% make '<<' and '>>' safe on PS Level 1 devices
+/languagelevel where {pop languagelevel}{1} ifelse
+2 lt {
+    userdict (<<) cvn ([) cvn load put
+    userdict (>>) cvn ([) cvn load put
+} if
+
+%%EndSetup
+%%Page: 1 1
+%%PageBoundingBox: 36 36 178 80
+%%PageOrientation: Portrait
+gsave
+36 36 142 44 boxprim clip newpath
+36 36 translate
+0 0 1 beginpage
+1.0000 set_scale
+4 4 translate 0 rotate
+0.167 0.600 1.000 graphcolor
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+140 42 lineto
+140 -6 lineto
+closepath
+fill
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+140 42 lineto
+140 -6 lineto
+closepath
+stroke
+0.000 0.000 0.000 graphcolor
+14.00 /Times-Roman set_font
+% OnePointCompletion
+[ /Rect [ 0 0 134 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=ONECOMP) >>
+  /Subtype /Link
+/ANN pdfmark
+gsave 10 dict begin
+filled
+0.537 0.247 0.902 nodecolor
+0.537 0.247 0.902 nodecolor
+newpath 134 36 moveto
+0 36 lineto
+0 0 lineto
+134 0 lineto
+closepath
+fill
+0.537 0.247 0.902 nodecolor
+newpath 134 36 moveto
+0 36 lineto
+0 0 lineto
+134 0 lineto
+closepath
+stroke
+gsave 10 dict begin
+0.000 0.000 0.000 nodecolor
+8 13 moveto
+(OnePointCompletion)
+[10.08 6.96 6.24 7.44 6.96 3.84 6.96 3.84 9.36 6.96 10.56 6.96 3.84 6 3.84 3.84 6.96 6.96]
+xshow
+end grestore
+end grestore
+endpage
+showpage
+grestore
+%%PageTrailer
+%%EndPage: 1
+%%Trailer
+%%Pages: 1
+end
+restore
+%%EOF
diff --git a/books/ps/v103orderedcompletion.ps b/books/ps/v103orderedcompletion.ps
new file mode 100644
index 0000000..6d88d43
--- /dev/null
+++ b/books/ps/v103orderedcompletion.ps
@@ -0,0 +1,248 @@
+%!PS-Adobe-2.0
+%%Creator: dot version 2.8 (Thu Sep 14 20:34:11 UTC 2006)
+%%For: (root) root
+%%Title: pic
+%%Pages: (atend)
+%%BoundingBox: 36 36 172 80
+%%EndComments
+save
+%%BeginProlog
+/DotDict 200 dict def
+DotDict begin
+
+/setupLatin1 {
+mark
+/EncodingVector 256 array def
+ EncodingVector 0
+
+ISOLatin1Encoding 0 255 getinterval putinterval
+EncodingVector 45 /hyphen put
+
+% Set up ISO Latin 1 character encoding
+/starnetISO {
+        dup dup findfont dup length dict begin
+        { 1 index /FID ne { def }{ pop pop } ifelse
+        } forall
+        /Encoding EncodingVector def
+        currentdict end definefont
+} def
+/Times-Roman starnetISO def
+/Times-Italic starnetISO def
+/Times-Bold starnetISO def
+/Times-BoldItalic starnetISO def
+/Helvetica starnetISO def
+/Helvetica-Oblique starnetISO def
+/Helvetica-Bold starnetISO def
+/Helvetica-BoldOblique starnetISO def
+/Courier starnetISO def
+/Courier-Oblique starnetISO def
+/Courier-Bold starnetISO def
+/Courier-BoldOblique starnetISO def
+cleartomark
+} bind def
+
+%%BeginResource: procset graphviz 0 0
+/coord-font-family /Times-Roman def
+/default-font-family /Times-Roman def
+/coordfont coord-font-family findfont 8 scalefont def
+
+/InvScaleFactor 1.0 def
+/set_scale {
+	dup 1 exch div /InvScaleFactor exch def
+	dup scale
+} bind def
+
+% styles
+/solid { [] 0 setdash } bind def
+/dashed { [9 InvScaleFactor mul dup ] 0 setdash } bind def
+/dotted { [1 InvScaleFactor mul 6 InvScaleFactor mul] 0 setdash } bind def
+/invis {/fill {newpath} def /stroke {newpath} def /show {pop newpath} def} bind def
+/bold { 2 setlinewidth } bind def
+/filled { } bind def
+/unfilled { } bind def
+/rounded { } bind def
+/diagonals { } bind def
+
+% hooks for setting color 
+/nodecolor { sethsbcolor } bind def
+/edgecolor { sethsbcolor } bind def
+/graphcolor { sethsbcolor } bind def
+/nopcolor {pop pop pop} bind def
+
+/beginpage {	% i j npages
+	/npages exch def
+	/j exch def
+	/i exch def
+	/str 10 string def
+	npages 1 gt {
+		gsave
+			coordfont setfont
+			0 0 moveto
+			(\() show i str cvs show (,) show j str cvs show (\)) show
+		grestore
+	} if
+} bind def
+
+/set_font {
+	findfont exch
+	scalefont setfont
+} def
+
+% draw aligned label in bounding box aligned to current point
+/alignedtext {			% width adj text
+	/text exch def
+	/adj exch def
+	/width exch def
+	gsave
+		width 0 gt {
+			text stringwidth pop adj mul 0 rmoveto
+		} if
+		[] 0 setdash
+		text show
+	grestore
+} def
+
+/boxprim {				% xcorner ycorner xsize ysize
+		4 2 roll
+		moveto
+		2 copy
+		exch 0 rlineto
+		0 exch rlineto
+		pop neg 0 rlineto
+		closepath
+} bind def
+
+/ellipse_path {
+	/ry exch def
+	/rx exch def
+	/y exch def
+	/x exch def
+	matrix currentmatrix
+	newpath
+	x y translate
+	rx ry scale
+	0 0 1 0 360 arc
+	setmatrix
+} bind def
+
+/endpage { showpage } bind def
+/showpage { } def
+
+/layercolorseq
+	[	% layer color sequence - darkest to lightest
+		[0 0 0]
+		[.2 .8 .8]
+		[.4 .8 .8]
+		[.6 .8 .8]
+		[.8 .8 .8]
+	]
+def
+
+/layerlen layercolorseq length def
+
+/setlayer {/maxlayer exch def /curlayer exch def
+	layercolorseq curlayer 1 sub layerlen mod get
+	aload pop sethsbcolor
+	/nodecolor {nopcolor} def
+	/edgecolor {nopcolor} def
+	/graphcolor {nopcolor} def
+} bind def
+
+/onlayer { curlayer ne {invis} if } def
+
+/onlayers {
+	/myupper exch def
+	/mylower exch def
+	curlayer mylower lt
+	curlayer myupper gt
+	or
+	{invis} if
+} def
+
+/curlayer 0 def
+
+%%EndResource
+%%EndProlog
+%%BeginSetup
+14 default-font-family set_font
+1 setmiterlimit
+% /arrowlength 10 def
+% /arrowwidth 5 def
+
+% make sure pdfmark is harmless for PS-interpreters other than Distiller
+/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse
+% make '<<' and '>>' safe on PS Level 1 devices
+/languagelevel where {pop languagelevel}{1} ifelse
+2 lt {
+    userdict (<<) cvn ([) cvn load put
+    userdict (>>) cvn ([) cvn load put
+} if
+
+%%EndSetup
+%%Page: 1 1
+%%PageBoundingBox: 36 36 172 80
+%%PageOrientation: Portrait
+gsave
+36 36 136 44 boxprim clip newpath
+36 36 translate
+0 0 1 beginpage
+1.0000 set_scale
+4 4 translate 0 rotate
+0.167 0.600 1.000 graphcolor
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+134 42 lineto
+134 -6 lineto
+closepath
+fill
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+134 42 lineto
+134 -6 lineto
+closepath
+stroke
+0.000 0.000 0.000 graphcolor
+14.00 /Times-Roman set_font
+% OrderedCompletion
+[ /Rect [ 0 0 128 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=ORDCOMP) >>
+  /Subtype /Link
+/ANN pdfmark
+gsave 10 dict begin
+filled
+0.537 0.247 0.902 nodecolor
+0.537 0.247 0.902 nodecolor
+newpath 128 36 moveto
+0 36 lineto
+0 0 lineto
+128 0 lineto
+closepath
+fill
+0.537 0.247 0.902 nodecolor
+newpath 128 36 moveto
+0 36 lineto
+0 0 lineto
+128 0 lineto
+closepath
+stroke
+gsave 10 dict begin
+0.000 0.000 0.000 nodecolor
+8 13 moveto
+(OrderedCompletion)
+[10.08 4.56 6.96 6.24 4.8 6.24 6.96 9.36 6.96 10.56 6.96 3.84 6 3.84 3.84 6.96 6.96]
+xshow
+end grestore
+end grestore
+endpage
+showpage
+grestore
+%%PageTrailer
+%%EndPage: 1
+%%Trailer
+%%Pages: 1
+end
+restore
+%%EOF
diff --git a/books/ps/v103palette.ps b/books/ps/v103palette.ps
new file mode 100644
index 0000000..41f13d2
--- /dev/null
+++ b/books/ps/v103palette.ps
@@ -0,0 +1,248 @@
+%!PS-Adobe-2.0
+%%Creator: dot version 2.8 (Thu Sep 14 20:34:11 UTC 2006)
+%%For: (root) root
+%%Title: pic
+%%Pages: (atend)
+%%BoundingBox: 36 36 98 80
+%%EndComments
+save
+%%BeginProlog
+/DotDict 200 dict def
+DotDict begin
+
+/setupLatin1 {
+mark
+/EncodingVector 256 array def
+ EncodingVector 0
+
+ISOLatin1Encoding 0 255 getinterval putinterval
+EncodingVector 45 /hyphen put
+
+% Set up ISO Latin 1 character encoding
+/starnetISO {
+        dup dup findfont dup length dict begin
+        { 1 index /FID ne { def }{ pop pop } ifelse
+        } forall
+        /Encoding EncodingVector def
+        currentdict end definefont
+} def
+/Times-Roman starnetISO def
+/Times-Italic starnetISO def
+/Times-Bold starnetISO def
+/Times-BoldItalic starnetISO def
+/Helvetica starnetISO def
+/Helvetica-Oblique starnetISO def
+/Helvetica-Bold starnetISO def
+/Helvetica-BoldOblique starnetISO def
+/Courier starnetISO def
+/Courier-Oblique starnetISO def
+/Courier-Bold starnetISO def
+/Courier-BoldOblique starnetISO def
+cleartomark
+} bind def
+
+%%BeginResource: procset graphviz 0 0
+/coord-font-family /Times-Roman def
+/default-font-family /Times-Roman def
+/coordfont coord-font-family findfont 8 scalefont def
+
+/InvScaleFactor 1.0 def
+/set_scale {
+	dup 1 exch div /InvScaleFactor exch def
+	dup scale
+} bind def
+
+% styles
+/solid { [] 0 setdash } bind def
+/dashed { [9 InvScaleFactor mul dup ] 0 setdash } bind def
+/dotted { [1 InvScaleFactor mul 6 InvScaleFactor mul] 0 setdash } bind def
+/invis {/fill {newpath} def /stroke {newpath} def /show {pop newpath} def} bind def
+/bold { 2 setlinewidth } bind def
+/filled { } bind def
+/unfilled { } bind def
+/rounded { } bind def
+/diagonals { } bind def
+
+% hooks for setting color 
+/nodecolor { sethsbcolor } bind def
+/edgecolor { sethsbcolor } bind def
+/graphcolor { sethsbcolor } bind def
+/nopcolor {pop pop pop} bind def
+
+/beginpage {	% i j npages
+	/npages exch def
+	/j exch def
+	/i exch def
+	/str 10 string def
+	npages 1 gt {
+		gsave
+			coordfont setfont
+			0 0 moveto
+			(\() show i str cvs show (,) show j str cvs show (\)) show
+		grestore
+	} if
+} bind def
+
+/set_font {
+	findfont exch
+	scalefont setfont
+} def
+
+% draw aligned label in bounding box aligned to current point
+/alignedtext {			% width adj text
+	/text exch def
+	/adj exch def
+	/width exch def
+	gsave
+		width 0 gt {
+			text stringwidth pop adj mul 0 rmoveto
+		} if
+		[] 0 setdash
+		text show
+	grestore
+} def
+
+/boxprim {				% xcorner ycorner xsize ysize
+		4 2 roll
+		moveto
+		2 copy
+		exch 0 rlineto
+		0 exch rlineto
+		pop neg 0 rlineto
+		closepath
+} bind def
+
+/ellipse_path {
+	/ry exch def
+	/rx exch def
+	/y exch def
+	/x exch def
+	matrix currentmatrix
+	newpath
+	x y translate
+	rx ry scale
+	0 0 1 0 360 arc
+	setmatrix
+} bind def
+
+/endpage { showpage } bind def
+/showpage { } def
+
+/layercolorseq
+	[	% layer color sequence - darkest to lightest
+		[0 0 0]
+		[.2 .8 .8]
+		[.4 .8 .8]
+		[.6 .8 .8]
+		[.8 .8 .8]
+	]
+def
+
+/layerlen layercolorseq length def
+
+/setlayer {/maxlayer exch def /curlayer exch def
+	layercolorseq curlayer 1 sub layerlen mod get
+	aload pop sethsbcolor
+	/nodecolor {nopcolor} def
+	/edgecolor {nopcolor} def
+	/graphcolor {nopcolor} def
+} bind def
+
+/onlayer { curlayer ne {invis} if } def
+
+/onlayers {
+	/myupper exch def
+	/mylower exch def
+	curlayer mylower lt
+	curlayer myupper gt
+	or
+	{invis} if
+} def
+
+/curlayer 0 def
+
+%%EndResource
+%%EndProlog
+%%BeginSetup
+14 default-font-family set_font
+1 setmiterlimit
+% /arrowlength 10 def
+% /arrowwidth 5 def
+
+% make sure pdfmark is harmless for PS-interpreters other than Distiller
+/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse
+% make '<<' and '>>' safe on PS Level 1 devices
+/languagelevel where {pop languagelevel}{1} ifelse
+2 lt {
+    userdict (<<) cvn ([) cvn load put
+    userdict (>>) cvn ([) cvn load put
+} if
+
+%%EndSetup
+%%Page: 1 1
+%%PageBoundingBox: 36 36 98 80
+%%PageOrientation: Portrait
+gsave
+36 36 62 44 boxprim clip newpath
+36 36 translate
+0 0 1 beginpage
+1.0000 set_scale
+4 4 translate 0 rotate
+0.167 0.600 1.000 graphcolor
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+60 42 lineto
+60 -6 lineto
+closepath
+fill
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+60 42 lineto
+60 -6 lineto
+closepath
+stroke
+0.000 0.000 0.000 graphcolor
+14.00 /Times-Roman set_font
+% Palette
+[ /Rect [ 0 0 54 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=PALETTE) >>
+  /Subtype /Link
+/ANN pdfmark
+gsave 10 dict begin
+filled
+0.537 0.247 0.902 nodecolor
+0.537 0.247 0.902 nodecolor
+newpath 54 36 moveto
+0 36 lineto
+0 0 lineto
+54 0 lineto
+closepath
+fill
+0.537 0.247 0.902 nodecolor
+newpath 54 36 moveto
+0 36 lineto
+0 0 lineto
+54 0 lineto
+closepath
+stroke
+gsave 10 dict begin
+0.000 0.000 0.000 nodecolor
+7 13 moveto
+(Palette)
+[7.44 6.24 3.84 6 3.84 3.84 6.24]
+xshow
+end grestore
+end grestore
+endpage
+showpage
+grestore
+%%PageTrailer
+%%EndPage: 1
+%%Trailer
+%%Pages: 1
+end
+restore
+%%EOF
diff --git a/books/ps/v103quadraticform.ps b/books/ps/v103quadraticform.ps
new file mode 100644
index 0000000..a403fb4
--- /dev/null
+++ b/books/ps/v103quadraticform.ps
@@ -0,0 +1,248 @@
+%!PS-Adobe-2.0
+%%Creator: dot version 2.8 (Thu Sep 14 20:34:11 UTC 2006)
+%%For: (root) root
+%%Title: pic
+%%Pages: (atend)
+%%BoundingBox: 36 36 146 80
+%%EndComments
+save
+%%BeginProlog
+/DotDict 200 dict def
+DotDict begin
+
+/setupLatin1 {
+mark
+/EncodingVector 256 array def
+ EncodingVector 0
+
+ISOLatin1Encoding 0 255 getinterval putinterval
+EncodingVector 45 /hyphen put
+
+% Set up ISO Latin 1 character encoding
+/starnetISO {
+        dup dup findfont dup length dict begin
+        { 1 index /FID ne { def }{ pop pop } ifelse
+        } forall
+        /Encoding EncodingVector def
+        currentdict end definefont
+} def
+/Times-Roman starnetISO def
+/Times-Italic starnetISO def
+/Times-Bold starnetISO def
+/Times-BoldItalic starnetISO def
+/Helvetica starnetISO def
+/Helvetica-Oblique starnetISO def
+/Helvetica-Bold starnetISO def
+/Helvetica-BoldOblique starnetISO def
+/Courier starnetISO def
+/Courier-Oblique starnetISO def
+/Courier-Bold starnetISO def
+/Courier-BoldOblique starnetISO def
+cleartomark
+} bind def
+
+%%BeginResource: procset graphviz 0 0
+/coord-font-family /Times-Roman def
+/default-font-family /Times-Roman def
+/coordfont coord-font-family findfont 8 scalefont def
+
+/InvScaleFactor 1.0 def
+/set_scale {
+	dup 1 exch div /InvScaleFactor exch def
+	dup scale
+} bind def
+
+% styles
+/solid { [] 0 setdash } bind def
+/dashed { [9 InvScaleFactor mul dup ] 0 setdash } bind def
+/dotted { [1 InvScaleFactor mul 6 InvScaleFactor mul] 0 setdash } bind def
+/invis {/fill {newpath} def /stroke {newpath} def /show {pop newpath} def} bind def
+/bold { 2 setlinewidth } bind def
+/filled { } bind def
+/unfilled { } bind def
+/rounded { } bind def
+/diagonals { } bind def
+
+% hooks for setting color 
+/nodecolor { sethsbcolor } bind def
+/edgecolor { sethsbcolor } bind def
+/graphcolor { sethsbcolor } bind def
+/nopcolor {pop pop pop} bind def
+
+/beginpage {	% i j npages
+	/npages exch def
+	/j exch def
+	/i exch def
+	/str 10 string def
+	npages 1 gt {
+		gsave
+			coordfont setfont
+			0 0 moveto
+			(\() show i str cvs show (,) show j str cvs show (\)) show
+		grestore
+	} if
+} bind def
+
+/set_font {
+	findfont exch
+	scalefont setfont
+} def
+
+% draw aligned label in bounding box aligned to current point
+/alignedtext {			% width adj text
+	/text exch def
+	/adj exch def
+	/width exch def
+	gsave
+		width 0 gt {
+			text stringwidth pop adj mul 0 rmoveto
+		} if
+		[] 0 setdash
+		text show
+	grestore
+} def
+
+/boxprim {				% xcorner ycorner xsize ysize
+		4 2 roll
+		moveto
+		2 copy
+		exch 0 rlineto
+		0 exch rlineto
+		pop neg 0 rlineto
+		closepath
+} bind def
+
+/ellipse_path {
+	/ry exch def
+	/rx exch def
+	/y exch def
+	/x exch def
+	matrix currentmatrix
+	newpath
+	x y translate
+	rx ry scale
+	0 0 1 0 360 arc
+	setmatrix
+} bind def
+
+/endpage { showpage } bind def
+/showpage { } def
+
+/layercolorseq
+	[	% layer color sequence - darkest to lightest
+		[0 0 0]
+		[.2 .8 .8]
+		[.4 .8 .8]
+		[.6 .8 .8]
+		[.8 .8 .8]
+	]
+def
+
+/layerlen layercolorseq length def
+
+/setlayer {/maxlayer exch def /curlayer exch def
+	layercolorseq curlayer 1 sub layerlen mod get
+	aload pop sethsbcolor
+	/nodecolor {nopcolor} def
+	/edgecolor {nopcolor} def
+	/graphcolor {nopcolor} def
+} bind def
+
+/onlayer { curlayer ne {invis} if } def
+
+/onlayers {
+	/myupper exch def
+	/mylower exch def
+	curlayer mylower lt
+	curlayer myupper gt
+	or
+	{invis} if
+} def
+
+/curlayer 0 def
+
+%%EndResource
+%%EndProlog
+%%BeginSetup
+14 default-font-family set_font
+1 setmiterlimit
+% /arrowlength 10 def
+% /arrowwidth 5 def
+
+% make sure pdfmark is harmless for PS-interpreters other than Distiller
+/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse
+% make '<<' and '>>' safe on PS Level 1 devices
+/languagelevel where {pop languagelevel}{1} ifelse
+2 lt {
+    userdict (<<) cvn ([) cvn load put
+    userdict (>>) cvn ([) cvn load put
+} if
+
+%%EndSetup
+%%Page: 1 1
+%%PageBoundingBox: 36 36 146 80
+%%PageOrientation: Portrait
+gsave
+36 36 110 44 boxprim clip newpath
+36 36 translate
+0 0 1 beginpage
+1.0000 set_scale
+4 4 translate 0 rotate
+0.167 0.600 1.000 graphcolor
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+108 42 lineto
+108 -6 lineto
+closepath
+fill
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+108 42 lineto
+108 -6 lineto
+closepath
+stroke
+0.000 0.000 0.000 graphcolor
+14.00 /Times-Roman set_font
+% QuadraticForm
+[ /Rect [ 0 0 102 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=QFORM) >>
+  /Subtype /Link
+/ANN pdfmark
+gsave 10 dict begin
+filled
+0.537 0.247 0.902 nodecolor
+0.537 0.247 0.902 nodecolor
+newpath 102 36 moveto
+0 36 lineto
+0 0 lineto
+102 0 lineto
+closepath
+fill
+0.537 0.247 0.902 nodecolor
+newpath 102 36 moveto
+0 36 lineto
+0 0 lineto
+102 0 lineto
+closepath
+stroke
+gsave 10 dict begin
+0.000 0.000 0.000 nodecolor
+8 13 moveto
+(QuadraticForm)
+[10.08 6.96 6.24 6.96 4.8 6.24 3.84 3.84 6.24 7.44 6.96 5.04 10.8]
+xshow
+end grestore
+end grestore
+endpage
+showpage
+grestore
+%%PageTrailer
+%%EndPage: 1
+%%Trailer
+%%Pages: 1
+end
+restore
+%%EOF
diff --git a/books/ps/v103radicalfunctionfield.ps b/books/ps/v103radicalfunctionfield.ps
new file mode 100644
index 0000000..926a5b1
--- /dev/null
+++ b/books/ps/v103radicalfunctionfield.ps
@@ -0,0 +1,248 @@
+%!PS-Adobe-2.0
+%%Creator: dot version 2.8 (Thu Sep 14 20:34:11 UTC 2006)
+%%For: (root) root
+%%Title: pic
+%%Pages: (atend)
+%%BoundingBox: 36 36 180 80
+%%EndComments
+save
+%%BeginProlog
+/DotDict 200 dict def
+DotDict begin
+
+/setupLatin1 {
+mark
+/EncodingVector 256 array def
+ EncodingVector 0
+
+ISOLatin1Encoding 0 255 getinterval putinterval
+EncodingVector 45 /hyphen put
+
+% Set up ISO Latin 1 character encoding
+/starnetISO {
+        dup dup findfont dup length dict begin
+        { 1 index /FID ne { def }{ pop pop } ifelse
+        } forall
+        /Encoding EncodingVector def
+        currentdict end definefont
+} def
+/Times-Roman starnetISO def
+/Times-Italic starnetISO def
+/Times-Bold starnetISO def
+/Times-BoldItalic starnetISO def
+/Helvetica starnetISO def
+/Helvetica-Oblique starnetISO def
+/Helvetica-Bold starnetISO def
+/Helvetica-BoldOblique starnetISO def
+/Courier starnetISO def
+/Courier-Oblique starnetISO def
+/Courier-Bold starnetISO def
+/Courier-BoldOblique starnetISO def
+cleartomark
+} bind def
+
+%%BeginResource: procset graphviz 0 0
+/coord-font-family /Times-Roman def
+/default-font-family /Times-Roman def
+/coordfont coord-font-family findfont 8 scalefont def
+
+/InvScaleFactor 1.0 def
+/set_scale {
+	dup 1 exch div /InvScaleFactor exch def
+	dup scale
+} bind def
+
+% styles
+/solid { [] 0 setdash } bind def
+/dashed { [9 InvScaleFactor mul dup ] 0 setdash } bind def
+/dotted { [1 InvScaleFactor mul 6 InvScaleFactor mul] 0 setdash } bind def
+/invis {/fill {newpath} def /stroke {newpath} def /show {pop newpath} def} bind def
+/bold { 2 setlinewidth } bind def
+/filled { } bind def
+/unfilled { } bind def
+/rounded { } bind def
+/diagonals { } bind def
+
+% hooks for setting color 
+/nodecolor { sethsbcolor } bind def
+/edgecolor { sethsbcolor } bind def
+/graphcolor { sethsbcolor } bind def
+/nopcolor {pop pop pop} bind def
+
+/beginpage {	% i j npages
+	/npages exch def
+	/j exch def
+	/i exch def
+	/str 10 string def
+	npages 1 gt {
+		gsave
+			coordfont setfont
+			0 0 moveto
+			(\() show i str cvs show (,) show j str cvs show (\)) show
+		grestore
+	} if
+} bind def
+
+/set_font {
+	findfont exch
+	scalefont setfont
+} def
+
+% draw aligned label in bounding box aligned to current point
+/alignedtext {			% width adj text
+	/text exch def
+	/adj exch def
+	/width exch def
+	gsave
+		width 0 gt {
+			text stringwidth pop adj mul 0 rmoveto
+		} if
+		[] 0 setdash
+		text show
+	grestore
+} def
+
+/boxprim {				% xcorner ycorner xsize ysize
+		4 2 roll
+		moveto
+		2 copy
+		exch 0 rlineto
+		0 exch rlineto
+		pop neg 0 rlineto
+		closepath
+} bind def
+
+/ellipse_path {
+	/ry exch def
+	/rx exch def
+	/y exch def
+	/x exch def
+	matrix currentmatrix
+	newpath
+	x y translate
+	rx ry scale
+	0 0 1 0 360 arc
+	setmatrix
+} bind def
+
+/endpage { showpage } bind def
+/showpage { } def
+
+/layercolorseq
+	[	% layer color sequence - darkest to lightest
+		[0 0 0]
+		[.2 .8 .8]
+		[.4 .8 .8]
+		[.6 .8 .8]
+		[.8 .8 .8]
+	]
+def
+
+/layerlen layercolorseq length def
+
+/setlayer {/maxlayer exch def /curlayer exch def
+	layercolorseq curlayer 1 sub layerlen mod get
+	aload pop sethsbcolor
+	/nodecolor {nopcolor} def
+	/edgecolor {nopcolor} def
+	/graphcolor {nopcolor} def
+} bind def
+
+/onlayer { curlayer ne {invis} if } def
+
+/onlayers {
+	/myupper exch def
+	/mylower exch def
+	curlayer mylower lt
+	curlayer myupper gt
+	or
+	{invis} if
+} def
+
+/curlayer 0 def
+
+%%EndResource
+%%EndProlog
+%%BeginSetup
+14 default-font-family set_font
+1 setmiterlimit
+% /arrowlength 10 def
+% /arrowwidth 5 def
+
+% make sure pdfmark is harmless for PS-interpreters other than Distiller
+/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse
+% make '<<' and '>>' safe on PS Level 1 devices
+/languagelevel where {pop languagelevel}{1} ifelse
+2 lt {
+    userdict (<<) cvn ([) cvn load put
+    userdict (>>) cvn ([) cvn load put
+} if
+
+%%EndSetup
+%%Page: 1 1
+%%PageBoundingBox: 36 36 180 80
+%%PageOrientation: Portrait
+gsave
+36 36 144 44 boxprim clip newpath
+36 36 translate
+0 0 1 beginpage
+1.0000 set_scale
+4 4 translate 0 rotate
+0.167 0.600 1.000 graphcolor
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+142 42 lineto
+142 -6 lineto
+closepath
+fill
+0.167 0.600 1.000 graphcolor
+newpath -6 -6 moveto
+-6 42 lineto
+142 42 lineto
+142 -6 lineto
+closepath
+stroke
+0.000 0.000 0.000 graphcolor
+14.00 /Times-Roman set_font
+% RadicalFunctionField
+[ /Rect [ 0 0 136 36 ]
+  /Border [ 0 0 0 ]
+  /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=RADFF) >>
+  /Subtype /Link
+/ANN pdfmark
+gsave 10 dict begin
+filled
+0.537 0.247 0.902 nodecolor
+0.537 0.247 0.902 nodecolor
+newpath 136 36 moveto
+0 36 lineto
+0 0 lineto
+136 0 lineto
+closepath
+fill
+0.537 0.247 0.902 nodecolor
+newpath 136 36 moveto
+0 36 lineto
+0 0 lineto
+136 0 lineto
+closepath
+stroke
+gsave 10 dict begin
+0.000 0.000 0.000 nodecolor
+7 13 moveto
+(RadicalFunctionField)
+[9.36 6.24 6.96 3.84 6.24 6.24 3.84 7.44 6.96 6.96 6.24 3.84 3.84 6.96 6.96 7.44 3.84 6.24 3.84 6.96]
+xshow
+end grestore
+end grestore
+endpage
+showpage
+grestore
+%%PageTrailer
+%%EndPage: 1
+%%Trailer
+%%Pages: 1
+end
+restore
+%%EOF
diff --git a/changelog b/changelog
index 12d8deb..71f1683 100644
--- a/changelog
+++ b/changelog
@@ -1,3 +1,27 @@
+20081125 tpd src/axiom-website/patches.html 20081125.01.tpd.patch
+20081125 tpd books/bookvol10.3 add domains
+20081125 tpd src/algebra/Makefile remove files, fixup help
+20081125 tpd src/algebra/curve.spad move domains to bookvol10.3
+20081125 tpd books/ps/v103algebraicfunctionfield.ps added
+20081125 tpd books/ps/v103radicalfunctionfield.ps added
+20081125 tpd src/algebra/contfrac.spad move domains to bookvol10.3
+20081125 tpd books/ps/v103continuedfraction.ps added
+20081125 tpd src/algebra/constant.spad removed, domains moved to bookvol10.3
+20081125 tpd books/ps/v103algebraicnumber.ps added
+20081125 tpd books/ps/v103inneralgebraicnumber.ps added
+20081125 tpd src/algebra/complet.spad moved domains to bookvol10.3
+20081125 tpd books/ps/v103onepointcompletion.ps added
+20081125 tpd books/ps/v103orderedcompletion.ps added
+20081125 tpd src/algebra/color.spad removed, moved domains to bookvol10.3
+20081125 tpd books/ps/v103palette.ps added
+20081125 tpd books/ps/v103color.ps added
+20081125 tpd src/algebra/clifford.spad removed, moved domains to bookvol10.3
+20081125 tpd books/ps/v103cliffordalgebra.ps added
+20081125 tpd books/ps/v103quadraticform.ps added
+20081125 tpd books/ps/v103cartesiantensor.ps added
+20081125 tpd src/algebra/carten.spad move domain to bookvol10.3
+20081125 tpd books/ps/v103cardinalnumber.ps added
+20081125 tpd src/algebra/card.spad removed, move domain to bookvol10.3
 20081124 tpd src/axiom-website/patches.html 20081124.05.tpd.patch	
 20081124 tpd books/bookvol1 remove SmallFloat reference
 20081124 tpd books/bookvol0 remove SmallFloat reference
diff --git a/src/algebra/Makefile.pamphlet b/src/algebra/Makefile.pamphlet
index 6088c74..eb241b3 100644
--- a/src/algebra/Makefile.pamphlet
+++ b/src/algebra/Makefile.pamphlet
@@ -235,7 +235,6 @@ LAYER3=\
 
 \subsubsection{Completed spad files}
 \begin{verbatim}
-color.spad.pamphlet (COLOR PALETTE)
 paramete.spad.pamphlet (PARPCURV PARPC2 PARSCURV PARSC2 PARSURF PARSU2
 suchthat.spad.pamphlet (SUCH)
 ystream.spad.pamphlet (YSTREAM)
@@ -322,10 +321,6 @@ LAYER7=\
 
 @
 \subsection{Layer8}
-\subsubsection{Completed spad files}
-\begin{verbatim}
-card.spad.pamphlet (CARD)
-\end{verbatim}
 
 <<layer8>>=
 
@@ -478,7 +473,6 @@ LAYER12=\
 \subsubsection{Completed spad files}
 \begin{verbatim}
 carten.spad.pamphlet (GRMOD GRALG CARTEN CARTEN2)
-clifford.spad.pamphlet (QFORM CLIF)
 clip.spad.pamphlet (CLIP)
 coordsys.spad.pamphlet (COORDSYS)
 d02routine.spad.pamphlet (D02BBFA D02BHFA D02CJFA D02EJFA)
@@ -850,7 +844,6 @@ LAYER19=\
 \begin{verbatim}
 algfact.spad.pamphlet (IALGFACT SAEFACT RFFACT SAERFFC ALGFACT)
 algfunc.spad.pamphlet (ACF ACFS AF)
-constant.spad.pamphlet (IAN AN)
 cmplxrt.spad.pamphlet (CMPLXRT)
 crfp.spad.pamphlet (CRFP)
 curve.spad.pamphlet (FFCAT MMAP FFCAT2 CHAVAR RDFF ALGFF)
@@ -1163,11 +1156,11 @@ SPADFILES= \
  ${OUTSRC}/bezout.spad \
  ${OUTSRC}/brill.spad \
  ${OUTSRC}/c02.spad ${OUTSRC}/c05.spad ${OUTSRC}/c06.spad \
- ${OUTSRC}/card.spad ${OUTSRC}/carten.spad \
- ${OUTSRC}/cden.spad ${OUTSRC}/clifford.spad ${OUTSRC}/clip.spad \
- ${OUTSRC}/cmplxrt.spad ${OUTSRC}/color.spad \
+ ${OUTSRC}/carten.spad \
+ ${OUTSRC}/cden.spad ${OUTSRC}/clip.spad \
+ ${OUTSRC}/cmplxrt.spad \
  ${OUTSRC}/combfunc.spad ${OUTSRC}/combinat.spad ${OUTSRC}/complet.spad \
- ${OUTSRC}/constant.spad ${OUTSRC}/contfrac.spad ${OUTSRC}/cont.spad \
+ ${OUTSRC}/contfrac.spad ${OUTSRC}/cont.spad \
  ${OUTSRC}/coordsys.spad ${OUTSRC}/cra.spad ${OUTSRC}/crfp.spad \
  ${OUTSRC}/curve.spad ${OUTSRC}/cycles.spad ${OUTSRC}/cyclotom.spad \
  ${OUTSRC}/d01agents.spad ${OUTSRC}/d01package.spad \
@@ -1321,11 +1314,11 @@ DOCFILES= \
  ${DOC}/bezout.spad.dvi \
  ${DOC}/brill.spad.dvi \
  ${DOC}/c02.spad.dvi ${DOC}/c05.spad.dvi ${DOC}/c06.spad.dvi \
- ${DOC}/card.spad.dvi ${DOC}/carten.spad.dvi \
- ${DOC}/cden.spad.dvi ${DOC}/clifford.spad.dvi ${DOC}/clip.spad.dvi \
- ${DOC}/cmplxrt.spad.dvi ${DOC}/color.spad.dvi \
+ ${DOC}/carten.spad.dvi \
+ ${DOC}/cden.spad.dvi ${DOC}/clip.spad.dvi \
+ ${DOC}/cmplxrt.spad.dvi \
  ${DOC}/combfunc.spad.dvi ${DOC}/combinat.spad.dvi ${DOC}/complet.spad.dvi \
- ${DOC}/constant.spad.dvi ${DOC}/contfrac.spad.dvi ${DOC}/cont.spad.dvi \
+ ${DOC}/contfrac.spad.dvi ${DOC}/cont.spad.dvi \
  ${DOC}/coordsys.spad.dvi ${DOC}/cra.spad.dvi ${DOC}/crfp.spad.dvi \
  ${DOC}/curve.spad.dvi ${DOC}/cycles.spad.dvi ${DOC}/cyclotom.spad.dvi \
  ${DOC}/d01agents.spad.dvi ${DOC}/d01package.spad.dvi \
@@ -2228,20 +2221,22 @@ ${HELP}/BinarySearchTree.help: ${IN}/tree.spad.pamphlet
 	@${TANGLE} -R"BinarySearchTree.input" ${IN}/tree.spad.pamphlet \
             >${INPUT}/BinarySearchTree.input
 
-${HELP}/CardinalNumber.help: ${IN}/card.spad.pamphlet
-	@echo 7005 create CardinalNumber.help from ${IN}/card.spad.pamphlet
-	@${TANGLE} -R"CardinalNumber.help" ${IN}/card.spad.pamphlet \
+${HELP}/CardinalNumber.help: ${BOOKS}/bookvol10.3.pamphlet
+	@echo 7005 create CardinalNumber.help from \
+                ${BOOKS}/bookvol10.3.pamphlet
+	@${TANGLE} -R"CardinalNumber.help" ${BOOKS}/bookvol10.3.pamphlet \
             >${HELP}/CardinalNumber.help
 	@cp ${HELP}/CardinalNumber.help ${HELP}/CARD.help
-	@${TANGLE} -R"CardinalNumber.input" ${IN}/card.spad.pamphlet \
+	@${TANGLE} -R"CardinalNumber.input" ${BOOKS}/bookvol10.3.pamphlet \
             >${INPUT}/CardinalNumber.input
 
-${HELP}/CartesianTensor.help: ${IN}/carten.spad.pamphlet
-	@echo 7006 create CartesianTensor.help from ${IN}/carten.spad.pamphlet
-	@${TANGLE} -R"CartesianTensor.help" ${IN}/carten.spad.pamphlet \
+${HELP}/CartesianTensor.help: ${BOOKS}/bookvol10.3.pamphlet
+	@echo 7006 create CartesianTensor.help from \
+             ${BOOKS}/bookvol10.3.pamphlet
+	@${TANGLE} -R"CartesianTensor.help" ${BOOKS}/bookvol10.3.pamphlet \
             >${HELP}/CartesianTensor.help
 	@cp ${HELP}/CartesianTensor.help ${HELP}/CARTEN.help
-	@${TANGLE} -R"CartesianTensor.input" ${IN}/carten.spad.pamphlet \
+	@${TANGLE} -R"CartesianTensor.input" ${BOOKS}/bookvol10.3.pamphlet \
             >${INPUT}/CartesianTensor.input
 
 ${HELP}/Character.help: ${IN}/string.spad.pamphlet
@@ -2260,13 +2255,13 @@ ${HELP}/CharacterClass.help: ${IN}/string.spad.pamphlet
 	@${TANGLE} -R"CharacterClass.input" ${IN}/string.spad.pamphlet \
             >${INPUT}/CharacterClass.input
 
-${HELP}/CliffordAlgebra.help: ${IN}/clifford.spad.pamphlet
+${HELP}/CliffordAlgebra.help: ${BOOKS}/bookvol10.3.pamphlet
 	@echo 7009 create CliffordAlgebra.help from \
-          ${IN}/clifford.spad.pamphlet
-	@${TANGLE} -R"CliffordAlgebra.help" ${IN}/clifford.spad.pamphlet \
+          ${BOOKS}/bookvol10.3.pamphlet
+	@${TANGLE} -R"CliffordAlgebra.help" ${BOOKS}/bookvol10.3.pamphlet \
             >${HELP}/CliffordAlgebra.help
 	@cp ${HELP}/CliffordAlgebra.help ${HELP}/CLIF.help
-	@${TANGLE} -R"CliffordAlgebra.input" ${IN}/clifford.spad.pamphlet \
+	@${TANGLE} -R"CliffordAlgebra.input" ${BOOKS}/bookvol10.3.pamphlet \
             >${INPUT}/CliffordAlgebra.input
 
 ${HELP}/Complex.help: ${IN}/gaussian.spad.pamphlet
@@ -2277,13 +2272,13 @@ ${HELP}/Complex.help: ${IN}/gaussian.spad.pamphlet
 	@${TANGLE} -R"Complex.input" ${IN}/gaussian.spad.pamphlet \
             >${INPUT}/Complex.input
 
-${HELP}/ContinuedFraction.help: ${IN}/contfrac.spad.pamphlet
+${HELP}/ContinuedFraction.help: ${BOOKS}/bookvol10.3.pamphlet
 	@echo 7011 create ContinuedFraction.help from \
-            ${IN}/contfrac.spad.pamphlet
-	@${TANGLE} -R"ContinuedFraction.help" ${IN}/contfrac.spad.pamphlet \
+            ${BOOKS}/bookvol10.3.pamphlet
+	@${TANGLE} -R"ContinuedFraction.help" ${BOOKS}/bookvol10.3.pamphlet \
             >${HELP}/ContinuedFraction.help
 	@cp ${HELP}/ContinuedFraction.help ${HELP}/CONTFRAC.help
-	@${TANGLE} -R"ContinuedFraction.input" ${IN}/contfrac.spad.pamphlet \
+	@${TANGLE} -R"ContinuedFraction.input" ${BOOKS}/bookvol10.3.pamphlet \
             >${INPUT}/ContinuedFraction.input
 
 ${HELP}/CycleIndicators.help: ${IN}/cycles.spad.pamphlet
diff --git a/src/algebra/card.spad.pamphlet b/src/algebra/card.spad.pamphlet
deleted file mode 100644
index b56b5c2..0000000
--- a/src/algebra/card.spad.pamphlet
+++ /dev/null
@@ -1,568 +0,0 @@
-\documentclass{article}
-\usepackage{axiom}
-\begin{document}
-\title{\$SPAD/src/algebra card.spad}
-\author{Stephen M. Watt}
-\maketitle
-\begin{abstract}
-\end{abstract}
-\eject
-\tableofcontents
-\eject
-\section{domain CARD CardinalNumber}
-<<CardinalNumber.input>>=
--- card.spad.pamphlet CardinalNumber.input
-)spool CardinalNumber.output
-)set message test on
-)set message auto off
-)clear all
---S 1 of 20
-c0 := 0 :: CardinalNumber
---R 
---R
---R   (1)  0
---R                                                         Type: CardinalNumber
---E 1
-
---S 2 of 20
-c1 := 1 :: CardinalNumber
---R 
---R
---R   (2)  1
---R                                                         Type: CardinalNumber
---E 2
-
---S 3 of 20
-c2 := 2 :: CardinalNumber
---R 
---R
---R   (3)  2
---R                                                         Type: CardinalNumber
---E 3
-
---S 4 of 20
-c3 := 3 :: CardinalNumber
---R 
---R
---R   (4)  3
---R                                                         Type: CardinalNumber
---E 4
-
---S 5 of 20
-A0 := Aleph 0
---R 
---R
---R   (5)  Aleph(0)
---R                                                         Type: CardinalNumber
---E 5
-
---S 6 of 20
-A1 := Aleph 1
---R 
---R
---R   (6)  Aleph(1)
---R                                                         Type: CardinalNumber
---E 6
-
---S 7 of 20
-finite? c2
---R 
---R
---R   (7)  true
---R                                                                Type: Boolean
---E 7
-
---S 8 of 20
-finite? A0
---R 
---R
---R   (8)  false
---R                                                                Type: Boolean
---E 8
-
---S 9 of 20
-countable? c2
---R 
---R
---R   (9)  true
---R                                                                Type: Boolean
---E 9
-
---S 10 of 20
-countable? A0
---R 
---R
---R   (10)  true
---R                                                                Type: Boolean
---E 10
-
---S 11 of 20
-countable? A1
---R 
---R
---R   (11)  false
---R                                                                Type: Boolean
---E 11
-
---S 12 of 20
-[c2 + c2, c2 + A1]
---R 
---R
---R   (12)  [4,Aleph(1)]
---R                                                    Type: List CardinalNumber
---E 12
-
---S 13 of 20
-[c0*c2, c1*c2, c2*c2, c0*A1, c1*A1, c2*A1, A0*A1]
---R 
---R
---R   (13)  [0,2,4,0,Aleph(1),Aleph(1),Aleph(1)]
---R                                                    Type: List CardinalNumber
---E 13
-
---S 14 of 20
-[c2**c0, c2**c1, c2**c2, A1**c0, A1**c1, A1**c2]
---R 
---R
---R   (14)  [1,2,4,1,Aleph(1),Aleph(1)]
---R                                                    Type: List CardinalNumber
---E 14
-
---S 15 of 20
-[c2-c1, c2-c2, c2-c3, A1-c2, A1-A0, A1-A1]
---R 
---R
---R   (15)  [1,0,"failed",Aleph(1),Aleph(1),"failed"]
---R                                    Type: List Union(CardinalNumber,"failed")
---E 15
-
---S 16 of 20
-generalizedContinuumHypothesisAssumed true
---R 
---R
---R   (16)  true
---R                                                                Type: Boolean
---E 16
-
---S 17 of 20
-[c0**A0, c1**A0, c2**A0, A0**A0, A0**A1, A1**A0, A1**A1]
---R 
---R
---R   (17)  [0,1,Aleph(1),Aleph(1),Aleph(2),Aleph(1),Aleph(2)]
---R                                                    Type: List CardinalNumber
---E 17
-
---S 18 of 20
-a := Aleph 0
---R 
---R
---R   (18)  Aleph(0)
---R                                                         Type: CardinalNumber
---E 18
-
---S 19 of 20
-c := 2**a
---R 
---R
---R   (19)  Aleph(1)
---R                                                         Type: CardinalNumber
---E 19
-
---S 20 of 20
-f := 2**c
---R 
---R
---R   (20)  Aleph(2)
---R                                                         Type: CardinalNumber
---E 20
-)spool
-)lisp (bye)
-@
-<<CardinalNumber.help>>=
-====================================================================
-CardinalNumber examples
-====================================================================
-
-The CardinalNumber domain can be used for values indicating the
-cardinality of sets, both finite and infinite.  For example, the
-dimension operation in the category VectorSpace returns a cardinal
-number.
-
-The non-negative integers have a natural construction as cardinals
-
-  0 = #{ }, 1 = {0}, 2 = {0, 1}, ..., n = {i | 0 <= i < n}.
-
-The fact that 0 acts as a zero for the multiplication of cardinals is
-equivalent to the axiom of choice.
-
-Cardinal numbers can be created by conversion from non-negative integers.
-
-  c0 := 0 :: CardinalNumber
-   0 
-                      Type: CardinalNumber
-
-  c1 := 1 :: CardinalNumber
-   1 
-                      Type: CardinalNumber
-
-  c2 := 2 :: CardinalNumber
-   2 
-                      Type: CardinalNumber
-
-  c3 := 3 :: CardinalNumber
-   3 
-                      Type: CardinalNumber
-
-They can also be obtained as the named cardinal Aleph(n).
-
-  A0 := Aleph 0
-   Aleph(0)
-                      Type: CardinalNumber
-
-  A1 := Aleph 1
-   Aleph(1)
-                      Type: CardinalNumber
-
-The finite? operation tests whether a value is a finite cardinal, that
-is, a non-negative integer.
-
-  finite? c2
-   true
-                      Type: Boolean
-
-  finite? A0
-   false
-                      Type: Boolean
-
-Similarly, the countable?  operation determines whether a value is a
-countable cardinal, that is, finite or Aleph(0).
-
-  countable? c2
-   true
-                      Type: Boolean
-
-  countable? A0
-   true
-                      Type: Boolean
-
-  countable? A1
-   false
-                      Type: Boolean
-
-Arithmetic operations are defined on cardinal numbers as follows:
-If x = #X  and y = #Y then
-
-  x+y  = #(X+Y) cardinality of the disjoint union
-  x-y  = #(X-Y) cardinality of the relative complement
-  x*y  = #(X*Y) cardinality of the Cartesian product
-  x**y = #(X**Y) cardinality of the set of maps from Y to X
-
-Here are some arithmetic examples.
-
-  [c2 + c2, c2 + A1]
-   [4, Aleph(1)]
-                      Type: List CardinalNumber
-
-  [c0*c2, c1*c2, c2*c2, c0*A1, c1*A1, c2*A1, A0*A1]
-   [0, 2, 4, 0, Aleph(1), Aleph(1), Aleph(1)]
-                      Type: List CardinalNumber
-
-  [c2**c0, c2**c1, c2**c2, A1**c0, A1**c1, A1**c2]
-   [1, 2, 4, 1, Aleph(1), Aleph(1)]
-                      Type: List CardinalNumber
-
-Subtraction is a partial operation: it is not defined when subtracting
-a larger cardinal from a smaller one, nor when subtracting two equal
-infinite cardinals.
-
-  [c2-c1, c2-c2, c2-c3, A1-c2, A1-A0, A1-A1]
-   [1, 0, "failed", Aleph(1), Aleph(1), "failed"]
-                      Type: List Union(CardinalNumber,"failed")
-
-The generalized continuum hypothesis asserts that
-
-  2**Aleph i = Aleph(i+1)
-
-and is independent of the axioms of set theory.
-
-(reference: Goedel, The consistency of the continuum hypothesis,
-Ann. Math. Studies, Princeton Univ. Press, 1940.)
-
-The CardinalNumber domain provides an operation to assert whether the
-hypothesis is to be assumed.
-
-  generalizedContinuumHypothesisAssumed true
-   true
-                      Type: Boolean
-
-When the generalized continuum hypothesis is assumed, exponentiation
-to a transfinite power is allowed.
-
-  [c0**A0, c1**A0, c2**A0, A0**A0, A0**A1, A1**A0, A1**A1]
-   [0, 1, Aleph(1), Aleph(1), Aleph(2), Aleph(1), Aleph(2)]
-                      Type: List CardinalNumber
-
-Three commonly encountered cardinal numbers are
-
-  a = #Z countable infinity
-  c = #R the continuum
-  f = #{g| g: [0,1] -> R}
-
-In this domain, these values are obtained under the generalized
-continuum hypothesis in this way.
-
-  a := Aleph 0
-   Aleph(0)
-                      Type: CardinalNumber
-
-  c := 2**a
-   Aleph(1)
-                      Type: CardinalNumber
-
-  f := 2**c
-   Aleph(2)
-                      Type: CardinalNumber
-
-See Also:
-o )show CardinalNumber
-o $AXIOM/doc/src/algebra/card.spad.dvi
-
-@
-<<dot>>=
-"CARD" -> "ORDSET"
-"CardinalNumber()" -> "OrderedSet()"
-"CARD" -> "ABELMON"
-"CardinalNumber()" -> "AbelianMonoid()"
-"CARD" -> "MONOID"
-"CardinalNumber()" -> "Monoid()" 
-"CARD" -> "RETRACT"
-"CardinalNumber()" -> "RetractableTo(NonNegativeInteger)"
-@
-<<domain CARD CardinalNumber>>=
-)abbrev domain CARD CardinalNumber
-++ Author: S.M. Watt
-++ Date Created: June 1986
-++ Date Last Updated: May 1990
-++ Basic Operations: Aleph, +, -, *, **
-++ Related Domains: 
-++ Also See:
-++ AMS Classifications:
-++ Keywords: cardinal number, transfinite arithmetic
-++ Examples:
-++ References:
-++   Goedel, "The consistency of the continuum hypothesis",
-++   Ann. Math. Studies, Princeton Univ. Press, 1940
-++ Description:
-++   Members of the domain CardinalNumber are values indicating the
-++   cardinality of sets, both finite and infinite.  Arithmetic operations
-++   are defined on cardinal numbers as follows.
-++
-++   If \spad{x = #X}  and  \spad{y = #Y} then
-++     \spad{x+y  = #(X+Y)}   \tab{30}disjoint union
-++     \spad{x-y  = #(X-Y)}   \tab{30}relative complement
-++     \spad{x*y  = #(X*Y)}   \tab{30}cartesian product
-++     \spad{x**y = #(X**Y)}  \tab{30}\spad{X**Y = \{g| g:Y->X\}}
-++
-++   The non-negative integers have a natural construction as cardinals
-++     \spad{0 = #\{\}}, \spad{1 = \{0\}}, \spad{2 = \{0, 1\}}, ..., \spad{n = \{i| 0 <= i < n\}}.
-++
-++   That \spad{0} acts as a zero for the multiplication of cardinals is
-++   equivalent to the axiom of choice.
-++
-++   The generalized continuum hypothesis asserts 
-++   \center{\spad{2**Aleph i = Aleph(i+1)}}
-++   and is independent of the axioms of set theory [Goedel 1940].
-++
-++   Three commonly encountered cardinal numbers are
-++      \spad{a = #Z}       \tab{30}countable infinity
-++      \spad{c = #R}       \tab{30}the continuum
-++      \spad{f = #\{g| g:[0,1]->R\}}
-++
-++   In this domain, these values are obtained using
-++      \spad{a := Aleph 0}, \spad{c := 2**a}, \spad{f := 2**c}.
-++
-CardinalNumber: Join(OrderedSet, AbelianMonoid, Monoid,
-                        RetractableTo NonNegativeInteger) with
-        commutative "*"
-            ++ a domain D has \spad{commutative("*")} if it has an operation
-            ++ \spad{"*": (D,D) -> D} which is commutative.
-
-        "-": (%,%) -> Union(%,"failed")
-            ++ \spad{x - y} returns an element z such that 
-            ++ \spad{z+y=x} or "failed" if no such element exists.
-            ++
-            ++X c2:=2::CardinalNumber
-            ++X c2-c2
-            ++X A1:=Aleph 1
-            ++X A1-c2
-
-        "**": (%, %) -> %
-            ++ \spad{x**y} returns \spad{#(X**Y)} where \spad{X**Y} is defined
-            ++  as \spad{\{g| g:Y->X\}}.
-            ++
-            ++X c2:=2::CardinalNumber
-            ++X c2**c2
-            ++X A1:=Aleph 1
-            ++X A1**c2
-            ++X generalizedContinuumHypothesisAssumed true
-            ++X A1**A1
-
-        Aleph: NonNegativeInteger -> %
-            ++ Aleph(n) provides the named (infinite) cardinal number.
-            ++
-            ++X A0:=Aleph 0
-
-        finite?: % -> Boolean
-            ++ finite?(\spad{a}) determines whether 
-            ++ \spad{a} is a finite cardinal, i.e. an integer.
-            ++
-            ++X c2:=2::CardinalNumber
-            ++X finite? c2
-            ++X A0:=Aleph 0
-            ++X finite? A0
-
-        countable?: % -> Boolean
-            ++ countable?(\spad{a}) determines 
-            ++ whether \spad{a} is a countable cardinal,
-            ++ i.e. an integer or \spad{Aleph 0}.
-            ++
-            ++X c2:=2::CardinalNumber
-            ++X countable? c2
-            ++X A0:=Aleph 0
-            ++X countable? A0
-            ++X A1:=Aleph 1
-            ++X countable? A1
-
-        generalizedContinuumHypothesisAssumed?: () -> Boolean
-            ++ generalizedContinuumHypothesisAssumed?()
-            ++ tests if the hypothesis is currently assumed.
-            ++
-            ++X generalizedContinuumHypothesisAssumed?
-
-        generalizedContinuumHypothesisAssumed:  Boolean -> Boolean
-            ++ generalizedContinuumHypothesisAssumed(bool)
-            ++ is used to dictate whether the hypothesis is to be assumed.
-            ++
-            ++X generalizedContinuumHypothesisAssumed true
-            ++X a:=Aleph 0
-            ++X c:=2**a
-            ++X f:=2**c
-    == add
-        NNI ==> NonNegativeInteger
-        FINord   ==> -1
-        DUMMYval ==> -1
- 
-        Rep := Record(order: Integer, ival: Integer)
- 
-        GCHypothesis: Reference(Boolean) := ref false
- 
-        -- Creation
-        0           == [FINord, 0]
-        1           == [FINord, 1]
-        coerce(n:NonNegativeInteger):% == [FINord, n]
-        Aleph n     == [n, DUMMYval]
- 
-        -- Output
-        ALEPHexpr := "Aleph"::OutputForm
- 
-        coerce(x: %): OutputForm ==
-            x.order = FINord => (x.ival)::OutputForm
-            prefix(ALEPHexpr, [(x.order)::OutputForm])
- 
-        -- Manipulation
-        x = y ==
-            x.order ^= y.order => false
-            finite? x          => x.ival = y.ival
-            true     -- equal transfinites
-        x < y ==
-            x.order < y.order => true
-            x.order > y.order => false
-            finite? x         => x.ival < y.ival
-            false    -- equal transfinites
-        x:% + y:% ==
-            finite? x and finite? y => [FINord, x.ival+y.ival]
-            max(x, y)
-        x - y ==
-            x < y     => "failed"
-            finite? x => [FINord, x.ival-y.ival]
-            x > y     => x
-            "failed" -- equal transfinites
-        x:% * y:% ==
-            finite? x and finite? y => [FINord, x.ival*y.ival]
-            x = 0 or y = 0          => 0
-            max(x, y)
-        n:NonNegativeInteger * x:% ==
-            finite? x => [FINord, n*x.ival]
-            n = 0     => 0
-            x
-        x**y ==
-            y = 0 =>
-                x ^= 0 => 1
-                error "0**0 not defined for cardinal numbers."
-            finite? y =>
-                not finite? x => x
-                [FINord,x.ival**(y.ival):NNI]
-            x = 0 => 0
-            x = 1 => 1
-            GCHypothesis() => [max(x.order-1, y.order) + 1, DUMMYval]
-            error "Transfinite exponentiation only implemented under GCH"
- 
-        finite? x    == x.order = FINord
-        countable? x == x.order < 1
- 
-        retract(x:%):NonNegativeInteger ==
-          finite? x => (x.ival)::NNI
-          error "Not finite"
- 
-        retractIfCan(x:%):Union(NonNegativeInteger, "failed") ==
-          finite? x => (x.ival)::NNI
-          "failed"
- 
-        -- State manipulation
-        generalizedContinuumHypothesisAssumed?() == GCHypothesis()
-        generalizedContinuumHypothesisAssumed b == (GCHypothesis() := b)
-
-@
-\section{License}
-<<license>>=
---Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd.
---All rights reserved.
---
---Redistribution and use in source and binary forms, with or without
---modification, are permitted provided that the following conditions are
---met:
---
---    - Redistributions of source code must retain the above copyright
---      notice, this list of conditions and the following disclaimer.
---
---    - Redistributions in binary form must reproduce the above copyright
---      notice, this list of conditions and the following disclaimer in
---      the documentation and/or other materials provided with the
---      distribution.
---
---    - Neither the name of The Numerical ALgorithms Group Ltd. nor the
---      names of its contributors may be used to endorse or promote products
---      derived from this software without specific prior written permission.
---
---THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
---IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
---TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
---PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
---OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
---EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
---PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
---PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
---LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
---NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
---SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-@
-<<*>>=
-<<license>>
-
-<<domain CARD CardinalNumber>>
-@
-\eject
-\begin{thebibliography}{99}
-\bibitem{1} nothing
-\end{thebibliography}
-\end{document}
diff --git a/src/algebra/clifford.spad.pamphlet b/src/algebra/clifford.spad.pamphlet
deleted file mode 100644
index cd94dd5..0000000
--- a/src/algebra/clifford.spad.pamphlet
+++ /dev/null
@@ -1,1157 +0,0 @@
-\documentclass{article}
-\usepackage{amssymb}
-\usepackage{axiom}
-\begin{document}
-\title{\$SPAD/src/algebra clifford.spad}
-\author{Stephen M. Watt}
-\maketitle
-\begin{abstract}
-\end{abstract}
-\eject
-\tableofcontents
-\eject
-\section{domain QFORM QuadraticForm}
-<<domain QFORM QuadraticForm>>=
-)abbrev domain QFORM QuadraticForm
-++ Author: Stephen M. Watt
-++ Date Created: August 1988
-++ Date Last Updated: May 17, 1991
-++ Basic Operations: quadraticForm, elt
-++ Related Domains: Matrix, SquareMatrix
-++ Also See:
-++ AMS Classifications:
-++ Keywords: quadratic form
-++ Examples:
-++ References:
-++
-++ Description:
-++   This domain provides modest support for quadratic forms.
-QuadraticForm(n, K): T == Impl where
-    n: PositiveInteger
-    K: Field
-    SM ==> SquareMatrix
-    V  ==> DirectProduct
- 
-    T ==> AbelianGroup with
-        quadraticForm: SM(n, K) -> %
-            ++ quadraticForm(m) creates a quadratic form from a symmetric,
-            ++ square matrix m.
-        matrix: % -> SM(n, K)
-            ++ matrix(qf) creates a square matrix from the quadratic form qf.
-        elt: (%, V(n, K)) -> K
-            ++ elt(qf,v) evaluates the quadratic form qf on the vector v, 
-            ++ producing a scalar.
- 
-    Impl ==> SM(n,K) add
-        Rep := SM(n,K)
- 
-        quadraticForm m ==
-            not symmetric? m =>
-                error "quadraticForm requires a symmetric matrix"
-            m::%
-        matrix q == q pretend SM(n,K)
-        elt(q,v) == dot(v, (matrix q * v))
-
-@
-\section{domain CLIF CliffordAlgebra\cite{7,12}}
-\subsection{Vector (linear) spaces}
-This information is originally from Paul Leopardi's presentation on
-the {\sl Introduction to Clifford Algebras} and is included here as
-an outline with his permission. Further details are based on the book
-by Doran and Lasenby called {\sl Geometric Algebra for Physicists}.
-
-Consider the various kinds of products that can occur between vectors.
-There are scalar and vector products from 3D geometry. There are the
-complex and quaterion products. There is also
-the {\sl outer} or {\sl exterior} product.
-
-Vector addition commutes:
-\[a + b = b + a\]
-Vector addtion is associative:
-\[a + (b + c) = (a + b) + c\]
-The identity vector exists:
-\[a + 0 = a\]
-Every vector has an inverse:
-\[a + (-a) = 0\]
-
-If we consider vectors to be directed line segments, thus establishing
-a geometric meaning for a vector, then each of these properties has a
-geometric meaning.
-
-A multiplication operator exists between scalars and vectors with
-the properties:
-\[\lambda(a + b) = \lambda a + \lambda b\]
-\[(\lambda + \mu)a = \lambda a + \mu a\]
-\[(\lambda\mu)a = \lambda(\mu a)\]
-\[{\rm If\ }1\lambda = \lambda{\rm\ for\ all\ scalars\ }\lambda
-{\rm\ then\ }1a=a{\rm\ for\ all\ vectors\ }a\]
-
-These properties completely define a vector (linear) space. The
-$+$ operation for scalar arithmetic is not the same as the $+$
-operation for vectors.
-
-{\bf Definition: Isomorphic} The vector space $A$ is isomorphic to
-the vector space $B$ if their exists a one-to-one correspondence
-between their elements which preserves sums and there is a one-to-one
-correspondence between the scalars which preserves sums and products.
-
-{\bf Definition: Subspace} Vector space $B$ is a subspace of vector
-space $A$ if all of the elements of $B$ are contained in $A$ and
-they share the same scalars.
-
-{\bf Definition: Linear Combination} Given vectors $a_1,\ldots,a_n$
-the vector $b$ is a linear combination of the vectors if we can find
-scalars $\lambda_i$ such that
-\[b = \lambda_1 a_1+\ldots+\lambda_n a_n = \sum_{k=1}^n \lambda_i a_i\]
-
-{\bf Definition: Linearly Independent} If there exists scalars $\lambda_i$
-such that
-\[\lambda_1 a_1 + \ldots + \lambda_n a_n = 0\]
-and at least one of the $\lambda_i$ is not zero
-then the vectors $a_1,\ldots,a_n$ are linearly dependent. If no such
-scalars exist then the vectors are linearly independent.
-
-{\bf Definition: Span} If every vector can be written as a linear
-combination of a fixed set of vectors $a_1,\ldots,a_n$ then this set
-of vectors is said to span the vector space.
-
-{\bf Definition: Basis} If a set of vectors $a_1,\ldots,a_n$ is linearly
-independent and spans a vector space $A$ then the vectors form a basis
-for $A$.
-
-{\bf Definition: Dimension} The dimension of a vector space is the 
-number of basis elements, which is unique since all bases of a 
-vector space have the same number of elements.
-\subsection{Quadratic Forms\cite{1}}
-For vector space $\mathbb{V}$ over field $\mathbb{F}$, characteristic 
-$\ne 2$:
-\begin{list}{}
-\item Map $f:\mathbb{V} \rightarrow \mathbb{F}$, with
-$$f(\lambda x)=\lambda^2f(x),\forall \lambda \in \mathbb{F}, x \in \mathbb{V}$$
-\item $f(x) = b(x,x)$, where
-$$b:\mathbb{V}{\rm\ x\ }\mathbb{V} \rightarrow \mathbb{F}{\rm\ ,given\ by\ }$$
-$$b(x,y):=\frac{1}{2}(f(x+y)-f(x)=f(y))$$
-is a symmetric bilinear form
-\end{list}
-\subsection{Quadratic spaces, Clifford Maps\cite{1,2}}
-\begin{list}{}
-\item A quadratic space is the pair($\mathbb{V}$,$f$), where $f$ is a 
-quadratic form on $\mathbb{V}$
-\item A Clifford map is a vector space homomorphism
-$$\rho : \mathbb{V} \rightarrow \mathbb{A}$$
-where $\mathbb{A}$ is an associated algebra, and
-$$(\rho v)^2 = f(v),{\rm\ \ \ } \forall v \in \mathbb{V}$$
-\end{list}
-\subsection{Universal Clifford algebras\cite{1}}
-\begin{list}{}
-\item The {\sl universal Clifford algebra} $Cl(f)$ for the quadratic space
-$(\mathbb{V},f)$ is the algebra generated by the image of the Clifford
-map $\phi_f$ such that $Cl(f)$ is the universal initial object such
-that $\forall$ suitable algebra $\mathbb{A}$ with Clifford map
-$\phi_{\mathbb{A}} \exists$ a homomorphism
-$$P_\mathbb{A}:Cl(f) \rightarrow \mathbb{A}$$
-$$\rho_\mathbb{A} = P_\mathbb{A}\circ\rho_f$$
-\end{list}
-\subsection{Real Clifford algebras $\mathbb{R}_{p,q}$\cite{2}}
-\begin{list}{}
-\item The real quadratic space $\mathbb{R}^{p,q}$ is $\mathbb{R}^{p+q}$ with
-$$\phi(x):=-\sum_{k:=-q}^{-1}{x_k^2}+\sum_{k=1}^p{x_k^2}$$
-\item For each $p,q \in \mathbb{N}$, the real universal Clifford algebra
-for $\mathbb{R}^{p,q}$ is called $\mathbb{R}_{p,q}$
-\item $\mathbb{R}_{p,q}$ is isomorphic to some matrix algebra over one of:
-$\mathbb{R}$,$\mathbb{R}\oplus\mathbb{R}$,$\mathbb{C}$,
-$\mathbb{H}$,$\mathbb{H}\oplus\mathbb{H}$ 
-\item For example, $\mathbb{R}_{1,1} \cong \mathbb{R}(2)$ 
-\end{list}
-\subsection{Notation for integer sets}
-\begin{list}{}
-\item For $S \subseteq \mathbb{Z}$, define
-$$\sum_{k \in S}{f_k}:=\sum_{k={\rm min\ }S, k \in S}^{{\rm max\ } S}{f_k}$$
-$$\prod_{k \in S}{f_k}:=\prod_{k={\rm min\ }S, k \in S}^{{\rm max\ } S}{f_k}$$
-$$\mathbb{P}(S):={\rm\ the\ }\ power\ set\ {\rm\ of\ }S$$
-\item For $m \le n \in \mathbb{Z}$, define
-$$\zeta(m,n):=\{m,m+1,\ldots,n-1,n\}\backslash\{0\}$$
-\end{list}
-\subsection{Frames for Clifford algebras\cite{9,10,11}}
-\begin{list}{}
-\item A {\sl frame} is an ordered basis $(\gamma_{-q},\ldots,\gamma_p)$
-for $\mathbb{R}^{p,q}$ which puts a quadratic form into the canonical
-form $\phi$
-\item For $p,q \in \mathbb{N}$, embed the frame for $\mathbb{R}^{p,q}$
-into $\mathbb{R}_{p,q}$ via the maps
-$$\gamma:\zeta(-q,p) \rightarrow \mathbb{R}^{p,q}$$
-$$\rho:\mathbb{R}^{p,q} \rightarrow \mathbb{R}_{p,q}$$
-$$(\rho\gamma k)^2 = \phi\gamma k = {\rm\ sgn\ }k$$
-\end{list}
-\subsection{Real frame groups\cite{5,6}}
-\begin{list}{}
-\item For $p,q \in \mathbb{N}$, define the real {\sl frame group} $\mathbb{G}_{p,q}$
-via the map
-$$g:\zeta(-q,p) \rightarrow \mathbb{G}_{p,q}$$
-with generators and relations
-$$\langle \mu,g_k | \mu g_k = g_k \mu,{\rm\ \ \ }\mu^2 = 1,$$
-$$(g_k)^2 = 
-\left\{
-\begin{array}{lcc}
-\mu,&{\rm\ \ }&{\rm\ if\ }k < 0\\
-1&{\rm\ \ }&{\rm\ if\ }k > 0
-\end{array}
-\right.$$
-$$g_kg_m = \mu g_mg_k{\rm\ \ \ }\forall k \ne m\rangle$$
-\end{list}
-\subsection{Canonical products\cite{1,3,4}}
-\begin{list}{}
-\item The real frame group $\mathbb{G}_{p,q}$ has order $2^{p+q+1}$
-\item Each member $w$ can be expressed as the canonically ordered product
-$$w=\mu^a\prod_{k \in T}{g_k}$$
-$$\ =\mu^a\prod_{k=-q,k\ne0}^p{g_k^{b_k}}$$
-where $T \subseteq \zeta(-q,p),a,b_k \in \{0,1\}$
-\end{list}
-\subsection{Clifford algebra of frame group\cite{1,4,5,6}}
-\begin{list}{}
-\item For $p,q \in \mathbb{N}$ embed $\mathbb{G}_{p,q}$ into 
-$\mathbb{R}_{p,q}$ via the map
-$$\alpha  \mathbb{G}_{p,q} \rightarrow \mathbb{R}_{p,q}$$
-$$\alpha 1 := 1,{\rm\ \ \ \ \ } \alpha\mu := -1$$
-$$\alpha g_k := \rho\gamma_k, {\rm \ \ \ \ \ }
-\alpha(gh) := (\alpha g)(\alpha h)$$
-\item Define {\sl basis elements} via the map
-$$e:\mathbb{P}\zeta(-q,p) \rightarrow \mathbb{R}_{p,q}, 
-{\rm \ \ \ \ \ }e_T := \alpha \prod_{k \in T}{g_k}$$
-\item Each $a \in \mathbb{R}_{p,q}$ can be expressed as
-$$a = \sum_{T \subseteq \zeta(-q,p)}{a_T e_T}$$
-\end{list} 
-\subsection{Neutral matrix representations\cite{1,2,8}}
-The {\sl representation map} $P_m$ and {\sl representation matrix} $R_m$
-make the following diagram commute:
-\begin{tabular}{ccc}
-               &   coord   &           \\
-$\mathbb{R}_{m,m}$      & --------$>$ & $\mathbb{R}^{4^m}$ \\
-    $|$          &           &    $|$      \\
-    $|$          &           &    $|$      \\
-  $P_m$        &           &  $R_m$    \\ 
-    $|$          &           &    $|$      \\
-    $|$          &           &    $|$      \\
-    V          &           &    V      \\
- $\mathbb{R}(2^m)$      & --------$>$ &  $\mathbb{R}^{4^m}$\\
-               &  reshape  &           \\
-\end{tabular}
-<<CliffordAlgebra.input>>=
--- clifford.spad.pamphlet CliffordAlgebra.input
-)spool CliffordAlgebra.output
-)set message test on
-)set message auto off
-)clear all
---S 1 of 36
-K := Fraction Polynomial Integer
---R 
---R
---R   (1)  Fraction Polynomial Integer
---R                                                                 Type: Domain
---E 1
-
---S 2 of 36
-m := matrix [ [-1] ]
---R 
---R
---R   (2)  [- 1]
---R                                                         Type: Matrix Integer
---E 2
-
---S 3 of 36
-C := CliffordAlgebra(1, K, quadraticForm m)
---R 
---R
---R   (3)  CliffordAlgebra(1,Fraction Polynomial Integer,MATRIX)
---R                                                                 Type: Domain
---E 3
-
---S 4 of 36
-i: C := e(1)
---R 
---R
---R   (4)  e
---R         1
---R                  Type: CliffordAlgebra(1,Fraction Polynomial Integer,MATRIX)
---E 4
-
---S 5 of 36
-x := a + b * i
---R 
---R
---R   (5)  a + b e
---R               1
---R                  Type: CliffordAlgebra(1,Fraction Polynomial Integer,MATRIX)
---E 5
-
---S 6 of 36
-y := c + d * i
---R 
---R
---R   (6)  c + d e
---R               1
---R                  Type: CliffordAlgebra(1,Fraction Polynomial Integer,MATRIX)
---E 6
-
---S 7 of 36
-x * y
---R 
---R
---R   (7)  - b d + a c + (a d + b c)e
---R                                  1
---R                  Type: CliffordAlgebra(1,Fraction Polynomial Integer,MATRIX)
---E 7
-)clear all
- 
---S 8 of 36
-K := Fraction Polynomial Integer
---R 
---R
---R   (1)  Fraction Polynomial Integer
---R                                                                 Type: Domain
---E 8
-
---S 9 of 36
-m := matrix [ [-1,0],[0,-1] ]
---R 
---R
---R        +- 1   0 +
---R   (2)  |        |
---R        + 0   - 1+
---R                                                         Type: Matrix Integer
---E 9
-
---S 10 of 36
-H  := CliffordAlgebra(2, K, quadraticForm m)
---R 
---R
---R   (3)  CliffordAlgebra(2,Fraction Polynomial Integer,MATRIX)
---R                                                                 Type: Domain
---E 10
-
---S 11 of 36
-i: H  := e(1)
---R 
---R
---R   (4)  e
---R         1
---R                  Type: CliffordAlgebra(2,Fraction Polynomial Integer,MATRIX)
---E 11
-
---S 12 of 36
-j: H  := e(2)
---R 
---R
---R   (5)  e
---R         2
---R                  Type: CliffordAlgebra(2,Fraction Polynomial Integer,MATRIX)
---E 12
-
---S 13 of 36
-k: H  := i * j
---R 
---R
---R   (6)  e e
---R         1 2
---R                  Type: CliffordAlgebra(2,Fraction Polynomial Integer,MATRIX)
---E 13
-
---S 14 of 36
-x := a + b * i + c * j + d * k
---R 
---R
---R   (7)  a + b e  + c e  + d e e
---R               1      2      1 2
---R                  Type: CliffordAlgebra(2,Fraction Polynomial Integer,MATRIX)
---E 14
-
---S 15 of 36
-y := e + f * i + g * j + h * k 
---R 
---R
---R   (8)  e + f e  + g e  + h e e
---R               1      2      1 2
---R                  Type: CliffordAlgebra(2,Fraction Polynomial Integer,MATRIX)
---E 15
-
---S 16 of 36
-x + y
---R 
---R
---R   (9)  e + a + (f + b)e  + (g + c)e  + (h + d)e e
---R                        1           2           1 2
---R                  Type: CliffordAlgebra(2,Fraction Polynomial Integer,MATRIX)
---E 16
-
---S 17 of 36
-x * y
---R 
---R
---R   (10)
---R     - d h - c g - b f + a e + (c h - d g + a f + b e)e
---R                                                       1
---R   + 
---R     (- b h + a g + d f + c e)e  + (a h + b g - c f + d e)e e
---R                               2                           1 2
---R                  Type: CliffordAlgebra(2,Fraction Polynomial Integer,MATRIX)
---E 17
-
---S 18 of 36
-y * x
---R 
---R
---R   (11)
---R     - d h - c g - b f + a e + (- c h + d g + a f + b e)e
---R                                                         1
---R   + 
---R     (b h + a g - d f + c e)e  + (a h - b g + c f + d e)e e
---R                             2                           1 2
---R                  Type: CliffordAlgebra(2,Fraction Polynomial Integer,MATRIX)
---E 18
-)clear all
- 
---S 19 of 36
-K := Fraction Polynomial Integer
---R 
---R
---R   (1)  Fraction Polynomial Integer
---R                                                                 Type: Domain
---E 19
-
---S 20 of 36
-Ext := CliffordAlgebra(3, K, quadraticForm 0)
---R 
---R
---R   (2)  CliffordAlgebra(3,Fraction Polynomial Integer,MATRIX)
---R                                                                 Type: Domain
---E 20
-
---S 21 of 36
-i: Ext := e(1)
---R 
---R
---R   (3)  e
---R         1
---R                  Type: CliffordAlgebra(3,Fraction Polynomial Integer,MATRIX)
---E 21
-
---S 22 of 36
-j: Ext := e(2)
---R 
---R
---R   (4)  e
---R         2
---R                  Type: CliffordAlgebra(3,Fraction Polynomial Integer,MATRIX)
---E 22
-
---S 23 of 36
-k: Ext := e(3)
---R 
---R
---R   (5)  e
---R         3
---R                  Type: CliffordAlgebra(3,Fraction Polynomial Integer,MATRIX)
---E 23
-
---S 24 of 36
-x := x1*i + x2*j + x3*k
---R 
---R
---R   (6)  x1 e  + x2 e  + x3 e
---R            1       2       3
---R                  Type: CliffordAlgebra(3,Fraction Polynomial Integer,MATRIX)
---E 24
-
---S 25 of 36
-y := y1*i + y2*j + y3*k
---R 
---R
---R   (7)  y1 e  + y2 e  + y3 e
---R            1       2       3
---R                  Type: CliffordAlgebra(3,Fraction Polynomial Integer,MATRIX)
---E 25
-
---S 26 of 36
-x + y
---R 
---R
---R   (8)  (y1 + x1)e  + (y2 + x2)e  + (y3 + x3)e
---R                  1             2             3
---R                  Type: CliffordAlgebra(3,Fraction Polynomial Integer,MATRIX)
---E 26
-
---S 27 of 36
-x * y + y * x
---R 
---R
---R   (9)  0
---R                  Type: CliffordAlgebra(3,Fraction Polynomial Integer,MATRIX)
---E 27
-
---S 28 of 36
-dual2 a == coefficient(a,[2,3]) * i + coefficient(a,[3,1]) * j + coefficient(a,[1,2]) * k 
---R 
---R                                                                   Type: Void
---E 28
-
---S 29 of 36
-dual2(x*y)
---R 
---R   Compiling function dual2 with type CliffordAlgebra(3,Fraction 
---R      Polynomial Integer,MATRIX) -> CliffordAlgebra(3,Fraction 
---R      Polynomial Integer,MATRIX) 
---R
---R   (11)  (x2 y3 - x3 y2)e  + (- x1 y3 + x3 y1)e  + (x1 y2 - x2 y1)e
---R                         1                     2                   3
---R                  Type: CliffordAlgebra(3,Fraction Polynomial Integer,MATRIX)
---E 29
-)clear all
- 
---S 30 of 36
-K := Fraction Integer
---R 
---R
---R   (1)  Fraction Integer
---R                                                                 Type: Domain
---E 30
-
---S 31 of 36
-g := matrix [ [1,0,0,0], [0,-1,0,0], [0,0,-1,0], [0,0,0,-1] ]
---R 
---R
---R        +1   0    0    0 +
---R        |                |
---R        |0  - 1   0    0 |
---R   (2)  |                |
---R        |0   0   - 1   0 |
---R        |                |
---R        +0   0    0   - 1+
---R                                                         Type: Matrix Integer
---E 31
-
---S 32 of 36
-D := CliffordAlgebra(4,K, quadraticForm g)
---R 
---R
---R   (3)  CliffordAlgebra(4,Fraction Integer,MATRIX)
---R                                                                 Type: Domain
---E 32
-
---S 33 of 36
-gam := [e(i)$D for i in 1..4]
---R 
---R
---R   (4)  [e ,e ,e ,e ]
---R          1  2  3  4
---R                        Type: List CliffordAlgebra(4,Fraction Integer,MATRIX)
---E 33
-
---S 34 of 36
-m := 1; n:= 2; r := 3; s := 4;
---R 
---R
---R                                                        Type: PositiveInteger
---E 34
-
---S 35 of 36
-lhs := reduce(+, [reduce(+, [ g(l,t)*gam(l)*gam(m)*gam(n)*gam(r)*gam(s)*gam(t) for l in 1..4]) for t in 1..4])
---R 
---R
---R   (6)  - 4e e e e
---R            1 2 3 4
---R                             Type: CliffordAlgebra(4,Fraction Integer,MATRIX)
---E 35
-
---S 36 of 36
-rhs := 2*(gam s * gam m*gam n*gam r + gam r*gam n*gam m*gam s) 
---R 
---R
---R   (7)  - 4e e e e
---R            1 2 3 4
---R                             Type: CliffordAlgebra(4,Fraction Integer,MATRIX)
---E 36
-)spool
-)lisp (bye)
-@
-<<CliffordAlgebra.help>>=
-====================================================================
-CliffordAlgebra examples
-====================================================================
-
-CliffordAlgebra(n,K,Q) defines a vector space of dimension 2^n over
-the field K with a given quadratic form Q.  If {e1..en} is a basis for
-K^n then
-
-
-{ 1,
-  e(i)         1 <= i <= n,
-  e(i1)*e(i2)  1 <= i1 < i2 <=n,
-  ...,
-  e(1)*e(2)*...*e(n) }
-
-is a basis for the Clifford algebra. The algebra is defined by the relations
-
-  e(i)*e(i) = Q(e(i))
-  e(i)*e(j) = -e(j)*e(i),  for i ^= j
-
-Examples of Clifford Algebras are gaussians (complex numbers),
-quaternions, exterior algebras and spin algebras.
-
-====================================================================
-The Complex Numbers as a Clifford Algebra
-====================================================================
-
-This is the field over which we will work, rational functions with
-integer coefficients.
-
-  K := Fraction Polynomial Integer
-   Fraction Polynomial Integer
-                         Type: Domain
-
-We use this matrix for the quadratic form.
-
-  m := matrix [ [-1] ]
-   [- 1]
-                         Type: Matrix Integer
-
-We get complex arithmetic by using this domain.
-
-  C := CliffordAlgebra(1, K, quadraticForm m)
-   CliffordAlgebra(1,Fraction Polynomial Integer,MATRIX)
-                         Type: Domain
-
-Here is i, the usual square root of -1.
-
-  i: C := e(1)
-   e
-    1
-               Type: CliffordAlgebra(1,Fraction Polynomial Integer,MATRIX)
-
-Here are some examples of the arithmetic.
-
-  x := a + b * i
-   a + b e
-          1
-               Type: CliffordAlgebra(1,Fraction Polynomial Integer,MATRIX)
-
-  y := c + d * i
-   c + d e
-          1
-               Type: CliffordAlgebra(1,Fraction Polynomial Integer,MATRIX)
-
-  x * y
-   - b d + a c + (a d + b c)e
-                             1
-               Type: CliffordAlgebra(1,Fraction Polynomial Integer,MATRIX)
-
-====================================================================
-The Quaternion Numbers as a Clifford Algebra
-====================================================================
-
-This is the field over which we will work, rational functions with
-integer coefficients.
-
-  K := Fraction Polynomial Integer
-   Fraction Polynomial Integer
-                      Type: Domain
-
-We use this matrix for the quadratic form.
-
-  m := matrix [ [-1,0],[0,-1] ]
-   +- 1   0 +
-   |        |
-   + 0   - 1+
-                      Type: Matrix Integer
-
-The resulting domain is the quaternions.
-
-  H  := CliffordAlgebra(2, K, quadraticForm m)
-   CliffordAlgebra(2,Fraction Polynomial Integer,MATRIX)
-                      Type: Domain
-
-We use Hamilton's notation for i, j, k.
-
-  i: H  := e(1)
-   e
-    1
-              Type: CliffordAlgebra(2,Fraction Polynomial Integer,MATRIX)
-
-  j: H  := e(2)
-   e
-    2
-              Type: CliffordAlgebra(2,Fraction Polynomial Integer,MATRIX)
-
-  k: H  := i * j
-   e e
-    1 2
-              Type: CliffordAlgebra(2,Fraction Polynomial Integer,MATRIX)
-
-  x := a + b * i + c * j + d * k
-   a + b e  + c e  + d e e
-          1      2      1 2
-              Type: CliffordAlgebra(2,Fraction Polynomial Integer,MATRIX)
-
-  y := e + f * i + g * j + h * k 
-   e + f e  + g e  + h e e
-          1      2      1 2
-              Type: CliffordAlgebra(2,Fraction Polynomial Integer,MATRIX)
-
-  x + y
-   e + a + (f + b)e  + (g + c)e  + (h + d)e e
-                   1           2           1 2
-              Type: CliffordAlgebra(2,Fraction Polynomial Integer,MATRIX)
-
-  x * y
-   - d h - c g - b f + a e + (c h - d g + a f + b e)e
-                                                     1
-   + 
-     (- b h + a g + d f + c e)e  + (a h + b g - c f + d e)e e
-                               2                           1 2
-              Type: CliffordAlgebra(2,Fraction Polynomial Integer,MATRIX)
-
-  y * x
-   - d h - c g - b f + a e + (- c h + d g + a f + b e)e
-                                                       1
-   + 
-     (b h + a g - d f + c e)e  + (a h - b g + c f + d e)e e
-                             2                           1 2
-                  Type: CliffordAlgebra(2,Fraction Polynomial Integer,MATRIX)
-
-====================================================================
-The Exterior Algebra on a Three Space
-====================================================================
-
-This is the field over which we will work, rational functions with
-integer coefficients.
-
-  K := Fraction Polynomial Integer
-   Fraction Polynomial Integer
-                  Type: Domain
-
-If we chose the three by three zero quadratic form, we obtain
-the exterior algebra on e(1),e(2),e(3).
-
-  Ext := CliffordAlgebra(3, K, quadraticForm 0)
-   CliffordAlgebra(3,Fraction Polynomial Integer,MATRIX)
-                  Type: Domain
-
-This is a three dimensional vector algebra.  We define i, j, k as the
-unit vectors.
-
-  i: Ext := e(1)
-   e
-    1
-             Type: CliffordAlgebra(3,Fraction Polynomial Integer,MATRIX)
-
-  j: Ext := e(2)
-   e
-    2
-             Type: CliffordAlgebra(3,Fraction Polynomial Integer,MATRIX)
-
-  k: Ext := e(3)
-   e
-    3
-             Type: CliffordAlgebra(3,Fraction Polynomial Integer,MATRIX)
-
-Now it is possible to do arithmetic.
-
-  x := x1*i + x2*j + x3*k
-   x1 e  + x2 e  + x3 e
-       1       2       3
-             Type: CliffordAlgebra(3,Fraction Polynomial Integer,MATRIX)
-
-  y := y1*i + y2*j + y3*k
-   y1 e  + y2 e  + y3 e
-       1       2       3
-             Type: CliffordAlgebra(3,Fraction Polynomial Integer,MATRIX)
-
-  x + y
-   (y1 + x1)e  + (y2 + x2)e  + (y3 + x3)e
-             1             2             3
-             Type: CliffordAlgebra(3,Fraction Polynomial Integer,MATRIX)
-
-  x * y + y * x
-   0
-             Type: CliffordAlgebra(3,Fraction Polynomial Integer,MATRIX)
-
-On an n space, a grade p form has a dual n-p form.  In particular, in
-three space the dual of a grade two element identifies 
- 
-  e1*e2 -> e3, e2*e3 -> e1, e3*e1 -> e2.
-
-  dual2 a == coefficient(a,[2,3]) * i + coefficient(a,[3,1]) * j + coefficient(a,[1,2]) * k 
-                      Type: Void
-
-The vector cross product is then given by this.
-
-  dual2(x*y)
-   (x2 y3 - x3 y2)e  + (- x1 y3 + x3 y1)e  + (x1 y2 - x2 y1)e
-                   1                     2                   3
-           Type: CliffordAlgebra(3,Fraction Polynomial Integer,MATRIX)
-
-====================================================================
-The Dirac Spin Algebra
-====================================================================
-
-In this section we will work over the field of rational numbers.
-
-  K := Fraction Integer
-   Fraction Integer
-                       Type: Domain
-
-We define the quadratic form to be the Minkowski space-time metric.
-
-  g := matrix [ [1,0,0,0], [0,-1,0,0], [0,0,-1,0], [0,0,0,-1] ]
-   +1   0    0    0 +
-   |                |
-   |0  - 1   0    0 |
-   |                |
-   |0   0   - 1   0 |
-   |                |
-   +0   0    0   - 1+
-                       Type: Matrix Integer
-
-We obtain the Dirac spin algebra used in Relativistic Quantum Field Theory.
-
-  D := CliffordAlgebra(4,K, quadraticForm g)
-   CliffordAlgebra(4,Fraction Integer,MATRIX)
-                       Type: Domain
-
-The usual notation for the basis is gamma with a superscript.  For
-Axiom input we will use gam(i):
-
-  gam := [e(i)$D for i in 1..4]
-   [e ,e ,e ,e ]
-     1  2  3  4
-                 Type: List CliffordAlgebra(4,Fraction Integer,MATRIX)
-
-There are various contraction identities of the form
-
-  g(l,t)*gam(l)*gam(m)*gam(n)*gam(r)*gam(s)*gam(t) =
-      2*(gam(s)gam(m)gam(n)gam(r) + gam(r)*gam(n)*gam(m)*gam(s))
-
-where a sum over l and t is implied.
-
-Verify this identity for particular values of m,n,r,s.
-
-  m := 1; n:= 2; r := 3; s := 4;
-                      Type: PositiveInteger
-
-  lhs := reduce(+, [reduce(+, [ g(l,t)*gam(l)*gam(m)*gam(n)*gam(r)*gam(s)*gam(t) for l in 1..4]) for t in 1..4])
-   - 4e e e e
-       1 2 3 4
-                      Type: CliffordAlgebra(4,Fraction Integer,MATRIX)
-
-  rhs := 2*(gam s * gam m*gam n*gam r + gam r*gam n*gam m*gam s) 
-   - 4e e e e
-       1 2 3 4
-                      Type: CliffordAlgebra(4,Fraction Integer,MATRIX)
-
-See Also:
-o )help Complex
-o )help Quaternion
-o )show CliffordAlgebra
-o $AXIOM/doc/src/algebra/clifford.spad
-
-@
-<<domain CLIF CliffordAlgebra>>=
-)abbrev domain CLIF CliffordAlgebra
-++ Author: Stephen M. Watt
-++ Date Created: August 1988
-++ Date Last Updated: May 17, 1991
-++ Basic Operations: wholeRadix, fractRadix, wholeRagits, fractRagits
-++ Related Domains: QuadraticForm, Quaternion, Complex
-++ Also See:
-++ AMS Classifications:
-++ Keywords: clifford algebra, grassman algebra, spin algebra
-++ Examples:
-++ References:
-++
-++ Description:
-++  CliffordAlgebra(n, K, Q) defines a vector space of dimension \spad{2**n}
-++  over K, given a quadratic form Q on \spad{K**n}.
-++
-++  If \spad{e[i]}, \spad{1<=i<=n} is a basis for \spad{K**n} then
-++     1, \spad{e[i]} (\spad{1<=i<=n}), \spad{e[i1]*e[i2]} 
-++  (\spad{1<=i1<i2<=n}),...,\spad{e[1]*e[2]*..*e[n]}
-++  is a basis for the Clifford Algebra.
-++
-++  The algebra is defined by the relations
-++     \spad{e[i]*e[j] = -e[j]*e[i]}  (\spad{i \~~= j}),
-++     \spad{e[i]*e[i] = Q(e[i])}
-++
-++  Examples of Clifford Algebras are: gaussians, quaternions, exterior 
-++  algebras and spin algebras.
- 
-CliffordAlgebra(n, K, Q): T == Impl where
-    n: PositiveInteger
-    K: Field
-    Q: QuadraticForm(n, K)
- 
-    PI ==> PositiveInteger
-    NNI==> NonNegativeInteger
- 
-    T ==> Join(Ring, Algebra(K), VectorSpace(K)) with
-        e: PI -> %
-          ++ e(n) produces the appropriate unit element.
-        monomial: (K, List PI) -> %
-          ++ monomial(c,[i1,i2,...,iN]) produces the value given by
-          ++ \spad{c*e(i1)*e(i2)*...*e(iN)}.
-        coefficient:  (%, List PI) -> K
-          ++ coefficient(x,[i1,i2,...,iN])  extracts the coefficient of
-          ++ \spad{e(i1)*e(i2)*...*e(iN)} in x.
-        recip: % -> Union(%, "failed")
-          ++ recip(x) computes the multiplicative inverse of x or "failed"
-          ++ if x is not invertible.
- 
-    Impl ==> add
-        Qeelist :=  [Q unitVector(i::PositiveInteger) for i in 1..n]
-        dim     :=  2**n
- 
-        Rep     := PrimitiveArray K
- 
-        New     ==> new(dim, 0$K)$Rep
- 
-        x, y, z: %
-        c: K
-        m: Integer
- 
-        characteristic() == characteristic()$K
-        dimension()      == dim::CardinalNumber
- 
-        x = y ==
-            for i in 0..dim-1 repeat
-                if x.i ^= y.i then return false
-            true
- 
-        x + y == (z := New; for i in 0..dim-1 repeat z.i := x.i + y.i; z)
-        x - y == (z := New; for i in 0..dim-1 repeat z.i := x.i - y.i; z)
-        - x   == (z := New; for i in 0..dim-1 repeat z.i := - x.i; z)
-        m * x == (z := New; for i in 0..dim-1 repeat z.i := m*x.i; z)
-        c * x == (z := New; for i in 0..dim-1 repeat z.i := c*x.i; z)
- 
-        0            == New
-        1            == (z := New; z.0 := 1; z)
-        coerce(m): % == (z := New; z.0 := m::K; z)
-        coerce(c): % == (z := New; z.0 := c; z)
- 
-        e b ==
-            b::NNI > n => error "No such basis element"
-            iz := 2**((b-1)::NNI)
-            z := New; z.iz := 1; z
- 
-        -- The ei*ej products could instead be precomputed in
-        -- a (2**n)**2 multiplication table.
-        addMonomProd(c1: K, b1: NNI, c2: K, b2: NNI, z: %): % ==
-            c  := c1 * c2
-            bz := b2
-            for i in 0..n-1 | bit?(b1,i) repeat
-                -- Apply rule  ei*ej = -ej*ei for i^=j
-                k := 0
-                for j in i+1..n-1 | bit?(b1, j) repeat k := k+1
-                for j in 0..i-1   | bit?(bz, j) repeat k := k+1
-                if odd? k then c := -c
-                -- Apply rule  ei**2 = Q(ei)
-                if bit?(bz,i) then
-                    c := c * Qeelist.(i+1)
-                    bz:= (bz - 2**i)::NNI
-                else
-                    bz:= bz + 2**i
-            z.bz := z.bz + c
-            z
- 
-        x * y ==
-            z := New
-            for ix in 0..dim-1 repeat
-                if x.ix ^= 0 then for iy in 0..dim-1 repeat
-                    if y.iy ^= 0 then addMonomProd(x.ix,ix,y.iy,iy,z)
-            z
- 
-        canonMonom(c: K, lb: List PI): Record(coef: K, basel: NNI) ==
-            -- 0. Check input
-            for b in lb repeat b > n => error "No such basis element"
- 
-            -- 1. Apply identity ei*ej = -ej*ei, i^=j.
-            -- The Rep assumes n is small so bubble sort is ok.
-            -- Using bubble sort keeps the exchange info obvious.
-            wasordered   := false
-            exchanges := 0
-            while not wasordered repeat
-                wasordered := true
-                for i in 1..#lb-1 repeat
-                    if lb.i > lb.(i+1) then
-                        t := lb.i; lb.i := lb.(i+1); lb.(i+1) := t
-                        exchanges := exchanges + 1
-                        wasordered := false
-            if odd? exchanges then c := -c
- 
-            -- 2. Prepare the basis element
-            -- Apply identity ei*ei = Q(ei).
-            bz := 0
-            for b in lb repeat
-                bn := (b-1)::NNI
-                if bit?(bz, bn) then
-                    c := c * Qeelist bn
-                    bz:= ( bz - 2**bn )::NNI
-                else
-                    bz:= bz + 2**bn
-            [c, bz::NNI]
- 
-        monomial(c, lb) ==
-            r := canonMonom(c, lb)
-            z := New
-            z r.basel := r.coef
-            z
-        coefficient(z, lb) ==
-            r := canonMonom(1, lb)
-            r.coef = 0 => error "Cannot take coef of 0"
-            z r.basel/r.coef
- 
-        Ex ==> OutputForm
- 
-        coerceMonom(c: K, b: NNI): Ex ==
-            b = 0 => c::Ex
-            ml := [sub("e"::Ex, i::Ex) for i in 1..n | bit?(b,i-1)]
-            be := reduce("*", ml)
-            c = 1 => be
-            c::Ex * be
-        coerce(x): Ex ==
-            tl := [coerceMonom(x.i,i) for i in 0..dim-1 | x.i^=0]
-            null tl => "0"::Ex
-            reduce("+", tl)
-
-
-	localPowerSets(j:NNI): List(List(PI)) ==
-	  l: List List PI := list []
-	  j = 0 => l
-	  Sm := localPowerSets((j-1)::NNI)
-          Sn: List List PI := []
-	  for x in Sm repeat Sn := cons(cons(j pretend PI, x),Sn)
-	  append(Sn, Sm)
-
-	powerSets(j:NNI):List List PI == map(reverse, localPowerSets j)
-
-	Pn:List List PI := powerSets(n)
-
-	recip(x: %): Union(%, "failed") ==
-	  one:% := 1
-	  -- tmp:c := x*yC - 1$C
-	  rhsEqs : List K := []
-	  lhsEqs: List List K := []
-	  lhsEqi: List K
-	  for pi in Pn repeat
-	    rhsEqs := cons(coefficient(one, pi), rhsEqs)
-
-	    lhsEqi := []
-	    for pj in Pn repeat
-		lhsEqi := cons(coefficient(x*monomial(1,pj),pi),lhsEqi)
-	    lhsEqs := cons(reverse(lhsEqi),lhsEqs)
-	  ans := particularSolution(matrix(lhsEqs),
-            vector(rhsEqs))$LinearSystemMatrixPackage(K, Vector K, Vector K, Matrix K)
-          ans case "failed" => "failed"
-	  ansP := parts(ans)
-	  ansC:% := 0
-	  for pj in Pn repeat
-	    cj:= first ansP
-	    ansP := rest ansP
-	    ansC := ansC + cj*monomial(1,pj)
-	  ansC
-
-@
-\section{License}
-<<license>>=
---Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd.
---All rights reserved.
---
---Redistribution and use in source and binary forms, with or without
---modification, are permitted provided that the following conditions are
---met:
---
---    - Redistributions of source code must retain the above copyright
---      notice, this list of conditions and the following disclaimer.
---
---    - Redistributions in binary form must reproduce the above copyright
---      notice, this list of conditions and the following disclaimer in
---      the documentation and/or other materials provided with the
---      distribution.
---
---    - Neither the name of The Numerical ALgorithms Group Ltd. nor the
---      names of its contributors may be used to endorse or promote products
---      derived from this software without specific prior written permission.
---
---THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
---IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
---TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
---PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
---OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
---EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
---PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
---PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
---LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
---NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
---SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-@
-<<*>>=
-<<license>>
-
-<<domain QFORM QuadraticForm>> 
-<<domain CLIF CliffordAlgebra>>
-@
-\eject
-\begin{thebibliography}{99}
-\bibitem{1} Lounesto, P.
-"Clifford algebras and spinors",
-2nd edition, Cambridge University Press (2001)
-\bibitem{2} Porteous, I.,
-"Clifford algebras and the classical groups",
-Cambridge University Press (1995)
-Van Nostrand Reinhold, (1969)
-\bibitem{3} Bergdolt, G.
-"Orthonormal basis sets in Clifford algebras",
-in \cite{16} (1996)
-\bibitem{4} Dorst, Leo, 
-"Honing geometric algebra for its use in the computer sciences",
-pp127-152 from \cite{15} (2001)
-\bibitem{5} Braden, H.W., 
-"N-dimensional spinors: Their properties in terms of finite groups",
-American Institute of Physics,
-J. Math. Phys. 26(4), April 1985
-\bibitem{6} Lam, T.Y. and Smith, Tara L.,
-"On the Clifford-Littlewood-Eckmann groups: a new look at periodicity mod 8",
-Rocky Mountains Journal of Mathematics, vol 19, no. 3, (Summer 1989)
-\bibitem{7} Leopardi, Paul "Quick Introduction to Clifford Algebras"\\
-{\bf http://web.maths.unsw.edu.au/~leopardi/clifford-2003-06-05.pdf}
-\bibitem{8} Cartan, Elie and Study, Eduard
-"Nombres Complexes",
-Encyclopaedia Sciences Math\'ematique, \'edition fran\c caise, 15, (1908),
-d'apr\`es l'article allemand de Eduard Study, pp329-468. Reproduced as
-pp107-246 of \cite{17} 
-\bibitem{9} Hestenes, David and Sobczyck, Garret
-"Clifford algebra to geometric calculus: a unified language for 
-mathematics and physics", D. Reidel, (1984)
-\bibitem{10} Wene, G.P.,
-"The Idempotent structure of an infinite dimensional Clifford algebra",
-pp161-164 of \cite{13} (1995)
-\bibitem{11} Ashdown, M. 
-"GA Package for Maple V",\\
-http://www.mrao.cam.ac.uk/~clifford/software/GA/GAhelp5.html
-\bibitem{12} Doran, Chris and Lasenby, Anthony, 
-"Geometric Algebra for Physicists" 
-Cambridge University Press (2003) ISBN 0-521-48022-1
-\bibitem{13} Micali, A., Boudet, R., Helmstetter, J. (eds),
-"Clifford algebras and their applications in mathematical physics:
-proceedings of second workshop held at Montpellier, France, 1989",
-Kluwer Academic Publishers (1992)
-\bibitem{14} Porteous, I.,
-"Topological geometry"
-Van Nostrand Reinhold, (1969)
-\bibitem{15} Sommer, G. (editor),
-"Geometric Computing with Clifford Algebras",
-Springer, (2001)
-\bibitem{16} Ablamowicz, R., Lounesto, P., Parra, J.M. (eds)
-"Clifford algebras with numeric and symbolic computations",
-Birkh\"auser (1996)
-\bibitem{17} Cartan, Elie and Montel, P. (eds), 
-"\OE uvres Compl\`etes" Gauthier-Villars, (1953)
-\end{thebibliography}
-\end{document}
diff --git a/src/algebra/color.spad.pamphlet b/src/algebra/color.spad.pamphlet
deleted file mode 100644
index 56801bf..0000000
--- a/src/algebra/color.spad.pamphlet
+++ /dev/null
@@ -1,202 +0,0 @@
-\documentclass{article}
-\usepackage{axiom}
-\begin{document}
-\title{\$SPAD/src/algebra color.spad}
-\author{Jim Wen}
-\maketitle
-\begin{abstract}
-\end{abstract}
-\eject
-\tableofcontents
-\eject
-\section{domain COLOR Color}
-<<domain COLOR Color>>=
-)abbrev domain COLOR Color
-++ Author: Jim Wen
-++ Date Created: 10 May 1989
-++ Date Last Updated: 19 Mar 1991 by Jon Steinbach
-++ Basic Operations: red, yellow, green, blue, hue, numberOfHues, color, +, *, =
-++ Related Constructors:
-++ Also See:
-++ AMS Classifications:
-++ Keywords: 
-++ References:
-++ Description: Color() specifies a domain of 27 colors provided in the 
-++ \Language{} system (the colors mix additively).
- 
-
-Color(): Exports == Implementation where
-  I      ==> Integer
-  PI     ==> PositiveInteger
-  SF     ==> DoubleFloat
- 
-  Exports ==> AbelianSemiGroup with
-    "*"    : (PI, %) -> %
-      ++ s * c, returns the color c, whose weighted shade has been scaled by s.
-    "*"    : (SF, %) -> %
-      ++ s * c, returns the color c, whose weighted shade has been scaled by s.
-    "+"    : (%, %) -> %
-      ++ c1 + c2 additively mixes the two colors c1 and c2.
-    red    : ()      -> %
-      ++ red() returns the position of the red hue from total hues.
-    yellow : ()      -> %
-      ++ yellow() returns the position of the yellow hue from total hues.
-    green  : ()      -> %
-      ++ green() returns the position of the green hue from total hues.
-    blue   : ()      -> %
-      ++ blue() returns the position of the blue hue from total hues.
-    hue    : %       -> I
-      ++ hue(c) returns the hue index of the indicated color c.
-    numberOfHues : ()    -> PI
-      ++ numberOfHues() returns the number of total hues, set in totalHues.
-    color  : Integer -> %
-      ++ color(i) returns a color of the indicated hue i.
-  
-  Implementation ==> add
-    totalHues   ==> 27  --see  (header.h file) for the current number
-
-    Rep := Record(hue:I, weight:SF)
- 
-
-    f:SF * c:% ==
-      -- s * c returns the color c, whose weighted shade has been scaled by s
-      zero? f => c
-      -- 0 is the identitly function...or maybe an error is better?
-      [c.hue, f * c.weight]
- 
-    x + y ==
-      x.hue = y.hue => [x.hue, x.weight + y.weight]
-      if y.weight > x.weight then  -- let x be color with bigger weight
-        c := x
-        x := y
-        y := c
-      diff := x.hue - y.hue
-      if (xHueSmaller:= (diff < 0)) then diff := -diff
-      if (moreThanHalf:=(diff > totalHues quo 2)) then diff := totalHues-diff
-      offset : I := wholePart(round (diff::SF/(2::SF)**(x.weight/y.weight)) )
-      if (xHueSmaller and ^moreThanHalf) or (^xHueSmaller and moreThanHalf) then
-        ans := x.hue + offset
-      else
-        ans := x.hue - offset
-      if (ans < 0) then ans := totalHues + ans
-      else if (ans > totalHues) then ans := ans - totalHues
-      [ans,1]
- 
-    x = y     == (x.hue = y.hue) and (x.weight = y.weight)
-    red()     == [1,1]
-    yellow()  == [11::I,1]
-    green()   == [14::I,1]
-    blue()    == [22::I,1]
-    sample()  == red()
-    hue c     == c.hue
-    i:PositiveInteger * c:% == i::SF * c
-    numberOfHues() == totalHues 
-
-    color i ==
-      if (i<0) or (i>totalHues) then
-       error concat("Color should be in the range 1..",totalHues::String)
-      [i::I, 1]
- 
-    coerce(c:%):OutputForm ==
-      hconcat ["Hue: "::OutputForm, (c.hue)::OutputForm,
-               "  Weight: "::OutputForm, (c.weight)::OutputForm]
-
-@
-\section{domain PALETTE Palette}
-<<domain PALETTE Palette>>=
-)abbrev domain PALETTE Palette
-++ Author: Jim Wen
-++ Date Created: May 10th 1989
-++ Date Last Updated: Jan 19th 1990
-++ Basic Operations: dark, dim, bright, pastel, light, hue, shade, coerce
-++ Related Constructors:
-++ Also See:
-++ AMS Classifications:
-++ Keywords: dim,bright,pastel,coerce
-++ References:
-++ Description: This domain describes four groups of color shades (palettes).
- 
-Palette(): Exports == Implementation where
-  I      ==> Integer
-  C      ==> Color
-  SHADE  ==> ["Dark","Dim","Bright","Pastel","Light"]
-
-  Exports ==> SetCategory with
-    dark   : C  -> %
-      ++ dark(c) sets the shade of the indicated hue of c to it's lowest value.
-    dim    : C  -> %
-      ++ dim(c) sets the shade of a hue, c,  above dark, but below bright.
-    bright : C  -> %
-      ++ bright(c) sets the shade of a hue, c, above dim, but below pastel.
-    pastel : C  -> %
-      ++ pastel(c) sets the shade of a hue, c,  above bright, but below light.
-    light  : C  -> %
-      ++ light(c) sets the shade of a hue, c,  to it's highest value.
-    hue    : %  -> C
-      ++ hue(p) returns the hue field of the indicated palette p.
-    shade  : %  -> I
-      ++ shade(p) returns the shade index of the indicated palette p.
-    coerce : C  -> %
-      ++ coerce(c) sets the average shade for the palette to that of the 
-      ++ indicated color c.
- 
-  Implementation ==> add
-    Rep := Record(shadeField:I, hueField:C)
-
-    dark   c == [1,c]
-    dim    c == [2,c]  
-    bright c == [3,c]  
-    pastel c == [4,c]  
-    light  c == [5,c]  
-    hue    p == p.hueField
-    shade  p == p.shadeField
-    sample() == bright(sample())
-    coerce(c:Color):% == bright c
-    coerce(p:%):OutputForm ==
-      hconcat ["[",coerce(p.hueField),"] from the ",SHADE.(p.shadeField)," palette"]
-
-@
-\section{License}
-<<license>>=
---Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd.
---All rights reserved.
---
---Redistribution and use in source and binary forms, with or without
---modification, are permitted provided that the following conditions are
---met:
---
---    - Redistributions of source code must retain the above copyright
---      notice, this list of conditions and the following disclaimer.
---
---    - Redistributions in binary form must reproduce the above copyright
---      notice, this list of conditions and the following disclaimer in
---      the documentation and/or other materials provided with the
---      distribution.
---
---    - Neither the name of The Numerical ALgorithms Group Ltd. nor the
---      names of its contributors may be used to endorse or promote products
---      derived from this software without specific prior written permission.
---
---THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
---IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
---TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
---PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
---OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
---EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
---PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
---PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
---LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
---NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
---SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-@
-<<*>>=
-<<license>>
- 
-<<domain COLOR Color>>
-<<domain PALETTE Palette>>
-@
-\eject
-\begin{thebibliography}{99}
-\bibitem{1} nothing
-\end{thebibliography}
-\end{document}
diff --git a/src/algebra/complet.spad.pamphlet b/src/algebra/complet.spad.pamphlet
index 2dc03ae..d99c3a8 100644
--- a/src/algebra/complet.spad.pamphlet
+++ b/src/algebra/complet.spad.pamphlet
@@ -9,137 +9,11 @@
 \eject
 \tableofcontents
 \eject
-\section{domain ORDCOMP OrderedCompletion}
-<<domain ORDCOMP OrderedCompletion>>=
-)abbrev domain ORDCOMP OrderedCompletion
-++ Completion with + and - infinity
-++ Author: Manuel Bronstein
-++ Description: Adjunction of two real infinites quantities to a set.
-++ Date Created: 4 Oct 1989
-++ Date Last Updated: 1 Nov 1989
-OrderedCompletion(R:SetCategory): Exports == Implementation where
-  B ==> Boolean
-
-  Exports ==> Join(SetCategory, FullyRetractableTo R) with
-    plusInfinity : () -> %        ++ plusInfinity() returns +infinity.
-    minusInfinity: () -> %        ++ minusInfinity() returns  -infinity.
-    finite?      : %  -> B
-      ++ finite?(x) tests if x is finite.
-    infinite?    : %  -> B
-      ++ infinite?(x) tests if x is +infinity or -infinity,
-    whatInfinity : %  -> SingleInteger
-      ++ whatInfinity(x) returns 0 if x is finite,
-      ++ 1 if x is +infinity, and -1 if x is -infinity.
-    if R has AbelianGroup then AbelianGroup
-    if R has OrderedRing then OrderedRing
-    if R has IntegerNumberSystem then
-      rational?: % -> Boolean
-        ++ rational?(x) tests if x is a finite rational number.
-      rational : % -> Fraction Integer
-        ++ rational(x) returns x as a finite rational number.
-        ++ Error: if x cannot be so converted.
-      rationalIfCan: % -> Union(Fraction Integer, "failed")
-        ++ rationalIfCan(x) returns x as a finite rational number if
-        ++ it is one and "failed" otherwise.
-
-  Implementation ==> add
-    Rep := Union(fin:R, inf:B)  -- true = +infinity, false = -infinity
-
-    coerce(r:R):%          == [r]
-    retract(x:%):R         == (x case fin => x.fin; error "Not finite")
-    finite? x              == x case fin
-    infinite? x            == x case inf
-    plusInfinity()         == [true]
-    minusInfinity()        == [false]
-
-    retractIfCan(x:%):Union(R, "failed") ==
-      x case fin => x.fin
-      "failed"
-
-    coerce(x:%):OutputForm ==
-      x case fin => (x.fin)::OutputForm
-      e := "infinity"::OutputForm
-      x.inf => empty() + e
-      - e
-
-    whatInfinity x ==
-      x case fin => 0
-      x.inf => 1
-      -1
-
-    x = y ==
-      x case inf =>
-        y case inf => not xor(x.inf, y.inf)
-        false
-      y case inf => false
-      x.fin = y.fin
-
-    if R has AbelianGroup then
-      0 == [0$R]
-
-      n:Integer * x:% ==
-        x case inf =>
-          n > 0 => x
-          n < 0 => [not(x.inf)]
-          error "Undefined product"
-        [n * x.fin]
-
-      - x ==
-        x case inf => [not(x.inf)]
-        [- (x.fin)]
-
-      x + y ==
-        x case inf =>
-          y case fin => x
-          xor(x.inf, y.inf) => error "Undefined sum"
-          x
-        y case inf => y
-        [x.fin + y.fin]
-
-    if R has OrderedRing then
-      fininf: (B, R) -> %
-
-      1                == [1$R]
-      characteristic() == characteristic()$R
-
-      fininf(b, r) ==
-        r > 0 => [b]
-        r < 0 => [not b]
-        error "Undefined product"
-
-      x:% * y:% ==
-        x case inf =>
-          y case inf =>
-            xor(x.inf, y.inf) => minusInfinity()
-            plusInfinity()
-          fininf(x.inf, y.fin)
-        y case inf => fininf(y.inf, x.fin)
-        [x.fin * y.fin]
-
-      recip x ==
-        x case inf => 0
-        (u := recip(x.fin)) case "failed" => "failed"
-        [u::R]
-
-      x < y ==
-        x case inf =>
-          y case inf =>
-            xor(x.inf, y.inf) => y.inf
-            false
-          not(x.inf)
-        y case inf => y.inf
-        x.fin < y.fin
-
-    if R has IntegerNumberSystem then
-      rational? x == finite? x
-      rational  x == rational(retract(x)@R)
-
-      rationalIfCan x ==
-        (r:= retractIfCan(x)@Union(R,"failed")) case "failed" =>"failed"
-        rational(r::R)
-
-@
 \section{package ORDCOMP2 OrderedCompletionFunctions2}
+<<dot>>=
+"ORDCOMP2" -> "PACKAGE"
+"OrderedCompletionFunctions2(a:SETCAT,b:SETCAT)" -> "Package"
+@
 <<package ORDCOMP2 OrderedCompletionFunctions2>>=
 )abbrev package ORDCOMP2 OrderedCompletionFunctions2
 ++ Lifting of maps to ordered completions
@@ -172,111 +46,11 @@ OrderedCompletionFunctions2(R, S): Exports == Implementation where
       m
 
 @
-\section{domain ONECOMP OnePointCompletion}
-<<domain ONECOMP OnePointCompletion>>=
-)abbrev domain ONECOMP OnePointCompletion
-++ Completion with infinity
-++ Author: Manuel Bronstein
-++ Description: Adjunction of a complex infinity to a set.
-++ Date Created: 4 Oct 1989
-++ Date Last Updated: 1 Nov 1989
-OnePointCompletion(R:SetCategory): Exports == Implementation where
-  B ==> Boolean
-
-  Exports ==> Join(SetCategory, FullyRetractableTo R) with
-    infinity : () -> %
-      ++  infinity() returns infinity.
-    finite?  : %  -> B
-      ++ finite?(x) tests if x is finite.
-    infinite?: %  -> B
-      ++ infinite?(x) tests if x is infinite.
-    if R has AbelianGroup then AbelianGroup
-    if R has OrderedRing then OrderedRing
-    if R has IntegerNumberSystem then
-      rational?: % -> Boolean
-        ++ rational?(x) tests if x is a finite rational number.
-      rational : % -> Fraction Integer
-        ++ rational(x) returns x as a finite rational number.
-        ++ Error: if x is not a rational number.
-      rationalIfCan: % -> Union(Fraction Integer, "failed")
-        ++ rationalIfCan(x) returns x as a finite rational number if
-        ++ it is one, "failed" otherwise.
-
-  Implementation ==> add
-    Rep := Union(R, "infinity")
-
-    coerce(r:R):%          == r
-    retract(x:%):R         == (x case R => x::R; error "Not finite")
-    finite? x              == x case R
-    infinite? x            == x case "infinity"
-    infinity()             == "infinity"
-    retractIfCan(x:%):Union(R, "failed") == (x case R => x::R; "failed")
-
-    coerce(x:%):OutputForm ==
-      x case "infinity" => "infinity"::OutputForm
-      x::R::OutputForm
-
-    x = y ==
-      x case "infinity" => y case "infinity"
-      y case "infinity" => false
-      x::R = y::R
-
-    if R has AbelianGroup then
-      0 == 0$R
-
-      n:Integer * x:% ==
-        x case "infinity" =>
-          zero? n => error "Undefined product"
-          infinity()
-        n * x::R
-
-      - x ==
-        x case "infinity" => error "Undefined inverse"
-        - (x::R)
-
-      x + y ==
-        x case "infinity" => x
-        y case "infinity" => y
-        x::R + y::R
-
-    if R has OrderedRing then
-      fininf: R -> %
-
-      1                == 1$R
-      characteristic() == characteristic()$R
-
-      fininf r ==
-        zero? r => error "Undefined product"
-        infinity()
-
-      x:% * y:% ==
-        x case "infinity" =>
-          y case "infinity" => y
-          fininf(y::R)
-        y case "infinity" => fininf(x::R)
-        x::R * y::R
-
-      recip x ==
-        x case "infinity" => 0
-        zero?(x::R) => infinity()
-        (u := recip(x::R)) case "failed" => "failed"
-        u::R::%
-
-      x < y ==
-        x case "infinity" => false     -- do not change the order
-        y case "infinity" => true      -- of those two tests
-        x::R < y::R
-
-    if R has IntegerNumberSystem then
-      rational? x == finite? x
-      rational  x == rational(retract(x)@R)
-
-      rationalIfCan x ==
-        (r:= retractIfCan(x)@Union(R,"failed")) case "failed" =>"failed"
-        rational(r::R)
-
-@
 \section{package ONECOMP2 OnePointCompletionFunctions2}
+<<dot>>=
+"ONECOMP2" -> "PACKAGE"
+"OnePointCompletionFunctions2(a:SETCAT,b:SETCAT)" -> "Package"
+@
 <<package ONECOMP2 OnePointCompletionFunctions2>>=
 )abbrev package ONECOMP2 OnePointCompletionFunctions2
 ++ Lifting of maps to one-point completions
@@ -307,6 +81,10 @@ OnePointCompletionFunctions2(R, S): Exports == Implementation where
 
 @
 \section{package INFINITY Infinity}
+<<dot>>=
+"INFINITY" -> "PACKAGE"
+"Infinity()" -> "Package"
+@
 <<package INFINITY Infinity>>=
 )abbrev package INFINITY Infinity
 ++ Top-level infinity
@@ -363,9 +141,7 @@ Infinity(): with
 <<*>>=
 <<license>>
 
-<<domain ORDCOMP OrderedCompletion>>
 <<package ORDCOMP2 OrderedCompletionFunctions2>>
-<<domain ONECOMP OnePointCompletion>>
 <<package ONECOMP2 OnePointCompletionFunctions2>>
 <<package INFINITY Infinity>>
 
diff --git a/src/algebra/constant.spad.pamphlet b/src/algebra/constant.spad.pamphlet
deleted file mode 100644
index 8cab8cc..0000000
--- a/src/algebra/constant.spad.pamphlet
+++ /dev/null
@@ -1,243 +0,0 @@
-\documentclass{article}
-\usepackage{axiom}
-\begin{document}
-\title{\$SPAD/src/algebra constant.spad}
-\author{Manuel Bronstein, James Davenport}
-\maketitle
-\begin{abstract}
-\end{abstract}
-\eject
-\tableofcontents
-\eject
-\section{domain IAN InnerAlgebraicNumber}
-<<domain IAN InnerAlgebraicNumber>>=
-)abbrev domain IAN InnerAlgebraicNumber
-++ Algebraic closure of the rational numbers
-++ Author: Manuel Bronstein
-++ Date Created: 22 March 1988
-++ Date Last Updated: 4 October 1995 (JHD)
-++ Description: Algebraic closure of the rational numbers.
-++ Keywords: algebraic, number.
-InnerAlgebraicNumber(): Exports == Implementation where
-  Z   ==> Integer
-  FE  ==> Expression Z
-  K   ==> Kernel %
-  P   ==> SparseMultivariatePolynomial(Z, K)
-  ALGOP ==> "%alg"
-  SUP ==>  SparseUnivariatePolynomial
-
-  Exports ==> Join(ExpressionSpace, AlgebraicallyClosedField,
-                   RetractableTo Z, RetractableTo Fraction Z,
-                   LinearlyExplicitRingOver Z, RealConstant,
-                   LinearlyExplicitRingOver Fraction Z,
-                   CharacteristicZero,
-                   ConvertibleTo Complex Float, DifferentialRing) with
-    coerce : P -> %
-      ++ coerce(p) returns p viewed as an algebraic number.
-    numer  : % -> P
-      ++ numer(f) returns the numerator of f viewed as a
-      ++ polynomial in the kernels over Z.
-    denom  : % -> P
-      ++ denom(f) returns the denominator of f viewed as a
-      ++ polynomial in the kernels over Z.
-    reduce : % -> %
-      ++ reduce(f) simplifies all the unreduced algebraic numbers
-      ++ present in f by applying their defining relations.
-    trueEqual : (%,%) -> Boolean
-      ++ trueEqual(x,y) tries to determine if the two numbers are equal
-    norm : (SUP(%),Kernel %) -> SUP(%)
-      ++ norm(p,k) computes the norm of the polynomial p
-      ++ with respect to the extension generated by kernel k
-    norm : (SUP(%),List Kernel %) -> SUP(%)
-      ++ norm(p,l) computes the norm of the polynomial p
-      ++ with respect to the extension generated by kernels l
-    norm : (%,Kernel %) -> %
-      ++ norm(f,k) computes the norm of the algebraic number f
-      ++ with respect to the extension generated by kernel k
-    norm : (%,List Kernel %) -> %
-      ++ norm(f,l) computes the norm of the algebraic number f
-      ++ with respect to the extension generated by kernels l
-  Implementation ==> FE add
-
-    Rep := FE
-
-    -- private
-    mainRatDenom(f:%):% ==
-       ratDenom(f::Rep::FE)$AlgebraicManipulations(Integer, FE)::Rep::%
---        mv:= mainVariable denom f
---        mv case "failed" => f
---        algv:=mv::K
---	q:=univariate(f, algv, minPoly(algv))$PolynomialCategoryQuotientFunctions(IndexedExponents K,K,Integer,P,%)
---	q(algv::%)
-
-    findDenominator(z:SUP %):Record(num:SUP %,den:%) ==
-       zz:=z
-       while not(zz=0) repeat
-          dd:=(denom leadingCoefficient zz)::%
-          not(dd=1) =>
-             rec:=findDenominator(dd*z)
-             return [rec.num,rec.den*dd]
-          zz:=reductum zz
-       [z,1]
-    makeUnivariate(p:P,k:Kernel %):SUP % ==
-      map(#1::%,univariate(p,k))$SparseUnivariatePolynomialFunctions2(P,%)
-    -- public
-    a,b:%
-    differentiate(x:%):% == 0
-    zero? a == zero? numer a
---    one? a == one? numer a and one? denom a
-    one? a == (numer a = 1) and (denom a = 1)
-    x:% / y:%        == mainRatDenom(x /$Rep y)
-    x:% ** n:Integer ==
-      n < 0 => mainRatDenom (x **$Rep n)
-      x **$Rep n
-    trueEqual(a,b) ==
-       -- if two algebraic numbers have the same norm (after deleting repeated
-       -- roots, then they are certainly conjugates. Note that we start with a
-       -- monic polynomial, so don't have to check for constant factors.
-       -- this will be fooled by sqrt(2) and -sqrt(2), but the = in
-       -- AlgebraicNumber knows what to do about this.
-       ka:=reverse tower a
-       kb:=reverse tower b
-       empty? ka and empty? kb => retract(a)@Fraction Z = retract(b)@Fraction Z
-       pa,pb:SparseUnivariatePolynomial %
-       pa:=monomial(1,1)-monomial(a,0)
-       pb:=monomial(1,1)-monomial(b,0)
-       na:=map(retract,norm(pa,ka))$SparseUnivariatePolynomialFunctions2(%,Fraction Z)
-       nb:=map(retract,norm(pb,kb))$SparseUnivariatePolynomialFunctions2(%,Fraction Z)
-       (sa:=squareFreePart(na)) = (sb:=squareFreePart(nb)) => true
-       g:=gcd(sa,sb)
-       (dg:=degree g) = 0 => false
-       -- of course, if these have a factor in common, then the
-       -- answer is really ambiguous, so we ought to be using Duval-type
-       -- technology
-       dg = degree sa or dg = degree sb => true
-       false
-    norm(z:%,k:Kernel %): % ==
-       p:=minPoly k
-       n:=makeUnivariate(numer z,k)
-       d:=makeUnivariate(denom z,k)
-       resultant(n,p)/resultant(d,p)
-    norm(z:%,l:List Kernel %): % ==
-       for k in l repeat
-           z:=norm(z,k)
-       z
-    norm(z:SUP %,k:Kernel %):SUP % ==
-       p:=map(#1::SUP %,minPoly k)$SparseUnivariatePolynomialFunctions2(%,SUP %)
-       f:=findDenominator z
-       zz:=map(makeUnivariate(numer #1,k),f.num)$SparseUnivariatePolynomialFunctions2( %,SUP %)
-       zz:=swap(zz)$CommuteUnivariatePolynomialCategory(%,SUP %,SUP SUP %)
-       resultant(p,zz)/norm(f.den,k)
-    norm(z:SUP %,l:List Kernel %): SUP % ==
-       for k in l repeat
-           z:=norm(z,k)
-       z
-    belong? op           == belong?(op)$ExpressionSpace_&(%) or has?(op, ALGOP)
-
-    convert(x:%):Float ==
-      retract map(#1::Float, x pretend FE)$ExpressionFunctions2(Z,Float)
-
-    convert(x:%):DoubleFloat ==
-      retract map(#1::DoubleFloat,
-                  x pretend FE)$ExpressionFunctions2(Z, DoubleFloat)
-
-    convert(x:%):Complex(Float) ==
-      retract map(#1::Complex(Float),
-                  x pretend FE)$ExpressionFunctions2(Z, Complex Float)
-
-@
-\section{domain AN AlgebraicNumber}
-<<domain AN AlgebraicNumber>>=
-)abbrev domain AN AlgebraicNumber
-++ Algebraic closure of the rational numbers
-++ Author: James Davenport
-++ Date Created: 9 October 1995
-++ Date Last Updated: 10 October 1995 (JHD)
-++ Description: Algebraic closure of the rational numbers, with mathematical =
-++ Keywords: algebraic, number.
-AlgebraicNumber(): Exports == Implementation where
-  Z   ==> Integer
-  P   ==> SparseMultivariatePolynomial(Z, Kernel %)
-  SUP ==>  SparseUnivariatePolynomial
-
-  Exports ==> Join(ExpressionSpace, AlgebraicallyClosedField,
-                   RetractableTo Z, RetractableTo Fraction Z,
-                   LinearlyExplicitRingOver Z, RealConstant,
-                   LinearlyExplicitRingOver Fraction Z,
-                   CharacteristicZero,
-                   ConvertibleTo Complex Float, DifferentialRing) with
-    coerce : P -> %
-      ++ coerce(p) returns p viewed as an algebraic number.
-    numer  : % -> P
-      ++ numer(f) returns the numerator of f viewed as a
-      ++ polynomial in the kernels over Z.
-    denom  : % -> P
-      ++ denom(f) returns the denominator of f viewed as a
-      ++ polynomial in the kernels over Z.
-    reduce : % -> %
-      ++ reduce(f) simplifies all the unreduced algebraic numbers
-      ++ present in f by applying their defining relations.
-    norm : (SUP(%),Kernel %) -> SUP(%)
-      ++ norm(p,k) computes the norm of the polynomial p
-      ++ with respect to the extension generated by kernel k
-    norm : (SUP(%),List Kernel %) -> SUP(%)
-      ++ norm(p,l) computes the norm of the polynomial p
-      ++ with respect to the extension generated by kernels l
-    norm : (%,Kernel %) -> %
-      ++ norm(f,k) computes the norm of the algebraic number f
-      ++ with respect to the extension generated by kernel k
-    norm : (%,List Kernel %) -> %
-      ++ norm(f,l) computes the norm of the algebraic number f
-      ++ with respect to the extension generated by kernels l
-  Implementation ==> InnerAlgebraicNumber add
-    Rep:=InnerAlgebraicNumber
-    a,b:%
-    zero? a == trueEqual(a::Rep,0::Rep)
-    one? a == trueEqual(a::Rep,1::Rep)
-    a=b == trueEqual((a-b)::Rep,0::Rep)
-
-@
-\section{License}
-<<license>>=
---Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd.
---All rights reserved.
---
---Redistribution and use in source and binary forms, with or without
---modification, are permitted provided that the following conditions are
---met:
---
---    - Redistributions of source code must retain the above copyright
---      notice, this list of conditions and the following disclaimer.
---
---    - Redistributions in binary form must reproduce the above copyright
---      notice, this list of conditions and the following disclaimer in
---      the documentation and/or other materials provided with the
---      distribution.
---
---    - Neither the name of The Numerical ALgorithms Group Ltd. nor the
---      names of its contributors may be used to endorse or promote products
---      derived from this software without specific prior written permission.
---
---THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
---IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
---TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
---PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
---OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
---EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
---PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
---PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
---LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
---NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
---SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-@
-<<*>>=
-<<license>>
-
-<<domain IAN InnerAlgebraicNumber>>
-<<domain AN AlgebraicNumber>>
-@
-\eject
-\begin{thebibliography}{99}
-\bibitem{1} nothing
-\end{thebibliography}
-\end{document}
diff --git a/src/algebra/contfrac.spad.pamphlet b/src/algebra/contfrac.spad.pamphlet
index d6c24af..f39c28a 100644
--- a/src/algebra/contfrac.spad.pamphlet
+++ b/src/algebra/contfrac.spad.pamphlet
@@ -9,879 +9,11 @@
 \eject
 \tableofcontents
 \eject
-\section{domain CONTFRAC ContinuedFraction}
-<<ContinuedFraction.input>>=
--- contfrac.spad.pamphlet ContinuedFraction.input
-)spool ContinuedFraction.output
-)set message test on
-)set message auto off
-)clear all
---S 1 of 22
-c := continuedFraction(314159/100000)
---R 
---R
---R              1 |     1  |     1 |     1  |     1 |     1 |     1 |
---R   (1)  3 + +---+ + +----+ + +---+ + +----+ + +---+ + +---+ + +---+
---R            | 7     | 15     | 1     | 25     | 1     | 7     | 4
---R                                              Type: ContinuedFraction Integer
---E 1
-
---S 2 of 22
-partialQuotients c
---R 
---R
---R   (2)  [3,7,15,1,25,1,7,4]
---R                                                         Type: Stream Integer
---E 2
-
---S 3 of 22
-convergents c
---R 
---R
---R           22 333 355 9208 9563 76149 314159
---R   (3)  [3,--,---,---,----,----,-----,------]
---R            7 106 113 2931 3044 24239 100000
---R                                                Type: Stream Fraction Integer
---E 3
-
---S 4 of 22
-approximants c
---R 
---R
---R                                      ______
---R           22 333 355 9208 9563 76149 314159
---R   (4)  [3,--,---,---,----,----,-----,------]
---R            7 106 113 2931 3044 24239 100000
---R                                                Type: Stream Fraction Integer
---E 4
-
---S 5 of 22
-pq := partialQuotients(1/c)
---R 
---R
---R   (5)  [0,3,7,15,1,25,1,7,4]
---R                                                         Type: Stream Integer
---E 5
-
---S 6 of 22
-continuedFraction(first pq,repeating [1],rest pq)
---R 
---R
---R          1 |     1 |     1  |     1 |     1  |     1 |     1 |     1 |
---R   (6)  +---+ + +---+ + +----+ + +---+ + +----+ + +---+ + +---+ + +---+
---R        | 3     | 7     | 15     | 1     | 25     | 1     | 7     | 4
---R                                              Type: ContinuedFraction Integer
---E 6
-
---S 7 of 22
-z:=continuedFraction(3,repeating [1],repeating [3,6])
---R 
---R
---R   (7)
---R           1 |     1 |     1 |     1 |     1 |     1 |     1 |     1 |     1 |
---R     3 + +---+ + +---+ + +---+ + +---+ + +---+ + +---+ + +---+ + +---+ + +---+
---R         | 3     | 6     | 3     | 6     | 3     | 6     | 3     | 6     | 3
---R   + 
---R       1 |
---R     +---+ + ...
---R     | 6
---R                                              Type: ContinuedFraction Integer
---E 7
-
---S 8 of 22
-dens:Stream Integer := cons(1,generate((x+->x+4),6))
---R 
---R
---R   (8)  [1,6,10,14,18,22,26,30,34,38,...]
---R                                                         Type: Stream Integer
---E 8
-
---S 9 of 22
-cf := continuedFraction(0,repeating [1],dens)
---R 
---R
---R   (9)
---R       1 |     1 |     1  |     1  |     1  |     1  |     1  |     1  |
---R     +---+ + +---+ + +----+ + +----+ + +----+ + +----+ + +----+ + +----+
---R     | 1     | 6     | 10     | 14     | 18     | 22     | 26     | 30
---R   + 
---R       1  |     1  |
---R     +----+ + +----+ + ...
---R     | 34     | 38
---R                                              Type: ContinuedFraction Integer
---E 9
-
---S 10 of 22
-ccf := convergents cf
---R 
---R
---R              6 61  860 15541 342762  8927353 268163352  9126481321
---R   (10)  [0,1,-,--,----,-----,------,--------,---------,-----------,...]
---R              7 71 1001 18089 398959 10391023 312129649 10622799089
---R                                                Type: Stream Fraction Integer
---E 10
-
---S 11 of 22
-eConvergents := [2*e + 1 for e in ccf]
---R 
---R
---R              19 193 2721 49171 1084483 28245729 848456353 28875761731
---R   (11)  [1,3,--,---,----,-----,-------,--------,---------,-----------,...]
---R               7  71 1001 18089  398959 10391023 312129649 10622799089
---R                                                Type: Stream Fraction Integer
---E 11
-
---S 12 of 22
-eConvergents :: Stream Float
---R 
---R
---R   (12)
---R   [1.0, 3.0, 2.7142857142 857142857, 2.7183098591 549295775,
---R    2.7182817182 817182817, 2.7182818287 356957267, 2.7182818284 585634113,
---R    2.7182818284 590458514, 2.7182818284 590452348, 2.7182818284 590452354,
---R    ...]
---R                                                           Type: Stream Float
---E 12
-
---S 13 of 22
-exp 1.0
---R 
---R
---R   (13)  2.7182818284 590452354
---R                                                                  Type: Float
---E 13
-
---S 14 of 22
-cf := continuedFraction(1,[(2*i+1)**2 for i in 0..],repeating [2])
---R 
---R
---R   (14)
---R           1 |     9 |     25 |     49 |     81 |     121 |     169 |     225 |
---R     1 + +---+ + +---+ + +----+ + +----+ + +----+ + +-----+ + +-----+ + +-----+
---R         | 2     | 2     | 2      | 2      | 2      |  2      |  2      |  2
---R   + 
---R       289 |     361 |
---R     +-----+ + +-----+ + ...
---R     |  2      |  2
---R                                              Type: ContinuedFraction Integer
---E 14
-
---S 15 of 22
-ccf := convergents cf
---R 
---R
---R            3 15 105 315 3465 45045 45045 765765 14549535
---R   (15)  [1,-,--,---,---,----,-----,-----,------,--------,...]
---R            2 13  76 263 2578 36979 33976 622637 11064338
---R                                                Type: Stream Fraction Integer
---E 15
-
---S 16 of 22
-piConvergents := [4/p for p in ccf] 
---R 
---R
---R            8 52 304 1052 10312 147916 135904 2490548 44257352
---R   (16)  [4,-,--,---,----,-----,------,------,-------,--------,...]
---R            3 15 105  315  3465  45045  45045  765765 14549535
---R                                                Type: Stream Fraction Integer
---E 16
-
---S 17 of 22
-piConvergents :: Stream Float
---R 
---R
---R   (17)
---R   [4.0, 2.6666666666 666666667, 3.4666666666 666666667,
---R    2.8952380952 380952381, 3.3396825396 825396825, 2.9760461760 461760462,
---R    3.2837384837 384837385, 3.0170718170 718170718, 3.2523659347 188758953,
---R    3.0418396189 294022111, ...]
---R                                                           Type: Stream Float
---E 17
-
---S 18 of 22
-continuedFraction((- 122 + 597*%i)/(4 - 4*%i))
---R 
---R
---R                            1    |         1     |
---R   (18)  - 90 + 59%i + +---------+ + +-----------+
---R                       | 1 - 2%i     | - 1 + 2%i
---R                                      Type: ContinuedFraction Complex Integer
---E 18
-
---S 19 of 22
-r : Fraction UnivariatePolynomial(x,Fraction Integer) 
---R 
---R                                                                   Type: Void
---E 19
-
---S 20 of 22
-r := ((x - 1) * (x - 2)) / ((x-3) * (x-4))
---R 
---R
---R           2
---R          x  - 3x + 2
---R   (20)  ------------
---R          2
---R         x  - 7x + 12
---R                      Type: Fraction UnivariatePolynomial(x,Fraction Integer)
---E 20
-
---S 21 of 22
-continuedFraction r 
---R 
---R
---R                  1    |         1     |
---R   (21)  1 + +---------+ + +-----------+
---R             | 1     9     | 16     40
---R             | - x - -     | -- x - --
---R             | 4     8     |  3      3
---R             Type: ContinuedFraction UnivariatePolynomial(x,Fraction Integer)
---E 21
-
---S 22 of 22
-[i*i for i in convergents(z) :: Stream Float] 
---R 
---R
---R   (22)
---R   [9.0, 11.1111111111 11111111, 10.9944598337 9501385, 11.0002777777 77777778,
---R    10.9999860763 98799786, 11.0000006979 29731039, 10.9999999650 15834446,
---R    11.0000000017 53603304, 10.9999999999 12099531, 11.0000000000 04406066,
---R    ...]
---R                                                           Type: Stream Float
---E 22
-)spool
-)lisp (bye)
-@
-<<ContinuedFraction.help>>=
-====================================================================
-ContinuedFraction examples
-====================================================================
-
-Continued fractions have been a fascinating and useful tool in
-mathematics for well over three hundred years.  Axiom implements
-continued fractions for fractions of any Euclidean domain.  In
-practice, this usually means rational numbers.  In this section we
-demonstrate some of the operations available for manipulating both
-finite and infinite continued fractions.  
-
-The ContinuedFraction domain is a field and therefore you can add,
-subtract, multiply and divide the fractions.
-
-The continuedFraction operation converts its fractional argument to a
-continued fraction.
-
-  c := continuedFraction(314159/100000)
-         1 |     1  |     1 |     1  |     1 |     1 |     1 |
-   3 + +---+ + +----+ + +---+ + +----+ + +---+ + +---+ + +---+
-       | 7     | 15     | 1     | 25     | 1     | 7     | 4
-                        Type: ContinuedFraction Integer
-
-This display is a compact form of the bulkier
-
-        3 +                 1
-            -------------------------------
-            7 +               1
-                ---------------------------
-                15 +            1
-                     ----------------------
-                     1 +          1
-                         ------------------
-                         25 +       1
-                              -------------
-                              1 +     1
-                                  ---------
-                                  7 +   1
-                                      -----
-                                        4
-
-You can write any rational number in a similar form.  The fraction
-will be finite and you can always take the "numerators" to be 1.
-That is, any rational number can be written as a simple, finite
-continued fraction of the form
-
-        a(1) +           1
-               -------------------------
-               a(2) +          1
-                      --------------------
-                      a(3) +
-                             .
-                              .
-                               .
-                                     1
-                               -------------
-                               a(n-1) +  1
-                                        ----
-                                        a(n)
-
-
-The a(i) are called partial quotients and the operation partialQuotients 
-creates a stream of them.
-
-  partialQuotients c
-   [3,7,15,1,25,1,7,4]
-                        Type: Stream Integer
-
-By considering more and more of the fraction, you get the convergents.
-For example, the first convergent is a(1), the second is a(1) + 1/a(2)
-and so on.
-
-  convergents c
-      22 333 355 9208 9563 76149 314159
-   [3,--,---,---,----,----,-----,------]
-       7 106 113 2931 3044 24239 100000
-                         Type: Stream Fraction Integer
-
-Since this is a finite continued fraction, the last convergent is the
-original rational number, in reduced form.  The result of approximants
-is always an infinite stream, though it may just repeat the "last" value.
-
-  approximants c
-                                 ______
-      22 333 355 9208 9563 76149 314159
-   [3,--,---,---,----,----,-----,------]
-       7 106 113 2931 3044 24239 100000
-                         Type: Stream Fraction Integer
-
-Inverting c only changes the partial quotients of its fraction by
-inserting a 0 at the beginning of the list.
-
-  pq := partialQuotients(1/c)
-   [0,3,7,15,1,25,1,7,4]
-                         Type: Stream Integer
-
-Do this to recover the original continued fraction from this list of
-partial quotients.  The three-argument form of the continuedFraction
-operation takes an element which is the whole part of the fraction, a
-stream of elements which are the numerators of the fraction, and a
-stream of elements which are the denominators of the fraction.
-
-  continuedFraction(first pq,repeating [1],rest pq)
-     1 |     1 |     1  |     1 |     1  |     1 |     1 |     1 |
-   +---+ + +---+ + +----+ + +---+ + +----+ + +---+ + +---+ + +---+
-   | 3     | 7     | 15     | 1     | 25     | 1     | 7     | 4
-                         Type: ContinuedFraction Integer
-
-The streams need not be finite for continuedFraction.  Can you guess
-which irrational number has the following continued fraction?  See the
-end of this section for the answer.
-
-  z:=continuedFraction(3,repeating [1],repeating [3,6])
-           1 |     1 |     1 |     1 |     1 |     1 |     1 |     1 |     1 |
-     3 + +---+ + +---+ + +---+ + +---+ + +---+ + +---+ + +---+ + +---+ + +---+
-         | 3     | 6     | 3     | 6     | 3     | 6     | 3     | 6     | 3
-   + 
-       1 |
-     +---+ + ...
-     | 6
-                         Type: ContinuedFraction Integer
-
-In 1737 Euler discovered the infinite continued fraction expansion
-
-        e - 1             1
-        ----- = ---------------------
-          2     1 +         1
-                    -----------------
-                    6 +       1
-                        -------------
-                        10 +    1
-                             --------
-                             14 + ...
-
-
-We use this expansion to compute rational and floating point
-approximations of e. For this and other interesting expansions, see
-C. D. Olds, Continued Fractions, New Mathematical Library, (New York:
-Random House, 1963), pp.  134--139.}
-
-By looking at the above expansion, we see that the whole part is 0 and
-the numerators are all equal to 1.  This constructs the stream of
-denominators.
-
-  dens:Stream Integer := cons(1,generate((x+->x+4),6))
-   [1,6,10,14,18,22,26,30,34,38,...]
-                        Type: Stream Integer
-
-Therefore this is the continued fraction expansion for (e - 1) / 2.
-
-  cf := continuedFraction(0,repeating [1],dens)
-       1 |     1 |     1  |     1  |     1  |     1  |     1  |     1  |
-     +---+ + +---+ + +----+ + +----+ + +----+ + +----+ + +----+ + +----+
-     | 1     | 6     | 10     | 14     | 18     | 22     | 26     | 30
-   + 
-       1  |     1  |
-     +----+ + +----+ + ...
-     | 34     | 38
-                    Type: ContinuedFraction Integer
-
-These are the rational number convergents.
-
-  ccf := convergents cf
-        6 61  860 15541 342762  8927353 268163352  9126481321
-   [0,1,-,--,----,-----,------,--------,---------,-----------,...]
-        7 71 1001 18089 398959 10391023 312129649 10622799089
-                    Type: Stream Fraction Integer
-
-You can get rational convergents for e by multiplying by 2 and adding 1.
-
-  eConvergents := [2*e + 1 for e in ccf]
-         19 193 2721 49171 1084483 28245729 848456353 28875761731
-    [1,3,--,---,----,-----,-------,--------,---------,-----------,...]
-          7  71 1001 18089  398959 10391023 312129649 10622799089
-                    Type: Stream Fraction Integer
-
-You can also compute the floating point approximations to these convergents.
-
-  eConvergents :: Stream Float
-   [1.0, 3.0, 2.7142857142 857142857, 2.7183098591 549295775,
-    2.7182817182 817182817, 2.7182818287 356957267, 2.7182818284 585634113,
-    2.7182818284 590458514, 2.7182818284 590452348, 2.7182818284 590452354,
-    ...]
-                       Type: Stream Float
-
-Compare this to the value of e computed by the exp operation in Float.
-
-  exp 1.0
-   2.7182818284 590452354
-                       Type: Float
-
-In about 1658, Lord Brouncker established the following expansion
-for 4 / pi,
-
-        1 +            1
-            -----------------------
-            2 +          9
-                -------------------
-                2 +        25
-                    ---------------
-                    2 +      49
-                        -----------
-                        2 +    81
-                            -------
-                            2 + ...
-
-Let's use this expansion to compute rational and floating point
-approximations for pi.
-
-  cf := continuedFraction(1,[(2*i+1)**2 for i in 0..],repeating [2])
-           1 |     9 |     25 |     49 |     81 |     121 |     169 |     225 |
-     1 + +---+ + +---+ + +----+ + +----+ + +----+ + +-----+ + +-----+ + +-----+
-         | 2     | 2     | 2      | 2      | 2      |  2      |  2      |  2
-   + 
-       289 |     361 |
-     +-----+ + +-----+ + ...
-     |  2      |  2
-                       Type: ContinuedFraction Integer
-
-  ccf := convergents cf
-      3 15 105 315 3465 45045 45045 765765 14549535
-   [1,-,--,---,---,----,-----,-----,------,--------,...]
-      2 13  76 263 2578 36979 33976 622637 11064338
-                       Type: Stream Fraction Integer
-
-  piConvergents := [4/p for p in ccf] 
-      8 52 304 1052 10312 147916 135904 2490548 44257352
-   [4,-,--,---,----,-----,------,------,-------,--------,...]
-      3 15 105  315  3465  45045  45045  765765 14549535
-                       Type: Stream Fraction Integer
-
-As you can see, the values are converging to
-pi = 3.14159265358979323846..., but not very quickly.
-
-  piConvergents :: Stream Float
-   [4.0, 2.6666666666 666666667, 3.4666666666 666666667,
-    2.8952380952 380952381, 3.3396825396 825396825, 2.9760461760 461760462,
-    3.2837384837 384837385, 3.0170718170 718170718, 3.2523659347 188758953,
-    3.0418396189 294022111, ...]
-                      Type: Stream Float
-
-You need not restrict yourself to continued fractions of integers.
-Here is an expansion for a quotient of Gaussian integers.
-
-  continuedFraction((- 122 + 597*%i)/(4 - 4*%i))
-                      1    |         1     |
-   - 90 + 59%i + +---------+ + +-----------+
-                 | 1 - 2%i     | - 1 + 2%i
-                      Type: ContinuedFraction Complex Integer
-
-This is an expansion for a quotient of polynomials in one variable
-with rational number coefficients.
-
-  r : Fraction UnivariatePolynomial(x,Fraction Integer) 
-                      Type: Void
-
-  r := ((x - 1) * (x - 2)) / ((x-3) * (x-4))
-     2
-    x  - 3x + 2
-   ------------
-    2
-   x  - 7x + 12
-                      Type: Fraction UnivariatePolynomial(x,Fraction Integer)
-
-  continuedFraction r 
-            1    |         1     |
-   1 + +---------+ + +-----------+
-       | 1     9     | 16     40
-       | - x - -     | -- x - --
-       | 4     8     |  3      3
-             Type: ContinuedFraction UnivariatePolynomial(x,Fraction Integer)
-
-To conclude this section, we give you evidence that
-
-    z = 3 +            1
-            -----------------------
-            3 +          1
-                -------------------
-                6 +        1
-                    ---------------
-                    3 +      1
-                        -----------
-                        6 +    1
-                            -------
-                            3 + ...
-
-is the expansion of sqrt(11).
-
-  [i*i for i in convergents(z) :: Stream Float] 
-   [9.0, 11.1111111111 11111111, 10.9944598337 9501385, 11.0002777777 77777778,
-    10.9999860763 98799786, 11.0000006979 29731039, 10.9999999650 15834446,
-    11.0000000017 53603304, 10.9999999999 12099531, 11.0000000000 04406066,
-    ...]
-                        Type: Stream Float
-
-See Also:
-o )help Stream
-o )show ContinuedFraction
-o $AXIOM/doc/src/algebra/contrac.spad.dvi
-
-@
-<<domain CONTFRAC ContinuedFraction>>=
-)abbrev domain CONTFRAC ContinuedFraction
-++ Author: Stephen M. Watt
-++ Date Created: January 1987
-++ Change History:
-++   11 April   1990
-++    7 October 1991 -- SMW: Treat whole part specially.  Added comments.
-++ Basic Operations:
-++   (Field), (Algebra),
-++   approximants, complete, continuedFraction, convergents, denominators,
-++   extend, numerators, partialDenominators, partialNumerators,
-++   partialQuotients, reducedContinuedFraction, reducedForm, wholePart
-++ Related Constructors:
-++ Also See: Fraction
-++ AMS Classifications: 11A55 11J70 11K50 11Y65 30B70 40A15
-++ Keywords: continued fraction, convergent
-++ References:
-++ Description:  \spadtype{ContinuedFraction} implements general
-++   continued fractions.  This version is not restricted to simple,
-++   finite fractions and uses the \spadtype{Stream} as a
-++   representation.  The arithmetic functions assume that the
-++   approximants alternate below/above the convergence point.
-++   This is enforced by ensuring the partial numerators and partial
-++   denominators are greater than 0 in the Euclidean domain view of \spad{R}
-++   (i.e. \spad{sizeLess?(0, x)}). 
-
-
-ContinuedFraction(R): Exports == Implementation where
-  R :     EuclideanDomain
-  Q   ==> Fraction R
-  MT  ==> MoebiusTransform Q
-  OUT ==> OutputForm
-
-  Exports ==> Join(Algebra R,Algebra Q,Field) with
-    continuedFraction:        Q -> %
-      ++ continuedFraction(r) converts the fraction \spadvar{r} with
-      ++ components of type \spad{R} to a continued fraction over
-      ++ \spad{R}.
-
-    continuedFraction:        (R, Stream R, Stream R) -> %
-      ++ continuedFraction(b0,a,b) constructs a continued fraction in
-      ++ the following way:  if \spad{a = [a1,a2,...]} and \spad{b =
-      ++ [b1,b2,...]} then the result is the continued fraction
-      ++ \spad{b0 + a1/(b1 + a2/(b2 + ...))}.
-
-    reducedContinuedFraction: (R, Stream R) -> %
-      ++ reducedContinuedFraction(b0,b) constructs a continued
-      ++ fraction in the following way:  if \spad{b = [b1,b2,...]}
-      ++ then the result is the continued fraction \spad{b0 + 1/(b1 +
-      ++ 1/(b2 + ...))}.  That is, the result is the same as
-      ++ \spad{continuedFraction(b0,[1,1,1,...],[b1,b2,b3,...])}.
-
-    partialNumerators:   % -> Stream R
-      ++ partialNumerators(x) extracts the numerators in \spadvar{x}.
-      ++ That is, if \spad{x = continuedFraction(b0, [a1,a2,a3,...],
-      ++ [b1,b2,b3,...])}, then \spad{partialNumerators(x) =
-      ++ [a1,a2,a3,...]}.
-
-    partialDenominators: % -> Stream R
-      ++ partialDenominators(x) extracts the denominators in
-      ++ \spadvar{x}.  That is, if \spad{x = continuedFraction(b0,
-      ++ [a1,a2,a3,...], [b1,b2,b3,...])}, then
-      ++ \spad{partialDenominators(x) = [b1,b2,b3,...]}.
-
-    partialQuotients:    % -> Stream R
-      ++ partialQuotients(x) extracts the partial quotients in
-      ++ \spadvar{x}.  That is, if \spad{x = continuedFraction(b0,
-      ++ [a1,a2,a3,...], [b1,b2,b3,...])}, then
-      ++ \spad{partialQuotients(x) = [b0,b1,b2,b3,...]}.
-
-    wholePart:           % -> R
-      ++ wholePart(x) extracts the whole part of \spadvar{x}.  That
-      ++ is, if \spad{x = continuedFraction(b0, [a1,a2,a3,...],
-      ++ [b1,b2,b3,...])}, then \spad{wholePart(x) = b0}.
-
-    reducedForm:         % -> %
-      ++ reducedForm(x) puts the continued fraction \spadvar{x} in
-      ++ reduced form, i.e.  the function returns an equivalent
-      ++ continued fraction of the form
-      ++ \spad{continuedFraction(b0,[1,1,1,...],[b1,b2,b3,...])}.
-
-    approximants:        % -> Stream Q
-      ++ approximants(x) returns the stream of approximants of the
-      ++ continued fraction \spadvar{x}. If the continued fraction is
-      ++ finite, then the stream will be infinite and periodic with
-      ++ period 1.
-
-    convergents:         % -> Stream Q
-      ++ convergents(x) returns the stream of the convergents of the
-      ++ continued fraction \spadvar{x}. If the continued fraction is
-      ++ finite, then the stream will be finite.
-
-    numerators:          % -> Stream R
-      ++ numerators(x) returns the stream of numerators of the
-      ++ approximants of the continued fraction \spadvar{x}. If the
-      ++ continued fraction is finite, then the stream will be finite.
-
-    denominators:        % -> Stream R
-      ++ denominators(x) returns the stream of denominators of the
-      ++ approximants of the continued fraction \spadvar{x}. If the
-      ++ continued fraction is finite, then the stream will be finite.
-
-    extend:              (%,Integer) -> %
-      ++ extend(x,n) causes the first \spadvar{n} entries in the
-      ++ continued fraction \spadvar{x} to be computed.  Normally
-      ++ entries are only computed as needed.
-
-    complete:            % -> %
-      ++ complete(x) causes all entries in \spadvar{x} to be computed.
-      ++ Normally entries are only computed as needed.  If \spadvar{x}
-      ++ is an infinite continued fraction, a user-initiated interrupt is
-      ++ necessary to stop the computation.
-
-  Implementation ==> add
-
- -- isOrdered  ==> R is Integer
-    isOrdered  ==> R has OrderedRing and R has multiplicativeValuation
-    canReduce? ==> isOrdered or R has additiveValuation
-
-    Rec ==> Record(num: R, den: R)
-    Str ==> Stream Rec
-    Rep :=  Record(value: Record(whole: R, fract: Str), reduced?: Boolean)
-
-    import Str
-
-    genFromSequence:     Stream Q -> %
-    genReducedForm:      (Q, Stream Q, MT)    -> Stream Rec
-    genFractionA:        (Stream R,Stream R)  -> Stream Rec
-    genFractionB:        (Stream R,Stream R)  -> Stream Rec
-    genNumDen:           (R,R, Stream Rec)    -> Stream R
-
-    genApproximants:     (R,R,R,R,Stream Rec) -> Stream Q
-    genConvergents:      (R,R,R,R,Stream Rec) -> Stream Q
-    iGenApproximants:    (R,R,R,R,Stream Rec) -> Stream Q
-    iGenConvergents:     (R,R,R,R,Stream Rec) -> Stream Q
-
-    reducedForm c == 
-        c.reduced? => c
-        explicitlyFinite? c.value.fract =>
-                      continuedFraction last complete convergents c
-        canReduce? => genFromSequence approximants c
-        error "Reduced form not defined for this continued fraction."
-
-    eucWhole(a: Q): R == numer a quo denom a
-
-    eucWhole0(a: Q): R ==
-        isOrdered =>
-            n := numer a
-            d := denom a
-            q := n quo d
-            r := n - q*d
-            if r < 0 then q := q - 1
-            q
-        eucWhole a
-
-    x = y ==
-        x := reducedForm x
-        y := reducedForm y
-
-        x.value.whole ^= y.value.whole => false
-
-        xl := x.value.fract; yl := y.value.fract
-
-        while not empty? xl and not empty? yl repeat
-            frst.xl.den ^= frst.yl.den => return false
-            xl := rst xl; yl := rst yl
-        empty? xl and empty? yl
-
-    continuedFraction q == q :: %
-
-    if isOrdered then
-        continuedFraction(wh,nums,dens) == [[wh,genFractionA(nums,dens)],false]
-
-        genFractionA(nums,dens) ==
-            empty? nums or empty? dens => empty()
-            n := frst nums
-            d := frst dens
-            n < 0 => error "Numerators must be greater than 0."
-            d < 0 => error "Denominators must be greater than 0."
-            concat([n,d]$Rec, delay genFractionA(rst nums,rst dens))
-    else
-        continuedFraction(wh,nums,dens) == [[wh,genFractionB(nums,dens)],false]
-
-        genFractionB(nums,dens) ==
-            empty? nums or empty? dens => empty()
-            n := frst nums
-            d := frst dens
-            concat([n,d]$Rec, delay genFractionB(rst nums,rst dens))
-
-    reducedContinuedFraction(wh,dens) ==
-        continuedFraction(wh, repeating [1], dens)
-
-    coerce(n:Integer):% == [[n::R,empty()], true]
-    coerce(r:R):%       == [[r,   empty()], true]
-
-    coerce(a: Q): % ==
-      wh := eucWhole0 a
-      fr := a - wh::Q
-      zero? fr => [[wh, empty()], true]
-
-      l : List Rec := empty()
-      n := numer fr
-      d := denom fr
-      while not zero? d repeat
-        qr := divide(n,d)
-        l  := concat([1,qr.quotient],l)
-        n  := d
-        d  := qr.remainder
-      [[wh, construct rest reverse_! l], true]
-
-    characteristic() == characteristic()$Q
-
-
-    genFromSequence apps ==
-        lo := first apps; apps := rst apps
-        hi := first apps; apps := rst apps
-        while eucWhole0 lo ^= eucWhole0 hi repeat
-            lo := first apps; apps := rst apps
-            hi := first apps; apps := rst apps
-        wh := eucWhole0 lo
-        [[wh, genReducedForm(wh::Q, apps, moebius(1,0,0,1))], canReduce?]
-
-    genReducedForm(wh0, apps, mt) ==
-        lo: Q := first apps - wh0; apps := rst apps
-        hi: Q := first apps - wh0; apps := rst apps
-        lo = hi and zero? eval(mt, lo) => empty()
-        mt  := recip mt
-        wlo := eucWhole eval(mt, lo)
-        whi := eucWhole eval(mt, hi)
-        while wlo ^= whi repeat
-            wlo := eucWhole eval(mt, first apps - wh0); apps := rst apps
-            whi := eucWhole eval(mt, first apps - wh0); apps := rst apps
-        concat([1,wlo], delay genReducedForm(wh0, apps, shift(mt, -wlo::Q)))
-
-    wholePart c           == c.value.whole
-    partialNumerators c   == map(#1.num, c.value.fract)$StreamFunctions2(Rec,R)
-    partialDenominators c == map(#1.den, c.value.fract)$StreamFunctions2(Rec,R)
-    partialQuotients c    == concat(c.value.whole, partialDenominators c)
-
-    approximants c ==
-      empty? c.value.fract => repeating [c.value.whole::Q]
-      genApproximants(1,0,c.value.whole,1,c.value.fract)
-    convergents c ==
-      empty? c.value.fract => concat(c.value.whole::Q, empty())
-      genConvergents (1,0,c.value.whole,1,c.value.fract)
-    numerators c ==
-      empty? c.value.fract => concat(c.value.whole, empty())
-      genNumDen(1,c.value.whole,c.value.fract)
-    denominators c ==
-      genNumDen(0,1,c.value.fract)
-
-    extend(x,n) == (extend(x.value.fract,n); x)
-    complete(x) == (complete(x.value.fract); x)
-
-    iGenApproximants(pm2,qm2,pm1,qm1,fr) == delay
-      nd := frst fr
-      pm := nd.num*pm2 + nd.den*pm1
-      qm := nd.num*qm2 + nd.den*qm1
-      genApproximants(pm1,qm1,pm,qm,rst fr)
-
-    genApproximants(pm2,qm2,pm1,qm1,fr) ==
-      empty? fr => repeating [pm1/qm1]
-      concat(pm1/qm1,iGenApproximants(pm2,qm2,pm1,qm1,fr))
-
-    iGenConvergents(pm2,qm2,pm1,qm1,fr) == delay
-      nd := frst fr
-      pm := nd.num*pm2 + nd.den*pm1
-      qm := nd.num*qm2 + nd.den*qm1
-      genConvergents(pm1,qm1,pm,qm,rst fr)
-
-    genConvergents(pm2,qm2,pm1,qm1,fr) ==
-      empty? fr => concat(pm1/qm1, empty())
-      concat(pm1/qm1,iGenConvergents(pm2,qm2,pm1,qm1,fr))
-
-    genNumDen(m2,m1,fr) ==
-      empty? fr => concat(m1,empty())
-      concat(m1,delay genNumDen(m1,m2*frst(fr).num + m1*frst(fr).den,rst fr))
-
-    gen  ==> genFromSequence
-    apx  ==> approximants
-
-    c, d: %
-    a: R
-    q: Q
-    n: Integer
-
-    0 == (0$R) :: %
-    1 == (1$R) :: %
-
-    c + d   == genFromSequence map(#1 + #2, apx c, apx d)
-    c - d   == genFromSequence map(#1 - #2, apx c, rest apx d)
-    - c     == genFromSequence map(   - #1, rest apx c)
-    c * d   == genFromSequence map(#1 * #2, apx c, apx d)
-    a * d   == genFromSequence map( a * #1, apx d)
-    q * d   == genFromSequence map( q * #1, apx d)
-    n * d   == genFromSequence map( n * #1, apx d)
-    c / d   == genFromSequence map(#1 / #2, apx c, rest apx d)
-    recip c ==(c = 0 => "failed";
-	       genFromSequence map( 1 / #1, rest apx c))
-
-    showAll?: () -> Boolean
-    showAll?() ==
-      NULL(_$streamsShowAll$Lisp)$Lisp => false
-      true
-
-    zagRec(t:Rec):OUT == zag(t.num :: OUT,t.den :: OUT)
-
-    coerce(c:%): OUT ==
-      wh := c.value.whole
-      fr := c.value.fract
-      empty? fr => wh :: OUT
-      count : NonNegativeInteger := _$streamCount$Lisp
-      l : List OUT := empty()
-      for n in 1..count while not empty? fr repeat
-        l  := concat(zagRec frst fr,l)
-        fr := rst fr
-      if showAll?() then
-        for n in (count + 1).. while explicitEntries? fr repeat
-          l  := concat(zagRec frst fr,l)
-          fr := rst fr
-      if not explicitlyEmpty? fr then l := concat("..." :: OUT,l)
-      l := reverse_! l
-      e := reduce("+",l)
-      zero? wh => e
-      (wh :: OUT) + e
-
-@
 \section{package NCNTFRAC NumericContinuedFraction}
+<<dot>>=
+"NCNTFRAC" -> "PACKAGE"
+"NumericContinuedFraction(a:FloatingPointSystem)" -> "Package"
+@
 <<package NCNTFRAC NumericContinuedFraction>>=
 )abbrev package NCNTFRAC NumericContinuedFraction
 ++ Author: Clifton J. Williamson
@@ -959,7 +91,6 @@ NumericContinuedFraction(F): Exports == Implementation where
 <<*>>=
 <<license>>
 
-<<domain CONTFRAC ContinuedFraction>>
 <<package NCNTFRAC NumericContinuedFraction>>
 @
 \eject
diff --git a/src/algebra/curve.spad.pamphlet b/src/algebra/curve.spad.pamphlet
index 9d4d464..ea91bfe 100644
--- a/src/algebra/curve.spad.pamphlet
+++ b/src/algebra/curve.spad.pamphlet
@@ -226,354 +226,6 @@ ChangeOfVariable(F, UP, UPUP): Exports == Implementation where
       [pr.exponent, d / pr.coef, */(pr.radicand)]
 
 @
-\section{domain RADFF RadicalFunctionField}
-<<dot>>=
-"RADFF" -> "FFCAT"
-"RadicalFunctionField(a:UFD,b:UPOLYC(a),c:UPOLYC(FRAC(b)),d:FRAC(b))"
-   -> "FunctionFieldCategory(a:UFD,b:UPOLYC(a),c:UPOLYC(FRAC(b)))"
-"RADFF" -> "SAE"
-"RadicalFunctionField(a:UFD,b:UPOLYC(a),c:UPOLYC(FRAC(b)),d:FRAC(b))"
-   -> 
-"SimpleAlgebraicExtension(a:FRAC(UPOLYC(UFD)),b:UPOLYC(FRAC(UPOLYC(UFD))))"
-@
-<<domain RADFF RadicalFunctionField>>=
-)abbrev domain RADFF RadicalFunctionField
-++ Function field defined by y**n = f(x)
-++ Author: Manuel Bronstein
-++ Date Created: 1987
-++ Date Last Updated: 27 July 1993
-++ Keywords: algebraic, curve, radical, function, field.
-++ Description: Function field defined by y**n = f(x);
-++ Examples: )r RADFF INPUT
-RadicalFunctionField(F, UP, UPUP, radicnd, n): Exports == Impl where
-  F       : UniqueFactorizationDomain
-  UP      : UnivariatePolynomialCategory F
-  UPUP    : UnivariatePolynomialCategory Fraction UP
-  radicnd : Fraction UP
-  n       : NonNegativeInteger
-
-  N   ==> NonNegativeInteger
-  Z   ==> Integer
-  RF  ==> Fraction UP
-  QF  ==> Fraction UPUP
-  UP2 ==> SparseUnivariatePolynomial UP
-  REC ==> Record(factor:UP, exponent:Z)
-  MOD ==> monomial(1, n)$UPUP - radicnd::UPUP
-  INIT ==> if (deref brandNew?) then startUp false
-
-  Exports ==> FunctionFieldCategory(F, UP, UPUP)
-
-  Impl ==> SimpleAlgebraicExtension(RF, UPUP, MOD) add
-    import ChangeOfVariable(F, UP, UPUP)
-    import InnerCommonDenominator(UP, RF, Vector UP, Vector RF)
-    import UnivariatePolynomialCategoryFunctions2(RF, UPUP, UP, UP2)
-
-    diag        : Vector RF -> Vector $
-    startUp     : Boolean -> Void
-    fullVector  : (Factored UP, N) -> PrimitiveArray UP
-    iBasis      : (UP, N) -> Vector UP
-    inftyBasis  : (RF, N) -> Vector RF
-    basisvec    : () -> Vector RF
-    char0StartUp: () -> Void
-    charPStartUp: () -> Void
-    getInfBasis : () -> Void
-    radcand     : () -> UP
-    charPintbas : (UPUP, RF, Vector RF, Vector RF) -> Void
-
-    brandNew?:Reference(Boolean) := ref true
-    discPoly:Reference(RF) := ref(0$RF)
-    newrad:Reference(UP) := ref(0$UP)
-    n1 := (n - 1)::N
-    modulus := MOD
-    ibasis:Vector(RF)     := new(n, 0)
-    invibasis:Vector(RF)  := new(n, 0)
-    infbasis:Vector(RF)   := new(n, 0)
-    invinfbasis:Vector(RF):= new(n, 0)
-    mini := minIndex ibasis
-
-    discriminant()                   == (INIT; discPoly())
-    radcand()                        == (INIT; newrad())
-    integralBasis()                  == (INIT; diag ibasis)
-    integralBasisAtInfinity()        == (INIT; diag infbasis)
-    basisvec()                       == (INIT; ibasis)
-    integralMatrix()                 == diagonalMatrix basisvec()
-    integralMatrixAtInfinity()       == (INIT; diagonalMatrix infbasis)
-    inverseIntegralMatrix()          == (INIT; diagonalMatrix invibasis)
-    inverseIntegralMatrixAtInfinity()==(INIT;diagonalMatrix invinfbasis)
-    definingPolynomial()             == modulus
-    ramified?(point:F)               == zero?(radcand() point)
-    branchPointAtInfinity?()  == (degree(radcand()) exquo n) case "failed"
-    elliptic()     == (n = 2 and degree(radcand()) = 3 => radcand(); "failed")
-    hyperelliptic() == (n=2 and odd? degree(radcand()) => radcand(); "failed")
-    diag v == [reduce monomial(qelt(v,i+mini), i) for i in 0..n1]
-
-    integralRepresents(v, d) ==
-      ib := basisvec()
-      represents
-        [qelt(ib, i) * (qelt(v, i) /$RF d) for i in mini .. maxIndex ib]
-
-    integralCoordinates f ==
-      v  := coordinates f
-      ib := basisvec()
-      splitDenominator
-        [qelt(v,i) / qelt(ib,i) for i in mini .. maxIndex ib]$Vector(RF)
-
-    integralDerivationMatrix d ==
-      dlogp := differentiate(radicnd, d) / (n * radicnd)
-      v := basisvec()
-      cd := splitDenominator(
-                [(i - mini) * dlogp + differentiate(qelt(v, i), d) / qelt(v, i)
-                                         for i in mini..maxIndex v]$Vector(RF))
-      [diagonalMatrix(cd.num), cd.den]
-
--- return (d0,...,d(n-1)) s.t. (1/d0, y/d1,...,y**(n-1)/d(n-1))
--- is an integral basis for the curve y**d = p
--- requires that p has no factor of multiplicity >= d
-    iBasis(p, d) ==
-      pl := fullVector(squareFree p, d)
-      d1 := (d - 1)::N
-      [*/[pl.j ** ((i * j) quo d) for j in 0..d1] for i in 0..d1]
-
--- returns a vector [a0,a1,...,a_{m-1}] of length m such that
--- p = a0^0 a1^1 ... a_{m-1}^{m-1}
-    fullVector(p, m) ==
-      ans:PrimitiveArray(UP) := new(m, 0)
-      ans.0 := unit p
-      l := factors p
-      for i in 1..maxIndex ans repeat
-        ans.i :=
-          (u := find(#1.exponent = i, l)) case "failed" => 1
-          (u::REC).factor
-      ans
-
--- return (f0,...,f(n-1)) s.t. (f0, y f1,..., y**(n-1) f(n-1))
--- is a local integral basis at infinity for the curve y**d = p
-    inftyBasis(p, m) ==
-      rt := rootPoly(p(x := inv(monomial(1, 1)$UP :: RF)), m)
-      m ^= rt.exponent =>
-        error "Curve not irreducible after change of variable 0 -> infinity"
-      a    := (rt.coef) x
-      b:RF := 1
-      v    := iBasis(rt.radicand, m)
-      w:Vector(RF) := new(m, 0)
-      for i in mini..maxIndex v repeat
-        qsetelt_!(w, i, b / ((qelt(v, i)::RF) x))
-        b := b * a
-      w
-
-    charPintbas(p, c, v, w) ==
-      degree(p) ^= n => error "charPintbas: should not happen"
-      q:UP2 := map(retract(#1)@UP, p)
-      ib := integralBasis()$FunctionFieldIntegralBasis(UP, UP2,
-                                          SimpleAlgebraicExtension(UP, UP2, q))
-      not diagonal?(ib.basis)=> error "charPintbas: integral basis not diagonal"
-      a:RF := 1
-      for i in minRowIndex(ib.basis) .. maxRowIndex(ib.basis)
-        for j in minColIndex(ib.basis) .. maxColIndex(ib.basis)
-          for k in mini .. maxIndex v repeat
-            qsetelt_!(v, k, (qelt(ib.basis, i, j) / ib.basisDen) * a)
-            qsetelt_!(w, k, qelt(ib.basisInv, i, j) * inv a)
-            a := a * c
-      void
-
-    charPStartUp() ==
-      r      := mkIntegral modulus
-      charPintbas(r.poly, r.coef, ibasis, invibasis)
-      x      := inv(monomial(1, 1)$UP :: RF)
-      invmod := monomial(1, n)$UPUP - (radicnd x)::UPUP
-      r      := mkIntegral invmod
-      charPintbas(r.poly, (r.coef) x, infbasis, invinfbasis)
-
-    startUp b ==
-      brandNew?() := b
-      if zero?(p := characteristic()$F) or p > n then char0StartUp()
-                                                 else charPStartUp()
-      dsc:RF := ((-1)$Z ** ((n *$N n1) quo 2::N) * (n::Z)**n)$Z *
-               radicnd ** n1 *
-                  */[qelt(ibasis, i) ** 2 for i in mini..maxIndex ibasis]
-      discPoly() := primitivePart(numer dsc) / denom(dsc)
-      void
-
-    char0StartUp() ==
-      rp          := rootPoly(radicnd, n)
-      rp.exponent ^= n => error "RadicalFunctionField: curve is not irreducible"
-      newrad()    := rp.radicand
-      ib          := iBasis(newrad(), n)
-      infb        := inftyBasis(radicnd, n)
-      invden:RF   := 1
-      for i in mini..maxIndex ib repeat
-        qsetelt_!(invibasis, i, a := qelt(ib, i) * invden)
-        qsetelt_!(ibasis, i, inv a)
-        invden := invden / rp.coef        -- always equals 1/rp.coef**(i-mini)
-        qsetelt_!(infbasis, i, a := qelt(infb, i))
-        qsetelt_!(invinfbasis, i, inv a)
-      void
-
-    ramified?(p:UP) ==
-      (r := retractIfCan(p)@Union(F, "failed")) case F =>
-        singular?(r::F)
-      (radcand() exquo p) case UP
-
-    singular?(p:UP) ==
-      (r := retractIfCan(p)@Union(F, "failed")) case F =>
-        singular?(r::F)
-      (radcand() exquo(p**2)) case UP
-
-    branchPoint?(p:UP) ==
-      (r := retractIfCan(p)@Union(F, "failed")) case F =>
-        branchPoint?(r::F)
-      ((q := (radcand() exquo p)) case UP) and
-        ((q::UP exquo p) case "failed")
-
-    singular?(point:F) ==
-      zero?(radcand()  point) and
-        zero?(((radcand() exquo (monomial(1,1)$UP-point::UP))::UP) point)
-
-    branchPoint?(point:F) ==
-      zero?(radcand()  point) and not
-        zero?(((radcand() exquo (monomial(1,1)$UP-point::UP))::UP) point)
-
-@
-\section{domain ALGFF AlgebraicFunctionField}
-<<domain ALGFF AlgebraicFunctionField>>=
-)abbrev domain ALGFF AlgebraicFunctionField
-++ Function field defined by f(x, y) = 0
-++ Author: Manuel Bronstein
-++ Date Created: 3 May 1988
-++ Date Last Updated: 24 Jul 1990
-++ Keywords: algebraic, curve, function, field.
-++ Description: Function field defined by f(x, y) = 0.
-++ Examples: )r ALGFF INPUT
-AlgebraicFunctionField(F, UP, UPUP, modulus): Exports == Impl where
-  F      : Field
-  UP     : UnivariatePolynomialCategory F
-  UPUP   : UnivariatePolynomialCategory Fraction UP
-  modulus: UPUP
-
-  N   ==> NonNegativeInteger
-  Z   ==> Integer
-  RF  ==> Fraction UP
-  QF  ==> Fraction UPUP
-  UP2 ==> SparseUnivariatePolynomial UP
-  SAE ==> SimpleAlgebraicExtension(RF, UPUP, modulus)
-  INIT ==> if (deref brandNew?) then startUp false
-
-  Exports ==> FunctionFieldCategory(F, UP, UPUP) with
-    knownInfBasis: N -> Void
-	++ knownInfBasis(n) \undocumented{}
-
-  Impl ==> SAE add
-    import ChangeOfVariable(F, UP, UPUP)
-    import InnerCommonDenominator(UP, RF, Vector UP, Vector RF)
-    import MatrixCommonDenominator(UP, RF)
-    import UnivariatePolynomialCategoryFunctions2(RF, UPUP, UP, UP2)
-
-    startUp    : Boolean -> Void
-    vect       : Matrix RF -> Vector $
-    getInfBasis: () -> Void
-
-    brandNew?:Reference(Boolean) := ref true
-    infBr?:Reference(Boolean) := ref true
-    discPoly:Reference(RF) := ref 0
-    n  := degree modulus
-    n1 := (n - 1)::N
-    ibasis:Matrix(RF)     := zero(n, n)
-    invibasis:Matrix(RF)  := copy ibasis
-    infbasis:Matrix(RF)   := copy ibasis
-    invinfbasis:Matrix(RF):= copy ibasis
-
-    branchPointAtInfinity?()   == (INIT; infBr?())
-    discriminant()             == (INIT; discPoly())
-    integralBasis()            == (INIT; vect ibasis)
-    integralBasisAtInfinity()  == (INIT; vect infbasis)
-    integralMatrix()           == (INIT; ibasis)
-    inverseIntegralMatrix()    == (INIT; invibasis)
-    integralMatrixAtInfinity() == (INIT; infbasis)
-    branchPoint?(a:F)          == zero?((retract(discriminant())@UP) a)
-    definingPolynomial()       == modulus
-    inverseIntegralMatrixAtInfinity() == (INIT; invinfbasis)
-
-    vect m ==
-      [represents row(m, i) for i in minRowIndex m .. maxRowIndex m]
-
-    integralCoordinates f ==
-      splitDenominator(coordinates(f) * inverseIntegralMatrix())
-
-    knownInfBasis d ==
-      if deref brandNew? then
-        alpha := [monomial(1, d * i)$UP :: RF for i in 0..n1]$Vector(RF)
-        ib := diagonalMatrix
-          [inv qelt(alpha, i) for i in minIndex alpha .. maxIndex alpha]
-        invib := diagonalMatrix alpha
-        for i in minRowIndex ib .. maxRowIndex ib repeat
-          for j in minColIndex ib .. maxColIndex ib repeat
-            infbasis(i, j)    := qelt(ib, i, j)
-            invinfbasis(i, j) := invib(i, j)
-      void
-
-    getInfBasis() ==
-      x           := inv(monomial(1, 1)$UP :: RF)
-      invmod      := map(#1 x, modulus)
-      r           := mkIntegral invmod
-      degree(r.poly) ^= n => error "Should not happen"
-      ninvmod:UP2 := map(retract(#1)@UP, r.poly)
-      alpha       := [(r.coef ** i) x for i in 0..n1]$Vector(RF)
-      invalpha := [inv qelt(alpha, i)
-                   for i in minIndex alpha .. maxIndex alpha]$Vector(RF)
-      invib       := integralBasis()$FunctionFieldIntegralBasis(UP, UP2,
-                             SimpleAlgebraicExtension(UP, UP2, ninvmod))
-      for i in minRowIndex ibasis .. maxRowIndex ibasis repeat
-        for j in minColIndex ibasis .. maxColIndex ibasis repeat
-          infbasis(i, j)    := ((invib.basis)(i,j) / invib.basisDen) x
-          invinfbasis(i, j) := ((invib.basisInv) (i, j)) x
-      ib2    := infbasis * diagonalMatrix alpha
-      invib2 := diagonalMatrix(invalpha) * invinfbasis
-      for i in minRowIndex ib2 .. maxRowIndex ib2 repeat
-        for j in minColIndex ibasis .. maxColIndex ibasis repeat
-          infbasis(i, j)    := qelt(ib2, i, j)
-          invinfbasis(i, j) := invib2(i, j)
-      void
-
-    startUp b ==
-      brandNew?() := b
-      nmod:UP2    := map(retract, modulus)
-      ib          := integralBasis()$FunctionFieldIntegralBasis(UP, UP2,
-                                SimpleAlgebraicExtension(UP, UP2, nmod))
-      for i in minRowIndex ibasis .. maxRowIndex ibasis repeat
-        for j in minColIndex ibasis .. maxColIndex ibasis repeat
-          qsetelt_!(ibasis, i, j, (ib.basis)(i, j) / ib.basisDen)
-          invibasis(i, j) := ((ib.basisInv) (i, j))::RF
-      if zero?(infbasis(minRowIndex infbasis, minColIndex infbasis))
-        then getInfBasis()
-      ib2    := coordinates normalizeAtInfinity vect ibasis
-      invib2 := inverse(ib2)::Matrix(RF)
-      for i in minRowIndex ib2 .. maxRowIndex ib2 repeat
-        for j in minColIndex ib2 .. maxColIndex ib2 repeat
-          ibasis(i, j)    := qelt(ib2, i, j)
-          invibasis(i, j) := invib2(i, j)
-      dsc  := resultant(modulus, differentiate modulus)
-      dsc0 := dsc * determinant(infbasis) ** 2
-      degree(numer dsc0) > degree(denom dsc0) =>error "Shouldn't happen"
-      infBr?() := degree(numer dsc0) < degree(denom dsc0)
-      dsc := dsc * determinant(ibasis) ** 2
-      discPoly() := primitivePart(numer dsc) / denom(dsc)
-      void
-
-    integralDerivationMatrix d ==
-      w := integralBasis()
-      splitDenominator(coordinates([differentiate(w.i, d)
-          for i in minIndex w .. maxIndex w]$Vector($))
-               * inverseIntegralMatrix())
-
-    integralRepresents(v, d) ==
-      represents(coordinates(represents(v, d)) * integralMatrix())
-
-    branchPoint?(p:UP) ==
-      INIT
-      (r:=retractIfCan(p)@Union(F,"failed")) case F =>branchPoint?(r::F)
-      not ground? gcd(retract(discriminant())@UP, p)
-
-@
 \section{License}
 <<license>>=
 --Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd.
@@ -619,8 +271,6 @@ AlgebraicFunctionField(F, UP, UPUP, modulus): Exports == Impl where
 <<package MMAP MultipleMap>>
 <<package FFCAT2 FunctionFieldCategoryFunctions2>>
 <<package CHVAR ChangeOfVariable>>
-<<domain RADFF RadicalFunctionField>>
-<<domain ALGFF AlgebraicFunctionField>>
 @
 \eject
 \begin{thebibliography}{99}
diff --git a/src/axiom-website/patches.html b/src/axiom-website/patches.html
index ac05fe8..e9bbb4a 100644
--- a/src/axiom-website/patches.html
+++ b/src/axiom-website/patches.html
@@ -749,6 +749,8 @@ move util.ht to doc (fix 7146)<br/>
 bookvol10.3 add domains<br/>
 <a href="patches/20081124.05.tpd.patch">20081124.05.tpd.patch</a>
 bookvol0, bookvol1 fix SmallFloat reference<br/>
+<a href="patches/20081125.01.tpd.patch">20081125.01.tpd.patch</a>
+bookvol10.3 add domains<br/>
 
  </body>
 </html>
\ No newline at end of file
