From 29b2133ffc208f8e73d42ab41b578d709e12476a Mon Sep 17 00:00:00 2001
From: Tim Daly <daly@axiom-developer.org>
Date: Wed, 14 Jan 2015 00:46:40 -0500
Subject: books/bookvol3 remove |function| and regularize Spad code

---
 books/bookvol3.pamphlet        |  152 ++++++++++++++++++++++++++++++++++++++++
 changelog                      |    2 +
 patch                          |   23 +------
 src/axiom-website/patches.html |    2 +
 4 files changed, 157 insertions(+), 22 deletions(-)

diff --git a/books/bookvol3.pamphlet b/books/bookvol3.pamphlet
index 20570c9..fd7fa69 100644
--- a/books/bookvol3.pamphlet
+++ b/books/bookvol3.pamphlet
@@ -4,6 +4,158 @@
 \mainmatter
 \setcounter{chapter}{0} % Chapter 1
 \chapter{Details for Programmers}
+Axiom maintains internal representations for domains.
+There are functions for examining the internals of objects of
+a particular domain. 
+\section{Examining Internals}
+One useful function is {\bf devaluate} which takes an object
+and returns a Lisp pair. The CAR of the pair is the Axiom type.
+The CDR of the pair is the object representation.
+For instances, consider the session where we create a list of 
+objects using the domain {\bf List(Any)}.
+\begin{verbatim}
+(1) -> w:=[1,7.2,"luanne",3*x^2+5,_
+           (3*x^2+5)::FRAC(POLY(INT)),_
+           (3*x^2+5)::POLY(FRAC(INT)),_
+           (3*x^2+5)::EXPR(INT)]$LIST(ANY)
+
+                          2       2       2       2
+   (1)  [1,7.2,"luanne",3x  + 5,3x  + 5,3x  + 5,3x  + 5]
+                                                              Type: List(Any)
+
+\end{verbatim}
+The first object, {\bf 1} is a primitive object that has the domain
+{\bf PI} and uses the underlying Lisp representation for the number.
+\begin{verbatim}
+(2) -> devaluate(1)$Lisp
+
+   (2)  1
+                                                            Type: SExpression
+\end{verbatim}
+The second object, {\bf 7.2} is a primitive object that has the domain
+{\bf FLOAT} and uses the underlying Lisp representation for the number,
+in this case, itself a pair whose CAR is the floating point base and whose
+CDR is the mantissa,
+\begin{verbatim}
+(3) -> devaluate(7.2)$Lisp
+
+   (3)  (265633114661417543270 . - 65)
+                                                            Type: SExpression
+\end{verbatim}
+The third object, {\tt {\bf "luanne"}} is from the domain {\bf STRING}
+and uses the Lisp string representation.
+\begin{verbatim}
+(4) -> devaluate("luanne")$Lisp
+
+   (4)  luanne
+                                                            Type: SExpression
+\end{verbatim}
+
+Now we get more complicated. We illustrate various ways to store the
+formula $3x^2+5$ in different domains. Each domain has a chosen 
+representation. 
+
+\begin{verbatim}
+(5) -> devaluate(3*x^2+5)$Lisp
+
+   (5)  (1 x (2 0 . 3) (0 0 . 5))
+                                                            Type: SExpression
+\end{verbatim}
+The fourth object, $3x^2+5$ is from the domain {\bf POLY(INT)}. It is stored
+as the list
+\begin{verbatim}
+   (1 x (2 0 . 3) (0 0 . 5))
+\end{verbatim}
+From the domain {\bf POLY} (Vol 10.3, POLY) we see that
+\begin{verbatim}
+   Polynomial(R:Ring): ...
+      == SparseMultivariatePolynomial(R, Symbol) add ...
+\end{verbatim}
+So objects from this domain are represented as {\bf SMP(INT,SYMBOL)}. 
+From this domain we ss that 
+\begin{verbatim}
+   SparseMultivariatePolynomial(R: Ring,VarSet: OrderedSet): ...
+     == add
+       --representations
+       D := SparseUnivariatePolynomial(%)
+\end{verbatim}
+So objects from this domain are represented as a {\bf SUP(INT)}
+\begin{verbatim}
+   SparseUnivariatePolynomial(R:Ring): ...
+     == PolynomialRing(R,NonNegativeInteger) add
+\end{verbatim}
+So objects from this domain are represented as {\bf PR(INT,NNI)}
+\begin{verbatim}
+   PolynomialRing(R:Ring,E:OrderedAbelianMonoid): ...
+     FreeModule(R,E) add
+       --representations
+       Term:=  Record(k:E,c:R)
+       Rep:=  List Term
+\end{verbatim}
+So objects from this domain are represented as {\bf FM(INT,NNI)}
+\begin{verbatim}
+   FreeModule(R:Ring,S:OrderedSet):
+      == IndexedDirectProductAbelianGroup(R,S) add
+        --representations
+        Term:=  Record(k:S,c:R)
+        Rep:=  List Term
+\end{verbatim}
+So objects from this domain are represented as {\bf IDPAG(INT,NNI)}
+\begin{verbatim}
+   IndexedDirectProductAbelianGroup(A:AbelianGroup,S:OrderedSet):
+     ==  IndexedDirectProductAbelianMonoid(A,S) add
+\end{verbatim}
+So objects from this domain are represented as {\bf IDPAM(INT,NNI)}
+\begin{verbatim}
+   IndexedDirectProductAbelianMonoid(A:AbelianMonoid,S:OrderedSet):
+     ==  IndexedDirectProductObject(A,S) add
+       --representations
+       Term:=  Record(k:S,c:A)
+       Rep:=  List Term
+\end{verbatim}
+So objects from this domain are represented as {\bf IDPO(INT,NNI)}
+\begin{verbatim}
+IndexedDirectProductObject(A:SetCategory,S:OrderedSet):
+ == add
+       -- representations
+       Term:=  Record(k:S,c:A)
+       Rep:=  List Term
+\end{verbatim}
+
+\begin{verbatim}
+(6) -> devaluate((3*x^2+5)::FRAC(POLY(INT)))$Lisp
+
+   (6)  ((1 x (2 0 . 3) (0 0 . 5)) 0 . 1)
+                                                            Type: SExpression
+\end{verbatim}
+\begin{verbatim}
+(7) -> devaluate((3*x^2+5)::POLY(FRAC(INT)))$Lisp
+
+   (7)  (1 x (2 0 3 . 1) (0 0 5 . 1))
+                                                            Type: SExpression
+\end{verbatim}
+\begin{verbatim}
+(8) -> devaluate((3*x^2+5)::EXPR(INT))$Lisp
+
+   (8)  ((1 [[x,0,%symbol()()()],NIL,1,1024] (2 0 . 3) (0 0 . 5)) 0 . 1)
+                                                            Type: SExpression
+\end{verbatim}
+\begin{verbatim}
+(9) -> devaluate(w)$Lisp
+
+   (9)
+   (((PositiveInteger) . 1)  ((Float) 265633114661417543270 . - 65)
+    ((String) . luanne)  ((Polynomial (Integer)) 1 x (2 0 . 3) (0 0 . 5))
+    ((Fraction (Polynomial (Integer))) (1 x (2 0 . 3) (0 0 . 5)) 0 . 1)
+    ((Polynomial (Fraction (Integer))) 1 x (2 0 3 . 1) (0 0 5 . 1))
+
+     ((Expression (Integer))
+      (1 [[x,0,%symbol()()()],NIL,1,1024] (2 0 . 3) (0 0 . 5))  0  .  1)
+     )
+                                                            Type: SExpression
+\end{verbatim}
+
+
 \section{Makefile}
 This book is actually a literate program\cite{Knut92} and can contain 
 executable source code. In particular, the Makefile for this book
diff --git a/changelog b/changelog
index c397fc1..11bb609 100644
--- a/changelog
+++ b/changelog
@@ -1,3 +1,5 @@
+20150113 tpd src/axiom-website/patches.html 20150113.01.tpd.patch
+20150113 tpd books/bookvol3 remove |function| and regularize Spad code
 20150109 tpd src/axiom-website/patches.html 20150109.03.tpd.patch
 20150109 tpd books/bookvolbib add Stou07 reference
 20150109 tpd src/axiom-website/patches.html 20150109.02.tpd.patch
diff --git a/patch b/patch
index 7a2b880..1c3a3d0 100644
--- a/patch
+++ b/patch
@@ -1,23 +1,2 @@
-books/bookvolbib add Stou07 reference
+books/bookvol3 remove |function| and regularize Spad code
 
-@article{Stou07,
-  author = "Stoutemyer, David R.",
-  title = "Useful Computations Need Useful Numbers",
-  year = "2007",
-  publisher = "ACM",
-  journal = "Communications in Computer Algebra",
-  volume = "41",
-  number = "3",
-  abstract =
-    "Most of us have taken the exact rational and approximate numbers in
-    our computer algebra systems for granted for a long time, not thinking
-    to ask if they could be significantly better. With exact rational
-    arithmetic and adjustable-precision floating-point arithmetic to
-    precision limited only by the total computer memory or our patience,
-    what more could we want for such numbers?  It turns out that there is
-    much that can be done that permits us to obtain exact results more
-    often, more intelligible results, approximate results guaranteed to
-    have requested error bounds, and recovery of exact results from
-    approximate ones."
-
-}
diff --git a/src/axiom-website/patches.html b/src/axiom-website/patches.html
index c21c4a7..412912a 100644
--- a/src/axiom-website/patches.html
+++ b/src/axiom-website/patches.html
@@ -4950,6 +4950,8 @@ src/input/* fix failing tests across platforms<br/>
 books/bookvolbib add Fate13 reference<br/>
 <a href="patches/20150109.03.tpd.patch">20150109.03.tpd.patch</a>
 books/bookvolbib add Stou07 reference<br/>
+<a href="patches/20150113.01.tpd.patch">20150113.01.tpd.patch</a>
+books/bookvol3 remove |function| and regularize Spad code
  </body>
 </html>
 
-- 
1.7.5.4

