diff --git a/books/bookvol10.3.pamphlet b/books/bookvol10.3.pamphlet index 45a1be9..69bab0a 100644 --- a/books/bookvol10.3.pamphlet +++ b/books/bookvol10.3.pamphlet @@ -6256,6 +6256,361 @@ Automorphism(R:Ring): Join(Group, Eltable(R, R)) with %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \chapter{Chapter B} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{domain BBTREE BalancedBinaryTree} +<>= +-- tree.spad.pamphlet BalancedBinaryTree.input +)spool BalancedBinaryTree.output +)set message test on +)set message auto off +)clear all +--S 1 +lm := [3,5,7,11] +--R +--R +--R (1) [3,5,7,11] +--R Type: List PositiveInteger +--E 1 + +--S 2 +modTree(12,lm) +--R +--R +--R (2) [0,2,5,1] +--R Type: List Integer +--E 2 + +--S 3 +t := balancedBinaryTree(#lm, 0) +--R +--R +--R (3) [[0,0,0],0,[0,0,0]] +--R Type: BalancedBinaryTree NonNegativeInteger +--E 3 + +--S 4 +setleaves!(t,lm) +--R +--R +--R (4) [[3,0,5],0,[7,0,11]] +--R Type: BalancedBinaryTree NonNegativeInteger +--E 4 + +--S 5 +mapUp!(t,_*) +--R +--R +--R (5) 1155 +--R Type: PositiveInteger +--E 5 + +--S 6 +t +--R +--R +--R (6) [[3,15,5],1155,[7,77,11]] +--R Type: BalancedBinaryTree NonNegativeInteger +--E 6 + +--S 7 +mapDown!(t,12,_rem) +--R +--R +--R (7) [[0,12,2],12,[5,12,1]] +--R Type: BalancedBinaryTree NonNegativeInteger +--E 7 + +--S 8 +leaves % +--R +--R +--R (8) [0,2,5,1] +--R Type: List NonNegativeInteger +--E 8 + +--S 9 +squares := [x**2 rem m for x in % for m in lm] +--R +--R +--R (9) [0,4,4,1] +--R Type: List NonNegativeInteger +--E 9 + +--S 10 +chineseRemainder(%,lm) +--R +--R +--R (10) 144 +--R Type: PositiveInteger +--E 10 +)spool +)lisp (bye) +@ +<>= +==================================================================== +BalancedBinaryTree examples +==================================================================== + +BalancedBinaryTrees(S) is the domain of balanced binary trees with +elements of type S at the nodes. A binary tree is either empty or +else consists of a node having a value and two branches, each branch a +binary tree. A balanced binary tree is one that is balanced with +respect its leaves. One with 2^k leaves is perfectly "balanced": the +tree has minimum depth, and the left and right branch of every +interior node is identical in shape. + +Balanced binary trees are useful in algebraic computation for +so-called "divide-and-conquer" algorithms. Conceptually, the data +for a problem is initially placed at the root of the tree. The +original data is then split into two subproblems, one for each +subtree. And so on. Eventually, the problem is solved at the leaves +of the tree. A solution to the original problem is obtained by some +mechanism that can reassemble the pieces. In fact, an implementation +of the Chinese Remainder Algorithm using balanced binary trees was +first proposed by David Y. Y. Yun at the IBM T. J. Watson Research +Center in Yorktown Heights, New York, in 1978. It served as the +prototype for polymorphic algorithms in Axiom. + +In what follows, rather than perform a series of computations with a +single expression, the expression is reduced modulo a number of +integer primes, a computation is done with modular arithmetic for each +prime, and the Chinese Remainder Algorithm is used to obtain the +answer to the original problem. We illustrate this principle with the +computation of 12^2 = 144. + +A list of moduli: + + lm := [3,5,7,11] + [3,5,7,11] + Type: PositiveInteger + +The expression modTree(n, lm) creates a balanced binary tree with leaf +values n mod m for each modulus m in lm. + + modTree(12,lm) + [0, 2, 5, 1] + Type: List Integer + +Operation modTree does this using operations on balanced binary trees. +We trace its steps. Create a balanced binary tree t of zeros with +four leaves. + + t := balancedBinaryTree(#lm, 0) + [[0, 0, 0], 0, [0, 0, 0]] + Type: BalancedBinaryTree NonNegativeInteger + +The leaves of the tree are set to the individual moduli. + + setleaves!(t,lm) + [[3, 0, 5], 0, [7, 0, 11]] + Type: BalancedBinaryTree NonNegativeInteger + +mapUp! to do a bottom-up traversal of t, setting each interior node to +the product of the values at the nodes of its children. + + mapUp!(t,_*) + 1155 + Type: PositiveInteger + +The value at the node of every subtree is the product of the moduli +of the leaves of the subtree. + + t + [[3, 15, 5], 1155, [7, 77, 11]] + Type: BalancedBinaryTree NonNegativeInteger + +Operation mapDown!(t,a,fn) replaces the value v at each node of t by +fn(a,v). + + mapDown!(t,12,_rem) + [[0, 12, 2], 12, [5, 12, 1]] + Type: BalancedBinaryTree NonNegativeInteger + +The operation leaves returns the leaves of the resulting tree. In +this case, it returns the list of 12 mod m for each modulus m. + + leaves % + [0, 2, 5, 1] + Type: List NonNegativeInteger + +Compute the square of the images of 12 modulo each m. + + squares := [x**2 rem m for x in % for m in lm] + [0, 4, 4, 1] + Type: List NonNegativeInteger + +Call the Chinese Remainder Algorithm to get the answer for 12^2. + + chineseRemainder(%,lm) + 144 + Type: PositiveInteger + +See Also: +o )show BalancedBinaryTree +o $AXIOM/doc/src/algebra/tree.spad.dvi + +@ +\pagehead{BalancedBinaryTree}{BBTREE} +\pagepic{ps/v103balancedbinarytree.ps}{BBTREE}{1.00} +See also:\\ +\refto{Tree}{TREE} +\refto{BinaryTree}{BTREE} +\refto{BinarySearchTree}{BSTREE} +\refto{BinaryTournament}{BTOURN} +\refto{PendantTree}{PENDTREE} +<>= +)abbrev domain BBTREE BalancedBinaryTree +++ Description: \spadtype{BalancedBinaryTree(S)} is the domain of balanced +++ binary trees (bbtree). A balanced binary tree of \spad{2**k} leaves, +++ for some \spad{k > 0}, is symmetric, that is, the left and right +++ subtree of each interior node have identical shape. +++ In general, the left and right subtree of a given node can differ +++ by at most leaf node. +BalancedBinaryTree(S: SetCategory): Exports == Implementation where + Exports == BinaryTreeCategory(S) with + finiteAggregate + shallowlyMutable +-- BUG: applies wrong fnct for balancedBinaryTree(0,[1,2,3,4]) +-- balancedBinaryTree: (S, List S) -> % +-- ++ balancedBinaryTree(s, ls) creates a balanced binary tree with +-- ++ s at the interior nodes and elements of ls at the +-- ++ leaves. + balancedBinaryTree: (NonNegativeInteger, S) -> % + ++ balancedBinaryTree(n, s) creates a balanced binary tree with + ++ n nodes each with value s. + ++ + ++X balancedBinaryTree(4, 0) + + setleaves_!: (%, List S) -> % + ++ setleaves!(t, ls) sets the leaves of t in left-to-right order + ++ to the elements of ls. + ++ + ++X t1:=balancedBinaryTree(4, 0) + ++X setleaves!(t1,[1,2,3,4]) + + mapUp_!: (%, (S,S) -> S) -> S + ++ mapUp!(t,f) traverses balanced binary tree t in an "endorder" + ++ (left then right then node) fashion returning t with the value + ++ at each successive interior node of t replaced by + ++ f(l,r) where l and r are the values at the immediate + ++ left and right nodes. + ++ + ++X T1:=BalancedBinaryTree Integer + ++X t2:=balancedBinaryTree(4, 0)$T1 + ++X setleaves!(t2,[1,2,3,4]::List(Integer)) + ++X adder(a:Integer,b:Integer):Integer == a+b + ++X mapUp!(t2,adder) + ++X t2 + + mapUp_!: (%, %, (S,S,S,S) -> S) -> % + ++ mapUp!(t,t1,f) traverses balanced binary tree t in an "endorder" + ++ (left then right then node) fashion returning t with the value + ++ at each successive interior node of t replaced by + ++ f(l,r,l1,r1) where l and r are the values at the immediate + ++ left and right nodes. Values l1 and r1 are values at the + ++ corresponding nodes of a balanced binary tree t1, of identical + ++ shape at t. + ++ + ++X T1:=BalancedBinaryTree Integer + ++X t2:=balancedBinaryTree(4, 0)$T1 + ++X setleaves!(t2,[1,2,3,4]::List(Integer)) + ++X adder4(i:INT,j:INT,k:INT,l:INT):INT == i+j+k+l + ++X mapUp!(t2,t2,adder4) + ++X t2 + + mapDown_!: (%,S,(S,S) -> S) -> % + ++ mapDown!(t,p,f) returns t after traversing t in "preorder" + ++ (node then left then right) fashion replacing the successive + ++ interior nodes as follows. The root value x is + ++ replaced by q := f(p,x). The mapDown!(l,q,f) and + ++ mapDown!(r,q,f) are evaluated for the left and right subtrees + ++ l and r of t. + ++ + ++X T1:=BalancedBinaryTree Integer + ++X t2:=balancedBinaryTree(4, 0)$T1 + ++X setleaves!(t2,[1,2,3,4]::List(Integer)) + ++X adder(i:Integer,j:Integer):Integer == i+j + ++X mapDown!(t2,4::INT,adder) + ++X t2 + + mapDown_!: (%,S, (S,S,S) -> List S) -> % + ++ mapDown!(t,p,f) returns t after traversing t in "preorder" + ++ (node then left then right) fashion replacing the successive + ++ interior nodes as follows. Let l and r denote the left and + ++ right subtrees of t. The root value x of t is replaced by p. + ++ Then f(value l, value r, p), where l and r denote the left + ++ and right subtrees of t, is evaluated producing two values + ++ pl and pr. Then \spad{mapDown!(l,pl,f)} and \spad{mapDown!(l,pr,f)} + ++ are evaluated. + ++ + ++X T1:=BalancedBinaryTree Integer + ++X t2:=balancedBinaryTree(4, 0)$T1 + ++X setleaves!(t2,[1,2,3,4]::List(Integer)) + ++X adder3(i:Integer,j:Integer,k:Integer):List Integer == [i+j,j+k] + ++X mapDown!(t2,4::INT,adder3) + ++X t2 + + Implementation == BinaryTree(S) add + Rep := BinaryTree(S) + leaf? x == + empty? x => false + empty? left x and empty? right x +-- balancedBinaryTree(x: S, u: List S) == +-- n := #u +-- n = 0 => empty() +-- setleaves_!(balancedBinaryTree(n, x), u) + setleaves_!(t, u) == + n := #u + n = 0 => + empty? t => t + error "the tree and list must have the same number of elements" + n = 1 => + setvalue_!(t,first u) + t + m := n quo 2 + acc := empty()$(List S) + for i in 1..m repeat + acc := [first u,:acc] + u := rest u + setleaves_!(left t, reverse_! acc) + setleaves_!(right t, u) + t + balancedBinaryTree(n: NonNegativeInteger, val: S) == + n = 0 => empty() + n = 1 => node(empty(),val,empty()) + m := n quo 2 + node(balancedBinaryTree(m, val), val, + balancedBinaryTree((n - m) pretend NonNegativeInteger, val)) + mapUp_!(x,fn) == + empty? x => error "mapUp! called on a null tree" + leaf? x => x.value + x.value := fn(mapUp_!(x.left,fn),mapUp_!(x.right,fn)) + mapUp_!(x,y,fn) == + empty? x => error "mapUp! is called on a null tree" + leaf? x => + leaf? y => x + error "balanced binary trees are incompatible" + leaf? y => error "balanced binary trees are incompatible" + mapUp_!(x.left,y.left,fn) + mapUp_!(x.right,y.right,fn) + x.value := fn(x.left.value,x.right.value,y.left.value,y.right.value) + x + mapDown_!(x: %, p: S, fn: (S,S) -> S ) == + empty? x => x + x.value := fn(p, x.value) + mapDown_!(x.left, x.value, fn) + mapDown_!(x.right, x.value, fn) + x + mapDown_!(x: %, p: S, fn: (S,S,S) -> List S) == + empty? x => x + x.value := p + leaf? x => x + u := fn(x.left.value, x.right.value, p) + mapDown_!(x.left, u.1, fn) + mapDown_!(x.right, u.2, fn) + x + +@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{domain BPADIC BalancedPAdicInteger} \pagehead{BalancedPAdicInteger}{BPADIC} \pagepic{ps/v103balancedpadicinteger.ps}{BPADIC}{1.00} @@ -7189,6 +7544,395 @@ BinaryFile: Cat == Def where @ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{domain BSTREE BinarySearchTree} +<>= +-- tree.spad.pamphlet BinarySearchTree.input +)spool BinarySearchTree.output +)set message test on +)set message auto off +)clear all +--S 1 of 12 +lv := [8,3,5,4,6,2,1,5,7] +--R +--R +--R (1) [8,3,5,4,6,2,1,5,7] +--R Type: List PositiveInteger +--E 1 + +--S 2 of 12 +t := binarySearchTree lv +--R +--R +--R (2) [[[1,2,.],3,[4,5,[5,6,7]]],8,.] +--R Type: BinarySearchTree PositiveInteger +--E 2 + +--S 3 of 12 +emptybst := empty()$BSTREE(INT) +--R +--R +--R (3) [] +--R Type: BinarySearchTree Integer +--E 3 + +--S 4 of 12 +t1 := insert!(8,emptybst) +--R +--R +--R (4) 8 +--R Type: BinarySearchTree Integer +--E 4 + +--S 5 of 12 +insert!(3,t1) +--R +--R +--R (5) [3,8,.] +--R Type: BinarySearchTree Integer +--E 5 + +--S 6 of 12 +leaves t +--R +--R +--R (6) [1,4,5,7] +--R Type: List PositiveInteger +--E 6 + +--S 7 of 12 +split(3,t) +--R +--R +--R (7) [less= [1,2,.],greater= [[.,3,[4,5,[5,6,7]]],8,.]] +--RType: Record(less: BinarySearchTree PositiveInteger,greater: BinarySearchTree PositiveInteger) +--E 7 + +--S 8 of 12 +insertRoot: (INT,BSTREE INT) -> BSTREE INT +--R +--R Type: Void +--E 8 + +--S 9 of 12 +insertRoot(x, t) == + a := split(x, t) + node(a.less, x, a.greater) +--R +--R Type: Void +--E 9 + +--S 10 of 12 +buildFromRoot ls == reduce(insertRoot,ls,emptybst) +--R +--R Type: Void +--E 10 + +--S 11 of 12 +rt := buildFromRoot reverse lv +--R +--R Compiling function buildFromRoot with type List PositiveInteger -> +--R BinarySearchTree Integer +--R Compiling function insertRoot with type (Integer,BinarySearchTree +--R Integer) -> BinarySearchTree Integer +--R +--R (11) [[[1,2,.],3,[4,5,[5,6,7]]],8,.] +--R Type: BinarySearchTree Integer +--E 11 + +--S 12 of 12 +(t = rt)@Boolean +--R +--R +--R (12) true +--R Type: Boolean +--E 12 +)spool +)lisp (bye) +@ +<>= +==================================================================== +BinarySearchTree examples +==================================================================== + +BinarySearchTree(R) is the domain of binary trees with elements of +type R, ordered across the nodes of the tree. A non-empty binary +search tree has a value of type R, and right and left binary search +subtrees. If a subtree is empty, it is displayed as a period ("."). + +Define a list of values to be placed across the tree. The resulting +tree has 8 at the root; all other elements are in the left subtree. + + lv := [8,3,5,4,6,2,1,5,7] + [8, 3, 5, 4, 6, 2, 1, 5, 7] + Type: List PositiveInteger + +A convenient way to create a binary search tree is to apply the +operation binarySearchTree to a list of elements. + + t := binarySearchTree lv + [[[1, 2, .], 3, [4, 5, [5, 6, 7]]], 8, .] + Type: BinarySearchTree PositiveInteger + +Another approach is to first create an empty binary search tree of integers. + + emptybst := empty()$BSTREE(INT) + [] + Type: BinarySearchTree Integer + +Insert the value 8. This establishes 8 as the root of the binary +search tree. Values inserted later that are less than 8 get stored in +the left subtree, others in the right subtree. + + t1 := insert!(8,emptybst) + 8 + Type: BinarySearchTree Integer + +Insert the value 3. This number becomes the root of the left subtree +of t1. For optimal retrieval, it is thus important to insert the +middle elements first. + + insert!(3,t1) + [3, 8, .] + Type: BinarySearchTree Integer + +We go back to the original tree t. The leaves of the binary search +tree are those which have empty left and right subtrees. + + leaves t + [1, 4, 5, 7] + Type: List PositiveInteger + +The operation split(k,t) returns a record containing the two subtrees: +one with all elements "less" than k, another with elements "greater" +than k. + + split(3,t) + [less=[1, 2, .], greater=[[., 3, [4, 5, [5, 6, 7]]], 8, .]] + Type: Record(less: BinarySearchTree PositiveInteger,greater: + BinarySearchTree PositiveInteger) + +Define insertRoot to insert new elements by creating a new node. + + insertRoot: (INT,BSTREE INT) -> BSTREE INT + Type: Void + +The new node puts the inserted value between its "less" tree and +"greater" tree. + + + insertRoot(x, t) == + a := split(x, t) + node(a.less, x, a.greater) + Type: Void + + +Function buildFromRoot builds a binary search tree from a list +of elements ls and the empty tree emptybst. + + buildFromRoot ls == reduce(insertRoot,ls,emptybst) + Type: Void + +Apply this to the reverse of the list lv. + + rt := buildFromRoot reverse lv + [[[1, 2, . ], 3, [4, 5, [5, 6, 7]]], 8, .] + Type: BinarySearchTree Integer + +Have Axiom check that these are equal. + + (t = rt)@Boolean + true + Type: Boolean + +See Also: +o )show BinarySearchTree +o $AXIOM/doc/src/algebra/tree.spad.dvi + +@ +\pagehead{BinarySearchTree}{BSTREE} +\pagepic{ps/v103binarysearchtree.ps}{BSTREE}{1.00} +See also:\\ +\refto{Tree}{TREE} +\refto{BinaryTree}{BTREE} +\refto{BinaryTournament}{BTOURN} +\refto{BalancedBinaryTree}{BBTREE} +\refto{PendantTree}{PENDTREE} +<>= +)abbrev domain BSTREE BinarySearchTree +++ Description: BinarySearchTree(S) is the domain of +++ a binary trees where elements are ordered across the tree. +++ A binary search tree is either empty or has +++ a value which is an S, and a +++ right and left which are both BinaryTree(S) +++ Elements are ordered across the tree. +BinarySearchTree(S: OrderedSet): Exports == Implementation where + Exports == BinaryTreeCategory(S) with + shallowlyMutable + finiteAggregate + binarySearchTree: List S -> % + ++ binarySearchTree(l) \undocumented + ++ + ++X binarySearchTree [1,2,3,4] + + insert_!: (S,%) -> % + ++ insert!(x,b) inserts element x as leaves into binary search tree b. + ++ + ++X t1:=binarySearchTree [1,2,3,4] + ++X insert!(5,t1) + + insertRoot_!: (S,%) -> % + ++ insertRoot!(x,b) inserts element x as a root of binary search tree b. + ++ + ++X t1:=binarySearchTree [1,2,3,4] + ++X insertRoot!(5,t1) + + split: (S,%) -> Record(less: %, greater: %) + ++ split(x,b) splits binary tree b into two trees, one with elements + ++ greater than x, the other with elements less than x. + ++ + ++X t1:=binarySearchTree [1,2,3,4] + ++X split(3,t1) + + Implementation == BinaryTree(S) add + Rep := BinaryTree(S) + binarySearchTree(u:List S) == + null u => empty() + tree := binaryTree(first u) + for x in rest u repeat insert_!(x,tree) + tree + insert_!(x,t) == + empty? t => binaryTree(x) + x >= value t => + setright_!(t,insert_!(x,right t)) + t + setleft_!(t,insert_!(x,left t)) + t + split(x,t) == + empty? t => [empty(),empty()] + x > value t => + a := split(x,right t) + [node(left t, value t, a.less), a.greater] + a := split(x,left t) + [a.less, node(a.greater, value t, right t)] + insertRoot_!(x,t) == + a := split(x,t) + node(a.less, x, a.greater) + +@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{domain BTOURN BinaryTournament} +A BinaryTournament(S) is the domain of binary trees where elements are +ordered down the tree. A binary search tree is either empty or is a +node containing a value of type S, and a right and a left which are +both BinaryTree(S) +\pagehead{BinaryTournament}{BTOURN} +\pagepic{ps/v103binarytournament.ps}{BTOURN}{1.00} +See also:\\ +\refto{Tree}{TREE} +\refto{BinaryTree}{BTREE} +\refto{BinarySearchTree}{BSTREE} +\refto{BalancedBinaryTree}{BBTREE} +\refto{PendantTree}{PENDTREE} +<>= +)abbrev domain BTOURN BinaryTournament +BinaryTournament(S: OrderedSet): Exports == Implementation where + Exports == BinaryTreeCategory(S) with + shallowlyMutable + binaryTournament: List S -> % + ++ binaryTournament(ls) creates a binary tournament with the + ++ elements of ls as values at the nodes. + ++ + ++X binaryTournament [1,2,3,4] + + insert_!: (S,%) -> % + ++ insert!(x,b) inserts element x as leaves into binary tournament b. + ++ + ++X t1:=binaryTournament [1,2,3,4] + ++X insert!(5,t1) + ++X t1 + + Implementation == BinaryTree(S) add + Rep := BinaryTree(S) + binaryTournament(u:List S) == + null u => empty() + tree := binaryTree(first u) + for x in rest u repeat insert_!(x,tree) + tree + insert_!(x,t) == + empty? t => binaryTree(x) + x > value t => + setleft_!(t,copy t) + setvalue_!(t,x) + setright_!(t,empty()) + setright_!(t,insert_!(x,right t)) + t + +@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{domain BTREE BinaryTree} +\pagehead{BinaryTree}{BTREE} +\pagepic{ps/v103binarytree.ps}{BTREE}{1.00} +See also:\\ +\refto{Tree}{TREE} +\refto{BinarySearchTree}{BSTREE} +\refto{BinaryTournament}{BTOURN} +\refto{BalancedBinaryTree}{BBTREE} +\refto{PendantTree}{PENDTREE} +<>= +)abbrev domain BTREE BinaryTree +++ Description: \spadtype{BinaryTree(S)} is the domain of all +++ binary trees. A binary tree over \spad{S} is either empty or has +++ a \spadfun{value} which is an S and a \spadfun{right} +++ and \spadfun{left} which are both binary trees. +BinaryTree(S: SetCategory): Exports == Implementation where + Exports == BinaryTreeCategory(S) with + binaryTree: S -> % + ++ binaryTree(v) is an non-empty binary tree + ++ with value v, and left and right empty. + ++ + ++X t1:=binaryTree([1,2,3]) + + binaryTree: (%,S,%) -> % + ++ binaryTree(l,v,r) creates a binary tree with + ++ value v with left subtree l and right subtree r. + ++ + ++X t1:=binaryTree([1,2,3]) + ++X t2:=binaryTree([4,5,6]) + ++X binaryTree(t1,[7,8,9],t2) + + Implementation == add + Rep := List Tree S + t1 = t2 == (t1::Rep) =$Rep (t2::Rep) + empty()== [] pretend % + empty()== [] pretend % + node(l,v,r) == cons(tree(v,l:Rep),r:Rep) + binaryTree(l,v,r) == node(l,v,r) + binaryTree(v:S) == node(empty(),v,empty()) + empty? t == empty?(t)$Rep + leaf? t == empty? t or empty? left t and empty? right t + right t == + empty? t => error "binaryTree:no right" + rest t + left t == + empty? t => error "binaryTree:no left" + children first t + value t== + empty? t => error "binaryTree:no value" + value first t + setvalue_! (t,nd)== + empty? t => error "binaryTree:no value to set" + setvalue_!(first(t:Rep),nd) + nd + setleft_!(t1,t2) == + empty? t1 => error "binaryTree:no left to set" + setchildren_!(first(t1:Rep),t2:Rep) + t1 + setright_!(t1,t2) == + empty? t1 => error "binaryTree:no right to set" + setrest_!(t1:List Tree S,t2) + +@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{domain BITS Bits} <>= "BITS" -> "BTAGG" @@ -18332,6 +19076,140 @@ Equation(S: Type): public == private where @ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{domain EQTBL EqTable} +<>= +-- table.spad.pamphlet EqTable.input +)spool EqTable.output +)set message test on +)set message auto off +)clear all +--S 1 of 6 +e: EqTable(List Integer, Integer) := table() +--R +--R +--R (1) table() +--R Type: EqTable(List Integer,Integer) +--E 1 + +--S 2 of 6 +l1 := [1,2,3] +--R +--R +--R (2) [1,2,3] +--R Type: List PositiveInteger +--E 2 + +--S 3 of 6 +l2 := [1,2,3] +--R +--R +--R (3) [1,2,3] +--R Type: List PositiveInteger +--E 3 + +--S 4 of 6 +e.l1 := 111 +--R +--R +--R (4) 111 +--R Type: PositiveInteger +--E 4 + +--S 5 of 6 +e.l2 := 222 +--R +--R +--R (5) 222 +--R Type: PositiveInteger +--E 5 + +--S 6 of 6 +e.l1 +--R +--R +--R (6) 111 +--R Type: PositiveInteger +--E 6 +)spool +)lisp (bye) +@ +<>= +==================================================================== +EqTable examples +==================================================================== + +The EqTable domain provides tables where the keys are compared using +eq?. Keys are considered equal only if they are the same instance of +a structure. This is useful if the keys are themselves updatable +structures. Otherwise, all operations are the same as for type Table. + +The operation table is here used to create a table where the keys are +lists of integers. + + e: EqTable(List Integer, Integer) := table() + table() + Type: EqTable(List Integer,Integer) + +These two lists are equal according to =, but not according to eq?. + + l1 := [1,2,3] + [1,2,3] + Type: List PositiveInteger + + l2 := [1,2,3] + [1,2,3] + Type: List PositiveInteger +Because the two lists are not eq?, separate values can be stored under +each. + + e.l1 := 111 + 111 + Type: PositiveInteger + + e.l2 := 222 + 222 + Type: PositiveInteger + + e.l1 + 111 + Type: PositiveInteger + +See Also: +o )help Table +o )show EqTable +o $AXIOM/doc/src/algebra/table.spad.dvi + +@ +\pagehead{EqTable}{EQTBL} +\pagepic{ps/v103eqtable.ps}{EQTBL}{1.00} +See also:\\ +\refto{HashTable}{HASHTBL} +\refto{InnerTable}{INTABL} +\refto{Table}{TABLE} +\refto{StringTable}{STRTBL} +\refto{GeneralSparseTable}{GSTBL} +\refto{SparseTable}{STBL} +<>= +)abbrev domain EQTBL EqTable +++ Author: Stephen M. Watt +++ Date Created: +++ Date Last Updated: June 21, 1991 +++ Basic Operations: +++ Related Domains: HashTable, Table, StringTable +++ Also See: +++ AMS Classifications: +++ Keywords: equation +++ Examples: +++ References: +++ Description: +++ This domain provides tables where the keys are compared using +++ \spadfun{eq?}. Thus keys are considered equal only if they +++ are the same instance of a structure. +EqTable(Key: SetCategory, Entry: SetCategory) == + HashTable(Key, Entry, "EQ") + +@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{domain EMR EuclideanModularRing} \pagehead{EuclideanModularRing}{EMR} \pagepic{ps/v103euclideanmodularring.ps}{EMR}{1.00} @@ -30320,6 +31198,252 @@ GeneralPolynomialSet(R,E,VarSet,P) : Exports == Implementation where @ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{domain GSTBL GeneralSparseTable} +<>= +-- table.spad.pamphlet GeneralSparseTable.input +)spool GeneralSparseTable.output +)set message test on +)set message auto off +)set break resume +)clear all +--S 1 of 7 +patrons: GeneralSparseTable(String, Integer, KeyedAccessFile(Integer), 0) := table() ; +--E 1 + +--S 2 of 7 +patrons."Smith" := 10500 +--E 2 + +--S 3 of 7 +patrons."Jones" := 22000 +--E 3 + +--S 4 of 7 +patrons."Jones" +--E 4 + +--S 5 of 7 +patrons."Stingy" +--E 5 + +--S 6 of 7 +reduce(+, entries patrons) +--E 6 + +--S 7 of 7 +)system rm -r kaf*.sdata +--E 7 +)spool +)lisp (bye) +@ +<>= +==================================================================== +GeneralSparseTable +==================================================================== + +Sometimes when working with tables there is a natural value to use as +the entry in all but a few cases. The GeneralSparseTable constructor +can be used to provide any table type with a default value for +entries. + +Suppose we launched a fund-raising campaign to raise fifty thousand +dollars. To record the contributions, we want a table with strings as +keys (for the names) and integer entries (for the amount). In a data +base of cash contributions, unless someone has been explicitly +entered, it is reasonable to assume they have made a zero dollar +contribution. + +This creates a keyed access file with default entry 0. + + patrons: GeneralSparseTable(String, Integer, KeyedAccessFile(Integer), 0) := table() ; + +Now patrons can be used just as any other table. Here we record two gifts. + + patrons."Smith" := 10500 + + patrons."Jones" := 22000 + +Now let us look up the size of the contributions from Jones and Stingy. + + patrons."Jones" + + patrons."Stingy" + +Have we met our seventy thousand dollar goal? + + reduce(+, entries patrons) + +So the project is cancelled and we can delete the data base: + + )system rm -r kaf*.sdata + +See Also: +o )show GeneralSparseTable +o $AXIOM/doc/src/algebra/table.spad.dvi + +@ +\pagehead{GeneralSparseTable}{GSTBL} +\pagepic{ps/v103generalsparsetable.ps}{GSTBL}{1.00} +See also:\\ +\refto{HashTable}{HASHTBL} +\refto{InnerTable}{INTABL} +\refto{Table}{TABLE} +\refto{EqTable}{EQTBL} +\refto{StringTable}{STRTBL} +\refto{SparseTable}{STBL} +<>= +)abbrev domain GSTBL GeneralSparseTable +++ Author: Stephen M. Watt +++ Date Created: 1986 +++ Date Last Updated: June 21, 1991 +++ Basic Operations: +++ Related Domains: Table +++ Also See: +++ AMS Classifications: +++ Keywords: equation +++ Examples: +++ References: +++ Description: +++ A sparse table has a default entry, which is returned if no other +++ value has been explicitly stored for a key. +GeneralSparseTable(Key, Entry, Tbl, dent): TableAggregate(Key, Entry) == Impl + where + Key, Entry: SetCategory + Tbl: TableAggregate(Key, Entry) + dent: Entry + + Impl ==> Tbl add + Rep := Tbl + + elt(t:%, k:Key) == + (u := search(k, t)$Rep) case "failed" => dent + u::Entry + + setelt(t:%, k:Key, e:Entry) == + e = dent => (remove_!(k, t); e) + setelt(t, k, e)$Rep + + search(k:Key, t:%) == + (u := search(k, t)$Rep) case "failed" => dent + u + +@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{domain GTSET GeneralTriangularSet} +\pagehead{GeneralTriangularSet}{GTSET} +\pagepic{ps/v103generaltriangularset.ps}{GTSET}{1.00} +See also:\\ +\refto{WuWenTsunTriangularSet}{WUTSET} +<>= +)abbrev domain GTSET GeneralTriangularSet +++ Author: Marc Moreno Maza (marc@nag.co.uk) +++ Date Created: 10/06/1995 +++ Date Last Updated: 06/12/1996 +++ Basic Functions: +++ Related Constructors: +++ Also See: +++ AMS Classifications: +++ Keywords: +++ Description: +++ A domain constructor of the category \axiomType{TriangularSetCategory}. +++ The only requirement for a list of polynomials to be a member of such +++ a domain is the following: no polynomial is constant and two distinct +++ polynomials have distinct main variables. Such a triangular set may +++ not be auto-reduced or consistent. Triangular sets are stored +++ as sorted lists w.r.t. the main variables of their members but they +++ are displayed in reverse order.\newline +++ References : +++ [1] P. AUBRY, D. LAZARD and M. MORENO MAZA "On the Theories +++ of Triangular Sets" Journal of Symbol. Comp. (to appear) +++ Version: 1 + +GeneralTriangularSet(R,E,V,P) : Exports == Implementation where + + R : IntegralDomain + E : OrderedAbelianMonoidSup + V : OrderedSet + P : RecursivePolynomialCategory(R,E,V) + N ==> NonNegativeInteger + Z ==> Integer + B ==> Boolean + LP ==> List P + PtoP ==> P -> P + + Exports == TriangularSetCategory(R,E,V,P) + + Implementation == add + + Rep ==> LP + + rep(s:$):Rep == s pretend Rep + per(l:Rep):$ == l pretend $ + + copy ts == + per(copy(rep(ts))$LP) + empty() == + per([]) + empty?(ts:$) == + empty?(rep(ts)) + parts ts == + rep(ts) + members ts == + rep(ts) + map (f : PtoP, ts : $) : $ == + construct(map(f,rep(ts))$LP)$$ + map! (f : PtoP, ts : $) : $ == + construct(map!(f,rep(ts))$LP)$$ + member? (p,ts) == + member?(p,rep(ts))$LP + + unitIdealIfCan() == + "failed"::Union($,"failed") + roughUnitIdeal? ts == + false + + -- the following assume that rep(ts) is decreasingly sorted + -- w.r.t. the main variavles of the polynomials in rep(ts) + coerce(ts:$) : OutputForm == + lp : List(P) := reverse(rep(ts)) + brace([p::OutputForm for p in lp]$List(OutputForm))$OutputForm + mvar ts == + empty? ts => error"failed in mvar : $ -> V from GTSET" + mvar(first(rep(ts)))$P + first ts == + empty? ts => "failed"::Union(P,"failed") + first(rep(ts))::Union(P,"failed") + last ts == + empty? ts => "failed"::Union(P,"failed") + last(rep(ts))::Union(P,"failed") + rest ts == + empty? ts => "failed"::Union($,"failed") + per(rest(rep(ts)))::Union($,"failed") + coerce(ts:$) : (List P) == + rep(ts) + collectUpper (ts,v) == + empty? ts => ts + lp := rep(ts) + newlp : Rep := [] + while (not empty? lp) and (mvar(first(lp)) > v) repeat + newlp := cons(first(lp),newlp) + lp := rest lp + per(reverse(newlp)) + collectUnder (ts,v) == + empty? ts => ts + lp := rep(ts) + while (not empty? lp) and (mvar(first(lp)) >= v) repeat + lp := rest lp + per(lp) + + -- for another domain of TSETCAT build on this domain GTSET + -- the following operations must be redefined + extendIfCan(ts:$,p:P) == + ground? p => "failed"::Union($,"failed") + empty? ts => (per([unitCanonical(p)]$LP))::Union($,"failed") + not (mvar(ts) < mvar(p)) => "failed"::Union($,"failed") + (per(cons(p,rep(ts))))::Union($,"failed") + +@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{domain GSERIES GeneralUnivariatePowerSeries} \pagehead{GeneralUnivariatePowerSeries}{GSERIES} \pagepic{ps/v103generalunivariatepowerseries.ps}{GSERIES}{1.00} @@ -30436,6 +31560,67 @@ GeneralUnivariatePowerSeries(Coef,var,cen): Exports == Implementation where %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \chapter{Chapter H} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{domain HASHTBL HashTable} +\pagehead{HashTable}{HASHTBL} +\pagepic{ps/v103hashtable.ps}{HASHTBL}{1.00} +See also:\\ +\refto{InnerTable}{INTABL} +\refto{Table}{TABLE} +\refto{EqTable}{EQTBL} +\refto{StringTable}{STRTBL} +\refto{GeneralSparseTable}{GSTBL} +\refto{SparseTable}{STBL} +<>= +)abbrev domain HASHTBL HashTable +++ Author: Stephen M. Watt +++ Date Created: 1985 +++ Date Last Updated: June 21, 1991 +++ Basic Operations: +++ Related Domains: Table, EqTable, StringTable +++ Also See: +++ AMS Classifications: +++ Keywords: +++ Examples: +++ References: +++ Description: +++ This domain provides access to the underlying Lisp hash tables. +++ By varying the hashfn parameter, tables suited for different +++ purposes can be obtained. + +HashTable(Key, Entry, hashfn): Exports == Implementation where + Key, Entry: SetCategory + hashfn: String -- Union("EQ", "UEQUAL", "CVEC", "ID") + + Exports ==> TableAggregate(Key, Entry) with + finiteAggregate + + Implementation ==> add + Pair ==> Record(key: Key, entry: Entry) + Ex ==> OutputForm + failMsg := GENSYM()$Lisp + + t1 = t2 == EQ(t1, t2)$Lisp + keys t == HKEYS(t)$Lisp + # t == HCOUNT(t)$Lisp + setelt(t, k, e) == HPUT(t,k,e)$Lisp + remove_!(k:Key, t:%) == + r := HGET(t,k,failMsg)$Lisp + not EQ(r,failMsg)$Lisp => + HREM(t, k)$Lisp + r pretend Entry + "failed" + + empty() == + MAKE_-HASHTABLE(INTERN(hashfn)$Lisp, + INTERN("STRONG")$Lisp)$Lisp + + search(k:Key, t:%) == + r := HGET(t, k, failMsg)$Lisp + not EQ(r, failMsg)$Lisp => r pretend Entry + "failed" + +@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{domain HEAP Heap} <>= -- bags.spad.pamphlet Heap.input @@ -34581,6 +35766,183 @@ InnerSparseUnivariatePowerSeries(Coef): Exports == Implementation where @ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{domain INTABL InnerTable} +\pagehead{InnerTable}{INTABL} +\pagepic{ps/v103innertable.ps}{INTABL}{1.00} +See also:\\ +\refto{HashTable}{HASHTBL} +\refto{Table}{TABLE} +\refto{EqTable}{EQTBL} +\refto{StringTable}{STRTBL} +\refto{GeneralSparseTable}{GSTBL} +\refto{SparseTable}{STBL} +<>= +)abbrev domain INTABL InnerTable +++ Author: Barry Trager +++ Date Created: 1992 +++ Date Last Updated: Sept 15, 1992 +++ Basic Operations: +++ Related Domains: HashTable, AssociationList, Table +++ Also See: +++ AMS Classifications: +++ Keywords: +++ Examples: +++ References: +++ Description: +++ This domain is used to provide a conditional "add" domain +++ for the implementation of \spadtype{Table}. + +InnerTable(Key: SetCategory, Entry: SetCategory, addDom):Exports == Implementation where + addDom : TableAggregate(Key, Entry) with + finiteAggregate + Exports ==> TableAggregate(Key, Entry) with + finiteAggregate + Implementation ==> addDom + +@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{domain ITAYLOR InnerTaylorSeries} +\pagehead{InnerTaylorSeries}{ITAYLOR} +\pagepic{ps/v103innertaylorseries.ps}{ITAYLOR}{1.00} +See also:\\ +\refto{UnivariateTaylorSeries}{UTS} +<>= +)abbrev domain ITAYLOR InnerTaylorSeries +++ Author: Clifton J. Williamson +++ Date Created: 21 December 1989 +++ Date Last Updated: 25 February 1989 +++ Basic Operations: +++ Related Domains: UnivariateTaylorSeries(Coef,var,cen) +++ Also See: +++ AMS Classifications: +++ Keywords: stream, dense Taylor series +++ Examples: +++ References: +++ Description: Internal package for dense Taylor series. +++ This is an internal Taylor series type in which Taylor series +++ are represented by a \spadtype{Stream} of \spadtype{Ring} elements. +++ For univariate series, the \spad{Stream} elements are the Taylor +++ coefficients. For multivariate series, the \spad{n}th Stream element +++ is a form of degree n in the power series variables. + +InnerTaylorSeries(Coef): Exports == Implementation where + Coef : Ring + I ==> Integer + NNI ==> NonNegativeInteger + ST ==> Stream Coef + STT ==> StreamTaylorSeriesOperations Coef + + Exports ==> Ring with + coefficients: % -> Stream Coef + ++\spad{coefficients(x)} returns a stream of ring elements. + ++ When x is a univariate series, this is a stream of Taylor + ++ coefficients. When x is a multivariate series, the + ++ \spad{n}th element of the stream is a form of + ++ degree n in the power series variables. + series: Stream Coef -> % + ++\spad{series(s)} creates a power series from a stream of + ++ ring elements. + ++ For univariate series types, the stream s should be a stream + ++ of Taylor coefficients. For multivariate series types, the + ++ stream s should be a stream of forms the \spad{n}th element + ++ of which is a + ++ form of degree n in the power series variables. + pole?: % -> Boolean + ++\spad{pole?(x)} tests if the series x has a pole. + ++ Note: this is false when x is a Taylor series. + order: % -> NNI + ++\spad{order(x)} returns the order of a power series x, + ++ i.e. the degree of the first non-zero term of the series. + order: (%,NNI) -> NNI + ++\spad{order(x,n)} returns the minimum of n and the order of x. + "*" : (Coef,%)->% + ++\spad{c*x} returns the product of c and the series x. + "*" : (%,Coef)->% + ++\spad{x*c} returns the product of c and the series x. + "*" : (%,Integer)->% + ++\spad{x*i} returns the product of integer i and the series x. + if Coef has IntegralDomain then IntegralDomain + --++ An IntegralDomain provides 'exquo' + + Implementation ==> add + + Rep := Stream Coef + +--% declarations + x,y: % + +--% definitions + + -- In what follows, we will be calling operations on Streams + -- which are NOT defined in the package Stream. Thus, it is + -- necessary to explicitly pass back and forth between Rep and %. + -- This will be done using the functions 'stream' and 'series'. + + stream : % -> Stream Coef + stream x == x pretend Stream(Coef) + series st == st pretend % + + 0 == coerce(0)$STT + 1 == coerce(1)$STT + + x = y == + -- tests if two power series are equal + -- difference must be a finite stream of zeroes of length <= n + 1, + -- where n = $streamCount$Lisp + st : ST := stream(x - y) + n : I := _$streamCount$Lisp + for i in 0..n repeat + empty? st => return true + frst st ^= 0 => return false + st := rst st + empty? st + + coefficients x == stream x + + x + y == stream(x) +$STT stream(y) + x - y == stream(x) -$STT stream(y) + (x:%) * (y:%) == stream(x) *$STT stream(y) + - x == -$STT (stream x) + (i:I) * (x:%) == (i::Coef) *$STT stream x + (x:%) * (i:I) == stream(x) *$STT (i::Coef) + (c:Coef) * (x:%) == c *$STT stream x + (x:%) * (c:Coef) == stream(x) *$STT c + + recip x == + (rec := recip$STT stream x) case "failed" => "failed" + series(rec :: ST) + + if Coef has IntegralDomain then + + x exquo y == + (quot := stream(x) exquo$STT stream(y)) case "failed" => "failed" + series(quot :: ST) + + x:% ** n:NNI == + n = 0 => 1 + expt(x,n :: PositiveInteger)$RepeatedSquaring(%) + + characteristic() == characteristic()$Coef + pole? x == false + + iOrder: (ST,NNI,NNI) -> NNI + iOrder(st,n,n0) == + (n = n0) or (empty? st) => n0 + zero? frst st => iOrder(rst st,n + 1,n0) + n + + order(x,n) == iOrder(stream x,0,n) + + iOrder2: (ST,NNI) -> NNI + iOrder2(st,n) == + empty? st => error "order: series has infinite order" + zero? frst st => iOrder2(rst st,n + 1) + n + + order x == iOrder2(stream x,0) + +@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{domain INFORM InputForm} \pagehead{InputForm}{INFORM} \pagepic{ps/v103inputform.ps}{INFORM}{1.00} @@ -49302,6 +50664,62 @@ PatternMatchResult(R:SetCategory, S:SetCategory): SetCategory with @ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{domain PENDTREE PendantTree} +A PendantTree(S)is either a leaf? and is an S or has +a left and a right both PendantTree(S)'s +\pagehead{PendantTree}{PENDTREE} +\pagepic{ps/v103pendanttree.ps}{PENDTREE}{1.00} +See also:\\ +\refto{Tree}{TREE} +\refto{BinaryTree}{BTREE} +\refto{BinarySearchTree}{BSTREE} +\refto{BinaryTournament}{BTOURN} +\refto{BalancedBinaryTree}{BBTREE} +<>= +)abbrev domain PENDTREE PendantTree +PendantTree(S: SetCategory): T == C where + T == BinaryRecursiveAggregate(S) with + ptree : S->% + ++ ptree(s) is a leaf? pendant tree + ++ + ++X t1:=ptree([1,2,3]) + + ptree:(%, %)->% + ++ ptree(x,y) \undocumented + ++ + ++X t1:=ptree([1,2,3]) + ++X ptree(t1,ptree([1,2,3])) + + coerce:%->Tree S + ++ coerce(x) \undocumented + ++ + ++X t1:=ptree([1,2,3]) + ++X t2:=ptree(t1,ptree([1,2,3])) + ++X t2::Tree List PositiveInteger + + C == add + Rep := Tree S + import Tree S + coerce (t:%):Tree S == t pretend Tree S + ptree(n) == tree(n,[])$Rep pretend % + ptree(l,r) == tree(value(r:Rep)$Rep,cons(l,children(r:Rep)$Rep)):% + leaf? t == empty?(children(t)$Rep) + t1=t2 == (t1:Rep) = (t2:Rep) + left b == + leaf? b => error "ptree:no left" + first(children(b)$Rep) + right b == + leaf? b => error "ptree:no right" + tree(value(b)$Rep,rest (children(b)$Rep)) + value b == + leaf? b => value(b)$Rep + error "the pendant tree has no value" + coerce(b:%): OutputForm == + leaf? b => value(b)$Rep :: OutputForm + paren blankSeparate [left b::OutputForm,right b ::OutputForm] + +@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{domain PERM Permutation} \pagehead{Permutation}{PERM} \pagepic{ps/v103permutation.ps}{PERM}{1.00} @@ -64475,6 +65893,159 @@ SparseMultivariateTaylorSeries(Coef,Var,SMP):_ @ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{domain STBL SparseTable} +<>= +-- table.spad.pamphlet SparseTable.input +)spool SparseTable.output +)set message test on +)set message auto off +)clear all +--S 1 of 7 +t: SparseTable(Integer, String, "Try again!") := table() +--R +--R +--R (1) table() +--R Type: SparseTable(Integer,String,Try again!) +--E 1 + +--S 2 of 7 +t.3 := "Number three" +--R +--R +--R (2) "Number three" +--R Type: String +--E 2 + +--S 3 of 7 +t.4 := "Number four" +--R +--R +--R (3) "Number four" +--R Type: String +--E 3 + +--S 4 of 7 +t.3 +--R +--R +--R (4) "Number three" +--R Type: String +--E 4 + +--S 5 of 7 +t.2 +--R +--R +--R (5) "Try again!" +--R Type: String +--E 5 + +--S 6 of 7 +keys t +--R +--R +--R (6) [4,3] +--R Type: List Integer +--E 6 + +--S 7 of 7 +entries t +--R +--R +--R (7) ["Number four","Number three"] +--R Type: List String +--E 7 +)spool +)lisp (bye) +@ +<>= +==================================================================== +SparseTable examples +==================================================================== + +The SparseTable domain provides a general purpose table type with +default entries. + +Here we create a table to save strings under integer keys. The value +"Try again!" is returned if no other value has been stored for a key. + + t: SparseTable(Integer, String, "Try again!") := table() + table() + Type: SparseTable(Integer,String,Try again!) + +Entries can be stored in the table. + + t.3 := "Number three" + "Number three" + Type: String + + t.4 := "Number four" + "Number four" + Type: String + +These values can be retrieved as usual, but if a look up fails the +default entry will be returned. + + t.3 + "Number three" + Type: String + + t.2 + "Try again!" + Type: String + +To see which values are explicitly stored, the keys and entries +functions can be used. + + keys t + [4,3] + Type: List Integer + + entries t + ["Number four","Number three"] + Type: List String + +If a specific table representation is required, the GeneralSparseTable +constructor should be used. The domain SparseTable(K, E, dflt)} is +equivalent to GeneralSparseTable(K,E,Table(K,E), dflt). + +See Also: +o )help Table +o )help GeneralSparseTable +o )show SparseTable +o $AXIOM/doc/src/algebra/table.spad.dvi + +@ +\pagehead{SparseTable}{STBL} +\pagepic{ps/v103sparsetable.ps}{STBL}{1.00} +See also:\\ +\refto{HashTable}{HASHTBL} +\refto{InnerTable}{INTABL} +\refto{Table}{TABLE} +\refto{EqTable}{EQTBL} +\refto{StringTable}{STRTBL} +\refto{GeneralSparseTable}{GSTBL} +<>= +)abbrev domain STBL SparseTable +++ Author: Stephen M. Watt +++ Date Created: 1986 +++ Date Last Updated: June 21, 1991 +++ Basic Operations: +++ Related Domains: Table +++ Also See: +++ AMS Classifications: +++ Keywords: equation +++ Examples: +++ References: +++ Description: +++ A sparse table has a default entry, which is returned if no other +++ value has been explicitly stored for a key. + +SparseTable(Key:SetCategory, Ent:SetCategory, dent:Ent) == + GeneralSparseTable(Key, Ent, Table(Key, Ent), dent) + +@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{domain SULS SparseUnivariateLaurentSeries} \pagehead{SparseUnivariateLaurentSeries}{SULS} \pagepic{ps/v103sparseunivariatelaurentseries.ps}{SULS}{1.00} @@ -68729,6 +70300,108 @@ String(): StringCategory == IndexedString(MINSTRINGINDEX) add @ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{domain STRTBL StringTable} +<>= +-- table.spad.pamphlet StringTable.input +)spool StringTable.output +)set message test on +)set message auto off +)clear all +--S 1 of 3 +t: StringTable(Integer) := table() +--R +--R +--R (1) table() +--R Type: StringTable Integer +--E 1 + +--S 2 of 3 +for s in split("My name is Ian Watt.",char " ") + repeat + t.s := #s +--R +--R Type: Void +--E 2 + +--S 3 of 3 +for key in keys t repeat output [key, t.key] +--R +--R ["Watt.",5] +--R ["Ian",3] +--R ["is",2] +--R ["name",4] +--R ["My",2] +--R Type: Void +--E 3 +)spool +)lisp (bye) +@ +<>= +==================================================================== +StringTable examples +==================================================================== + +This domain provides a table type in which the keys are known to be strings +so special techniques can be used. Other than performance, the type +StringTable(S) should behave exactly the same way as Table(String,S). + +This creates a new table whose keys are strings. + + t: StringTable(Integer) := table() + table() + Type: StringTable Integer + +The value associated with each string key is the number of characters +in the string. + +for s in split("My name is Ian Watt.",char " ") + repeat + t.s := #s + Type: Void + + for key in keys t repeat output [key, t.key] + ["Watt.",5] + ["Ian",3] + ["is",2] + ["name",4] + ["My",2] + Type: Void + +See Also: +o )help Table +o )show StringTable +o $AXIOM/doc/src/algebra/table.spad.dvi + +@ +\pagehead{StringTable}{STRTBL} +\pagepic{ps/v103stringtable.ps}{STRTBL}{1.00} +See also:\\ +\refto{HashTable}{HASHTBL} +\refto{InnerTable}{INTABL} +\refto{Table}{TABLE} +\refto{EqTable}{EQTBL} +\refto{GeneralSparseTable}{GSTBL} +\refto{SparseTable}{STBL} +<>= +)abbrev domain STRTBL StringTable +++ Author: Stephen M. Watt +++ Date Created: +++ Date Last Updated: June 21, 1991 +++ Basic Operations: +++ Related Domains: Table +++ Also See: +++ AMS Classifications: +++ Keywords: equation +++ Examples: +++ References: +++ Description: +++ This domain provides tables where the keys are strings. +++ A specialized hash function for strings is used. +StringTable(Entry: SetCategory) == + HashTable(String, Entry, "CVEC") + +@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{domain SUBSPACE SubSpace} The first argument n is the dimension of the subSpace @@ -70309,6 +71982,402 @@ SymmetricPolynomial(R:Ring) == PolynomialRing(R,Partition) add %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \chapter{Chapter T} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{domain TABLE Table} +<>= +-- table.spad.pamphlet Table.input +)spool Table.output +)set message test on +)set message auto off +)clear all +--S 1 of 18 +t: Table(Polynomial Integer, String) := table() +--R +--R +--R (1) table() +--R Type: Table(Polynomial Integer,String) +--E 1 + +--S 2 of 18 +setelt(t, x**2 - 1, "Easy to factor") +--R +--R +--R (2) "Easy to factor" +--R Type: String +--E 2 + +--S 3 of 18 +t(x**3 + 1) := "Harder to factor" +--R +--R +--R (3) "Harder to factor" +--R Type: String +--E 3 + +--S 4 of 18 +t(x) := "The easiest to factor" +--R +--R +--R (4) "The easiest to factor" +--R Type: String +--E 4 + +--S 5 of 18 +elt(t, x) +--R +--R +--R (5) "The easiest to factor" +--R Type: String +--E 5 + +--S 6 of 18 +t.x +--R +--R +--R (6) "The easiest to factor" +--R Type: String +--E 6 + +--S 7 of 18 +t x +--R +--R +--R (7) "The easiest to factor" +--R Type: String +--E 7 + +--S 8 of 18 +t.(x**2 - 1) +--R +--R +--R (8) "Easy to factor" +--R Type: String +--E 8 + +--S 9 of 18 +t (x**3 + 1) +--R +--R +--R (9) "Harder to factor" +--R Type: String +--E 9 + +--S 10 of 18 +keys t +--R +--R +--R 3 2 +--R (10) [x,x + 1,x - 1] +--R Type: List Polynomial Integer +--E 10 + +--S 11 of 18 +search(x, t) +--R +--R +--R (11) "The easiest to factor" +--R Type: Union(String,...) +--E 11 + +--S 12 of 18 +search(x**2, t) +--R +--R +--R (12) "failed" +--R Type: Union("failed",...) +--E 12 + +--S 13 of 18 +search(x**2, t) case "failed" +--R +--R +--R (13) true +--R Type: Boolean +--E 13 + +--S 14 of 18 +remove!(x**2-1, t) +--R +--R +--R (14) "Easy to factor" +--R Type: Union(String,...) +--E 14 + +--S 15 of 18 +remove!(x-1, t) +--R +--R +--R (15) "failed" +--R Type: Union("failed",...) +--E 15 + +--S 16 of 18 +#t +--R +--R +--R (16) 2 +--R Type: PositiveInteger +--E 16 + +--S 17 of 18 +members t +--R +--R +--R (17) ["The easiest to factor","Harder to factor"] +--R Type: List String +--E 17 + +--S 18 of 18 +count(s: String +-> prefix?("Hard", s), t) +--R +--R +--R (18) 1 +--R Type: PositiveInteger +--E 18 +)spool +)lisp (bye) +@ +<>= +==================================================================== +Table examples +==================================================================== + +The Table constructor provides a general structure for associative +storage. This type provides hash tables in which data objects can be +saved according to keys of any type. For a given table, specific +types must be chosen for the keys and entries. + +In this example the keys to the table are polynomials with integer +coefficients. The entries in the table are strings. + + t: Table(Polynomial Integer, String) := table() + table() + Type: Table(Polynomial Integer,String) + +To save an entry in the table, the setelt operation is used. This can +be called directly, giving the table a key and an entry. + + setelt(t, x**2 - 1, "Easy to factor") + "Easy to factor" + Type: String + +Alternatively, you can use assignment syntax. + + t(x**3 + 1) := "Harder to factor" + "Harder to factor" + Type: String + + t(x) := "The easiest to factor" + "The easiest to factor" + Type: String + +Entries are retrieved from the table by calling the elt operation. + + elt(t, x) + "The easiest to factor" + Type: String + +This operation is called when a table is "applied" to a key using this +or the following syntax. + + t.x + "The easiest to factor" + Type: String + + t x + "The easiest to factor" + Type: String + +Parentheses are used only for grouping. They are needed if the key is +an infixed expression. + + t.(x**2 - 1) + "Easy to factor" + Type: String + +Note that the elt operation is used only when the key is known to be +in the table, otherwise an error is generated. + + t (x**3 + 1) + "Harder to factor" + Type: String + +You can get a list of all the keys to a table using the keys operation. + + keys t + 3 2 + [x,x + 1,x - 1] + Type: List Polynomial Integer + +If you wish to test whether a key is in a table, the search operation +is used. This operation returns either an entry or "failed". + + search(x, t) + "The easiest to factor" + Type: Union(String,...) + + search(x**2, t) + "failed" + Type: Union("failed",...) + +The return type is a union so the success of the search can be tested +using case. + + search(x**2, t) case "failed" + true + Type: Boolean + +The remove operation is used to delete values from a table. + + remove!(x**2-1, t) + "Easy to factor" + Type: Union(String,...) + +If an entry exists under the key, then it is returned. Otherwise +remove returns "failed". + + remove!(x-1, t) + "failed" + Type: Union("failed",...) + +The number of key-entry pairs can be found using the # operation. + + #t + 2 + Type: PositiveInteger + +Just as keys returns a list of keys to the table, a list of all the +entries can be obtained using the members operation. + + members t + (17) ["The easiest to factor","Harder to factor"] + Type: List String + +A number of useful operations take functions and map them on to the +table to compute the result. Here we count the entries which have +"Hard" as a prefix. + + count(s: String +-> prefix?("Hard", s), t) + 1 + Type: PositiveInteger + +Other table types are provided to support various needs. + o AssociationList gives a list with a table view. This allows new + entries to be appended onto the front of the list to cover up old + entries. This is useful when table entries need to be stacked or when + frequent list traversals are required. + o EqTable gives tables in which keys are considered equal only when + they are in fact the same instance of a structure. + o StringTable should be used when the keys are known to be strings. + o SparseTable provides tables with default entries, so lookup never fails. + The GeneralSparseTable constructor can be used to make any table type + behave this way. + o KeyedAccessFile allows values to be saved in a file, accessed as a table. + +See Also: +o )help AssociationList +o )help EqTable +o )help StringTable +o )help SparseTable +o )help GeneralSparseTable +o )help KeyedAccessFile +o )show Table +o $AXIOM/doc/src/algebra/table.spad.dvi + +@ +\pagehead{Table}{TABLE} +\pagepic{ps/v103table.ps}{TABLE}{1.00} +See also:\\ +\refto{HashTable}{HASHTBL} +\refto{InnerTable}{INTABL} +\refto{EqTable}{EQTBL} +\refto{StringTable}{STRTBL} +\refto{GeneralSparseTable}{GSTBL} +\refto{SparseTable}{STBL} +<>= +)abbrev domain TABLE Table +++ Author: Stephen M. Watt, Barry Trager +++ Date Created: 1985 +++ Date Last Updated: Sept 15, 1992 +++ Basic Operations: +++ Related Domains: HashTable, EqTable, StringTable, AssociationList +++ Also See: +++ AMS Classifications: +++ Keywords: +++ Examples: +++ References: +++ Description: +++ This is the general purpose table type. +++ The keys are hashed to look up the entries. +++ This creates a \spadtype{HashTable} if equal for the Key +++ domain is consistent with Lisp EQUAL otherwise an +++ \spadtype{AssociationList} + +Table(Key: SetCategory, Entry: SetCategory):Exports == Implementation where + Exports ==> TableAggregate(Key, Entry) with + finiteAggregate + + Implementation ==> InnerTable(Key, Entry, + if hashable(Key)$Lisp then HashTable(Key, Entry, "UEQUAL") + else AssociationList(Key, Entry)) + +@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{domain TABLEAU Tableau} +\pagehead{Tableau}{TABLEAU} +\pagepic{ps/v103tableau.ps}{TABLEAU}{1.00} +<>= +)abbrev domain TABLEAU Tableau +++ Author: William H. Burge +++ Date Created: 1987 +++ Date Last Updated: 23 Sept 1991 +++ Basic Functions: +++ Related Constructors: +++ Also See: +++ AMS Classifications: +++ Keywords: Young tableau +++ References: +++ Description: +++ The tableau domain is for printing Young tableaux, and +++ coercions to and from List List S where S is a set. +Tableau(S:SetCategory):Exports == Implementation where + ++ The tableau domain is for printing Young tableaux, and + ++ coercions to and from List List S where S is a set. + L ==> List + I ==> Integer + NNI ==> NonNegativeInteger + OUT ==> OutputForm + V ==> Vector + fm==>formMatrix$PrintableForm() + Exports ==> with + tableau : L L S -> % + ++ tableau(ll) converts a list of lists ll to a tableau. + listOfLists : % -> L L S + ++ listOfLists t converts a tableau t to a list of lists. + coerce : % -> OUT + ++ coerce(t) converts a tableau t to an output form. + Implementation ==> add + + Rep := L L S + + tableau(lls:(L L S)) == lls pretend % + listOfLists(x:%):(L L S) == x pretend (L L S) + makeupv : (NNI,L S) -> L OUT + makeupv(n,ls)== + v:=new(n,message " ")$(List OUT) + for i in 1..#ls for s in ls repeat v.i:=box(s::OUT) + v + maketab : L L S -> OUT + maketab lls == + ll : L OUT := + empty? lls => [[empty()]] + sz:NNI:=# first lls + [blankSeparate makeupv(sz,i) for i in lls] + pile ll + + coerce(x:%):OUT == maketab listOfLists x + +@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{domain TS TaylorSeries} \pagehead{TaylorSeries}{TS} \pagepic{ps/v103taylorseries.ps}{TS}{1.00} @@ -70366,6 +72435,634 @@ TaylorSeries(Coef): Exports == Implementation where @ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{domain TEX TexFormat} +\subsection{product(product(i*j,i=a..b),j=c..d) fix} +The expression prints properly in ascii text but the tex output +is incorrect. Originally the input +\begin{verbatim} +product(product(i*j,i=a..b),j=c..d) +\end{verbatim} +prints as +$$ +PI2 +\left( +{{j=c}, \: d, \: {PI2 +\left( +{{i=a}, \: b, \: {i \ j}} +\right)}} +\right) +\leqno(1) +$$ +but now says: +The problem is in [[src/algebra/tex.spad.pamphlet]] in the list of +constants. +The code used to read +\begin{verbatim} + plexOps : L S := ["SIGMA","SIGMA2","PI","INTSIGN","INDEFINTEGRAL"]$(L S) + plexPrecs : L I := [ 700, 800, 700, 700]$(L I) +\end{verbatim} +it now reads: +<>= + plexOps : L S := ["SIGMA","SIGMA2","PI","PI2","INTSIGN","INDEFINTEGRAL"]$(L S) + plexPrecs : L I := [ 700, 800, 700, 800 , 700, 700]$(L I) +@ +in addition we need to add a line defining [[PI2]] in [[formatPlex]]: +<>= + op = "PI2" => "\prod" +@ +\pagehead{TexFormat}{TEX} +\pagepic{ps/v103texformat.ps}{TEX}{1.00} +<>= +)abbrev domain TEX TexFormat +++ Author: Robert S. Sutor +++ Date Created: 1987 through 1992 +++ Change History: +++ 05/15/91 RSS Changed matrix formatting to use array environment. +++ 06/27/91 RSS Fixed segments +++ 08/12/91 RSS Removed some grouping for things, added newWithNum and +++ ungroup, improved line splitting +++ 08/15/91 RSS Added mbox support for strings +++ 10/15/91 RSS Handle \%\% at beginning of string +++ 01/22/92 RSS Use \[ and \] instead of $$ and $$. Use +++ %AXIOM STEP NUMBER: instead of \leqno +++ 02/27/92 RSS Escape dollar signs appearing in the input. +++ 03/09/92 RSS Handle explicit blank appearing in the input. +++ 11/28/93 JHD Added code for the VCONCAT and TAG operations. +++ 06/27/95 RSS Change back to $$ and \leqno for Saturn +++ Basic Operations: coerce, convert, display, epilogue, +++ tex, new, prologue, setEpilogue!, setTex!, setPrologue! +++ Related Constructors: TexFormat1 +++ Also See: ScriptFormulaFormat +++ AMS Classifications: +++ Keywords: TeX, LaTeX, output, format +++ References: \TeX{} is a trademark of the American Mathematical Society. +++ Description: +++ \spadtype{TexFormat} provides a coercion from \spadtype{OutputForm} to +++ \TeX{} format. The particular dialect of \TeX{} used is \LaTeX{}. +++ The basic object consists of three parts: a prologue, a +++ tex part and an epilogue. The functions \spadfun{prologue}, +++ \spadfun{tex} and \spadfun{epilogue} extract these parts, +++ respectively. The main guts of the expression go into the tex part. +++ The other parts can be set (\spadfun{setPrologue!}, +++ \spadfun{setEpilogue!}) so that contain the appropriate tags for +++ printing. For example, the prologue and epilogue might simply +++ contain ``\verb+\[+'' and ``\verb+\]+'', respectively, so that +++ the TeX section will be printed in LaTeX display math mode. + +TexFormat(): public == private where + E ==> OutputForm + I ==> Integer + L ==> List + S ==> String + US ==> UniversalSegment(Integer) + + public == SetCategory with + coerce: E -> $ + ++ coerce(o) changes o in the standard output format to TeX + ++ format. + convert: (E,I) -> $ + ++ convert(o,step) changes o in standard output format to + ++ TeX format and also adds the given step number. This is useful + ++ if you want to create equations with given numbers or have the + ++ equation numbers correspond to the interpreter step numbers. + convert: (E,I,E) -> $ + ++ convert(o,step,type) changes o in standard output format to + ++ TeX format and also adds the given step number and type. This + ++ is useful if you want to create equations with given numbers + ++ or have the equation numbers correspond to the interpreter step + ++ numbers. + display: ($, I) -> Void + ++ display(t,width) outputs the TeX formatted code t so that each + ++ line has length less than or equal to \spadvar{width}. + display: $ -> Void + ++ display(t) outputs the TeX formatted code t so that each + ++ line has length less than or equal to the value set by + ++ the system command \spadsyscom{set output length}. + epilogue: $ -> L S + ++ epilogue(t) extracts the epilogue section of a TeX form t. + tex: $ -> L S + ++ tex(t) extracts the TeX section of a TeX form t. + new: () -> $ + ++ new() create a new, empty object. Use \spadfun{setPrologue!}, + ++ \spadfun{setTex!} and \spadfun{setEpilogue!} to set the various + ++ components of this object. + prologue: $ -> L S + ++ prologue(t) extracts the prologue section of a TeX form t. + setEpilogue!: ($, L S) -> L S + ++ setEpilogue!(t,strings) sets the epilogue section of a TeX form t to strings. + setTex!: ($, L S) -> L S + ++ setTex!(t,strings) sets the TeX section of a TeX form t to strings. + setPrologue!: ($, L S) -> L S + ++ setPrologue!(t,strings) sets the prologue section of a TeX form t to strings. + + private == add + import OutputForm + import Character + import Integer + import List OutputForm + import List String + + Rep := Record(prolog : L S, TeX : L S, epilog : L S) + + -- local variables declarations and definitions + + expr: E + prec,opPrec: I + str: S + blank : S := " \ " + + maxPrec : I := 1000000 + minPrec : I := 0 + + unaryOps : L S := ["-","^"]$(L S) + unaryPrecs : L I := [700,260]$(L I) + + -- the precedence of / in the following is relatively low because + -- the bar obviates the need for parentheses. + binaryOps : L S := ["+->","|","**","/","<",">","=","OVER"]$(L S) + binaryPrecs : L I := [0,0,900, 700,400,400,400, 700]$(L I) + + naryOps : L S := ["-","+","*",blank,",",";"," ","ROW","", + " \cr ","&"," \\ "]$(L S) + naryPrecs : L I := [700,700,800, 800,110,110, 0, 0, 0, + 0, 0, 0]$(L I) + naryNGOps : L S := ["ROW","&"]$(L S) + +<> + + specialOps : L S := ["MATRIX","BRACKET","BRACE","CONCATB","VCONCAT", _ + "AGGLST","CONCAT","OVERBAR","ROOT","SUB","TAG", _ + "SUPERSUB","ZAG","AGGSET","SC","PAREN", _ + "SEGMENT","QUOTE","theMap" ] + + -- the next two lists provide translations for some strings for + -- which TeX provides special macros. + + specialStrings : L S := + ["cos", "cot", "csc", "log", "sec", "sin", "tan", + "cosh", "coth", "csch", "sech", "sinh", "tanh", + "acos","asin","atan","erf","...","$","infinity"] + specialStringsInTeX : L S := + ["\cos","\cot","\csc","\log","\sec","\sin","\tan", + "\cosh","\coth","\csch","\sech","\sinh","\tanh", + "\arccos","\arcsin","\arctan","\erf","\ldots","\$","\infty"] + + -- local function signatures + + addBraces: S -> S + addBrackets: S -> S + group: S -> S + formatBinary: (S,L E, I) -> S + formatFunction: (S,L E, I) -> S + formatMatrix: L E -> S + formatNary: (S,L E, I) -> S + formatNaryNoGroup: (S,L E, I) -> S + formatNullary: S -> S + formatPlex: (S,L E, I) -> S + formatSpecial: (S,L E, I) -> S + formatUnary: (S, E, I) -> S + formatTex: (E,I) -> S + newWithNum: I -> $ + parenthesize: S -> S + precondition: E -> E + postcondition: S -> S + splitLong: (S,I) -> L S + splitLong1: (S,I) -> L S + stringify: E -> S + ungroup: S -> S + + -- public function definitions + + new() : $ == +-- [["\["]$(L S), [""]$(L S), ["\]"]$(L S)]$Rep + [["$$"]$(L S), [""]$(L S), ["$$"]$(L S)]$Rep + + newWithNum(stepNum: I) : $ == +-- num : S := concat("%AXIOM STEP NUMBER: ",string(stepNum)$S) +-- [["\["]$(L S), [""]$(L S), ["\]",num]$(L S)]$Rep + num : S := concat(concat("\leqno(",string(stepNum)$S),")")$S + [["$$"]$(L S), [""]$(L S), [num,"$$"]$(L S)]$Rep + + coerce(expr : E): $ == + f : $ := new()$$ + f.TeX := [postcondition + formatTex(precondition expr, minPrec)]$(L S) + f + + convert(expr : E, stepNum : I): $ == + f : $ := newWithNum(stepNum) + f.TeX := [postcondition + formatTex(precondition expr, minPrec)]$(L S) + f + + display(f : $, len : I) == + s,t : S + for s in f.prolog repeat sayTeX$Lisp s + for s in f.TeX repeat + for t in splitLong(s, len) repeat sayTeX$Lisp t + for s in f.epilog repeat sayTeX$Lisp s + void()$Void + + display(f : $) == + display(f, _$LINELENGTH$Lisp pretend I) + + prologue(f : $) == f.prolog + tex(f : $) == f.TeX + epilogue(f : $) == f.epilog + + setPrologue!(f : $, l : L S) == f.prolog := l + setTex!(f : $, l : L S) == f.TeX := l + setEpilogue!(f : $, l : L S) == f.epilog := l + + coerce(f : $): E == + s,t : S + l : L S := nil + for s in f.prolog repeat l := concat(s,l) + for s in f.TeX repeat + for t in splitLong(s, (_$LINELENGTH$Lisp pretend Integer) - 4) repeat + l := concat(t,l) + for s in f.epilog repeat l := concat(s,l) + (reverse l) :: E + + -- local function definitions + + ungroup(str: S): S == + len : I := #str + len < 2 => str + lbrace : Character := char "{" + rbrace : Character := char "}" + -- drop leading and trailing braces + if (str.1 =$Character lbrace) and (str.len =$Character rbrace) then + u : US := segment(2,len-1)$US + str := str.u + str + + postcondition(str: S): S == + str := ungroup str + len : I := #str + plus : Character := char "+" + minus: Character := char "-" + len < 4 => str + for i in 1..(len-1) repeat + if (str.i =$Character plus) and (str.(i+1) =$Character minus) + then setelt(str,i,char " ")$S + str + + stringify expr == (object2String$Lisp expr) pretend S + + lineConcat( line : S, lines: L S ) : L S == + length := #line + + if ( length > 0 ) then + -- If the last character is a backslash then split at "\ ". + -- Reinstate the blank. + + if (line.length = char "\" ) then line := concat(line, " ") + + -- Remark: for some reason, "\%" at the beginning + -- of a line has the "\" erased when printed + + if ( line.1 = char "%" ) then line := concat(" \", line) + else if ( line.1 = char "\" ) and length > 1 and ( line.2 = char "%" ) then + line := concat(" ", line) + + lines := concat(line,lines)$List(S) + lines + + splitLong(str : S, len : I): L S == + -- this blocks into lines + if len < 20 then len := _$LINELENGTH$Lisp + splitLong1(str, len) + + splitLong1(str : S, len : I) == + -- We first build the list of lines backwards and then we + -- reverse it. + + l : List S := nil + s : S := "" + ls : I := 0 + ss : S + lss : I + for ss in split(str,char " ") repeat + -- have the newline macro end a line (even if it means the line + -- is slightly too long) + + ss = "\\" => + l := lineConcat( concat(s,ss), l ) + s := "" + ls := 0 + + lss := #ss + + -- place certain tokens on their own lines for clarity + + ownLine : Boolean := + u : US := segment(1,4)$US + (lss > 3) and ("\end" = ss.u) => true + u := segment(1,5)$US + (lss > 4) and ("\left" = ss.u) => true + u := segment(1,6)$US + (lss > 5) and (("\right" = ss.u) or ("\begin" = ss.u)) => true + false + + if ownLine or (ls + lss > len) then + if not empty? s then l := lineConcat( s, l ) + s := "" + ls := 0 + + ownLine or lss > len => l := lineConcat( ss, l ) + + (lss = 1) and (ss.1 = char "\") => + ls := ls + lss + 2 + s := concat(s,concat(ss," ")$S)$S + + ls := ls + lss + 1 + s := concat(s,concat(ss," ")$S)$S + + if ls > 0 then l := lineConcat( s, l ) + + reverse l + + group str == + concat ["{",str,"}"] + + addBraces str == + concat ["\left\{ ",str," \right\}"] + + addBrackets str == + concat ["\left[ ",str," \right]"] + + parenthesize str == + concat ["\left( ",str," \right)"] + + precondition expr == + outputTran$Lisp expr + + formatSpecial(op : S, args : L E, prec : I) : S == + arg : E + prescript : Boolean := false + op = "theMap" => "\mbox{theMap(...)}" + op = "AGGLST" => + formatNary(",",args,prec) + op = "AGGSET" => + formatNary(";",args,prec) + op = "TAG" => + group concat [formatTex(first args,prec), + "\rightarrow", + formatTex(second args,prec)] + op = "VCONCAT" => + group concat("\begin{array}{c}", + concat(concat([concat(formatTex(u, minPrec),"\\") + for u in args]::L S), + "\end{array}")) + op = "CONCATB" => + formatNary(" ",args,prec) + op = "CONCAT" => + formatNary("",args,minPrec) + op = "QUOTE" => + group concat("{\tt '}",formatTex(first args, minPrec)) + op = "BRACKET" => + group addBrackets ungroup formatTex(first args, minPrec) + op = "BRACE" => + group addBraces ungroup formatTex(first args, minPrec) + op = "PAREN" => + group parenthesize ungroup formatTex(first args, minPrec) + op = "OVERBAR" => + null args => "" + group concat ["\overline ",formatTex(first args, minPrec)] + op = "ROOT" => + null args => "" + tmp : S := group formatTex(first args, minPrec) + null rest args => group concat ["\sqrt ",tmp] + group concat + ["\root ",group formatTex(first rest args, minPrec)," \of ",tmp] + op = "SEGMENT" => + tmp : S := concat [formatTex(first args, minPrec),".."] + group + null rest args => tmp + concat [tmp,formatTex(first rest args, minPrec)] + op = "SUB" => + group concat [formatTex(first args, minPrec)," \sb ", + formatSpecial("AGGLST",rest args,minPrec)] + op = "SUPERSUB" => + -- variable name + form : List S := [formatTex(first args, minPrec)] + -- subscripts + args := rest args + null args => concat(form)$S + tmp : S := formatTex(first args, minPrec) + if (tmp ^= "") and (tmp ^= "{}") and (tmp ^= " ") then + form := append(form,[" \sb ",group tmp])$(List S) + -- superscripts + args := rest args + null args => group concat(form)$S + tmp : S := formatTex(first args, minPrec) + if (tmp ^= "") and (tmp ^= "{}") and (tmp ^= " ") then + form := append(form,[" \sp ",group tmp])$(List S) + -- presuperscripts + args := rest args + null args => group concat(form)$S + tmp : S := formatTex(first args, minPrec) + if (tmp ^= "") and (tmp ^= "{}") and (tmp ^= " ") then + form := append([" \sp ",group tmp],form)$(List S) + prescript := true + -- presubscripts + args := rest args + null args => + group concat + prescript => cons("{}",form) + form + tmp : S := formatTex(first args, minPrec) + if (tmp ^= "") and (tmp ^= "{}") and (tmp ^= " ") then + form := append([" \sb ",group tmp],form)$(List S) + prescript := true + group concat + prescript => cons("{}",form) + form + op = "SC" => + -- need to handle indentation someday + null args => "" + tmp := formatNaryNoGroup(" \\ ", args, minPrec) + group concat ["\begin{array}{l} ",tmp," \end{array} "] + op = "MATRIX" => formatMatrix rest args + op = "ZAG" => + concat [" \zag{",formatTex(first args, minPrec),"}{", + formatTex(first rest args,minPrec),"}"] + concat ["not done yet for ",op] + + formatPlex(op : S, args : L E, prec : I) : S == + hold : S + p : I := position(op,plexOps) + p < 1 => error "unknown Tex unary op" + opPrec := plexPrecs.p + n : I := #args + (n ^= 2) and (n ^= 3) => error "wrong number of arguments for plex" + s : S := + op = "SIGMA" => "\sum" + op = "SIGMA2" => "\sum" + op = "PI" => "\prod" +<> + op = "INTSIGN" => "\int" + op = "INDEFINTEGRAL" => "\int" + "????" + hold := formatTex(first args,minPrec) + args := rest args + if op ^= "INDEFINTEGRAL" then + if hold ^= "" then + s := concat [s," \sb",group concat ["\displaystyle ",hold]] + if not null rest args then + hold := formatTex(first args,minPrec) + if hold ^= "" then + s := concat [s," \sp",group concat ["\displaystyle ",hold]] + args := rest args + s := concat [s," ",formatTex(first args,minPrec)] + else + hold := group concat [hold," ",formatTex(first args,minPrec)] + s := concat [s," ",hold] + if opPrec < prec then s := parenthesize s + group s + + formatMatrix(args : L E) : S == + -- format for args is [[ROW ...],[ROW ...],[ROW ...]] + -- generate string for formatting columns (centered) + cols : S := "{" + for i in 2..#(first(args) pretend L E) repeat + cols := concat(cols,"c") + cols := concat(cols,"} ") + group addBrackets concat + ["\begin{array}",cols,formatNaryNoGroup(" \\ ",args,minPrec), + " \end{array} "] + + formatFunction(op : S, args : L E, prec : I) : S == + group concat [op, " ", parenthesize formatNary(",",args,minPrec)] + + formatNullary(op : S) == + op = "NOTHING" => "" + group concat [op,"()"] + + formatUnary(op : S, arg : E, prec : I) == + p : I := position(op,unaryOps) + p < 1 => error "unknown Tex unary op" + opPrec := unaryPrecs.p + s : S := concat [op,formatTex(arg,opPrec)] + opPrec < prec => group parenthesize s + op = "-" => s + group s + + formatBinary(op : S, args : L E, prec : I) : S == + p : I := position(op,binaryOps) + p < 1 => error "unknown Tex binary op" + op := + op = "|" => " \mid " + op = "**" => " \sp " + op = "/" => " \over " + op = "OVER" => " \over " + op = "+->" => " \mapsto " + op + opPrec := binaryPrecs.p + s : S := formatTex(first args, opPrec) + if op = " \over " then + s := concat [" \frac{",s,"}{",formatTex(first rest args, opPrec),"}"] + else if op = " \sp " then + s := concat [s,"^",formatTex(first rest args, opPrec)] + else + s := concat [s,op,formatTex(first rest args, opPrec)] + group + op = " \over " => s + opPrec < prec => parenthesize s + s + + formatNary(op : S, args : L E, prec : I) : S == + group formatNaryNoGroup(op, args, prec) + + formatNaryNoGroup(op : S, args : L E, prec : I) : S == + null args => "" + p : I := position(op,naryOps) + p < 1 => error "unknown Tex nary op" + op := + op = "," => ", \: " + op = ";" => "; \: " + op = "*" => blank + op = " " => " \ " + op = "ROW" => " & " + op + l : L S := nil + opPrec := naryPrecs.p + for a in args repeat + l := concat(op,concat(formatTex(a,opPrec),l)$L(S))$L(S) + s : S := concat reverse rest l + opPrec < prec => parenthesize s + s + + formatTex(expr,prec) == + i,len : Integer + intSplitLen : Integer := 20 + ATOM(expr)$Lisp pretend Boolean => + str := stringify expr + len := #str + FIXP$Lisp expr => + i := expr pretend Integer + if (i < 0) or (i > 9) + then + group + nstr : String := "" + -- insert some blanks into the string, if too long + while ((len := #str) > intSplitLen) repeat + nstr := concat [nstr," ", + elt(str,segment(1,intSplitLen)$US)] + str := elt(str,segment(intSplitLen+1)$US) + empty? nstr => str + nstr := + empty? str => nstr + concat [nstr," ",str] + elt(nstr,segment(2)$US) + else str + str = "%pi" => "\pi" + str = "%e" => "e" + str = "%i" => "i" + len > 1 and str.1 = char "%" and str.2 = char "%" => + u : US := segment(3,len)$US + concat(" \%\%",str.u) + len > 0 and str.1 = char "%" => concat(" \",str) + len > 1 and digit? str.1 => group str -- should handle floats + len > 0 and str.1 = char "_"" => + concat(concat(" \mbox{\tt ",str),"} ") + len = 1 and str.1 = char " " => "{\ }" + (i := position(str,specialStrings)) > 0 => + specialStringsInTeX.i + (i := position(char " ",str)) > 0 => + -- We want to preserve spacing, so use a roman font. + concat(concat(" \mbox{\rm ",str),"} ") + str + l : L E := (expr pretend L E) + null l => blank + op : S := stringify first l + args : L E := rest l + nargs : I := #args + + -- special cases + member?(op, specialOps) => formatSpecial(op,args,prec) + member?(op, plexOps) => formatPlex(op,args,prec) + + -- nullary case + 0 = nargs => formatNullary op + + -- unary case + (1 = nargs) and member?(op, unaryOps) => + formatUnary(op, first args, prec) + + -- binary case + (2 = nargs) and member?(op, binaryOps) => + formatBinary(op, args, prec) + + -- nary case + member?(op,naryNGOps) => formatNaryNoGroup(op,args, prec) + member?(op,naryOps) => formatNary(op,args, prec) + op := formatTex(first l,minPrec) + formatFunction(op,args,prec) + +@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{domain TEXTFILE TextFile} <>= -- files.spad.pamphlet TextFile.input @@ -71451,6 +74148,409 @@ ThreeSpace(R:Ring):Exports == Implementation where @ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{domain TREE Tree} +\pagehead{Tree}{TREE} +\pagepic{ps/v103tree.ps}{TREE}{1.00} +See also:\\ +\refto{BinaryTree}{BTREE} +\refto{BinarySearchTree}{BSTREE} +\refto{BinaryTournament}{BTOURN} +\refto{BalancedBinaryTree}{BBTREE} +\refto{PendantTree}{PENDTREE} +<>= +)abbrev domain TREE Tree +++ Author:W. H. Burge +++ Date Created:17 Feb 1992 +++ Date Last Updated: +++ Basic Operations: +++ Related Domains: +++ Also See: +++ AMS Classifications: +++ Keywords: +++ Examples: +++ References: +++ Description: \spadtype{Tree(S)} is a basic domains of tree structures. +++ Each tree is either empty or else is a {\it node} consisting of a value and +++ a list of (sub)trees. +Tree(S: SetCategory): T==C where + T== RecursiveAggregate(S) with + finiteAggregate + shallowlyMutable + tree: (S,List %) -> % + ++ tree(nd,ls) creates a tree with value nd, and children ls. + ++ + ++X t1:=tree [1,2,3,4] + ++X tree(5,[t1]) + + tree: List S -> % + ++ tree(ls) creates a tree from a list of elements of s. + ++ + ++X tree [1,2,3,4] + + tree: S -> % + ++ tree(nd) creates a tree with value nd, and no children + ++ + ++X tree 6 + + cyclic?: % -> Boolean + ++ cyclic?(t) tests if t is a cyclic tree. + ++ + ++X t1:=tree [1,2,3,4] + ++X cyclic? t1 + + cyclicCopy: % -> % + ++ cyclicCopy(l) makes a copy of a (possibly) cyclic tree l. + ++ + ++X t1:=tree [1,2,3,4] + ++X cyclicCopy t1 + + cyclicEntries: % -> List % + ++ cyclicEntries(t) returns a list of top-level cycles in tree t. + ++ + ++X t1:=tree [1,2,3,4] + ++X cyclicEntries t1 + + cyclicEqual?: (%, %) -> Boolean + ++ cyclicEqual?(t1, t2) tests of two cyclic trees have + ++ the same structure. + ++ + ++X t1:=tree [1,2,3,4] + ++X t2:=tree [1,2,3,4] + ++X cyclicEqual?(t1,t2) + + cyclicParents: % -> List % + ++ cyclicParents(t) returns a list of cycles that are parents of t. + ++ + ++X t1:=tree [1,2,3,4] + ++X cyclicParents t1 + + C== add + cycleTreeMax ==> 5 + + Rep := Union(node:Record(value: S, args: List %),empty:"empty") + t:% + br:% + s: S + ls: List S + empty? t == t case empty + empty() == ["empty"] + children t == + t case empty => error "cannot take the children of an empty tree" + (t.node.args)@List(%) + setchildren_!(t,lt) == + t case empty => error "cannot set children of an empty tree" + (t.node.args:=lt;t pretend %) + setvalue_!(t,s) == + t case empty => error "cannot set value of an empty tree" + (t.node.value:=s;s) + count(n, t) == + t case empty => 0 + i := +/[count(n, c) for c in children t] + value t = n => i + 1 + i + count(fn: S -> Boolean, t: %): NonNegativeInteger == + t case empty => 0 + i := +/[count(fn, c) for c in children t] + fn value t => i + 1 + i + map(fn, t) == + t case empty => t + tree(fn value t,[map(fn, c) for c in children t]) + map_!(fn, t) == + t case empty => t + setvalue_!(t, fn value t) + for c in children t repeat map_!(fn, c) + tree(s,lt) == [[s,lt]] + tree(s) == [[s,[]]] + tree(ls) == + empty? ls => empty() + tree(first ls, [tree s for s in rest ls]) + value t == + t case empty => error "cannot take the value of an empty tree" + t.node.value + child?(t1,t2) == + empty? t2 => false + "or"/[t1 = t for t in children t2] + distance1(t1: %, t2: %): Integer == + t1 = t2 => 0 + t2 case empty => -1 + u := [n for t in children t2 | (n := distance1(t1,t)) >= 0] + #u > 0 => 1 + "min"/u + -1 + distance(t1,t2) == + n := distance1(t1, t2) + n >= 0 => n + distance1(t2, t1) + node?(t1, t2) == + t1 = t2 => true + t case empty => false + "or"/[node?(t1, t) for t in children t2] + leaf? t == + t case empty => false + empty? children t + leaves t == + t case empty => empty() + leaf? t => [value t] + "append"/[leaves c for c in children t] + less? (t, n) == # t < n + more?(t, n) == # t > n + nodes t == ---buggy + t case empty => empty() + nl := [nodes c for c in children t] + nl = empty() => [t] + cons(t,"append"/nl) + size? (t, n) == # t = n + any?(fn, t) == ---bug fixed + t case empty => false + fn value t or "or"/[any?(fn, c) for c in children t] + every?(fn, t) == + t case empty => true + fn value t and "and"/[every?(fn, c) for c in children t] + member?(n, t) == + t case empty => false + n = value t or "or"/[member?(n, c) for c in children t] + members t == parts t + parts t == --buggy? + t case empty => empty() + u := [parts c for c in children t] + u = empty() => [value t] + cons(value t,"append"/u) + + ---Functions that guard against cycles: =, #, copy------------- + + -----> = + equal?: (%, %, %, %, Integer) -> Boolean + + t1 = t2 == equal?(t1, t2, t1, t2, 0) + + equal?(t1, t2, ot1, ot2, k) == + k = cycleTreeMax and (cyclic? ot1 or cyclic? ot2) => + error "use cyclicEqual? to test equality on cyclic trees" + t1 case empty => t2 case empty + t2 case empty => false + value t1 = value t2 and (c1 := children t1) = (c2 := children t2) and + "and"/[equal?(x,y,ot1, ot2,k + 1) for x in c1 for y in c2] + + -----> # + treeCount: (%, %, NonNegativeInteger) -> NonNegativeInteger + # t == treeCount(t, t, 0) + treeCount(t, origTree, k) == + k = cycleTreeMax and cyclic? origTree => + error "# is not defined on cyclic trees" + t case empty => 0 + 1 + +/[treeCount(c, origTree, k + 1) for c in children t] + + -----> copy + copy1: (%, %, Integer) -> % + copy t == copy1(t, t, 0) + copy1(t, origTree, k) == + k = cycleTreeMax and cyclic? origTree => + error "use cyclicCopy to copy a cyclic tree" + t case empty => t + empty? children t => tree value t + tree(value t, [copy1(x, origTree, k + 1) for x in children t]) + + -----------Functions that allow cycles--------------- + --local utility functions: + eqUnion: (List %, List %) -> List % + eqMember?: (%, List %) -> Boolean + eqMemberIndex: (%, List %, Integer) -> Integer + lastNode: List % -> List % + insert: (%, List %) -> List % + + -----> coerce to OutputForm + if S has SetCategory then + multipleOverbar: (OutputForm, Integer, List %) -> OutputForm + coerce1: (%, List %, List %) -> OutputForm + + coerce(t:%): OutputForm == coerce1(t, empty()$(List %), cyclicParents t) + + coerce1(t,parents, pl) == + t case empty => empty()@List(S)::OutputForm + eqMember?(t, parents) => + multipleOverbar((".")::OutputForm,eqMemberIndex(t, pl,0),pl) + empty? children t => value t::OutputForm + nodeForm := (value t)::OutputForm + if (k := eqMemberIndex(t, pl, 0)) > 0 then + nodeForm := multipleOverbar(nodeForm, k, pl) + prefix(nodeForm, + [coerce1(br,cons(t,parents),pl) for br in children t]) + + multipleOverbar(x, k, pl) == + k < 1 => x + #pl = 1 => overbar x + s : String := "abcdefghijklmnopqrstuvwxyz" + c := s.(1 + ((k - 1) rem 26)) + overlabel(c::OutputForm, x) + + -----> cyclic? + cyclic2?: (%, List %) -> Boolean + + cyclic? t == cyclic2?(t, empty()$(List %)) + + cyclic2?(x,parents) == + empty? x => false + eqMember?(x, parents) => true + for y in children x repeat + cyclic2?(y,cons(x, parents)) => return true + false + + -----> cyclicCopy + cyclicCopy2: (%, List %) -> % + copyCycle2: (%, List %) -> % + copyCycle4: (%, %, %, List %) -> % + + cyclicCopy(t) == cyclicCopy2(t, cyclicEntries t) + + cyclicCopy2(t, cycles) == + eqMember?(t, cycles) => return copyCycle2(t, cycles) + tree(value t, [cyclicCopy2(c, cycles) for c in children t]) + + copyCycle2(cycle, cycleList) == + newCycle := tree(value cycle, nil) + setchildren!(newCycle, + [copyCycle4(c,cycle,newCycle, cycleList) for c in children cycle]) + newCycle + + copyCycle4(t, cycle, newCycle, cycleList) == + empty? cycle => empty() + eq?(t, cycle) => newCycle + eqMember?(t, cycleList) => copyCycle2(t, cycleList) + tree(value t, + [copyCycle4(c, cycle, newCycle, cycleList) for c in children t]) + + -----> cyclicEntries + cyclicEntries3: (%, List %, List %) -> List % + + cyclicEntries(t) == cyclicEntries3(t, empty()$(List %), empty()$(List %)) + + cyclicEntries3(t, parents, cl) == + empty? t => cl + eqMember?(t, parents) => insert(t, cl) + parents := cons(t, parents) + for y in children t repeat + cl := cyclicEntries3(t, parents, cl) + cl + + -----> cyclicEqual? + cyclicEqual4?: (%, %, List %, List %) -> Boolean + + cyclicEqual?(t1, t2) == + cp1 := cyclicParents t1 + cp2 := cyclicParents t2 + #cp1 ^= #cp2 or null cp1 => t1 = t2 + cyclicEqual4?(t1, t2, cp1, cp2) + + cyclicEqual4?(t1, t2, cp1, cp2) == + t1 case empty => t2 case empty + t2 case empty => false + 0 ^= (k := eqMemberIndex(t1, cp1, 0)) => eq?(t2, cp2 . k) + value t1 = value t2 and + "and"/[cyclicEqual4?(x,y,cp1,cp2) + for x in children t1 for y in children t2] + + -----> cyclicParents t + cyclicParents3: (%, List %, List %) -> List % + + cyclicParents t == cyclicParents3(t, empty()$(List %), empty()$(List %)) + + cyclicParents3(x, parents, pl) == + empty? x => pl + eqMember?(x, parents) => + cycleMembers := [y for y in parents while not eq?(x,y)] + eqUnion(cons(x, cycleMembers), pl) + parents := cons(x, parents) + for y in children x repeat + pl := cyclicParents3(y, parents, pl) + pl + + insert(x, l) == + eqMember?(x, l) => l + cons(x, l) + + lastNode l == + empty? l => error "empty tree has no last node" + while not empty? rest l repeat l := rest l + l + + eqMember?(y,l) == + for x in l repeat eq?(x,y) => return true + false + + eqMemberIndex(x, l, k) == + null l => k + k := k + 1 + eq?(x, first l) => k + eqMemberIndex(x, rest l, k) + + eqUnion(u, v) == + null u => v + x := first u + newV := + eqMember?(x, v) => v + cons(x, v) + eqUnion(rest u, newV) + +@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{domain TUBE TubePlot} +\pagehead{TubePlot}{TUBE} +\pagepic{ps/v103tubeplot.ps}{TUBE}{1.00} +<>= +)abbrev domain TUBE TubePlot +++ Author: Clifton J. Williamson +++ Date Created: Bastille Day 1989 +++ Date Last Updated: 5 June 1990 +++ Keywords: +++ Examples: +++ Description: +++ Package for constructing tubes around 3-dimensional parametric curves. +++ Domain of tubes around 3-dimensional parametric curves. +TubePlot(Curve): Exports == Implementation where + Curve : PlottableSpaceCurveCategory + B ==> Boolean + L ==> List + Pt ==> Point DoubleFloat + + Exports ==> with + getCurve: % -> Curve + ++ getCurve(t) returns the \spadtype{PlottableSpaceCurveCategory} + ++ representing the parametric curve of the given tube plot t. + listLoops: % -> L L Pt + ++ listLoops(t) returns the list of lists of points, or the 'loops', + ++ of the given tube plot t. + closed?: % -> B + ++ closed?(t) tests whether the given tube plot t is closed. + open?: % -> B + ++ open?(t) tests whether the given tube plot t is open. + setClosed: (%,B) -> B + ++ setClosed(t,b) declares the given tube plot t to be closed if + ++ b is true, or if b is false, t is set to be open. + tube: (Curve,L L Pt,B) -> % + ++ tube(c,ll,b) creates a tube of the domain \spadtype{TubePlot} from a + ++ space curve c of the category \spadtype{PlottableSpaceCurveCategory}, + ++ a list of lists of points (loops) ll and a boolean b which if + ++ true indicates a closed tube, or if false an open tube. + + Implementation ==> add + +--% representation + + Rep := Record(parCurve:Curve,loops:L L Pt,closedTube?:B) + + getCurve plot == plot.parCurve + + listLoops plot == plot.loops + + closed? plot == plot.closedTube? + open? plot == not plot.closedTube? + + setClosed(plot,flag) == plot.closedTube? := flag + + tube(curve,ll,b) == [curve,ll,b] + +@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{domain TUPLE Tuple} <>= "TUPLE" -> "PRIMARR" @@ -74001,6 +77101,274 @@ UnivariateSkewPolynomial(x:Symbol, R:Ring, sigma:Automorphism R, delta: R -> R): @ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{domain UTS UnivariateTaylorSeries} +\pagehead{UnivariateTaylorSeries}{UTS} +\pagepic{ps/v103univariatetaylorseries.ps}{UTS}{1.00} +See also:\\ +\refto{InnerTaylorSeries}{ITAYLOR} +<>= +)abbrev domain UTS UnivariateTaylorSeries +++ Author: Clifton J. Williamson +++ Date Created: 21 December 1989 +++ Date Last Updated: 21 September 1993 +++ Basic Operations: +++ Related Domains: UnivariateLaurentSeries(Coef,var,cen), UnivariatePuiseuxSeries(Coef,var,cen) +++ Also See: +++ AMS Classifications: +++ Keywords: dense, Taylor series +++ Examples: +++ References: +++ Description: Dense Taylor series in one variable +++ \spadtype{UnivariateTaylorSeries} is a domain representing Taylor +++ series in +++ one variable with coefficients in an arbitrary ring. The parameters +++ of the type specify the coefficient ring, the power series variable, +++ and the center of the power series expansion. For example, +++ \spadtype{UnivariateTaylorSeries}(Integer,x,3) represents +++ Taylor series in +++ \spad{(x - 3)} with \spadtype{Integer} coefficients. +UnivariateTaylorSeries(Coef,var,cen): Exports == Implementation where + Coef : Ring + var : Symbol + cen : Coef + I ==> Integer + NNI ==> NonNegativeInteger + P ==> Polynomial Coef + RN ==> Fraction Integer + ST ==> Stream + STT ==> StreamTaylorSeriesOperations Coef + TERM ==> Record(k:NNI,c:Coef) + UP ==> UnivariatePolynomial(var,Coef) + Exports ==> UnivariateTaylorSeriesCategory(Coef) with + coerce: UP -> % + ++\spad{coerce(p)} converts a univariate polynomial p in the variable + ++\spad{var} to a univariate Taylor series in \spad{var}. + univariatePolynomial: (%,NNI) -> UP + ++\spad{univariatePolynomial(f,k)} returns a univariate polynomial + ++ consisting of the sum of all terms of f of degree \spad{<= k}. + coerce: Variable(var) -> % + ++\spad{coerce(var)} converts the series variable \spad{var} into a + ++ Taylor series. + differentiate: (%,Variable(var)) -> % + ++ \spad{differentiate(f(x),x)} computes the derivative of + ++ \spad{f(x)} with respect to \spad{x}. + lagrange: % -> % + ++\spad{lagrange(g(x))} produces the Taylor series for \spad{f(x)} + ++ where \spad{f(x)} is implicitly defined as \spad{f(x) = x*g(f(x))}. + lambert: % -> % + ++\spad{lambert(f(x))} returns \spad{f(x) + f(x^2) + f(x^3) + ...}. + ++ This function is used for computing infinite products. + ++ \spad{f(x)} should have zero constant coefficient. + ++ If \spad{f(x)} is a Taylor series with constant term 1, then + ++ \spad{product(n = 1..infinity,f(x^n)) = exp(log(lambert(f(x))))}. + oddlambert: % -> % + ++\spad{oddlambert(f(x))} returns \spad{f(x) + f(x^3) + f(x^5) + ...}. + ++ \spad{f(x)} should have a zero constant coefficient. + ++ This function is used for computing infinite products. + ++ If \spad{f(x)} is a Taylor series with constant term 1, then + ++ \spad{product(n=1..infinity,f(x^(2*n-1)))=exp(log(oddlambert(f(x))))}. + evenlambert: % -> % + ++\spad{evenlambert(f(x))} returns \spad{f(x^2) + f(x^4) + f(x^6) + ...}. + ++ \spad{f(x)} should have a zero constant coefficient. + ++ This function is used for computing infinite products. + ++ If \spad{f(x)} is a Taylor series with constant term 1, then + ++ \spad{product(n=1..infinity,f(x^(2*n))) = exp(log(evenlambert(f(x))))}. + generalLambert: (%,I,I) -> % + ++\spad{generalLambert(f(x),a,d)} returns \spad{f(x^a) + f(x^(a + d)) + + ++ f(x^(a + 2 d)) + ... }. \spad{f(x)} should have zero constant + ++ coefficient and \spad{a} and d should be positive. + revert: % -> % + ++ \spad{revert(f(x))} returns a Taylor series \spad{g(x)} such that + ++ \spad{f(g(x)) = g(f(x)) = x}. Series \spad{f(x)} should have constant + ++ coefficient 0 and 1st order coefficient 1. + multisect: (I,I,%) -> % + ++\spad{multisect(a,b,f(x))} selects the coefficients of + ++ \spad{x^((a+b)*n+a)}, and changes this monomial to \spad{x^n}. + invmultisect: (I,I,%) -> % + ++\spad{invmultisect(a,b,f(x))} substitutes \spad{x^((a+b)*n)} + ++ for \spad{x^n} and multiples by \spad{x^b}. + if Coef has Algebra Fraction Integer then + integrate: (%,Variable(var)) -> % + ++ \spad{integrate(f(x),x)} returns an anti-derivative of the power + ++ series \spad{f(x)} with constant coefficient 0. + ++ We may integrate a series when we can divide coefficients + ++ by integers. + + Implementation ==> InnerTaylorSeries(Coef) add + + Rep := Stream Coef + +--% creation and destruction of series + + stream: % -> Stream Coef + stream x == x pretend Stream(Coef) + + coerce(v:Variable(var)) == + zero? cen => monomial(1,1) + monomial(1,1) + monomial(cen,0) + + coerce(n:I) == n :: Coef :: % + coerce(r:Coef) == coerce(r)$STT + monomial(c,n) == monom(c,n)$STT + + getExpon: TERM -> NNI + getExpon term == term.k + getCoef: TERM -> Coef + getCoef term == term.c + rec: (NNI,Coef) -> TERM + rec(expon,coef) == [expon,coef] + + recs: (ST Coef,NNI) -> ST TERM + recs(st,n) == delay$ST(TERM) + empty? st => empty() + zero? (coef := frst st) => recs(rst st,n + 1) + concat(rec(n,coef),recs(rst st,n + 1)) + + terms x == recs(stream x,0) + + recsToCoefs: (ST TERM,NNI) -> ST Coef + recsToCoefs(st,n) == delay + empty? st => empty() + term := frst st; expon := getExpon term + n = expon => concat(getCoef term,recsToCoefs(rst st,n + 1)) + concat(0,recsToCoefs(st,n + 1)) + + series(st: ST TERM) == recsToCoefs(st,0) + + stToPoly: (ST Coef,P,NNI,NNI) -> P + stToPoly(st,term,n,n0) == + (n > n0) or (empty? st) => 0 + frst(st) * term ** n + stToPoly(rst st,term,n + 1,n0) + + polynomial(x,n) == stToPoly(stream x,(var :: P) - (cen :: P),0,n) + + polynomial(x,n1,n2) == + if n1 > n2 then (n1,n2) := (n2,n1) + stToPoly(rest(stream x,n1),(var :: P) - (cen :: P),n1,n2) + + stToUPoly: (ST Coef,UP,NNI,NNI) -> UP + stToUPoly(st,term,n,n0) == + (n > n0) or (empty? st) => 0 + frst(st) * term ** n + stToUPoly(rst st,term,n + 1,n0) + + univariatePolynomial(x,n) == + stToUPoly(stream x,monomial(1,1)$UP - monomial(cen,0)$UP,0,n) + + coerce(p:UP) == + zero? p => 0 + if not zero? cen then + p := p(monomial(1,1)$UP + monomial(cen,0)$UP) + st : ST Coef := empty() + oldDeg : NNI := degree(p) + 1 + while not zero? p repeat + deg := degree p + delta := (oldDeg - deg - 1) :: NNI + for i in 1..delta repeat st := concat(0$Coef,st) + st := concat(leadingCoefficient p,st) + oldDeg := deg; p := reductum p + for i in 1..oldDeg repeat st := concat(0$Coef,st) + st + + if Coef has coerce: Symbol -> Coef then + if Coef has "**": (Coef,NNI) -> Coef then + + stToCoef: (ST Coef,Coef,NNI,NNI) -> Coef + stToCoef(st,term,n,n0) == + (n > n0) or (empty? st) => 0 + frst(st) * term ** n + stToCoef(rst st,term,n + 1,n0) + + approximate(x,n) == + stToCoef(stream x,(var :: Coef) - cen,0,n) + +--% values + + variable x == var + center s == cen + + coefficient(x,n) == + -- Cannot use elt! Should return 0 if stream doesn't have it. + u := stream x + while not empty? u and n > 0 repeat + u := rst u + n := (n - 1) :: NNI + empty? u or n ^= 0 => 0 + frst u + + elt(x:%,n:NNI) == coefficient(x,n) + +--% functions + + map(f,x) == map(f,x)$Rep + eval(x:%,r:Coef) == eval(stream x,r-cen)$STT + differentiate x == deriv(stream x)$STT + differentiate(x:%,v:Variable(var)) == differentiate x + if Coef has PartialDifferentialRing(Symbol) then + differentiate(x:%,s:Symbol) == + (s = variable(x)) => differentiate x + map(differentiate(#1,s),x) - differentiate(center x,s)*differentiate(x) + multiplyCoefficients(f,x) == gderiv(f,stream x)$STT + lagrange x == lagrange(stream x)$STT + lambert x == lambert(stream x)$STT + oddlambert x == oddlambert(stream x)$STT + evenlambert x == evenlambert(stream x)$STT + generalLambert(x:%,a:I,d:I) == generalLambert(stream x,a,d)$STT + extend(x,n) == extend(x,n+1)$Rep + complete x == complete(x)$Rep + truncate(x,n) == first(stream x,n + 1)$Rep + truncate(x,n1,n2) == + if n2 < n1 then (n1,n2) := (n2,n1) + m := (n2 - n1) :: NNI + st := first(rest(stream x,n1)$Rep,m + 1)$Rep + for i in 1..n1 repeat st := concat(0$Coef,st) + st + elt(x:%,y:%) == compose(stream x,stream y)$STT + revert x == revert(stream x)$STT + multisect(a,b,x) == multisect(a,b,stream x)$STT + invmultisect(a,b,x) == invmultisect(a,b,stream x)$STT + multiplyExponents(x,n) == invmultisect(n,0,x) + quoByVar x == (empty? x => 0; rst x) + if Coef has IntegralDomain then + unit? x == unit? coefficient(x,0) + if Coef has Field then + if Coef is RN then + (x:%) ** (s:Coef) == powern(s,stream x)$STT + else + (x:%) ** (s:Coef) == power(s,stream x)$STT + + if Coef has Algebra Fraction Integer then + coerce(r:RN) == r :: Coef :: % + + integrate x == integrate(0,stream x)$STT + integrate(x:%,v:Variable(var)) == integrate x + + if Coef has integrate: (Coef,Symbol) -> Coef and _ + Coef has variables: Coef -> List Symbol then + integrate(x:%,s:Symbol) == + (s = variable(x)) => integrate x + not entry?(s,variables center x) => map(integrate(#1,s),x) + error "integrate: center is a function of variable of integration" + + if Coef has TranscendentalFunctionCategory and _ + Coef has PrimitiveFunctionCategory and _ + Coef has AlgebraicallyClosedFunctionSpace Integer then + + integrateWithOneAnswer: (Coef,Symbol) -> Coef + integrateWithOneAnswer(f,s) == + res := integrate(f,s)$FunctionSpaceIntegration(I,Coef) + res case Coef => res :: Coef + first(res :: List Coef) + + integrate(x:%,s:Symbol) == + (s = variable(x)) => integrate x + not entry?(s,variables center x) => + map(integrateWithOneAnswer(#1,s),x) + error "integrate: center is a function of variable of integration" + +--% OutputForms +-- We use the default coerce: % -> OutputForm in UTSCAT& + +@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{domain UNISEG UniversalSegment} <>= -- seg.spad.pamphlet UniversalSegment.input @@ -74281,6 +77649,564 @@ UniversalSegment(S: Type): SegmentCategory(S) with %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \chapter{Chapter W} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{domain WUTSET WuWenTsunTriangularSet} +<>= +-- triset.spad.pamphlet WuWenTsunTriangularSet.input +)spool WuWenTsunTriangularSet.output +)set message test on +)set message auto off +)clear all +--S 1 of 16 +R := Integer +--R +--R +--R (1) Integer +--R Type: Domain +--E 1 + +--S 2 of 16 +ls : List Symbol := [x,y,z,t] +--R +--R +--R (2) [x,y,z,t] +--R Type: List Symbol +--E 2 + +--S 3 of 16 +V := OVAR(ls) +--R +--R +--R (3) OrderedVariableList [x,y,z,t] +--R Type: Domain +--E 3 + +--S 4 of 16 +E := IndexedExponents V +--R +--R +--R (4) IndexedExponents OrderedVariableList [x,y,z,t] +--R Type: Domain +--E 4 + +--S 5 of 16 +P := NSMP(R, V) +--R +--R +--R (5) NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t]) +--R Type: Domain +--E 5 + +--S 6 of 16 +x: P := 'x +--R +--R +--R (6) x +--R Type: NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t]) +--E 6 + +--S 7 of 16 +y: P := 'y +--R +--R +--R (7) y +--R Type: NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t]) +--E 7 + +--S 8 of 16 +z: P := 'z +--R +--R +--R (8) z +--R Type: NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t]) +--E 8 + +--S 9 of 16 +t: P := 't +--R +--R +--R (9) t +--R Type: NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t]) +--E 9 + +--S 10 of 16 +T := WUTSET(R,E,V,P) +--R +--R +--R (10) +--R WuWenTsunTriangularSet(Integer,IndexedExponents OrderedVariableList [x,y,z,t] +--R ,OrderedVariableList [x,y,z,t],NewSparseMultivariatePolynomial(Integer,Ordere +--R dVariableList [x,y,z,t])) +--R Type: Domain +--E 10 + +--S 11 of 16 +p1 := x ** 31 - x ** 6 - x - y +--R +--R +--R 31 6 +--R (11) x - x - x - y +--R Type: NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t]) +--E 11 + +--S 12 of 16 +p2 := x ** 8 - z +--R +--R +--R 8 +--R (12) x - z +--R Type: NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t]) +--E 12 + +--S 13 of 16 +p3 := x ** 10 - t +--R +--R +--R 10 +--R (13) x - t +--R Type: NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t]) +--E 13 + +--S 14 of 16 +lp := [p1, p2, p3] +--R +--R +--R 31 6 8 10 +--R (14) [x - x - x - y,x - z,x - t] +--RType: List NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t]) +--E 14 + +--S 15 of 16 +characteristicSet(lp)$T +--R +--R +--R (15) +--R 5 4 4 2 2 3 4 7 4 6 6 3 3 3 3 +--R {z - t ,t z y + 2t z y + (- t + 2t - t)z + t z,(t - 1)z x - z y - t } +--RType: Union(WuWenTsunTriangularSet(Integer,IndexedExponents OrderedVariableList [x,y,z,t],OrderedVariableList [x,y,z,t],NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t])),...) +--E 15 + +--S 16 of 16 +zeroSetSplit(lp)$T +--R +--R +--R (16) +--R 3 5 4 3 3 2 +--R [{t,z,y,x}, {t - 1,z - t ,z y + t ,z x - t}, +--R 5 4 4 2 2 3 4 7 4 6 6 3 3 3 3 +--R {z - t ,t z y + 2t z y + (- t + 2t - t)z + t z,(t - 1)z x - z y - t }] +--RType: List WuWenTsunTriangularSet(Integer,IndexedExponents OrderedVariableList [x,y,z,t],OrderedVariableList [x,y,z,t],NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t])) +--E 16 +)spool +)lisp (bye) +@ +<>= +==================================================================== +WuWenTsunTriangularSet examples +==================================================================== + +The WuWenTsunTriangularSet domain constructor implements the +characteristic set method of Wu Wen Tsun. This algorithm computes a +list of triangular sets from a list of polynomials such that the +algebraic variety defined by the given list of polynomials decomposes +into the union of the regular-zero sets of the computed triangular +sets. The constructor takes four arguments. The first one, R, is the +coefficient ring of the polynomials; it must belong to the category +IntegralDomain. The second one, E, is the exponent monoid of the +polynomials; it must belong to the category OrderedAbelianMonoidSup. +The third one, V, is the ordered set of variables; it must belong to +the category OrderedSet. The last one is the polynomial ring; it must +belong to the category RecursivePolynomialCategory(R,E,V). The +abbreviation for WuWenTsunTriangularSet is WUTSET. + +Let us illustrate the facilities by an example. + +Define the coefficient ring. + + R := Integer + Integer + Type: Domain + +Define the list of variables, + + ls : List Symbol := [x,y,z,t] + [x,y,z,t] + Type: List Symbol + +and make it an ordered set; + + V := OVAR(ls) + OrderedVariableList [x,y,z,t] + Type: Domain + +then define the exponent monoid. + + E := IndexedExponents V + IndexedExponents OrderedVariableList [x,y,z,t] + Type: Domain + +Define the polynomial ring. + + P := NSMP(R, V) + NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t]) + Type: Domain + +Let the variables be polynomial. + + x: P := 'x + x + Type: NewSparseMultivariatePolynomial(Integer, + OrderedVariableList [x,y,z,t]) + + y: P := 'y + y + Type: NewSparseMultivariatePolynomial(Integer, + OrderedVariableList [x,y,z,t]) + + z: P := 'z + z + Type: NewSparseMultivariatePolynomial(Integer, + OrderedVariableList [x,y,z,t]) + + t: P := 't + t + Type: NewSparseMultivariatePolynomial(Integer, + OrderedVariableList [x,y,z,t]) + +Now call the WuWenTsunTriangularSet domain constructor. + + T := WUTSET(R,E,V,P) + WuWenTsunTriangularSet(Integer,IndexedExponents OrderedVariableList [x,y,z,t] + ,OrderedVariableList [x,y,z,t],NewSparseMultivariatePolynomial(Integer,Ordere + dVariableList [x,y,z,t])) + Type: Domain + +Define a polynomial system. + + p1 := x ** 31 - x ** 6 - x - y + 31 6 + x - x - x - y + Type: NewSparseMultivariatePolynomial(Integer, + OrderedVariableList [x,y,z,t]) + + p2 := x ** 8 - z + 8 + x - z + Type: NewSparseMultivariatePolynomial(Integer, + OrderedVariableList [x,y,z,t]) + + p3 := x ** 10 - t + 10 + x - t + Type: NewSparseMultivariatePolynomial(Integer, + OrderedVariableList [x,y,z,t]) + + lp := [p1, p2, p3] + 31 6 8 10 + [x - x - x - y,x - z,x - t] + Type: List NewSparseMultivariatePolynomial(Integer, + OrderedVariableList [x,y,z,t]) + +Compute a characteristic set of the system. + + characteristicSet(lp)$T + 5 4 4 2 2 3 4 7 4 6 6 3 3 3 3 + {z - t ,t z y + 2t z y + (- t + 2t - t)z + t z,(t - 1)z x - z y - t } + Type: Union(WuWenTsunTriangularSet(Integer, + IndexedExponents OrderedVariableList [x,y,z,t], + OrderedVariableList [x,y,z,t], + NewSparseMultivariatePolynomial(Integer, + OrderedVariableList [x,y,z,t])),...) + +Solve the system. + + zeroSetSplit(lp)$T + 3 5 4 3 3 2 + [{t,z,y,x}, {t - 1,z - t ,z y + t ,z x - t}, + 5 4 4 2 2 3 4 7 4 6 6 3 3 3 3 + {z - t ,t z y + 2t z y + (- t + 2t - t)z + t z,(t - 1)z x - z y - t }] + Type: List WuWenTsunTriangularSet(Integer, + IndexedExponents OrderedVariableList [x,y,z,t], + OrderedVariableList [x,y,z,t], + NewSparseMultivariatePolynomial(Integer, + OrderedVariableList [x,y,z,t])) + +The RegularTriangularSet and SquareFreeRegularTriangularSet domain +constructors, the LazardSetSolvingPackage package constructors as well as, +SquareFreeRegularTriangularSet and ZeroDimensionalSolvePackage package +constructors also provide operations to compute triangular decompositions +of algebraic varieties. These five constructor use a special kind of +characteristic sets, called regular triangular sets. These special +characteristic sets have better properties than the general ones. +Regular triangular sets and their related concepts are presented in +the paper "On the Theories of Triangular sets" By P. Aubry, D. Lazard +and M. Moreno Maza (to appear in the Journal of Symbolic Computation). +The decomposition algorithm (due to the third author) available in the +four above constructors provide generally better timings than the +characteristic set method. In fact, the WUTSET constructor +remains interesting for the purpose of manipulating characteristic +sets whereas the other constructors are more convenient for solving +polynomial systems. + +Note that the way of understanding triangular decompositions is detailed +in the example of the RegularTriangularSet constructor. + +See Also: +o )help RecursivePolynomialCategory +o )help RegularTriangularSet +o )help SquareFreeRegularTriangularSet +o )help LazardSetSolvingPackage +o )help ZeroDimensionalSolvePackage +o )show WuWenTsunTriangularSet +o $AXIOM/doc/src/algebra/triset.spad.dvi + +@ +\pagehead{WuWenTsunTriangularSet}{WUTSET} +\pagepic{ps/v103wuwentsuntriangularset.ps}{WUTSET}{1.00} +See also:\\ +\refto{GeneralTriangularSet}{GTSET} +<>= +)abbrev domain WUTSET WuWenTsunTriangularSet +++ Author: Marc Moreno Maza (marc@nag.co.uk) +++ Date Created: 11/18/1995 +++ Date Last Updated: 12/15/1998 +++ Basic Functions: +++ Related Constructors: +++ Also See: +++ AMS Classifications: +++ Keywords: +++ Description: A domain constructor of the category \axiomType{GeneralTriangularSet}. +++ The only requirement for a list of polynomials to be a member of such +++ a domain is the following: no polynomial is constant and two distinct +++ polynomials have distinct main variables. Such a triangular set may +++ not be auto-reduced or consistent. The \axiomOpFrom{construct}{WuWenTsunTriangularSet} operation +++ does not check the previous requirement. Triangular sets are stored +++ as sorted lists w.r.t. the main variables of their members. +++ Furthermore, this domain exports operations dealing with the +++ characteristic set method of Wu Wen Tsun and some optimizations +++ mainly proposed by Dong Ming Wang.\newline +++ References : +++ [1] W. T. WU "A Zero Structure Theorem for polynomial equations solving" +++ MM Research Preprints, 1987. +++ [2] D. M. WANG "An implementation of the characteristic set method in Maple" +++ Proc. DISCO'92. Bath, England. +++ Version: 3 + +WuWenTsunTriangularSet(R,E,V,P) : Exports == Implementation where + + R : IntegralDomain + E : OrderedAbelianMonoidSup + V : OrderedSet + P : RecursivePolynomialCategory(R,E,V) + N ==> NonNegativeInteger + Z ==> Integer + B ==> Boolean + LP ==> List P + A ==> FiniteEdge P + H ==> FiniteSimpleHypergraph P + GPS ==> GeneralPolynomialSet(R,E,V,P) + RBT ==> Record(bas:$,top:LP) + RUL ==> Record(chs:Union($,"failed"),rfs:LP) + pa ==> PolynomialSetUtilitiesPackage(R,E,V,P) + NLpT ==> SplittingNode(LP,$) + ALpT ==> SplittingTree(LP,$) + O ==> OutputForm + OP ==> OutputPackage + + Exports == TriangularSetCategory(R,E,V,P) with + + medialSet : (LP,((P,P)->B),((P,P)->P)) -> Union($,"failed") + ++ \axiom{medialSet(ps,redOp?,redOp)} returns \axiom{bs} a basic set + ++ (in Wu Wen Tsun sense w.r.t the reduction-test \axiom{redOp?}) + ++ of some set generating the same ideal as \axiom{ps} (with + ++ rank not higher than any basic set of \axiom{ps}), if no non-zero + ++ constant polynomials appear during the computatioms, else + ++ \axiom{"failed"} is returned. In the former case, \axiom{bs} has to be + ++ understood as a candidate for being a characteristic set of \axiom{ps}. + ++ In the original algorithm, \axiom{bs} is simply a basic set of \axiom{ps}. + medialSet: LP -> Union($,"failed") + ++ \axiom{medial(ps)} returns the same as + ++ \axiom{medialSet(ps,initiallyReduced?,initiallyReduce)}. + characteristicSet : (LP,((P,P)->B),((P,P)->P)) -> Union($,"failed") + ++ \axiom{characteristicSet(ps,redOp?,redOp)} returns a non-contradictory + ++ characteristic set of \axiom{ps} in Wu Wen Tsun sense w.r.t the + ++ reduction-test \axiom{redOp?} (using \axiom{redOp} to reduce + ++ polynomials w.r.t a \axiom{redOp?} basic set), if no + ++ non-zero constant polynomial appear during those reductions, + ++ else \axiom{"failed"} is returned. + ++ The operations \axiom{redOp} and \axiom{redOp?} must satisfy + ++ the following conditions: \axiom{redOp?(redOp(p,q),q)} holds + ++ for every polynomials \axiom{p,q} and there exists an integer + ++ \axiom{e} and a polynomial \axiom{f} such that we have + ++ \axiom{init(q)^e*p = f*q + redOp(p,q)}. + characteristicSet: LP -> Union($,"failed") + ++ \axiom{characteristicSet(ps)} returns the same as + ++ \axiom{characteristicSet(ps,initiallyReduced?,initiallyReduce)}. + characteristicSerie : (LP,((P,P)->B),((P,P)->P)) -> List $ + ++ \axiom{characteristicSerie(ps,redOp?,redOp)} returns a list \axiom{lts} + ++ of triangular sets such that the zero set of \axiom{ps} is the + ++ union of the regular zero sets of the members of \axiom{lts}. + ++ This is made by the Ritt and Wu Wen Tsun process applying + ++ the operation \axiom{characteristicSet(ps,redOp?,redOp)} + ++ to compute characteristic sets in Wu Wen Tsun sense. + characteristicSerie: LP -> List $ + ++ \axiom{characteristicSerie(ps)} returns the same as + ++ \axiom{characteristicSerie(ps,initiallyReduced?,initiallyReduce)}. + + Implementation == GeneralTriangularSet(R,E,V,P) add + + removeSquares: $ -> Union($,"failed") + + Rep ==> LP + + rep(s:$):Rep == s pretend Rep + per(l:Rep):$ == l pretend $ + + removeAssociates (lp:LP):LP == + removeDuplicates [primPartElseUnitCanonical(p) for p in lp] + + medialSetWithTrace (ps:LP,redOp?:((P,P)->B),redOp:((P,P)->P)):Union(RBT,"failed") == + qs := rewriteIdealWithQuasiMonicGenerators(ps,redOp?,redOp)$pa + contradiction : B := any?(ground?,ps) + contradiction => "failed"::Union(RBT,"failed") + rs : LP := qs + bs : $ + while (not empty? rs) and (not contradiction) repeat + rec := basicSet(rs,redOp?) + contradiction := (rec case "failed")@B + if not contradiction + then + bs := (rec::RBT).bas + rs := (rec::RBT).top + rs := rewriteIdealWithRemainder(rs,bs) +-- contradiction := ((not empty? rs) and (one? first(rs))) + contradiction := ((not empty? rs) and (first(rs) = 1)) + if (not empty? rs) and (not contradiction) + then + rs := rewriteSetWithReduction(rs,bs,redOp,redOp?) +-- contradiction := ((not empty? rs) and (one? first(rs))) + contradiction := ((not empty? rs) and (first(rs) = 1)) + if (not empty? rs) and (not contradiction) + then + rs := removeDuplicates concat(rs,members(bs)) + rs := rewriteIdealWithQuasiMonicGenerators(rs,redOp?,redOp)$pa +-- contradiction := ((not empty? rs) and (one? first(rs))) + contradiction := ((not empty? rs) and (first(rs) = 1)) + contradiction => "failed"::Union(RBT,"failed") + ([bs,qs]$RBT)::Union(RBT,"failed") + + medialSet(ps:LP,redOp?:((P,P)->B),redOp:((P,P)->P)) == + foo: Union(RBT,"failed") := medialSetWithTrace(ps,redOp?,redOp) + (foo case "failed") => "failed" :: Union($,"failed") + ((foo::RBT).bas) :: Union($,"failed") + + medialSet(ps:LP) == medialSet(ps,initiallyReduced?,initiallyReduce) + + characteristicSetUsingTrace(ps:LP,redOp?:((P,P)->B),redOp:((P,P)->P)):Union($,"failed") == + ps := removeAssociates ps + ps := remove(zero?,ps) + contradiction : B := any?(ground?,ps) + contradiction => "failed"::Union($,"failed") + rs : LP := ps + qs : LP := ps + ms : $ + while (not empty? rs) and (not contradiction) repeat + rec := medialSetWithTrace (qs,redOp?,redOp) + contradiction := (rec case "failed")@B + if not contradiction + then + ms := (rec::RBT).bas + qs := (rec::RBT).top + qs := rewriteIdealWithRemainder(qs,ms) +-- contradiction := ((not empty? qs) and (one? first(qs))) + contradiction := ((not empty? qs) and (first(qs) = 1)) + if not contradiction + then + rs := rewriteSetWithReduction(qs,ms,lazyPrem,reduced?) +-- contradiction := ((not empty? rs) and (one? first(rs))) + contradiction := ((not empty? rs) and (first(rs) = 1)) + if (not contradiction) and (not empty? rs) + then + qs := removeDuplicates(concat(rs,concat(members(ms),qs))) + contradiction => "failed"::Union($,"failed") + ms::Union($,"failed") + + characteristicSet(ps:LP,redOp?:((P,P)->B),redOp:((P,P)->P)) == + characteristicSetUsingTrace(ps,redOp?,redOp) + + characteristicSet(ps:LP) == characteristicSet(ps,initiallyReduced?,initiallyReduce) + + characteristicSerie(ps:LP,redOp?:((P,P)->B),redOp:((P,P)->P)) == + a := [[ps,empty()$$]$NLpT]$ALpT + while ((esl := extractSplittingLeaf(a)) case ALpT) repeat + ps := value(value(esl::ALpT)$ALpT)$NLpT + charSet? := characteristicSetUsingTrace(ps,redOp?,redOp) + if not (charSet? case $) + then + setvalue!(esl::ALpT,[nil()$LP,empty()$$,true]$NLpT) + updateStatus!(a) + else + cs := (charSet?)::$ + lics := initials(cs) + lics := removeRedundantFactors(lics)$pa + lics := sort(infRittWu?,lics) + if empty? lics + then + setvalue!(esl::ALpT,[ps,cs,true]$NLpT) + updateStatus!(a) + else + ln : List NLpT := [[nil()$LP,cs,true]$NLpT] + while not empty? lics repeat + newps := cons(first(lics),concat(cs::LP,ps)) + lics := rest lics + newps := removeDuplicates newps + newps := sort(infRittWu?,newps) + ln := cons([newps,empty()$$,false]$NLpT,ln) + splitNodeOf!(esl::ALpT,a,ln) + remove(empty()$$,conditions(a)) + + characteristicSerie(ps:LP) == characteristicSerie (ps,initiallyReduced?,initiallyReduce) + + if R has GcdDomain + then + + removeSquares (ts:$):Union($,"failed") == + empty?(ts)$$ => ts::Union($,"failed") + p := (first ts)::P + rsts : Union($,"failed") + rsts := removeSquares((rest ts)::$) + not(rsts case $) => "failed"::Union($,"failed") + newts := rsts::$ + empty? newts => + p := squareFreePart(p) + (per([primitivePart(p)]$LP))::Union($,"failed") + zero? initiallyReduce(init(p),newts) => "failed"::Union($,"failed") + p := primitivePart(removeZero(p,newts)) + ground? p => "failed"::Union($,"failed") + not (mvar(newts) < mvar(p)) => "failed"::Union($,"failed") + p := squareFreePart(p) + (per(cons(unitCanonical(p),rep(newts))))::Union($,"failed") + + zeroSetSplit lp == + lts : List $ := characteristicSerie(lp,initiallyReduced?,initiallyReduce) + lts := removeDuplicates(lts)$(List $) + newlts : List $ := [] + while not empty? lts repeat + ts := first lts + lts := rest lts + iic := removeSquares(ts) + if iic case $ + then + newlts := cons(iic::$,newlts) + newlts := removeDuplicates(newlts)$(List $) + sort(infRittWu?, newlts) + + else + + zeroSetSplit lp == + lts : List $ := characteristicSerie(lp,initiallyReduced?,initiallyReduce) + sort(infRittWu?, removeDuplicates lts) + +@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \chapter{Chapter X} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -79102,12 +83028,16 @@ Note that this code is not included in the generated catdef.spad file. <> <> +<> <> <> <> <> <> <> +<> +<> +<> <> <> @@ -79151,12 +83081,13 @@ Note that this code is not included in the generated catdef.spad file. <> <> -<> +<> <> <> <> <> <> +<> <> <> <> @@ -79203,8 +83134,11 @@ Note that this code is not included in the generated catdef.spad file. <> <> <> +<> +<> <> +<> <> <> <> @@ -79233,6 +83167,8 @@ Note that this code is not included in the generated catdef.spad file. <> <> <> +<> +<> <> <> <> @@ -79310,6 +83246,7 @@ Note that this code is not included in the generated catdef.spad file. <> <> <> +<> <> <> <> @@ -79360,6 +83297,7 @@ Note that this code is not included in the generated catdef.spad file. <> <> <> +<> <> <> <> @@ -79374,6 +83312,7 @@ Note that this code is not included in the generated catdef.spad file. <> <> <> +<> <> <> <> @@ -79382,11 +83321,16 @@ Note that this code is not included in the generated catdef.spad file. <> <> +<> +<> <> +<> <> <> <> <> +<> +<> <> <> @@ -79397,8 +83341,10 @@ Note that this code is not included in the generated catdef.spad file. <> <> <> +<> <> +<> @ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \chapter{Index} diff --git a/books/ps/v103balancedbinarytree.ps b/books/ps/v103balancedbinarytree.ps new file mode 100644 index 0000000..7916997 --- /dev/null +++ b/books/ps/v103balancedbinarytree.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 176 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 176 80 +%%PageOrientation: Portrait +gsave +36 36 140 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 +138 42 lineto +138 -6 lineto +closepath +fill +0.167 0.600 1.000 graphcolor +newpath -6 -6 moveto +-6 42 lineto +138 42 lineto +138 -6 lineto +closepath +stroke +0.000 0.000 0.000 graphcolor +14.00 /Times-Roman set_font +% BalancedBinaryTree +[ /Rect [ 0 0 132 36 ] + /Border [ 0 0 0 ] + /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=BBTREE) >> + /Subtype /Link +/ANN pdfmark +gsave 10 dict begin +filled +0.537 0.247 0.902 nodecolor +0.537 0.247 0.902 nodecolor +newpath 132 36 moveto +0 36 lineto +0 0 lineto +132 0 lineto +closepath +fill +0.537 0.247 0.902 nodecolor +newpath 132 36 moveto +0 36 lineto +0 0 lineto +132 0 lineto +closepath +stroke +gsave 10 dict begin +0.000 0.000 0.000 nodecolor +7 13 moveto +(BalancedBinaryTree) +[9.36 6.24 3.84 6.24 6.96 6.24 6.24 6.96 9.36 3.84 6.96 6.24 5.04 6.96 7.92 4.8 6.24 6.24] +xshow +end grestore +end grestore +endpage +showpage +grestore +%%PageTrailer +%%EndPage: 1 +%%Trailer +%%Pages: 1 +end +restore +%%EOF diff --git a/books/ps/v103binarysearchtree.ps b/books/ps/v103binarysearchtree.ps new file mode 100644 index 0000000..aa785ca --- /dev/null +++ b/books/ps/v103binarysearchtree.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 +% BinarySearchTree +[ /Rect [ 0 0 118 36 ] + /Border [ 0 0 0 ] + /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=BSTREE) >> + /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 +7 13 moveto +(BinarySearchTree) +[9.36 3.84 6.96 6.24 5.04 6.96 7.68 6.24 6.24 4.8 6 6.96 7.92 4.8 6.24 6.24] +xshow +end grestore +end grestore +endpage +showpage +grestore +%%PageTrailer +%%EndPage: 1 +%%Trailer +%%Pages: 1 +end +restore +%%EOF diff --git a/books/ps/v103binarytournament.ps b/books/ps/v103binarytournament.ps new file mode 100644 index 0000000..af7c9e1 --- /dev/null +++ b/books/ps/v103binarytournament.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 166 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 166 80 +%%PageOrientation: Portrait +gsave +36 36 130 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 +128 42 lineto +128 -6 lineto +closepath +fill +0.167 0.600 1.000 graphcolor +newpath -6 -6 moveto +-6 42 lineto +128 42 lineto +128 -6 lineto +closepath +stroke +0.000 0.000 0.000 graphcolor +14.00 /Times-Roman set_font +% BinaryTournament +[ /Rect [ 0 0 122 36 ] + /Border [ 0 0 0 ] + /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=BTOURN) >> + /Subtype /Link +/ANN pdfmark +gsave 10 dict begin +filled +0.537 0.247 0.902 nodecolor +0.537 0.247 0.902 nodecolor +newpath 122 36 moveto +0 36 lineto +0 0 lineto +122 0 lineto +closepath +fill +0.537 0.247 0.902 nodecolor +newpath 122 36 moveto +0 36 lineto +0 0 lineto +122 0 lineto +closepath +stroke +gsave 10 dict begin +0.000 0.000 0.000 nodecolor +7 13 moveto +(BinaryTournament) +[9.36 3.84 6.96 6.24 5.04 6.96 7.44 6.96 6.96 5.04 6.96 6.24 10.8 6.24 6.96 3.84] +xshow +end grestore +end grestore +endpage +showpage +grestore +%%PageTrailer +%%EndPage: 1 +%%Trailer +%%Pages: 1 +end +restore +%%EOF diff --git a/books/ps/v103binarytree.ps b/books/ps/v103binarytree.ps new file mode 100644 index 0000000..905a3a8 --- /dev/null +++ b/books/ps/v103binarytree.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 124 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 124 80 +%%PageOrientation: Portrait +gsave +36 36 88 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 +86 42 lineto +86 -6 lineto +closepath +fill +0.167 0.600 1.000 graphcolor +newpath -6 -6 moveto +-6 42 lineto +86 42 lineto +86 -6 lineto +closepath +stroke +0.000 0.000 0.000 graphcolor +14.00 /Times-Roman set_font +% BinaryTree +[ /Rect [ 0 0 80 36 ] + /Border [ 0 0 0 ] + /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=BTREE) >> + /Subtype /Link +/ANN pdfmark +gsave 10 dict begin +filled +0.537 0.247 0.902 nodecolor +0.537 0.247 0.902 nodecolor +newpath 80 36 moveto +0 36 lineto +0 0 lineto +80 0 lineto +closepath +fill +0.537 0.247 0.902 nodecolor +newpath 80 36 moveto +0 36 lineto +0 0 lineto +80 0 lineto +closepath +stroke +gsave 10 dict begin +0.000 0.000 0.000 nodecolor +7 13 moveto +(BinaryTree) +[9.36 3.84 6.96 6.24 5.04 6.96 7.92 4.8 6.24 6.24] +xshow +end grestore +end grestore +endpage +showpage +grestore +%%PageTrailer +%%EndPage: 1 +%%Trailer +%%Pages: 1 +end +restore +%%EOF diff --git a/books/ps/v103eqtable.ps b/books/ps/v103eqtable.ps new file mode 100644 index 0000000..3fac874 --- /dev/null +++ b/books/ps/v103eqtable.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 106 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 106 80 +%%PageOrientation: Portrait +gsave +36 36 70 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 +68 42 lineto +68 -6 lineto +closepath +fill +0.167 0.600 1.000 graphcolor +newpath -6 -6 moveto +-6 42 lineto +68 42 lineto +68 -6 lineto +closepath +stroke +0.000 0.000 0.000 graphcolor +14.00 /Times-Roman set_font +% EqTable +[ /Rect [ 0 0 62 36 ] + /Border [ 0 0 0 ] + /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=EQTBL) >> + /Subtype /Link +/ANN pdfmark +gsave 10 dict begin +filled +0.537 0.247 0.902 nodecolor +0.537 0.247 0.902 nodecolor +newpath 62 36 moveto +0 36 lineto +0 0 lineto +62 0 lineto +closepath +fill +0.537 0.247 0.902 nodecolor +newpath 62 36 moveto +0 36 lineto +0 0 lineto +62 0 lineto +closepath +stroke +gsave 10 dict begin +0.000 0.000 0.000 nodecolor +7 13 moveto +(EqTable) +[8.64 6.96 7.68 6.24 6.96 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/v103generalsparsetable.ps b/books/ps/v103generalsparsetable.ps new file mode 100644 index 0000000..e34d538 --- /dev/null +++ b/books/ps/v103generalsparsetable.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 +% GeneralSparseTable +[ /Rect [ 0 0 128 36 ] + /Border [ 0 0 0 ] + /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=GSTBL) >> + /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 +7 13 moveto +(GeneralSparseTable) +[10.08 6.24 6.96 6.24 4.8 6.24 3.84 7.68 6.96 6.24 4.8 5.52 6.24 7.68 6.24 6.96 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/v103generaltriangularset.ps b/books/ps/v103generaltriangularset.ps new file mode 100644 index 0000000..b9bb964 --- /dev/null +++ b/books/ps/v103generaltriangularset.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 +% GeneralTriangularSet +[ /Rect [ 0 0 136 36 ] + /Border [ 0 0 0 ] + /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=GTSET) >> + /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 +(GeneralTriangularSet) +[10.08 6.24 6.96 6.24 4.8 6.24 3.84 7.92 5.04 3.84 6.24 6.96 6.96 6.96 3.84 6.24 4.8 7.68 6 3.84] +xshow +end grestore +end grestore +endpage +showpage +grestore +%%PageTrailer +%%EndPage: 1 +%%Trailer +%%Pages: 1 +end +restore +%%EOF diff --git a/books/ps/v103hashtable.ps b/books/ps/v103hashtable.ps new file mode 100644 index 0000000..4877773 --- /dev/null +++ b/books/ps/v103hashtable.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 120 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 120 80 +%%PageOrientation: Portrait +gsave +36 36 84 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 +82 42 lineto +82 -6 lineto +closepath +fill +0.167 0.600 1.000 graphcolor +newpath -6 -6 moveto +-6 42 lineto +82 42 lineto +82 -6 lineto +closepath +stroke +0.000 0.000 0.000 graphcolor +14.00 /Times-Roman set_font +% HashTable +[ /Rect [ 0 0 76 36 ] + /Border [ 0 0 0 ] + /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=HASHTBL) >> + /Subtype /Link +/ANN pdfmark +gsave 10 dict begin +filled +0.537 0.247 0.902 nodecolor +0.537 0.247 0.902 nodecolor +newpath 76 36 moveto +0 36 lineto +0 0 lineto +76 0 lineto +closepath +fill +0.537 0.247 0.902 nodecolor +newpath 76 36 moveto +0 36 lineto +0 0 lineto +76 0 lineto +closepath +stroke +gsave 10 dict begin +0.000 0.000 0.000 nodecolor +7 13 moveto +(HashTable) +[10.08 6.24 5.52 6.96 7.68 6.24 6.96 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/v103innertable.ps b/books/ps/v103innertable.ps new file mode 100644 index 0000000..26c4675 --- /dev/null +++ b/books/ps/v103innertable.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 122 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 122 80 +%%PageOrientation: Portrait +gsave +36 36 86 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 +84 42 lineto +84 -6 lineto +closepath +fill +0.167 0.600 1.000 graphcolor +newpath -6 -6 moveto +-6 42 lineto +84 42 lineto +84 -6 lineto +closepath +stroke +0.000 0.000 0.000 graphcolor +14.00 /Times-Roman set_font +% InnerTable +[ /Rect [ 0 0 78 36 ] + /Border [ 0 0 0 ] + /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=INTABL) >> + /Subtype /Link +/ANN pdfmark +gsave 10 dict begin +filled +0.537 0.247 0.902 nodecolor +0.537 0.247 0.902 nodecolor +newpath 78 36 moveto +0 36 lineto +0 0 lineto +78 0 lineto +closepath +fill +0.537 0.247 0.902 nodecolor +newpath 78 36 moveto +0 36 lineto +0 0 lineto +78 0 lineto +closepath +stroke +gsave 10 dict begin +0.000 0.000 0.000 nodecolor +8 13 moveto +(InnerTable) +[4.56 6.96 6.96 6.24 4.8 7.68 6.24 6.96 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/v103innertaylorseries.ps b/books/ps/v103innertaylorseries.ps new file mode 100644 index 0000000..242e3ac --- /dev/null +++ b/books/ps/v103innertaylorseries.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 160 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 160 80 +%%PageOrientation: Portrait +gsave +36 36 124 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 +122 42 lineto +122 -6 lineto +closepath +fill +0.167 0.600 1.000 graphcolor +newpath -6 -6 moveto +-6 42 lineto +122 42 lineto +122 -6 lineto +closepath +stroke +0.000 0.000 0.000 graphcolor +14.00 /Times-Roman set_font +% InnerTaylorSeries +[ /Rect [ 0 0 116 36 ] + /Border [ 0 0 0 ] + /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=ITAYLOR) >> + /Subtype /Link +/ANN pdfmark +gsave 10 dict begin +filled +0.537 0.247 0.902 nodecolor +0.537 0.247 0.902 nodecolor +newpath 116 36 moveto +0 36 lineto +0 0 lineto +116 0 lineto +closepath +fill +0.537 0.247 0.902 nodecolor +newpath 116 36 moveto +0 36 lineto +0 0 lineto +116 0 lineto +closepath +stroke +gsave 10 dict begin +0.000 0.000 0.000 nodecolor +7 13 moveto +(InnerTaylorSeries) +[4.56 6.96 6.96 6.24 4.8 7.68 5.76 6.48 3.84 6.96 4.8 7.68 6.24 5.04 3.84 6.24 5.52] +xshow +end grestore +end grestore +endpage +showpage +grestore +%%PageTrailer +%%EndPage: 1 +%%Trailer +%%Pages: 1 +end +restore +%%EOF diff --git a/books/ps/v103pendanttree.ps b/books/ps/v103pendanttree.ps new file mode 100644 index 0000000..d64e2be --- /dev/null +++ b/books/ps/v103pendanttree.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 130 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 130 80 +%%PageOrientation: Portrait +gsave +36 36 94 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 +92 42 lineto +92 -6 lineto +closepath +fill +0.167 0.600 1.000 graphcolor +newpath -6 -6 moveto +-6 42 lineto +92 42 lineto +92 -6 lineto +closepath +stroke +0.000 0.000 0.000 graphcolor +14.00 /Times-Roman set_font +% PendantTree +[ /Rect [ 0 0 86 36 ] + /Border [ 0 0 0 ] + /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=PENDTREE) >> + /Subtype /Link +/ANN pdfmark +gsave 10 dict begin +filled +0.537 0.247 0.902 nodecolor +0.537 0.247 0.902 nodecolor +newpath 86 36 moveto +0 36 lineto +0 0 lineto +86 0 lineto +closepath +fill +0.537 0.247 0.902 nodecolor +newpath 86 36 moveto +0 36 lineto +0 0 lineto +86 0 lineto +closepath +stroke +gsave 10 dict begin +0.000 0.000 0.000 nodecolor +7 13 moveto +(PendantTree) +[7.44 6.24 6.96 6.96 6.24 6.96 3.84 7.92 4.8 6.24 6.24] +xshow +end grestore +end grestore +endpage +showpage +grestore +%%PageTrailer +%%EndPage: 1 +%%Trailer +%%Pages: 1 +end +restore +%%EOF diff --git a/books/ps/v103sparsetable.ps b/books/ps/v103sparsetable.ps new file mode 100644 index 0000000..e0b8e16 --- /dev/null +++ b/books/ps/v103sparsetable.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 128 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 128 80 +%%PageOrientation: Portrait +gsave +36 36 92 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 +90 42 lineto +90 -6 lineto +closepath +fill +0.167 0.600 1.000 graphcolor +newpath -6 -6 moveto +-6 42 lineto +90 42 lineto +90 -6 lineto +closepath +stroke +0.000 0.000 0.000 graphcolor +14.00 /Times-Roman set_font +% SparseTable +[ /Rect [ 0 0 84 36 ] + /Border [ 0 0 0 ] + /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=STBL) >> + /Subtype /Link +/ANN pdfmark +gsave 10 dict begin +filled +0.537 0.247 0.902 nodecolor +0.537 0.247 0.902 nodecolor +newpath 84 36 moveto +0 36 lineto +0 0 lineto +84 0 lineto +closepath +fill +0.537 0.247 0.902 nodecolor +newpath 84 36 moveto +0 36 lineto +0 0 lineto +84 0 lineto +closepath +stroke +gsave 10 dict begin +0.000 0.000 0.000 nodecolor +7 13 moveto +(SparseTable) +[7.68 6.96 6.24 4.8 5.52 6.24 7.68 6.24 6.96 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/v103stringtable.ps b/books/ps/v103stringtable.ps new file mode 100644 index 0000000..c7e093a --- /dev/null +++ b/books/ps/v103stringtable.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 126 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 126 80 +%%PageOrientation: Portrait +gsave +36 36 90 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 +88 42 lineto +88 -6 lineto +closepath +fill +0.167 0.600 1.000 graphcolor +newpath -6 -6 moveto +-6 42 lineto +88 42 lineto +88 -6 lineto +closepath +stroke +0.000 0.000 0.000 graphcolor +14.00 /Times-Roman set_font +% StringTable +[ /Rect [ 0 0 82 36 ] + /Border [ 0 0 0 ] + /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=STRTBL) >> + /Subtype /Link +/ANN pdfmark +gsave 10 dict begin +filled +0.537 0.247 0.902 nodecolor +0.537 0.247 0.902 nodecolor +newpath 82 36 moveto +0 36 lineto +0 0 lineto +82 0 lineto +closepath +fill +0.537 0.247 0.902 nodecolor +newpath 82 36 moveto +0 36 lineto +0 0 lineto +82 0 lineto +closepath +stroke +gsave 10 dict begin +0.000 0.000 0.000 nodecolor +8 13 moveto +(StringTable) +[7.44 3.84 5.04 3.84 6.96 6.96 7.68 6.24 6.96 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/v103table.ps b/books/ps/v103table.ps new file mode 100644 index 0000000..6f31a7f --- /dev/null +++ b/books/ps/v103table.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 +% Table +[ /Rect [ 0 0 54 36 ] + /Border [ 0 0 0 ] + /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=TABLE) >> + /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 +11 13 moveto +(Table) +[7.68 6.24 6.96 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/v103tableau.ps b/books/ps/v103tableau.ps new file mode 100644 index 0000000..b3503a3 --- /dev/null +++ b/books/ps/v103tableau.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 104 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 104 80 +%%PageOrientation: Portrait +gsave +36 36 68 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 +66 42 lineto +66 -6 lineto +closepath +fill +0.167 0.600 1.000 graphcolor +newpath -6 -6 moveto +-6 42 lineto +66 42 lineto +66 -6 lineto +closepath +stroke +0.000 0.000 0.000 graphcolor +14.00 /Times-Roman set_font +% Tableau +[ /Rect [ 0 0 60 36 ] + /Border [ 0 0 0 ] + /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=TABLEAU) >> + /Subtype /Link +/ANN pdfmark +gsave 10 dict begin +filled +0.537 0.247 0.902 nodecolor +0.537 0.247 0.902 nodecolor +newpath 60 36 moveto +0 36 lineto +0 0 lineto +60 0 lineto +closepath +fill +0.537 0.247 0.902 nodecolor +newpath 60 36 moveto +0 36 lineto +0 0 lineto +60 0 lineto +closepath +stroke +gsave 10 dict begin +0.000 0.000 0.000 nodecolor +7 13 moveto +(Tableau) +[7.68 6.24 6.96 3.84 6.24 6.24 6.96] +xshow +end grestore +end grestore +endpage +showpage +grestore +%%PageTrailer +%%EndPage: 1 +%%Trailer +%%Pages: 1 +end +restore +%%EOF diff --git a/books/ps/v103texformat.ps b/books/ps/v103texformat.ps new file mode 100644 index 0000000..2e24a7e --- /dev/null +++ b/books/ps/v103texformat.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 120 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 120 80 +%%PageOrientation: Portrait +gsave +36 36 84 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 +82 42 lineto +82 -6 lineto +closepath +fill +0.167 0.600 1.000 graphcolor +newpath -6 -6 moveto +-6 42 lineto +82 42 lineto +82 -6 lineto +closepath +stroke +0.000 0.000 0.000 graphcolor +14.00 /Times-Roman set_font +% TexFormat +[ /Rect [ 0 0 76 36 ] + /Border [ 0 0 0 ] + /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=TEX) >> + /Subtype /Link +/ANN pdfmark +gsave 10 dict begin +filled +0.537 0.247 0.902 nodecolor +0.537 0.247 0.902 nodecolor +newpath 76 36 moveto +0 36 lineto +0 0 lineto +76 0 lineto +closepath +fill +0.537 0.247 0.902 nodecolor +newpath 76 36 moveto +0 36 lineto +0 0 lineto +76 0 lineto +closepath +stroke +gsave 10 dict begin +0.000 0.000 0.000 nodecolor +7 13 moveto +(TexFormat) +[7.44 5.76 6.96 7.44 6.96 5.04 10.8 6.24 3.84] +xshow +end grestore +end grestore +endpage +showpage +grestore +%%PageTrailer +%%EndPage: 1 +%%Trailer +%%Pages: 1 +end +restore +%%EOF diff --git a/books/ps/v103tree.ps b/books/ps/v103tree.ps new file mode 100644 index 0000000..3091b8e --- /dev/null +++ b/books/ps/v103tree.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 +% Tree +[ /Rect [ 0 0 54 36 ] + /Border [ 0 0 0 ] + /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=TREE) >> + /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 +14 13 moveto +(Tree) +[7.92 4.8 6.24 6.24] +xshow +end grestore +end grestore +endpage +showpage +grestore +%%PageTrailer +%%EndPage: 1 +%%Trailer +%%Pages: 1 +end +restore +%%EOF diff --git a/books/ps/v103tubeplot.ps b/books/ps/v103tubeplot.ps new file mode 100644 index 0000000..bbe0aa3 --- /dev/null +++ b/books/ps/v103tubeplot.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 110 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 110 80 +%%PageOrientation: Portrait +gsave +36 36 74 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 +72 42 lineto +72 -6 lineto +closepath +fill +0.167 0.600 1.000 graphcolor +newpath -6 -6 moveto +-6 42 lineto +72 42 lineto +72 -6 lineto +closepath +stroke +0.000 0.000 0.000 graphcolor +14.00 /Times-Roman set_font +% TubePlot +[ /Rect [ 0 0 66 36 ] + /Border [ 0 0 0 ] + /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=TUBE) >> + /Subtype /Link +/ANN pdfmark +gsave 10 dict begin +filled +0.537 0.247 0.902 nodecolor +0.537 0.247 0.902 nodecolor +newpath 66 36 moveto +0 36 lineto +0 0 lineto +66 0 lineto +closepath +fill +0.537 0.247 0.902 nodecolor +newpath 66 36 moveto +0 36 lineto +0 0 lineto +66 0 lineto +closepath +stroke +gsave 10 dict begin +0.000 0.000 0.000 nodecolor +8 13 moveto +(TubePlot) +[7.44 6.96 6.96 6.24 7.68 3.84 6.72 3.84] +xshow +end grestore +end grestore +endpage +showpage +grestore +%%PageTrailer +%%EndPage: 1 +%%Trailer +%%Pages: 1 +end +restore +%%EOF diff --git a/books/ps/v103univariatetaylorseries.ps b/books/ps/v103univariatetaylorseries.ps new file mode 100644 index 0000000..7521417 --- /dev/null +++ b/books/ps/v103univariatetaylorseries.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 190 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 190 80 +%%PageOrientation: Portrait +gsave +36 36 154 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 +152 42 lineto +152 -6 lineto +closepath +fill +0.167 0.600 1.000 graphcolor +newpath -6 -6 moveto +-6 42 lineto +152 42 lineto +152 -6 lineto +closepath +stroke +0.000 0.000 0.000 graphcolor +14.00 /Times-Roman set_font +% UnivariateTaylorSeries +[ /Rect [ 0 0 146 36 ] + /Border [ 0 0 0 ] + /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=UTS) >> + /Subtype /Link +/ANN pdfmark +gsave 10 dict begin +filled +0.537 0.247 0.902 nodecolor +0.537 0.247 0.902 nodecolor +newpath 146 36 moveto +0 36 lineto +0 0 lineto +146 0 lineto +closepath +fill +0.537 0.247 0.902 nodecolor +newpath 146 36 moveto +0 36 lineto +0 0 lineto +146 0 lineto +closepath +stroke +gsave 10 dict begin +0.000 0.000 0.000 nodecolor +8 13 moveto +(UnivariateTaylorSeries) +[9.6 6.96 3.84 6.72 6.24 5.04 3.84 6.24 3.84 6.24 7.68 5.76 6.48 3.84 6.96 4.8 7.68 6.24 5.04 3.84 6.24 5.52] +xshow +end grestore +end grestore +endpage +showpage +grestore +%%PageTrailer +%%EndPage: 1 +%%Trailer +%%Pages: 1 +end +restore +%%EOF diff --git a/books/ps/v103wuwentsuntriangularset.ps b/books/ps/v103wuwentsuntriangularset.ps new file mode 100644 index 0000000..58a23b8 --- /dev/null +++ b/books/ps/v103wuwentsuntriangularset.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 208 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 208 80 +%%PageOrientation: Portrait +gsave +36 36 172 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 +170 42 lineto +170 -6 lineto +closepath +fill +0.167 0.600 1.000 graphcolor +newpath -6 -6 moveto +-6 42 lineto +170 42 lineto +170 -6 lineto +closepath +stroke +0.000 0.000 0.000 graphcolor +14.00 /Times-Roman set_font +% WuWenTsunTriangularSet +[ /Rect [ 0 0 164 36 ] + /Border [ 0 0 0 ] + /Action << /Subtype /URI /URI (bookvol10.3.pdf#nameddest=WUTSET) >> + /Subtype /Link +/ANN pdfmark +gsave 10 dict begin +filled +0.537 0.247 0.902 nodecolor +0.537 0.247 0.902 nodecolor +newpath 164 36 moveto +0 36 lineto +0 0 lineto +164 0 lineto +closepath +fill +0.537 0.247 0.902 nodecolor +newpath 164 36 moveto +0 36 lineto +0 0 lineto +164 0 lineto +closepath +stroke +gsave 10 dict begin +0.000 0.000 0.000 nodecolor +7 13 moveto +(WuWenTsunTriangularSet) +[12.48 6.96 12.24 6.24 6.24 7.68 5.52 6.96 6.24 7.92 5.04 3.84 6.24 6.96 6.96 6.96 3.84 6.24 4.8 7.68 6 3.84] +xshow +end grestore +end grestore +endpage +showpage +grestore +%%PageTrailer +%%EndPage: 1 +%%Trailer +%%Pages: 1 +end +restore +%%EOF diff --git a/changelog b/changelog index a97ed0f..43b0db7 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,35 @@ +20081216 tpd src/axiom-website/patches.html 20081216.03.tpd.patch +20081216 tpd books/bookvol10.3 add domains +20081216 tpd books/ps/v103wuwentsuntriangularset.ps added +20081216 tpd books/ps/v103univariatetaylorseries.ps added +20081216 tpd books/ps/v103tubeplot.ps added +20081216 tpd books/ps/v103tree.ps added +20081216 tpd books/ps/v103texformat.ps added +20081216 tpd books/ps/v103tableau.ps added +20081216 tpd books/ps/v103table.ps added +20081216 tpd books/ps/v103stringtable.ps added +20081216 tpd books/ps/v103sparsetable.ps added +20081216 tpd books/ps/v103pendanttree.ps added +20081216 tpd books/ps/v103innertaylorseries.ps added +20081216 tpd books/ps/v103innertable.ps added +20081216 tpd books/ps/v103hashtable.ps added +20081216 tpd books/ps/v103generaltriangularset.ps added +20081216 tpd books/ps/v103generalsparsetable.ps added +20081216 tpd books/ps/v103eqtable.ps added +20081216 tpd books/ps/v103binarytree.ps added +20081216 tpd books/ps/v103binarytournament.ps added +20081216 tpd books/ps/v103binarysearchtree.ps added +20081216 tpd books/ps/v103balancedbinarytree.ps added +20081216 tpd src/algebra/tube.spad move domain to bookvol10.3 +20081216 tpd src/algebra/Makefile fix help for triset +20081216 tpd src/algebra/triset.spad move domains to bookvol10.3 +20081216 tpd src/algebra/Makefile remove tree.spad, fix help +20081216 tpd src/algebra/tree.spad removed, move domains to bookvol10.3 +20081216 tpd src/algebra/tex.spad move domains to bookvol10.3 +20081216 tpd src/algebra/taylor.spad move domains to bookvol10.3 +20081216 tpd src/algebra/Makefile remove table.spad, fix help +20081216 tpd src/algebra/table.spad removed, move domains to bookvol10.3 +20081216 tpd src/algebra/tableau.spad move domains to bookvol10.3 20081216 tpd src/axiom-website/patches.html 20081216.02.tpd.patch 20081216 tpd src/input/biquat.input source file name change 20081216 tpd src/axiom-website/patches.html 20081216.01.tpd.patch diff --git a/src/algebra/Makefile.pamphlet b/src/algebra/Makefile.pamphlet index 5cb177f..1c80278 100644 --- a/src/algebra/Makefile.pamphlet +++ b/src/algebra/Makefile.pamphlet @@ -555,7 +555,6 @@ sttf.spad.pamphlet (STTF STTFNC) sturm.spad.pamphlet (SHP) sum.spad.pamphlet (ISUMP GOSPER SUMRF) tex.spad.pamphlet (TEX) -tree.spad.pamphlet (TREE BTCAT BTREE BSTREE BTOURN BBTREE PENDTREE) twofact.spad.pamphlet (NORMRETR TWOFACT) unifact.spad.pamphlet (UNIFACT) updecomp.spad.pamphlet (UPDECOMP) @@ -696,7 +695,6 @@ LAYER17=\ \begin{verbatim} d01package.spad.pamphlet (INTPACK) list.spad.pamphlet (ILIST LIST LIST2 LIST3 LIST2MAP ALIST) -table.spad.pamphlet (HASHTBL INTABL TABLE EQTBL STRTBL GSTBL STBL) \end{verbatim} <>= @@ -1202,9 +1200,9 @@ SPADFILES= \ ${OUTSRC}/sttf.spad ${OUTSRC}/sturm.spad \ ${OUTSRC}/sum.spad \ ${OUTSRC}/syssolp.spad ${OUTSRC}/system.spad \ - ${OUTSRC}/tableau.spad ${OUTSRC}/table.spad ${OUTSRC}/taylor.spad \ + ${OUTSRC}/tableau.spad ${OUTSRC}/taylor.spad \ ${OUTSRC}/tex.spad ${OUTSRC}/tools.spad ${OUTSRC}/transsolve.spad \ - ${OUTSRC}/tree.spad ${OUTSRC}/triset.spad \ + ${OUTSRC}/triset.spad \ ${OUTSRC}/tube.spad ${OUTSRC}/twofact.spad \ ${OUTSRC}/unifact.spad ${OUTSRC}/updecomp.spad ${OUTSRC}/updivp.spad \ ${OUTSRC}/utsode.spad \ @@ -1354,9 +1352,9 @@ DOCFILES= \ ${DOC}/sttf.spad.dvi ${DOC}/sturm.spad.dvi \ ${DOC}/sum.spad.dvi \ ${DOC}/syssolp.spad.dvi ${DOC}/system.spad.dvi \ - ${DOC}/tableau.spad.dvi ${DOC}/table.spad.dvi ${DOC}/taylor.spad.dvi \ + ${DOC}/tableau.spad.dvi ${DOC}/taylor.spad.dvi \ ${DOC}/tex.spad.dvi ${DOC}/tools.spad.dvi ${DOC}/transsolve.spad.dvi \ - ${DOC}/tree.spad.dvi ${DOC}/triset.spad.dvi \ + ${DOC}/triset.spad.dvi \ ${DOC}/tube.spad.dvi ${DOC}/twofact.spad.dvi \ ${DOC}/unifact.spad.dvi ${DOC}/updecomp.spad.dvi ${DOC}/updivp.spad.dvi \ ${DOC}/utsode.spad.dvi \ @@ -2119,12 +2117,13 @@ ${HELP}/AssociationList.help: ${BOOKS}/bookvol10.3.pamphlet @${TANGLE} -R"AssociationList.input" ${BOOKS}/bookvol10.3.pamphlet \ >${INPUT}/AssociationList.input -${HELP}/BalancedBinaryTree.help: ${IN}/tree.spad.pamphlet - @echo 7001 create BalancedBinaryTree.help from ${IN}/tree.spad.pamphlet - @${TANGLE} -R"BalancedBinaryTree.help" ${IN}/tree.spad.pamphlet \ +${HELP}/BalancedBinaryTree.help: ${BOOKS}/bookvol10.3.pamphlet + @echo 7001 create BalancedBinaryTree.help from \ + ${BOOKS}/bookvol10.3.pamphlet + @${TANGLE} -R"BalancedBinaryTree.help" ${BOOKS}/bookvol10.3.pamphlet \ >${HELP}/BalancedBinaryTree.help @cp ${HELP}/BalancedBinaryTree.help ${HELP}/BBTREE.help - @${TANGLE} -R"BalancedBinaryTree.input" ${IN}/tree.spad.pamphlet \ + @${TANGLE} -R"BalancedBinaryTree.input" ${BOOKS}/bookvol10.3.pamphlet \ >${INPUT}/BalancedBinaryTree.input ${HELP}/BasicOperator.help: ${BOOKS}/bookvol10.3.pamphlet @@ -2144,12 +2143,13 @@ ${HELP}/BinaryExpansion.help: ${BOOKS}/bookvol10.3.pamphlet @${TANGLE} -R"BinaryExpansion.input" ${BOOKS}/bookvol10.3.pamphlet \ >${INPUT}/BinaryExpansion.input -${HELP}/BinarySearchTree.help: ${IN}/tree.spad.pamphlet - @echo 7004 create BinarySearchTree.help from ${IN}/tree.spad.pamphlet - @${TANGLE} -R"BinarySearchTree.help" ${IN}/tree.spad.pamphlet \ +${HELP}/BinarySearchTree.help: ${BOOKS}/bookvol10.3.pamphlet + @echo 7004 create BinarySearchTree.help from \ + ${BOOKS}/bookvol10.3.pamphlet + @${TANGLE} -R"BinarySearchTree.help" ${BOOKS}/bookvol10.3.pamphlet \ >${HELP}/BinarySearchTree.help @cp ${HELP}/BinarySearchTree.help ${HELP}/BSTREE.help - @${TANGLE} -R"BinarySearchTree.input" ${IN}/tree.spad.pamphlet \ + @${TANGLE} -R"BinarySearchTree.input" ${BOOKS}/bookvol10.3.pamphlet \ >${INPUT}/BinarySearchTree.input ${HELP}/CardinalNumber.help: ${BOOKS}/bookvol10.3.pamphlet @@ -2259,12 +2259,12 @@ ${HELP}/DoubleFloat.help: ${BOOKS}/bookvol10.3.pamphlet @${TANGLE} -R"DoubleFloat.input" ${BOOKS}/bookvol10.3.pamphlet \ >${INPUT}/DoubleFloat.input -${HELP}/EqTable.help: ${IN}/table.spad.pamphlet - @echo 7017 create EqTable.help from ${IN}/table.spad.pamphlet - @${TANGLE} -R"EqTable.help" ${IN}/table.spad.pamphlet \ +${HELP}/EqTable.help: ${BOOKS}/bookvol10.3.pamphlet + @echo 7017 create EqTable.help from ${BOOKS}/bookvol10.3.pamphlet + @${TANGLE} -R"EqTable.help" ${BOOKS}/bookvol10.3.pamphlet \ >${HELP}/EqTable.help @cp ${HELP}/EqTable.help ${HELP}/EQTBL.help - @${TANGLE} -R"EqTable.input" ${IN}/table.spad.pamphlet \ + @${TANGLE} -R"EqTable.input" ${BOOKS}/bookvol10.3.pamphlet \ >${INPUT}/EqTable.input ${HELP}/Equation.help: ${BOOKS}/bookvol10.3.pamphlet @@ -2363,13 +2363,13 @@ ${HELP}/GeneralDistributedMultivariatePolynomial.help: \ ${BOOKS}/bookvol10.3.pamphlet \ >${INPUT}/GeneralDistributedMultivariatePolynomial.input -${HELP}/GeneralSparseTable.help: ${IN}/table.spad.pamphlet +${HELP}/GeneralSparseTable.help: ${BOOKS}/bookvol10.3.pamphlet @echo 7028 create GeneralSparseTable.help from \ - ${IN}/table.spad.pamphlet - @${TANGLE} -R"GeneralSparseTable.help" ${IN}/table.spad.pamphlet \ + ${BOOKS}/bookvol10.3.pamphlet + @${TANGLE} -R"GeneralSparseTable.help" ${BOOKS}/bookvol10.3.pamphlet \ >${HELP}/GeneralSparseTable.help @cp ${HELP}/GeneralSparseTable.help ${HELP}/GSTBL.help - @${TANGLE} -R"GeneralSparseTable.input" ${IN}/table.spad.pamphlet \ + @${TANGLE} -R"GeneralSparseTable.input" ${BOOKS}/bookvol10.3.pamphlet \ >${INPUT}/GeneralSparseTable.input ${HELP}/GroebnerFactorizationPackage.help: ${IN}/groebf.spad.pamphlet @@ -2804,12 +2804,12 @@ ${HELP}/SingleInteger.help: ${BOOKS}/bookvol10.3.pamphlet @${TANGLE} -R"SingleInteger.input" ${BOOKS}/bookvol10.3.pamphlet \ >${INPUT}/SingleInteger.input -${HELP}/SparseTable.help: ${IN}/table.spad.pamphlet - @echo 7075 create SparseTable.help from ${IN}/table.spad.pamphlet - @${TANGLE} -R"SparseTable.help" ${IN}/table.spad.pamphlet \ +${HELP}/SparseTable.help: ${BOOKS}/bookvol10.3.pamphlet + @echo 7075 create SparseTable.help from ${BOOKS}/bookvol10.3.pamphlet + @${TANGLE} -R"SparseTable.help" ${BOOKS}/bookvol10.3.pamphlet \ >${HELP}/SparseTable.help @cp ${HELP}/SparseTable.help ${HELP}/STBL.help - @${TANGLE} -R"SparseTable.input" ${IN}/table.spad.pamphlet \ + @${TANGLE} -R"SparseTable.input" ${BOOKS}/bookvol10.3.pamphlet \ >${INPUT}/SparseTable.input ${HELP}/SquareMatrix.help: ${BOOKS}/bookvol10.3.pamphlet @@ -2847,12 +2847,12 @@ ${HELP}/String.help: ${BOOKS}/bookvol10.3.pamphlet @${TANGLE} -R"String.input" ${BOOKS}/bookvol10.3.pamphlet \ >${INPUT}/String.input -${HELP}/StringTable.help: ${IN}/table.spad.pamphlet - @echo 7080 create StringTable.help from ${IN}/table.spad.pamphlet - @${TANGLE} -R"StringTable.help" ${IN}/table.spad.pamphlet \ +${HELP}/StringTable.help: ${BOOKS}/bookvol10.3.pamphlet + @echo 7080 create StringTable.help from ${BOOKS}/bookvol10.3.pamphlet + @${TANGLE} -R"StringTable.help" ${BOOKS}/bookvol10.3.pamphlet \ >${HELP}/StringTable.help @cp ${HELP}/StringTable.help ${HELP}/STRTBL.help - @${TANGLE} -R"StringTable.input" ${IN}/table.spad.pamphlet \ + @${TANGLE} -R"StringTable.input" ${BOOKS}/bookvol10.3.pamphlet \ >${INPUT}/StringTable.input ${HELP}/Symbol.help: ${BOOKS}/bookvol10.3.pamphlet @@ -2863,12 +2863,12 @@ ${HELP}/Symbol.help: ${BOOKS}/bookvol10.3.pamphlet @${TANGLE} -R"Symbol.input" ${BOOKS}/bookvol10.3.pamphlet \ >${INPUT}/Symbol.input -${HELP}/Table.help: ${IN}/table.spad.pamphlet - @echo 7082 create Table.help from ${IN}/table.spad.pamphlet - @${TANGLE} -R"Table.help" ${IN}/table.spad.pamphlet \ +${HELP}/Table.help: ${BOOKS}/bookvol10.3.pamphlet + @echo 7082 create Table.help from ${BOOKS}/bookvol10.3.pamphlet + @${TANGLE} -R"Table.help" ${BOOKS}/bookvol10.3.pamphlet \ >${HELP}/Table.help @-cp ${HELP}/Table.help ${HELP}/TABLE.help - @${TANGLE} -R"Table.input" ${IN}/table.spad.pamphlet \ + @${TANGLE} -R"Table.input" ${BOOKS}/bookvol10.3.pamphlet \ >${INPUT}/Table.input ${HELP}/TextFile.help: ${BOOKS}/bookvol10.3.pamphlet @@ -2932,15 +2932,15 @@ ${HELP}/Void.help: ${IN}/void.spad.pamphlet @-cp ${HELP}/Void.help ${HELP}/VOID.help @${TANGLE} -R"Void.input" ${IN}/void.spad.pamphlet >${INPUT}/Void.input -${HELP}/WuWenTsunTriangularSet.help: ${IN}/triset.spad.pamphlet +${HELP}/WuWenTsunTriangularSet.help: ${BOOKS}/bookvol10.3.pamphlet @echo 7090 create WuWenTsunTriangularSet.help from \ - ${IN}/triset.spad.pamphlet + ${BOOKS}/bookvol10.3.pamphlet @${TANGLE} -R"WuWenTsunTriangularSet.help" \ - ${IN}/triset.spad.pamphlet \ + ${BOOKS}/bookvol10.3.pamphlet \ >${HELP}/WuWenTsunTriangularSet.help @cp ${HELP}/WuWenTsunTriangularSet.help ${HELP}/WUTSET.help @${TANGLE} -R"WuWenTsunTriangularSet.input" \ - ${IN}/triset.spad.pamphlet \ + ${BOOKS}/bookvol10.3.pamphlet \ >${INPUT}/WuWenTsunTriangularSet.input ${HELP}/XPBWPolynomial.help: ${IN}/xlpoly.spad.pamphlet diff --git a/src/algebra/table.spad.pamphlet b/src/algebra/table.spad.pamphlet deleted file mode 100644 index 651950a..0000000 --- a/src/algebra/table.spad.pamphlet +++ /dev/null @@ -1,946 +0,0 @@ -\documentclass{article} -\usepackage{axiom} -\begin{document} -\title{\$SPAD/src/algebra table.spad} -\author{Stephen M. Watt, Barry Trager} -\maketitle -\begin{abstract} -\end{abstract} -\eject -\tableofcontents -\eject -\section{domain HASHTBL HashTable} -<>= -)abbrev domain HASHTBL HashTable -++ Author: Stephen M. Watt -++ Date Created: 1985 -++ Date Last Updated: June 21, 1991 -++ Basic Operations: -++ Related Domains: Table, EqTable, StringTable -++ Also See: -++ AMS Classifications: -++ Keywords: -++ Examples: -++ References: -++ Description: -++ This domain provides access to the underlying Lisp hash tables. -++ By varying the hashfn parameter, tables suited for different -++ purposes can be obtained. - -HashTable(Key, Entry, hashfn): Exports == Implementation where - Key, Entry: SetCategory - hashfn: String -- Union("EQ", "UEQUAL", "CVEC", "ID") - - Exports ==> TableAggregate(Key, Entry) with - finiteAggregate - - Implementation ==> add - Pair ==> Record(key: Key, entry: Entry) - Ex ==> OutputForm - failMsg := GENSYM()$Lisp - - t1 = t2 == EQ(t1, t2)$Lisp - keys t == HKEYS(t)$Lisp - # t == HCOUNT(t)$Lisp - setelt(t, k, e) == HPUT(t,k,e)$Lisp - remove_!(k:Key, t:%) == - r := HGET(t,k,failMsg)$Lisp - not EQ(r,failMsg)$Lisp => - HREM(t, k)$Lisp - r pretend Entry - "failed" - - empty() == - MAKE_-HASHTABLE(INTERN(hashfn)$Lisp, - INTERN("STRONG")$Lisp)$Lisp - - search(k:Key, t:%) == - r := HGET(t, k, failMsg)$Lisp - not EQ(r, failMsg)$Lisp => r pretend Entry - "failed" - -@ -\section{domain INTABL InnerTable} -<>= -)abbrev domain INTABL InnerTable -++ Author: Barry Trager -++ Date Created: 1992 -++ Date Last Updated: Sept 15, 1992 -++ Basic Operations: -++ Related Domains: HashTable, AssociationList, Table -++ Also See: -++ AMS Classifications: -++ Keywords: -++ Examples: -++ References: -++ Description: -++ This domain is used to provide a conditional "add" domain -++ for the implementation of \spadtype{Table}. - -InnerTable(Key: SetCategory, Entry: SetCategory, addDom):Exports == Implementation where - addDom : TableAggregate(Key, Entry) with - finiteAggregate - Exports ==> TableAggregate(Key, Entry) with - finiteAggregate - Implementation ==> addDom - -@ -\section{domain TABLE Table} -<>= --- table.spad.pamphlet Table.input -)spool Table.output -)set message test on -)set message auto off -)clear all ---S 1 of 18 -t: Table(Polynomial Integer, String) := table() ---R ---R ---R (1) table() ---R Type: Table(Polynomial Integer,String) ---E 1 - ---S 2 of 18 -setelt(t, x**2 - 1, "Easy to factor") ---R ---R ---R (2) "Easy to factor" ---R Type: String ---E 2 - ---S 3 of 18 -t(x**3 + 1) := "Harder to factor" ---R ---R ---R (3) "Harder to factor" ---R Type: String ---E 3 - ---S 4 of 18 -t(x) := "The easiest to factor" ---R ---R ---R (4) "The easiest to factor" ---R Type: String ---E 4 - ---S 5 of 18 -elt(t, x) ---R ---R ---R (5) "The easiest to factor" ---R Type: String ---E 5 - ---S 6 of 18 -t.x ---R ---R ---R (6) "The easiest to factor" ---R Type: String ---E 6 - ---S 7 of 18 -t x ---R ---R ---R (7) "The easiest to factor" ---R Type: String ---E 7 - ---S 8 of 18 -t.(x**2 - 1) ---R ---R ---R (8) "Easy to factor" ---R Type: String ---E 8 - ---S 9 of 18 -t (x**3 + 1) ---R ---R ---R (9) "Harder to factor" ---R Type: String ---E 9 - ---S 10 of 18 -keys t ---R ---R ---R 3 2 ---R (10) [x,x + 1,x - 1] ---R Type: List Polynomial Integer ---E 10 - ---S 11 of 18 -search(x, t) ---R ---R ---R (11) "The easiest to factor" ---R Type: Union(String,...) ---E 11 - ---S 12 of 18 -search(x**2, t) ---R ---R ---R (12) "failed" ---R Type: Union("failed",...) ---E 12 - ---S 13 of 18 -search(x**2, t) case "failed" ---R ---R ---R (13) true ---R Type: Boolean ---E 13 - ---S 14 of 18 -remove!(x**2-1, t) ---R ---R ---R (14) "Easy to factor" ---R Type: Union(String,...) ---E 14 - ---S 15 of 18 -remove!(x-1, t) ---R ---R ---R (15) "failed" ---R Type: Union("failed",...) ---E 15 - ---S 16 of 18 -#t ---R ---R ---R (16) 2 ---R Type: PositiveInteger ---E 16 - ---S 17 of 18 -members t ---R ---R ---R (17) ["The easiest to factor","Harder to factor"] ---R Type: List String ---E 17 - ---S 18 of 18 -count(s: String +-> prefix?("Hard", s), t) ---R ---R ---R (18) 1 ---R Type: PositiveInteger ---E 18 -)spool -)lisp (bye) -@ -<>= -==================================================================== -Table examples -==================================================================== - -The Table constructor provides a general structure for associative -storage. This type provides hash tables in which data objects can be -saved according to keys of any type. For a given table, specific -types must be chosen for the keys and entries. - -In this example the keys to the table are polynomials with integer -coefficients. The entries in the table are strings. - - t: Table(Polynomial Integer, String) := table() - table() - Type: Table(Polynomial Integer,String) - -To save an entry in the table, the setelt operation is used. This can -be called directly, giving the table a key and an entry. - - setelt(t, x**2 - 1, "Easy to factor") - "Easy to factor" - Type: String - -Alternatively, you can use assignment syntax. - - t(x**3 + 1) := "Harder to factor" - "Harder to factor" - Type: String - - t(x) := "The easiest to factor" - "The easiest to factor" - Type: String - -Entries are retrieved from the table by calling the elt operation. - - elt(t, x) - "The easiest to factor" - Type: String - -This operation is called when a table is "applied" to a key using this -or the following syntax. - - t.x - "The easiest to factor" - Type: String - - t x - "The easiest to factor" - Type: String - -Parentheses are used only for grouping. They are needed if the key is -an infixed expression. - - t.(x**2 - 1) - "Easy to factor" - Type: String - -Note that the elt operation is used only when the key is known to be -in the table, otherwise an error is generated. - - t (x**3 + 1) - "Harder to factor" - Type: String - -You can get a list of all the keys to a table using the keys operation. - - keys t - 3 2 - [x,x + 1,x - 1] - Type: List Polynomial Integer - -If you wish to test whether a key is in a table, the search operation -is used. This operation returns either an entry or "failed". - - search(x, t) - "The easiest to factor" - Type: Union(String,...) - - search(x**2, t) - "failed" - Type: Union("failed",...) - -The return type is a union so the success of the search can be tested -using case. - - search(x**2, t) case "failed" - true - Type: Boolean - -The remove operation is used to delete values from a table. - - remove!(x**2-1, t) - "Easy to factor" - Type: Union(String,...) - -If an entry exists under the key, then it is returned. Otherwise -remove returns "failed". - - remove!(x-1, t) - "failed" - Type: Union("failed",...) - -The number of key-entry pairs can be found using the # operation. - - #t - 2 - Type: PositiveInteger - -Just as keys returns a list of keys to the table, a list of all the -entries can be obtained using the members operation. - - members t - (17) ["The easiest to factor","Harder to factor"] - Type: List String - -A number of useful operations take functions and map them on to the -table to compute the result. Here we count the entries which have -"Hard" as a prefix. - - count(s: String +-> prefix?("Hard", s), t) - 1 - Type: PositiveInteger - -Other table types are provided to support various needs. - o AssociationList gives a list with a table view. This allows new - entries to be appended onto the front of the list to cover up old - entries. This is useful when table entries need to be stacked or when - frequent list traversals are required. - o EqTable gives tables in which keys are considered equal only when - they are in fact the same instance of a structure. - o StringTable should be used when the keys are known to be strings. - o SparseTable provides tables with default entries, so lookup never fails. - The GeneralSparseTable constructor can be used to make any table type - behave this way. - o KeyedAccessFile allows values to be saved in a file, accessed as a table. - -See Also: -o )help AssociationList -o )help EqTable -o )help StringTable -o )help SparseTable -o )help GeneralSparseTable -o )help KeyedAccessFile -o )show Table -o $AXIOM/doc/src/algebra/table.spad.dvi - -@ -<>= -)abbrev domain TABLE Table -++ Author: Stephen M. Watt, Barry Trager -++ Date Created: 1985 -++ Date Last Updated: Sept 15, 1992 -++ Basic Operations: -++ Related Domains: HashTable, EqTable, StringTable, AssociationList -++ Also See: -++ AMS Classifications: -++ Keywords: -++ Examples: -++ References: -++ Description: -++ This is the general purpose table type. -++ The keys are hashed to look up the entries. -++ This creates a \spadtype{HashTable} if equal for the Key -++ domain is consistent with Lisp EQUAL otherwise an -++ \spadtype{AssociationList} - -Table(Key: SetCategory, Entry: SetCategory):Exports == Implementation where - Exports ==> TableAggregate(Key, Entry) with - finiteAggregate - - Implementation ==> InnerTable(Key, Entry, - if hashable(Key)$Lisp then HashTable(Key, Entry, "UEQUAL") - else AssociationList(Key, Entry)) - -@ -\section{domain EQTBL EqTable} -<>= --- table.spad.pamphlet EqTable.input -)spool EqTable.output -)set message test on -)set message auto off -)clear all ---S 1 of 6 -e: EqTable(List Integer, Integer) := table() ---R ---R ---R (1) table() ---R Type: EqTable(List Integer,Integer) ---E 1 - ---S 2 of 6 -l1 := [1,2,3] ---R ---R ---R (2) [1,2,3] ---R Type: List PositiveInteger ---E 2 - ---S 3 of 6 -l2 := [1,2,3] ---R ---R ---R (3) [1,2,3] ---R Type: List PositiveInteger ---E 3 - ---S 4 of 6 -e.l1 := 111 ---R ---R ---R (4) 111 ---R Type: PositiveInteger ---E 4 - ---S 5 of 6 -e.l2 := 222 ---R ---R ---R (5) 222 ---R Type: PositiveInteger ---E 5 - ---S 6 of 6 -e.l1 ---R ---R ---R (6) 111 ---R Type: PositiveInteger ---E 6 -)spool -)lisp (bye) -@ -<>= -==================================================================== -EqTable examples -==================================================================== - -The EqTable domain provides tables where the keys are compared using -eq?. Keys are considered equal only if they are the same instance of -a structure. This is useful if the keys are themselves updatable -structures. Otherwise, all operations are the same as for type Table. - -The operation table is here used to create a table where the keys are -lists of integers. - - e: EqTable(List Integer, Integer) := table() - table() - Type: EqTable(List Integer,Integer) - -These two lists are equal according to =, but not according to eq?. - - l1 := [1,2,3] - [1,2,3] - Type: List PositiveInteger - - l2 := [1,2,3] - [1,2,3] - Type: List PositiveInteger -Because the two lists are not eq?, separate values can be stored under -each. - - e.l1 := 111 - 111 - Type: PositiveInteger - - e.l2 := 222 - 222 - Type: PositiveInteger - - e.l1 - 111 - Type: PositiveInteger - -See Also: -o )help Table -o )show EqTable -o $AXIOM/doc/src/algebra/table.spad.dvi - -@ -<>= -)abbrev domain EQTBL EqTable -++ Author: Stephen M. Watt -++ Date Created: -++ Date Last Updated: June 21, 1991 -++ Basic Operations: -++ Related Domains: HashTable, Table, StringTable -++ Also See: -++ AMS Classifications: -++ Keywords: equation -++ Examples: -++ References: -++ Description: -++ This domain provides tables where the keys are compared using -++ \spadfun{eq?}. Thus keys are considered equal only if they -++ are the same instance of a structure. -EqTable(Key: SetCategory, Entry: SetCategory) == - HashTable(Key, Entry, "EQ") - -@ -\section{domain STRTBL StringTable} -<>= --- table.spad.pamphlet StringTable.input -)spool StringTable.output -)set message test on -)set message auto off -)clear all ---S 1 of 3 -t: StringTable(Integer) := table() ---R ---R ---R (1) table() ---R Type: StringTable Integer ---E 1 - ---S 2 of 3 -for s in split("My name is Ian Watt.",char " ") - repeat - t.s := #s ---R ---R Type: Void ---E 2 - ---S 3 of 3 -for key in keys t repeat output [key, t.key] ---R ---R ["Watt.",5] ---R ["Ian",3] ---R ["is",2] ---R ["name",4] ---R ["My",2] ---R Type: Void ---E 3 -)spool -)lisp (bye) -@ -<>= -==================================================================== -StringTable examples -==================================================================== - -This domain provides a table type in which the keys are known to be strings -so special techniques can be used. Other than performance, the type -StringTable(S) should behave exactly the same way as Table(String,S). - -This creates a new table whose keys are strings. - - t: StringTable(Integer) := table() - table() - Type: StringTable Integer - -The value associated with each string key is the number of characters -in the string. - -for s in split("My name is Ian Watt.",char " ") - repeat - t.s := #s - Type: Void - - for key in keys t repeat output [key, t.key] - ["Watt.",5] - ["Ian",3] - ["is",2] - ["name",4] - ["My",2] - Type: Void - -See Also: -o )help Table -o )show StringTable -o $AXIOM/doc/src/algebra/table.spad.dvi - -@ -<>= -)abbrev domain STRTBL StringTable -++ Author: Stephen M. Watt -++ Date Created: -++ Date Last Updated: June 21, 1991 -++ Basic Operations: -++ Related Domains: Table -++ Also See: -++ AMS Classifications: -++ Keywords: equation -++ Examples: -++ References: -++ Description: -++ This domain provides tables where the keys are strings. -++ A specialized hash function for strings is used. -StringTable(Entry: SetCategory) == - HashTable(String, Entry, "CVEC") - -@ -\section{domain GSTBL GeneralSparseTable} -<>= --- table.spad.pamphlet GeneralSparseTable.input -)spool GeneralSparseTable.output -)set message test on -)set message auto off -)set break resume -)clear all ---S 1 of 7 -patrons: GeneralSparseTable(String, Integer, KeyedAccessFile(Integer), 0) := table() ; ---E 1 - ---S 2 of 7 -patrons."Smith" := 10500 ---E 2 - ---S 3 of 7 -patrons."Jones" := 22000 ---E 3 - ---S 4 of 7 -patrons."Jones" ---E 4 - ---S 5 of 7 -patrons."Stingy" ---E 5 - ---S 6 of 7 -reduce(+, entries patrons) ---E 6 - ---S 7 of 7 -)system rm -r kaf*.sdata ---E 7 -)spool -)lisp (bye) -@ -<>= -==================================================================== -GeneralSparseTable -==================================================================== - -Sometimes when working with tables there is a natural value to use as -the entry in all but a few cases. The GeneralSparseTable constructor -can be used to provide any table type with a default value for -entries. - -Suppose we launched a fund-raising campaign to raise fifty thousand -dollars. To record the contributions, we want a table with strings as -keys (for the names) and integer entries (for the amount). In a data -base of cash contributions, unless someone has been explicitly -entered, it is reasonable to assume they have made a zero dollar -contribution. - -This creates a keyed access file with default entry 0. - - patrons: GeneralSparseTable(String, Integer, KeyedAccessFile(Integer), 0) := table() ; - -Now patrons can be used just as any other table. Here we record two gifts. - - patrons."Smith" := 10500 - - patrons."Jones" := 22000 - -Now let us look up the size of the contributions from Jones and Stingy. - - patrons."Jones" - - patrons."Stingy" - -Have we met our seventy thousand dollar goal? - - reduce(+, entries patrons) - -So the project is cancelled and we can delete the data base: - - )system rm -r kaf*.sdata - -See Also: -o )show GeneralSparseTable -o $AXIOM/doc/src/algebra/table.spad.dvi - -@ -<>= -)abbrev domain GSTBL GeneralSparseTable -++ Author: Stephen M. Watt -++ Date Created: 1986 -++ Date Last Updated: June 21, 1991 -++ Basic Operations: -++ Related Domains: Table -++ Also See: -++ AMS Classifications: -++ Keywords: equation -++ Examples: -++ References: -++ Description: -++ A sparse table has a default entry, which is returned if no other -++ value has been explicitly stored for a key. -GeneralSparseTable(Key, Entry, Tbl, dent): TableAggregate(Key, Entry) == Impl - where - Key, Entry: SetCategory - Tbl: TableAggregate(Key, Entry) - dent: Entry - - Impl ==> Tbl add - Rep := Tbl - - elt(t:%, k:Key) == - (u := search(k, t)$Rep) case "failed" => dent - u::Entry - - setelt(t:%, k:Key, e:Entry) == - e = dent => (remove_!(k, t); e) - setelt(t, k, e)$Rep - - search(k:Key, t:%) == - (u := search(k, t)$Rep) case "failed" => dent - u - -@ -\section{domain STBL SparseTable} -<>= --- table.spad.pamphlet SparseTable.input -)spool SparseTable.output -)set message test on -)set message auto off -)clear all ---S 1 of 7 -t: SparseTable(Integer, String, "Try again!") := table() ---R ---R ---R (1) table() ---R Type: SparseTable(Integer,String,Try again!) ---E 1 - ---S 2 of 7 -t.3 := "Number three" ---R ---R ---R (2) "Number three" ---R Type: String ---E 2 - ---S 3 of 7 -t.4 := "Number four" ---R ---R ---R (3) "Number four" ---R Type: String ---E 3 - ---S 4 of 7 -t.3 ---R ---R ---R (4) "Number three" ---R Type: String ---E 4 - ---S 5 of 7 -t.2 ---R ---R ---R (5) "Try again!" ---R Type: String ---E 5 - ---S 6 of 7 -keys t ---R ---R ---R (6) [4,3] ---R Type: List Integer ---E 6 - ---S 7 of 7 -entries t ---R ---R ---R (7) ["Number four","Number three"] ---R Type: List String ---E 7 -)spool -)lisp (bye) -@ -<>= -==================================================================== -SparseTable examples -==================================================================== - -The SparseTable domain provides a general purpose table type with -default entries. - -Here we create a table to save strings under integer keys. The value -"Try again!" is returned if no other value has been stored for a key. - - t: SparseTable(Integer, String, "Try again!") := table() - table() - Type: SparseTable(Integer,String,Try again!) - -Entries can be stored in the table. - - t.3 := "Number three" - "Number three" - Type: String - - t.4 := "Number four" - "Number four" - Type: String - -These values can be retrieved as usual, but if a look up fails the -default entry will be returned. - - t.3 - "Number three" - Type: String - - t.2 - "Try again!" - Type: String - -To see which values are explicitly stored, the keys and entries -functions can be used. - - keys t - [4,3] - Type: List Integer - - entries t - ["Number four","Number three"] - Type: List String - -If a specific table representation is required, the GeneralSparseTable -constructor should be used. The domain SparseTable(K, E, dflt)} is -equivalent to GeneralSparseTable(K,E,Table(K,E), dflt). - -See Also: -o )help Table -o )help GeneralSparseTable -o )show SparseTable -o $AXIOM/doc/src/algebra/table.spad.dvi - -@ -<>= -)abbrev domain STBL SparseTable -++ Author: Stephen M. Watt -++ Date Created: 1986 -++ Date Last Updated: June 21, 1991 -++ Basic Operations: -++ Related Domains: Table -++ Also See: -++ AMS Classifications: -++ Keywords: equation -++ Examples: -++ References: -++ Description: -++ A sparse table has a default entry, which is returned if no other -++ value has been explicitly stored for a key. - -SparseTable(Key:SetCategory, Ent:SetCategory, dent:Ent) == - GeneralSparseTable(Key, Ent, Table(Key, Ent), dent) - -@ -\section{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. -@ -<<*>>= -<> - -<> -<> -<> -<> -<> -<> -<> -@ -\eject -\begin{thebibliography}{99} -\bibitem{1} nothing -\end{thebibliography} -\end{document} diff --git a/src/algebra/tableau.spad.pamphlet b/src/algebra/tableau.spad.pamphlet index baa49c3..59497da 100644 --- a/src/algebra/tableau.spad.pamphlet +++ b/src/algebra/tableau.spad.pamphlet @@ -9,59 +9,6 @@ \eject \tableofcontents \eject -\section{domain TABLEAU Tableau} -<>= -)abbrev domain TABLEAU Tableau -++ Author: William H. Burge -++ Date Created: 1987 -++ Date Last Updated: 23 Sept 1991 -++ Basic Functions: -++ Related Constructors: -++ Also See: -++ AMS Classifications: -++ Keywords: Young tableau -++ References: -++ Description: -++ The tableau domain is for printing Young tableaux, and -++ coercions to and from List List S where S is a set. -Tableau(S:SetCategory):Exports == Implementation where - ++ The tableau domain is for printing Young tableaux, and - ++ coercions to and from List List S where S is a set. - L ==> List - I ==> Integer - NNI ==> NonNegativeInteger - OUT ==> OutputForm - V ==> Vector - fm==>formMatrix$PrintableForm() - Exports ==> with - tableau : L L S -> % - ++ tableau(ll) converts a list of lists ll to a tableau. - listOfLists : % -> L L S - ++ listOfLists t converts a tableau t to a list of lists. - coerce : % -> OUT - ++ coerce(t) converts a tableau t to an output form. - Implementation ==> add - - Rep := L L S - - tableau(lls:(L L S)) == lls pretend % - listOfLists(x:%):(L L S) == x pretend (L L S) - makeupv : (NNI,L S) -> L OUT - makeupv(n,ls)== - v:=new(n,message " ")$(List OUT) - for i in 1..#ls for s in ls repeat v.i:=box(s::OUT) - v - maketab : L L S -> OUT - maketab lls == - ll : L OUT := - empty? lls => [[empty()]] - sz:NNI:=# first lls - [blankSeparate makeupv(sz,i) for i in lls] - pile ll - - coerce(x:%):OUT == maketab listOfLists x - -@ \section{package TABLBUMP TableauxBumpers} <>= )abbrev package TABLBUMP TableauxBumpers @@ -224,7 +171,6 @@ TableauxBumpers(S:OrderedSet):T==C where <<*>>= <> -<> <> @ \eject diff --git a/src/algebra/taylor.spad.pamphlet b/src/algebra/taylor.spad.pamphlet index 7fa64c0..7492f9b 100644 --- a/src/algebra/taylor.spad.pamphlet +++ b/src/algebra/taylor.spad.pamphlet @@ -9,406 +9,6 @@ \eject \tableofcontents \eject -\section{domain ITAYLOR InnerTaylorSeries} -<>= -)abbrev domain ITAYLOR InnerTaylorSeries -++ Author: Clifton J. Williamson -++ Date Created: 21 December 1989 -++ Date Last Updated: 25 February 1989 -++ Basic Operations: -++ Related Domains: UnivariateTaylorSeries(Coef,var,cen) -++ Also See: -++ AMS Classifications: -++ Keywords: stream, dense Taylor series -++ Examples: -++ References: -++ Description: Internal package for dense Taylor series. -++ This is an internal Taylor series type in which Taylor series -++ are represented by a \spadtype{Stream} of \spadtype{Ring} elements. -++ For univariate series, the \spad{Stream} elements are the Taylor -++ coefficients. For multivariate series, the \spad{n}th Stream element -++ is a form of degree n in the power series variables. - -InnerTaylorSeries(Coef): Exports == Implementation where - Coef : Ring - I ==> Integer - NNI ==> NonNegativeInteger - ST ==> Stream Coef - STT ==> StreamTaylorSeriesOperations Coef - - Exports ==> Ring with - coefficients: % -> Stream Coef - ++\spad{coefficients(x)} returns a stream of ring elements. - ++ When x is a univariate series, this is a stream of Taylor - ++ coefficients. When x is a multivariate series, the - ++ \spad{n}th element of the stream is a form of - ++ degree n in the power series variables. - series: Stream Coef -> % - ++\spad{series(s)} creates a power series from a stream of - ++ ring elements. - ++ For univariate series types, the stream s should be a stream - ++ of Taylor coefficients. For multivariate series types, the - ++ stream s should be a stream of forms the \spad{n}th element - ++ of which is a - ++ form of degree n in the power series variables. - pole?: % -> Boolean - ++\spad{pole?(x)} tests if the series x has a pole. - ++ Note: this is false when x is a Taylor series. - order: % -> NNI - ++\spad{order(x)} returns the order of a power series x, - ++ i.e. the degree of the first non-zero term of the series. - order: (%,NNI) -> NNI - ++\spad{order(x,n)} returns the minimum of n and the order of x. - "*" : (Coef,%)->% - ++\spad{c*x} returns the product of c and the series x. - "*" : (%,Coef)->% - ++\spad{x*c} returns the product of c and the series x. - "*" : (%,Integer)->% - ++\spad{x*i} returns the product of integer i and the series x. - if Coef has IntegralDomain then IntegralDomain - --++ An IntegralDomain provides 'exquo' - - Implementation ==> add - - Rep := Stream Coef - ---% declarations - x,y: % - ---% definitions - - -- In what follows, we will be calling operations on Streams - -- which are NOT defined in the package Stream. Thus, it is - -- necessary to explicitly pass back and forth between Rep and %. - -- This will be done using the functions 'stream' and 'series'. - - stream : % -> Stream Coef - stream x == x pretend Stream(Coef) - series st == st pretend % - - 0 == coerce(0)$STT - 1 == coerce(1)$STT - - x = y == - -- tests if two power series are equal - -- difference must be a finite stream of zeroes of length <= n + 1, - -- where n = $streamCount$Lisp - st : ST := stream(x - y) - n : I := _$streamCount$Lisp - for i in 0..n repeat - empty? st => return true - frst st ^= 0 => return false - st := rst st - empty? st - - coefficients x == stream x - - x + y == stream(x) +$STT stream(y) - x - y == stream(x) -$STT stream(y) - (x:%) * (y:%) == stream(x) *$STT stream(y) - - x == -$STT (stream x) - (i:I) * (x:%) == (i::Coef) *$STT stream x - (x:%) * (i:I) == stream(x) *$STT (i::Coef) - (c:Coef) * (x:%) == c *$STT stream x - (x:%) * (c:Coef) == stream(x) *$STT c - - recip x == - (rec := recip$STT stream x) case "failed" => "failed" - series(rec :: ST) - - if Coef has IntegralDomain then - - x exquo y == - (quot := stream(x) exquo$STT stream(y)) case "failed" => "failed" - series(quot :: ST) - - x:% ** n:NNI == - n = 0 => 1 - expt(x,n :: PositiveInteger)$RepeatedSquaring(%) - - characteristic() == characteristic()$Coef - pole? x == false - - iOrder: (ST,NNI,NNI) -> NNI - iOrder(st,n,n0) == - (n = n0) or (empty? st) => n0 - zero? frst st => iOrder(rst st,n + 1,n0) - n - - order(x,n) == iOrder(stream x,0,n) - - iOrder2: (ST,NNI) -> NNI - iOrder2(st,n) == - empty? st => error "order: series has infinite order" - zero? frst st => iOrder2(rst st,n + 1) - n - - order x == iOrder2(stream x,0) - -@ -\section{domain UTS UnivariateTaylorSeries} -<>= -)abbrev domain UTS UnivariateTaylorSeries -++ Author: Clifton J. Williamson -++ Date Created: 21 December 1989 -++ Date Last Updated: 21 September 1993 -++ Basic Operations: -++ Related Domains: UnivariateLaurentSeries(Coef,var,cen), UnivariatePuiseuxSeries(Coef,var,cen) -++ Also See: -++ AMS Classifications: -++ Keywords: dense, Taylor series -++ Examples: -++ References: -++ Description: Dense Taylor series in one variable -++ \spadtype{UnivariateTaylorSeries} is a domain representing Taylor -++ series in -++ one variable with coefficients in an arbitrary ring. The parameters -++ of the type specify the coefficient ring, the power series variable, -++ and the center of the power series expansion. For example, -++ \spadtype{UnivariateTaylorSeries}(Integer,x,3) represents -++ Taylor series in -++ \spad{(x - 3)} with \spadtype{Integer} coefficients. -UnivariateTaylorSeries(Coef,var,cen): Exports == Implementation where - Coef : Ring - var : Symbol - cen : Coef - I ==> Integer - NNI ==> NonNegativeInteger - P ==> Polynomial Coef - RN ==> Fraction Integer - ST ==> Stream - STT ==> StreamTaylorSeriesOperations Coef - TERM ==> Record(k:NNI,c:Coef) - UP ==> UnivariatePolynomial(var,Coef) - Exports ==> UnivariateTaylorSeriesCategory(Coef) with - coerce: UP -> % - ++\spad{coerce(p)} converts a univariate polynomial p in the variable - ++\spad{var} to a univariate Taylor series in \spad{var}. - univariatePolynomial: (%,NNI) -> UP - ++\spad{univariatePolynomial(f,k)} returns a univariate polynomial - ++ consisting of the sum of all terms of f of degree \spad{<= k}. - coerce: Variable(var) -> % - ++\spad{coerce(var)} converts the series variable \spad{var} into a - ++ Taylor series. - differentiate: (%,Variable(var)) -> % - ++ \spad{differentiate(f(x),x)} computes the derivative of - ++ \spad{f(x)} with respect to \spad{x}. - lagrange: % -> % - ++\spad{lagrange(g(x))} produces the Taylor series for \spad{f(x)} - ++ where \spad{f(x)} is implicitly defined as \spad{f(x) = x*g(f(x))}. - lambert: % -> % - ++\spad{lambert(f(x))} returns \spad{f(x) + f(x^2) + f(x^3) + ...}. - ++ This function is used for computing infinite products. - ++ \spad{f(x)} should have zero constant coefficient. - ++ If \spad{f(x)} is a Taylor series with constant term 1, then - ++ \spad{product(n = 1..infinity,f(x^n)) = exp(log(lambert(f(x))))}. - oddlambert: % -> % - ++\spad{oddlambert(f(x))} returns \spad{f(x) + f(x^3) + f(x^5) + ...}. - ++ \spad{f(x)} should have a zero constant coefficient. - ++ This function is used for computing infinite products. - ++ If \spad{f(x)} is a Taylor series with constant term 1, then - ++ \spad{product(n=1..infinity,f(x^(2*n-1)))=exp(log(oddlambert(f(x))))}. - evenlambert: % -> % - ++\spad{evenlambert(f(x))} returns \spad{f(x^2) + f(x^4) + f(x^6) + ...}. - ++ \spad{f(x)} should have a zero constant coefficient. - ++ This function is used for computing infinite products. - ++ If \spad{f(x)} is a Taylor series with constant term 1, then - ++ \spad{product(n=1..infinity,f(x^(2*n))) = exp(log(evenlambert(f(x))))}. - generalLambert: (%,I,I) -> % - ++\spad{generalLambert(f(x),a,d)} returns \spad{f(x^a) + f(x^(a + d)) + - ++ f(x^(a + 2 d)) + ... }. \spad{f(x)} should have zero constant - ++ coefficient and \spad{a} and d should be positive. - revert: % -> % - ++ \spad{revert(f(x))} returns a Taylor series \spad{g(x)} such that - ++ \spad{f(g(x)) = g(f(x)) = x}. Series \spad{f(x)} should have constant - ++ coefficient 0 and 1st order coefficient 1. - multisect: (I,I,%) -> % - ++\spad{multisect(a,b,f(x))} selects the coefficients of - ++ \spad{x^((a+b)*n+a)}, and changes this monomial to \spad{x^n}. - invmultisect: (I,I,%) -> % - ++\spad{invmultisect(a,b,f(x))} substitutes \spad{x^((a+b)*n)} - ++ for \spad{x^n} and multiples by \spad{x^b}. - if Coef has Algebra Fraction Integer then - integrate: (%,Variable(var)) -> % - ++ \spad{integrate(f(x),x)} returns an anti-derivative of the power - ++ series \spad{f(x)} with constant coefficient 0. - ++ We may integrate a series when we can divide coefficients - ++ by integers. - - Implementation ==> InnerTaylorSeries(Coef) add - - Rep := Stream Coef - ---% creation and destruction of series - - stream: % -> Stream Coef - stream x == x pretend Stream(Coef) - - coerce(v:Variable(var)) == - zero? cen => monomial(1,1) - monomial(1,1) + monomial(cen,0) - - coerce(n:I) == n :: Coef :: % - coerce(r:Coef) == coerce(r)$STT - monomial(c,n) == monom(c,n)$STT - - getExpon: TERM -> NNI - getExpon term == term.k - getCoef: TERM -> Coef - getCoef term == term.c - rec: (NNI,Coef) -> TERM - rec(expon,coef) == [expon,coef] - - recs: (ST Coef,NNI) -> ST TERM - recs(st,n) == delay$ST(TERM) - empty? st => empty() - zero? (coef := frst st) => recs(rst st,n + 1) - concat(rec(n,coef),recs(rst st,n + 1)) - - terms x == recs(stream x,0) - - recsToCoefs: (ST TERM,NNI) -> ST Coef - recsToCoefs(st,n) == delay - empty? st => empty() - term := frst st; expon := getExpon term - n = expon => concat(getCoef term,recsToCoefs(rst st,n + 1)) - concat(0,recsToCoefs(st,n + 1)) - - series(st: ST TERM) == recsToCoefs(st,0) - - stToPoly: (ST Coef,P,NNI,NNI) -> P - stToPoly(st,term,n,n0) == - (n > n0) or (empty? st) => 0 - frst(st) * term ** n + stToPoly(rst st,term,n + 1,n0) - - polynomial(x,n) == stToPoly(stream x,(var :: P) - (cen :: P),0,n) - - polynomial(x,n1,n2) == - if n1 > n2 then (n1,n2) := (n2,n1) - stToPoly(rest(stream x,n1),(var :: P) - (cen :: P),n1,n2) - - stToUPoly: (ST Coef,UP,NNI,NNI) -> UP - stToUPoly(st,term,n,n0) == - (n > n0) or (empty? st) => 0 - frst(st) * term ** n + stToUPoly(rst st,term,n + 1,n0) - - univariatePolynomial(x,n) == - stToUPoly(stream x,monomial(1,1)$UP - monomial(cen,0)$UP,0,n) - - coerce(p:UP) == - zero? p => 0 - if not zero? cen then - p := p(monomial(1,1)$UP + monomial(cen,0)$UP) - st : ST Coef := empty() - oldDeg : NNI := degree(p) + 1 - while not zero? p repeat - deg := degree p - delta := (oldDeg - deg - 1) :: NNI - for i in 1..delta repeat st := concat(0$Coef,st) - st := concat(leadingCoefficient p,st) - oldDeg := deg; p := reductum p - for i in 1..oldDeg repeat st := concat(0$Coef,st) - st - - if Coef has coerce: Symbol -> Coef then - if Coef has "**": (Coef,NNI) -> Coef then - - stToCoef: (ST Coef,Coef,NNI,NNI) -> Coef - stToCoef(st,term,n,n0) == - (n > n0) or (empty? st) => 0 - frst(st) * term ** n + stToCoef(rst st,term,n + 1,n0) - - approximate(x,n) == - stToCoef(stream x,(var :: Coef) - cen,0,n) - ---% values - - variable x == var - center s == cen - - coefficient(x,n) == - -- Cannot use elt! Should return 0 if stream doesn't have it. - u := stream x - while not empty? u and n > 0 repeat - u := rst u - n := (n - 1) :: NNI - empty? u or n ^= 0 => 0 - frst u - - elt(x:%,n:NNI) == coefficient(x,n) - ---% functions - - map(f,x) == map(f,x)$Rep - eval(x:%,r:Coef) == eval(stream x,r-cen)$STT - differentiate x == deriv(stream x)$STT - differentiate(x:%,v:Variable(var)) == differentiate x - if Coef has PartialDifferentialRing(Symbol) then - differentiate(x:%,s:Symbol) == - (s = variable(x)) => differentiate x - map(differentiate(#1,s),x) - differentiate(center x,s)*differentiate(x) - multiplyCoefficients(f,x) == gderiv(f,stream x)$STT - lagrange x == lagrange(stream x)$STT - lambert x == lambert(stream x)$STT - oddlambert x == oddlambert(stream x)$STT - evenlambert x == evenlambert(stream x)$STT - generalLambert(x:%,a:I,d:I) == generalLambert(stream x,a,d)$STT - extend(x,n) == extend(x,n+1)$Rep - complete x == complete(x)$Rep - truncate(x,n) == first(stream x,n + 1)$Rep - truncate(x,n1,n2) == - if n2 < n1 then (n1,n2) := (n2,n1) - m := (n2 - n1) :: NNI - st := first(rest(stream x,n1)$Rep,m + 1)$Rep - for i in 1..n1 repeat st := concat(0$Coef,st) - st - elt(x:%,y:%) == compose(stream x,stream y)$STT - revert x == revert(stream x)$STT - multisect(a,b,x) == multisect(a,b,stream x)$STT - invmultisect(a,b,x) == invmultisect(a,b,stream x)$STT - multiplyExponents(x,n) == invmultisect(n,0,x) - quoByVar x == (empty? x => 0; rst x) - if Coef has IntegralDomain then - unit? x == unit? coefficient(x,0) - if Coef has Field then - if Coef is RN then - (x:%) ** (s:Coef) == powern(s,stream x)$STT - else - (x:%) ** (s:Coef) == power(s,stream x)$STT - - if Coef has Algebra Fraction Integer then - coerce(r:RN) == r :: Coef :: % - - integrate x == integrate(0,stream x)$STT - integrate(x:%,v:Variable(var)) == integrate x - - if Coef has integrate: (Coef,Symbol) -> Coef and _ - Coef has variables: Coef -> List Symbol then - integrate(x:%,s:Symbol) == - (s = variable(x)) => integrate x - not entry?(s,variables center x) => map(integrate(#1,s),x) - error "integrate: center is a function of variable of integration" - - if Coef has TranscendentalFunctionCategory and _ - Coef has PrimitiveFunctionCategory and _ - Coef has AlgebraicallyClosedFunctionSpace Integer then - - integrateWithOneAnswer: (Coef,Symbol) -> Coef - integrateWithOneAnswer(f,s) == - res := integrate(f,s)$FunctionSpaceIntegration(I,Coef) - res case Coef => res :: Coef - first(res :: List Coef) - - integrate(x:%,s:Symbol) == - (s = variable(x)) => integrate x - not entry?(s,variables center x) => - map(integrateWithOneAnswer(#1,s),x) - error "integrate: center is a function of variable of integration" - ---% OutputForms --- We use the default coerce: % -> OutputForm in UTSCAT& - -@ \section{package UTS2 UnivariateTaylorSeriesFunctions2} <>= )abbrev package UTS2 UnivariateTaylorSeriesFunctions2 @@ -479,8 +79,6 @@ UnivariateTaylorSeriesFunctions2(Coef1,Coef2,UTS1,UTS2):_ <<*>>= <> -<> -<> <> @ \eject diff --git a/src/algebra/tex.spad.pamphlet b/src/algebra/tex.spad.pamphlet index 3babcb2..b6383f4 100644 --- a/src/algebra/tex.spad.pamphlet +++ b/src/algebra/tex.spad.pamphlet @@ -9,632 +9,6 @@ \eject \tableofcontents \eject -\section{domain TEX TexFormat} -\subsection{product(product(i*j,i=a..b),j=c..d) fix} -The expression prints properly in ascii text but the tex output -is incorrect. Originally the input -\begin{verbatim} -product(product(i*j,i=a..b),j=c..d) -\end{verbatim} -prints as -$$ -PI2 -\left( -{{j=c}, \: d, \: {PI2 -\left( -{{i=a}, \: b, \: {i \ j}} -\right)}} -\right) -\leqno(1) -$$ -but now says: -The problem is in [[src/algebra/tex.spad.pamphlet]] in the list of -constants. -The code used to read -\begin{verbatim} - plexOps : L S := ["SIGMA","SIGMA2","PI","INTSIGN","INDEFINTEGRAL"]$(L S) - plexPrecs : L I := [ 700, 800, 700, 700]$(L I) -\end{verbatim} -it now reads: -<>= - plexOps : L S := ["SIGMA","SIGMA2","PI","PI2","INTSIGN","INDEFINTEGRAL"]$(L S) - plexPrecs : L I := [ 700, 800, 700, 800 , 700, 700]$(L I) -@ -in addition we need to add a line defining [[PI2]] in [[formatPlex]]: -<>= - op = "PI2" => "\prod" -@ -\subsection{domain TEX TexFormat} -<>= -)abbrev domain TEX TexFormat -++ Author: Robert S. Sutor -++ Date Created: 1987 through 1992 -++ Change History: -++ 05/15/91 RSS Changed matrix formatting to use array environment. -++ 06/27/91 RSS Fixed segments -++ 08/12/91 RSS Removed some grouping for things, added newWithNum and -++ ungroup, improved line splitting -++ 08/15/91 RSS Added mbox support for strings -++ 10/15/91 RSS Handle \%\% at beginning of string -++ 01/22/92 RSS Use \[ and \] instead of $$ and $$. Use -++ %AXIOM STEP NUMBER: instead of \leqno -++ 02/27/92 RSS Escape dollar signs appearing in the input. -++ 03/09/92 RSS Handle explicit blank appearing in the input. -++ 11/28/93 JHD Added code for the VCONCAT and TAG operations. -++ 06/27/95 RSS Change back to $$ and \leqno for Saturn -++ Basic Operations: coerce, convert, display, epilogue, -++ tex, new, prologue, setEpilogue!, setTex!, setPrologue! -++ Related Constructors: TexFormat1 -++ Also See: ScriptFormulaFormat -++ AMS Classifications: -++ Keywords: TeX, LaTeX, output, format -++ References: \TeX{} is a trademark of the American Mathematical Society. -++ Description: -++ \spadtype{TexFormat} provides a coercion from \spadtype{OutputForm} to -++ \TeX{} format. The particular dialect of \TeX{} used is \LaTeX{}. -++ The basic object consists of three parts: a prologue, a -++ tex part and an epilogue. The functions \spadfun{prologue}, -++ \spadfun{tex} and \spadfun{epilogue} extract these parts, -++ respectively. The main guts of the expression go into the tex part. -++ The other parts can be set (\spadfun{setPrologue!}, -++ \spadfun{setEpilogue!}) so that contain the appropriate tags for -++ printing. For example, the prologue and epilogue might simply -++ contain ``\verb+\[+'' and ``\verb+\]+'', respectively, so that -++ the TeX section will be printed in LaTeX display math mode. - -TexFormat(): public == private where - E ==> OutputForm - I ==> Integer - L ==> List - S ==> String - US ==> UniversalSegment(Integer) - - public == SetCategory with - coerce: E -> $ - ++ coerce(o) changes o in the standard output format to TeX - ++ format. - convert: (E,I) -> $ - ++ convert(o,step) changes o in standard output format to - ++ TeX format and also adds the given step number. This is useful - ++ if you want to create equations with given numbers or have the - ++ equation numbers correspond to the interpreter step numbers. - convert: (E,I,E) -> $ - ++ convert(o,step,type) changes o in standard output format to - ++ TeX format and also adds the given step number and type. This - ++ is useful if you want to create equations with given numbers - ++ or have the equation numbers correspond to the interpreter step - ++ numbers. - display: ($, I) -> Void - ++ display(t,width) outputs the TeX formatted code t so that each - ++ line has length less than or equal to \spadvar{width}. - display: $ -> Void - ++ display(t) outputs the TeX formatted code t so that each - ++ line has length less than or equal to the value set by - ++ the system command \spadsyscom{set output length}. - epilogue: $ -> L S - ++ epilogue(t) extracts the epilogue section of a TeX form t. - tex: $ -> L S - ++ tex(t) extracts the TeX section of a TeX form t. - new: () -> $ - ++ new() create a new, empty object. Use \spadfun{setPrologue!}, - ++ \spadfun{setTex!} and \spadfun{setEpilogue!} to set the various - ++ components of this object. - prologue: $ -> L S - ++ prologue(t) extracts the prologue section of a TeX form t. - setEpilogue!: ($, L S) -> L S - ++ setEpilogue!(t,strings) sets the epilogue section of a TeX form t to strings. - setTex!: ($, L S) -> L S - ++ setTex!(t,strings) sets the TeX section of a TeX form t to strings. - setPrologue!: ($, L S) -> L S - ++ setPrologue!(t,strings) sets the prologue section of a TeX form t to strings. - - private == add - import OutputForm - import Character - import Integer - import List OutputForm - import List String - - Rep := Record(prolog : L S, TeX : L S, epilog : L S) - - -- local variables declarations and definitions - - expr: E - prec,opPrec: I - str: S - blank : S := " \ " - - maxPrec : I := 1000000 - minPrec : I := 0 - - unaryOps : L S := ["-","^"]$(L S) - unaryPrecs : L I := [700,260]$(L I) - - -- the precedence of / in the following is relatively low because - -- the bar obviates the need for parentheses. - binaryOps : L S := ["+->","|","**","/","<",">","=","OVER"]$(L S) - binaryPrecs : L I := [0,0,900, 700,400,400,400, 700]$(L I) - - naryOps : L S := ["-","+","*",blank,",",";"," ","ROW","", - " \cr ","&"," \\ "]$(L S) - naryPrecs : L I := [700,700,800, 800,110,110, 0, 0, 0, - 0, 0, 0]$(L I) - naryNGOps : L S := ["ROW","&"]$(L S) - -<> - - specialOps : L S := ["MATRIX","BRACKET","BRACE","CONCATB","VCONCAT", _ - "AGGLST","CONCAT","OVERBAR","ROOT","SUB","TAG", _ - "SUPERSUB","ZAG","AGGSET","SC","PAREN", _ - "SEGMENT","QUOTE","theMap" ] - - -- the next two lists provide translations for some strings for - -- which TeX provides special macros. - - specialStrings : L S := - ["cos", "cot", "csc", "log", "sec", "sin", "tan", - "cosh", "coth", "csch", "sech", "sinh", "tanh", - "acos","asin","atan","erf","...","$","infinity"] - specialStringsInTeX : L S := - ["\cos","\cot","\csc","\log","\sec","\sin","\tan", - "\cosh","\coth","\csch","\sech","\sinh","\tanh", - "\arccos","\arcsin","\arctan","\erf","\ldots","\$","\infty"] - - -- local function signatures - - addBraces: S -> S - addBrackets: S -> S - group: S -> S - formatBinary: (S,L E, I) -> S - formatFunction: (S,L E, I) -> S - formatMatrix: L E -> S - formatNary: (S,L E, I) -> S - formatNaryNoGroup: (S,L E, I) -> S - formatNullary: S -> S - formatPlex: (S,L E, I) -> S - formatSpecial: (S,L E, I) -> S - formatUnary: (S, E, I) -> S - formatTex: (E,I) -> S - newWithNum: I -> $ - parenthesize: S -> S - precondition: E -> E - postcondition: S -> S - splitLong: (S,I) -> L S - splitLong1: (S,I) -> L S - stringify: E -> S - ungroup: S -> S - - -- public function definitions - - new() : $ == --- [["\["]$(L S), [""]$(L S), ["\]"]$(L S)]$Rep - [["$$"]$(L S), [""]$(L S), ["$$"]$(L S)]$Rep - - newWithNum(stepNum: I) : $ == --- num : S := concat("%AXIOM STEP NUMBER: ",string(stepNum)$S) --- [["\["]$(L S), [""]$(L S), ["\]",num]$(L S)]$Rep - num : S := concat(concat("\leqno(",string(stepNum)$S),")")$S - [["$$"]$(L S), [""]$(L S), [num,"$$"]$(L S)]$Rep - - coerce(expr : E): $ == - f : $ := new()$$ - f.TeX := [postcondition - formatTex(precondition expr, minPrec)]$(L S) - f - - convert(expr : E, stepNum : I): $ == - f : $ := newWithNum(stepNum) - f.TeX := [postcondition - formatTex(precondition expr, minPrec)]$(L S) - f - - display(f : $, len : I) == - s,t : S - for s in f.prolog repeat sayTeX$Lisp s - for s in f.TeX repeat - for t in splitLong(s, len) repeat sayTeX$Lisp t - for s in f.epilog repeat sayTeX$Lisp s - void()$Void - - display(f : $) == - display(f, _$LINELENGTH$Lisp pretend I) - - prologue(f : $) == f.prolog - tex(f : $) == f.TeX - epilogue(f : $) == f.epilog - - setPrologue!(f : $, l : L S) == f.prolog := l - setTex!(f : $, l : L S) == f.TeX := l - setEpilogue!(f : $, l : L S) == f.epilog := l - - coerce(f : $): E == - s,t : S - l : L S := nil - for s in f.prolog repeat l := concat(s,l) - for s in f.TeX repeat - for t in splitLong(s, (_$LINELENGTH$Lisp pretend Integer) - 4) repeat - l := concat(t,l) - for s in f.epilog repeat l := concat(s,l) - (reverse l) :: E - - -- local function definitions - - ungroup(str: S): S == - len : I := #str - len < 2 => str - lbrace : Character := char "{" - rbrace : Character := char "}" - -- drop leading and trailing braces - if (str.1 =$Character lbrace) and (str.len =$Character rbrace) then - u : US := segment(2,len-1)$US - str := str.u - str - - postcondition(str: S): S == - str := ungroup str - len : I := #str - plus : Character := char "+" - minus: Character := char "-" - len < 4 => str - for i in 1..(len-1) repeat - if (str.i =$Character plus) and (str.(i+1) =$Character minus) - then setelt(str,i,char " ")$S - str - - stringify expr == (object2String$Lisp expr) pretend S - - lineConcat( line : S, lines: L S ) : L S == - length := #line - - if ( length > 0 ) then - -- If the last character is a backslash then split at "\ ". - -- Reinstate the blank. - - if (line.length = char "\" ) then line := concat(line, " ") - - -- Remark: for some reason, "\%" at the beginning - -- of a line has the "\" erased when printed - - if ( line.1 = char "%" ) then line := concat(" \", line) - else if ( line.1 = char "\" ) and length > 1 and ( line.2 = char "%" ) then - line := concat(" ", line) - - lines := concat(line,lines)$List(S) - lines - - splitLong(str : S, len : I): L S == - -- this blocks into lines - if len < 20 then len := _$LINELENGTH$Lisp - splitLong1(str, len) - - splitLong1(str : S, len : I) == - -- We first build the list of lines backwards and then we - -- reverse it. - - l : List S := nil - s : S := "" - ls : I := 0 - ss : S - lss : I - for ss in split(str,char " ") repeat - -- have the newline macro end a line (even if it means the line - -- is slightly too long) - - ss = "\\" => - l := lineConcat( concat(s,ss), l ) - s := "" - ls := 0 - - lss := #ss - - -- place certain tokens on their own lines for clarity - - ownLine : Boolean := - u : US := segment(1,4)$US - (lss > 3) and ("\end" = ss.u) => true - u := segment(1,5)$US - (lss > 4) and ("\left" = ss.u) => true - u := segment(1,6)$US - (lss > 5) and (("\right" = ss.u) or ("\begin" = ss.u)) => true - false - - if ownLine or (ls + lss > len) then - if not empty? s then l := lineConcat( s, l ) - s := "" - ls := 0 - - ownLine or lss > len => l := lineConcat( ss, l ) - - (lss = 1) and (ss.1 = char "\") => - ls := ls + lss + 2 - s := concat(s,concat(ss," ")$S)$S - - ls := ls + lss + 1 - s := concat(s,concat(ss," ")$S)$S - - if ls > 0 then l := lineConcat( s, l ) - - reverse l - - group str == - concat ["{",str,"}"] - - addBraces str == - concat ["\left\{ ",str," \right\}"] - - addBrackets str == - concat ["\left[ ",str," \right]"] - - parenthesize str == - concat ["\left( ",str," \right)"] - - precondition expr == - outputTran$Lisp expr - - formatSpecial(op : S, args : L E, prec : I) : S == - arg : E - prescript : Boolean := false - op = "theMap" => "\mbox{theMap(...)}" - op = "AGGLST" => - formatNary(",",args,prec) - op = "AGGSET" => - formatNary(";",args,prec) - op = "TAG" => - group concat [formatTex(first args,prec), - "\rightarrow", - formatTex(second args,prec)] - op = "VCONCAT" => - group concat("\begin{array}{c}", - concat(concat([concat(formatTex(u, minPrec),"\\") - for u in args]::L S), - "\end{array}")) - op = "CONCATB" => - formatNary(" ",args,prec) - op = "CONCAT" => - formatNary("",args,minPrec) - op = "QUOTE" => - group concat("{\tt '}",formatTex(first args, minPrec)) - op = "BRACKET" => - group addBrackets ungroup formatTex(first args, minPrec) - op = "BRACE" => - group addBraces ungroup formatTex(first args, minPrec) - op = "PAREN" => - group parenthesize ungroup formatTex(first args, minPrec) - op = "OVERBAR" => - null args => "" - group concat ["\overline ",formatTex(first args, minPrec)] - op = "ROOT" => - null args => "" - tmp : S := group formatTex(first args, minPrec) - null rest args => group concat ["\sqrt ",tmp] - group concat - ["\root ",group formatTex(first rest args, minPrec)," \of ",tmp] - op = "SEGMENT" => - tmp : S := concat [formatTex(first args, minPrec),".."] - group - null rest args => tmp - concat [tmp,formatTex(first rest args, minPrec)] - op = "SUB" => - group concat [formatTex(first args, minPrec)," \sb ", - formatSpecial("AGGLST",rest args,minPrec)] - op = "SUPERSUB" => - -- variable name - form : List S := [formatTex(first args, minPrec)] - -- subscripts - args := rest args - null args => concat(form)$S - tmp : S := formatTex(first args, minPrec) - if (tmp ^= "") and (tmp ^= "{}") and (tmp ^= " ") then - form := append(form,[" \sb ",group tmp])$(List S) - -- superscripts - args := rest args - null args => group concat(form)$S - tmp : S := formatTex(first args, minPrec) - if (tmp ^= "") and (tmp ^= "{}") and (tmp ^= " ") then - form := append(form,[" \sp ",group tmp])$(List S) - -- presuperscripts - args := rest args - null args => group concat(form)$S - tmp : S := formatTex(first args, minPrec) - if (tmp ^= "") and (tmp ^= "{}") and (tmp ^= " ") then - form := append([" \sp ",group tmp],form)$(List S) - prescript := true - -- presubscripts - args := rest args - null args => - group concat - prescript => cons("{}",form) - form - tmp : S := formatTex(first args, minPrec) - if (tmp ^= "") and (tmp ^= "{}") and (tmp ^= " ") then - form := append([" \sb ",group tmp],form)$(List S) - prescript := true - group concat - prescript => cons("{}",form) - form - op = "SC" => - -- need to handle indentation someday - null args => "" - tmp := formatNaryNoGroup(" \\ ", args, minPrec) - group concat ["\begin{array}{l} ",tmp," \end{array} "] - op = "MATRIX" => formatMatrix rest args - op = "ZAG" => - concat [" \zag{",formatTex(first args, minPrec),"}{", - formatTex(first rest args,minPrec),"}"] - concat ["not done yet for ",op] - - formatPlex(op : S, args : L E, prec : I) : S == - hold : S - p : I := position(op,plexOps) - p < 1 => error "unknown Tex unary op" - opPrec := plexPrecs.p - n : I := #args - (n ^= 2) and (n ^= 3) => error "wrong number of arguments for plex" - s : S := - op = "SIGMA" => "\sum" - op = "SIGMA2" => "\sum" - op = "PI" => "\prod" -<> - op = "INTSIGN" => "\int" - op = "INDEFINTEGRAL" => "\int" - "????" - hold := formatTex(first args,minPrec) - args := rest args - if op ^= "INDEFINTEGRAL" then - if hold ^= "" then - s := concat [s," \sb",group concat ["\displaystyle ",hold]] - if not null rest args then - hold := formatTex(first args,minPrec) - if hold ^= "" then - s := concat [s," \sp",group concat ["\displaystyle ",hold]] - args := rest args - s := concat [s," ",formatTex(first args,minPrec)] - else - hold := group concat [hold," ",formatTex(first args,minPrec)] - s := concat [s," ",hold] - if opPrec < prec then s := parenthesize s - group s - - formatMatrix(args : L E) : S == - -- format for args is [[ROW ...],[ROW ...],[ROW ...]] - -- generate string for formatting columns (centered) - cols : S := "{" - for i in 2..#(first(args) pretend L E) repeat - cols := concat(cols,"c") - cols := concat(cols,"} ") - group addBrackets concat - ["\begin{array}",cols,formatNaryNoGroup(" \\ ",args,minPrec), - " \end{array} "] - - formatFunction(op : S, args : L E, prec : I) : S == - group concat [op, " ", parenthesize formatNary(",",args,minPrec)] - - formatNullary(op : S) == - op = "NOTHING" => "" - group concat [op,"()"] - - formatUnary(op : S, arg : E, prec : I) == - p : I := position(op,unaryOps) - p < 1 => error "unknown Tex unary op" - opPrec := unaryPrecs.p - s : S := concat [op,formatTex(arg,opPrec)] - opPrec < prec => group parenthesize s - op = "-" => s - group s - - formatBinary(op : S, args : L E, prec : I) : S == - p : I := position(op,binaryOps) - p < 1 => error "unknown Tex binary op" - op := - op = "|" => " \mid " - op = "**" => " \sp " - op = "/" => " \over " - op = "OVER" => " \over " - op = "+->" => " \mapsto " - op - opPrec := binaryPrecs.p - s : S := formatTex(first args, opPrec) - if op = " \over " then - s := concat [" \frac{",s,"}{",formatTex(first rest args, opPrec),"}"] - else if op = " \sp " then - s := concat [s,"^",formatTex(first rest args, opPrec)] - else - s := concat [s,op,formatTex(first rest args, opPrec)] - group - op = " \over " => s - opPrec < prec => parenthesize s - s - - formatNary(op : S, args : L E, prec : I) : S == - group formatNaryNoGroup(op, args, prec) - - formatNaryNoGroup(op : S, args : L E, prec : I) : S == - null args => "" - p : I := position(op,naryOps) - p < 1 => error "unknown Tex nary op" - op := - op = "," => ", \: " - op = ";" => "; \: " - op = "*" => blank - op = " " => " \ " - op = "ROW" => " & " - op - l : L S := nil - opPrec := naryPrecs.p - for a in args repeat - l := concat(op,concat(formatTex(a,opPrec),l)$L(S))$L(S) - s : S := concat reverse rest l - opPrec < prec => parenthesize s - s - - formatTex(expr,prec) == - i,len : Integer - intSplitLen : Integer := 20 - ATOM(expr)$Lisp pretend Boolean => - str := stringify expr - len := #str - FIXP$Lisp expr => - i := expr pretend Integer - if (i < 0) or (i > 9) - then - group - nstr : String := "" - -- insert some blanks into the string, if too long - while ((len := #str) > intSplitLen) repeat - nstr := concat [nstr," ", - elt(str,segment(1,intSplitLen)$US)] - str := elt(str,segment(intSplitLen+1)$US) - empty? nstr => str - nstr := - empty? str => nstr - concat [nstr," ",str] - elt(nstr,segment(2)$US) - else str - str = "%pi" => "\pi" - str = "%e" => "e" - str = "%i" => "i" - len > 1 and str.1 = char "%" and str.2 = char "%" => - u : US := segment(3,len)$US - concat(" \%\%",str.u) - len > 0 and str.1 = char "%" => concat(" \",str) - len > 1 and digit? str.1 => group str -- should handle floats - len > 0 and str.1 = char "_"" => - concat(concat(" \mbox{\tt ",str),"} ") - len = 1 and str.1 = char " " => "{\ }" - (i := position(str,specialStrings)) > 0 => - specialStringsInTeX.i - (i := position(char " ",str)) > 0 => - -- We want to preserve spacing, so use a roman font. - concat(concat(" \mbox{\rm ",str),"} ") - str - l : L E := (expr pretend L E) - null l => blank - op : S := stringify first l - args : L E := rest l - nargs : I := #args - - -- special cases - member?(op, specialOps) => formatSpecial(op,args,prec) - member?(op, plexOps) => formatPlex(op,args,prec) - - -- nullary case - 0 = nargs => formatNullary op - - -- unary case - (1 = nargs) and member?(op, unaryOps) => - formatUnary(op, first args, prec) - - -- binary case - (2 = nargs) and member?(op, binaryOps) => - formatBinary(op, args, prec) - - -- nary case - member?(op,naryNGOps) => formatNaryNoGroup(op,args, prec) - member?(op,naryOps) => formatNary(op,args, prec) - op := formatTex(first l,minPrec) - formatFunction(op,args,prec) - -@ \section{package TEX1 TexFormat1} <>= )abbrev package TEX1 TexFormat1 @@ -704,7 +78,6 @@ TexFormat1(S : SetCategory): public == private where <<*>>= <> -<> <> @ \eject diff --git a/src/algebra/tree.spad.pamphlet b/src/algebra/tree.spad.pamphlet deleted file mode 100644 index 8208245..0000000 --- a/src/algebra/tree.spad.pamphlet +++ /dev/null @@ -1,1149 +0,0 @@ -\documentclass{article} -\usepackage{axiom} -\begin{document} -\title{\$SPAD/src/algebra tree.spad} -\author{William Burge} -\maketitle -\begin{abstract} -\end{abstract} -\eject -\tableofcontents -\eject -\section{domain TREE Tree} -<>= -)abbrev domain TREE Tree -++ Author:W. H. Burge -++ Date Created:17 Feb 1992 -++ Date Last Updated: -++ Basic Operations: -++ Related Domains: -++ Also See: -++ AMS Classifications: -++ Keywords: -++ Examples: -++ References: -++ Description: \spadtype{Tree(S)} is a basic domains of tree structures. -++ Each tree is either empty or else is a {\it node} consisting of a value and -++ a list of (sub)trees. -Tree(S: SetCategory): T==C where - T== RecursiveAggregate(S) with - finiteAggregate - shallowlyMutable - tree: (S,List %) -> % - ++ tree(nd,ls) creates a tree with value nd, and children ls. - ++ - ++X t1:=tree [1,2,3,4] - ++X tree(5,[t1]) - - tree: List S -> % - ++ tree(ls) creates a tree from a list of elements of s. - ++ - ++X tree [1,2,3,4] - - tree: S -> % - ++ tree(nd) creates a tree with value nd, and no children - ++ - ++X tree 6 - - cyclic?: % -> Boolean - ++ cyclic?(t) tests if t is a cyclic tree. - ++ - ++X t1:=tree [1,2,3,4] - ++X cyclic? t1 - - cyclicCopy: % -> % - ++ cyclicCopy(l) makes a copy of a (possibly) cyclic tree l. - ++ - ++X t1:=tree [1,2,3,4] - ++X cyclicCopy t1 - - cyclicEntries: % -> List % - ++ cyclicEntries(t) returns a list of top-level cycles in tree t. - ++ - ++X t1:=tree [1,2,3,4] - ++X cyclicEntries t1 - - cyclicEqual?: (%, %) -> Boolean - ++ cyclicEqual?(t1, t2) tests of two cyclic trees have - ++ the same structure. - ++ - ++X t1:=tree [1,2,3,4] - ++X t2:=tree [1,2,3,4] - ++X cyclicEqual?(t1,t2) - - cyclicParents: % -> List % - ++ cyclicParents(t) returns a list of cycles that are parents of t. - ++ - ++X t1:=tree [1,2,3,4] - ++X cyclicParents t1 - - C== add - cycleTreeMax ==> 5 - - Rep := Union(node:Record(value: S, args: List %),empty:"empty") - t:% - br:% - s: S - ls: List S - empty? t == t case empty - empty() == ["empty"] - children t == - t case empty => error "cannot take the children of an empty tree" - (t.node.args)@List(%) - setchildren_!(t,lt) == - t case empty => error "cannot set children of an empty tree" - (t.node.args:=lt;t pretend %) - setvalue_!(t,s) == - t case empty => error "cannot set value of an empty tree" - (t.node.value:=s;s) - count(n, t) == - t case empty => 0 - i := +/[count(n, c) for c in children t] - value t = n => i + 1 - i - count(fn: S -> Boolean, t: %): NonNegativeInteger == - t case empty => 0 - i := +/[count(fn, c) for c in children t] - fn value t => i + 1 - i - map(fn, t) == - t case empty => t - tree(fn value t,[map(fn, c) for c in children t]) - map_!(fn, t) == - t case empty => t - setvalue_!(t, fn value t) - for c in children t repeat map_!(fn, c) - tree(s,lt) == [[s,lt]] - tree(s) == [[s,[]]] - tree(ls) == - empty? ls => empty() - tree(first ls, [tree s for s in rest ls]) - value t == - t case empty => error "cannot take the value of an empty tree" - t.node.value - child?(t1,t2) == - empty? t2 => false - "or"/[t1 = t for t in children t2] - distance1(t1: %, t2: %): Integer == - t1 = t2 => 0 - t2 case empty => -1 - u := [n for t in children t2 | (n := distance1(t1,t)) >= 0] - #u > 0 => 1 + "min"/u - -1 - distance(t1,t2) == - n := distance1(t1, t2) - n >= 0 => n - distance1(t2, t1) - node?(t1, t2) == - t1 = t2 => true - t case empty => false - "or"/[node?(t1, t) for t in children t2] - leaf? t == - t case empty => false - empty? children t - leaves t == - t case empty => empty() - leaf? t => [value t] - "append"/[leaves c for c in children t] - less? (t, n) == # t < n - more?(t, n) == # t > n - nodes t == ---buggy - t case empty => empty() - nl := [nodes c for c in children t] - nl = empty() => [t] - cons(t,"append"/nl) - size? (t, n) == # t = n - any?(fn, t) == ---bug fixed - t case empty => false - fn value t or "or"/[any?(fn, c) for c in children t] - every?(fn, t) == - t case empty => true - fn value t and "and"/[every?(fn, c) for c in children t] - member?(n, t) == - t case empty => false - n = value t or "or"/[member?(n, c) for c in children t] - members t == parts t - parts t == --buggy? - t case empty => empty() - u := [parts c for c in children t] - u = empty() => [value t] - cons(value t,"append"/u) - - ---Functions that guard against cycles: =, #, copy------------- - - -----> = - equal?: (%, %, %, %, Integer) -> Boolean - - t1 = t2 == equal?(t1, t2, t1, t2, 0) - - equal?(t1, t2, ot1, ot2, k) == - k = cycleTreeMax and (cyclic? ot1 or cyclic? ot2) => - error "use cyclicEqual? to test equality on cyclic trees" - t1 case empty => t2 case empty - t2 case empty => false - value t1 = value t2 and (c1 := children t1) = (c2 := children t2) and - "and"/[equal?(x,y,ot1, ot2,k + 1) for x in c1 for y in c2] - - -----> # - treeCount: (%, %, NonNegativeInteger) -> NonNegativeInteger - # t == treeCount(t, t, 0) - treeCount(t, origTree, k) == - k = cycleTreeMax and cyclic? origTree => - error "# is not defined on cyclic trees" - t case empty => 0 - 1 + +/[treeCount(c, origTree, k + 1) for c in children t] - - -----> copy - copy1: (%, %, Integer) -> % - copy t == copy1(t, t, 0) - copy1(t, origTree, k) == - k = cycleTreeMax and cyclic? origTree => - error "use cyclicCopy to copy a cyclic tree" - t case empty => t - empty? children t => tree value t - tree(value t, [copy1(x, origTree, k + 1) for x in children t]) - - -----------Functions that allow cycles--------------- - --local utility functions: - eqUnion: (List %, List %) -> List % - eqMember?: (%, List %) -> Boolean - eqMemberIndex: (%, List %, Integer) -> Integer - lastNode: List % -> List % - insert: (%, List %) -> List % - - -----> coerce to OutputForm - if S has SetCategory then - multipleOverbar: (OutputForm, Integer, List %) -> OutputForm - coerce1: (%, List %, List %) -> OutputForm - - coerce(t:%): OutputForm == coerce1(t, empty()$(List %), cyclicParents t) - - coerce1(t,parents, pl) == - t case empty => empty()@List(S)::OutputForm - eqMember?(t, parents) => - multipleOverbar((".")::OutputForm,eqMemberIndex(t, pl,0),pl) - empty? children t => value t::OutputForm - nodeForm := (value t)::OutputForm - if (k := eqMemberIndex(t, pl, 0)) > 0 then - nodeForm := multipleOverbar(nodeForm, k, pl) - prefix(nodeForm, - [coerce1(br,cons(t,parents),pl) for br in children t]) - - multipleOverbar(x, k, pl) == - k < 1 => x - #pl = 1 => overbar x - s : String := "abcdefghijklmnopqrstuvwxyz" - c := s.(1 + ((k - 1) rem 26)) - overlabel(c::OutputForm, x) - - -----> cyclic? - cyclic2?: (%, List %) -> Boolean - - cyclic? t == cyclic2?(t, empty()$(List %)) - - cyclic2?(x,parents) == - empty? x => false - eqMember?(x, parents) => true - for y in children x repeat - cyclic2?(y,cons(x, parents)) => return true - false - - -----> cyclicCopy - cyclicCopy2: (%, List %) -> % - copyCycle2: (%, List %) -> % - copyCycle4: (%, %, %, List %) -> % - - cyclicCopy(t) == cyclicCopy2(t, cyclicEntries t) - - cyclicCopy2(t, cycles) == - eqMember?(t, cycles) => return copyCycle2(t, cycles) - tree(value t, [cyclicCopy2(c, cycles) for c in children t]) - - copyCycle2(cycle, cycleList) == - newCycle := tree(value cycle, nil) - setchildren!(newCycle, - [copyCycle4(c,cycle,newCycle, cycleList) for c in children cycle]) - newCycle - - copyCycle4(t, cycle, newCycle, cycleList) == - empty? cycle => empty() - eq?(t, cycle) => newCycle - eqMember?(t, cycleList) => copyCycle2(t, cycleList) - tree(value t, - [copyCycle4(c, cycle, newCycle, cycleList) for c in children t]) - - -----> cyclicEntries - cyclicEntries3: (%, List %, List %) -> List % - - cyclicEntries(t) == cyclicEntries3(t, empty()$(List %), empty()$(List %)) - - cyclicEntries3(t, parents, cl) == - empty? t => cl - eqMember?(t, parents) => insert(t, cl) - parents := cons(t, parents) - for y in children t repeat - cl := cyclicEntries3(t, parents, cl) - cl - - -----> cyclicEqual? - cyclicEqual4?: (%, %, List %, List %) -> Boolean - - cyclicEqual?(t1, t2) == - cp1 := cyclicParents t1 - cp2 := cyclicParents t2 - #cp1 ^= #cp2 or null cp1 => t1 = t2 - cyclicEqual4?(t1, t2, cp1, cp2) - - cyclicEqual4?(t1, t2, cp1, cp2) == - t1 case empty => t2 case empty - t2 case empty => false - 0 ^= (k := eqMemberIndex(t1, cp1, 0)) => eq?(t2, cp2 . k) - value t1 = value t2 and - "and"/[cyclicEqual4?(x,y,cp1,cp2) - for x in children t1 for y in children t2] - - -----> cyclicParents t - cyclicParents3: (%, List %, List %) -> List % - - cyclicParents t == cyclicParents3(t, empty()$(List %), empty()$(List %)) - - cyclicParents3(x, parents, pl) == - empty? x => pl - eqMember?(x, parents) => - cycleMembers := [y for y in parents while not eq?(x,y)] - eqUnion(cons(x, cycleMembers), pl) - parents := cons(x, parents) - for y in children x repeat - pl := cyclicParents3(y, parents, pl) - pl - - insert(x, l) == - eqMember?(x, l) => l - cons(x, l) - - lastNode l == - empty? l => error "empty tree has no last node" - while not empty? rest l repeat l := rest l - l - - eqMember?(y,l) == - for x in l repeat eq?(x,y) => return true - false - - eqMemberIndex(x, l, k) == - null l => k - k := k + 1 - eq?(x, first l) => k - eqMemberIndex(x, rest l, k) - - eqUnion(u, v) == - null u => v - x := first u - newV := - eqMember?(x, v) => v - cons(x, v) - eqUnion(rest u, newV) - -@ -\section{domain BTREE BinaryTree} -<>= -)abbrev domain BTREE BinaryTree -++ Description: \spadtype{BinaryTree(S)} is the domain of all -++ binary trees. A binary tree over \spad{S} is either empty or has -++ a \spadfun{value} which is an S and a \spadfun{right} -++ and \spadfun{left} which are both binary trees. -BinaryTree(S: SetCategory): Exports == Implementation where - Exports == BinaryTreeCategory(S) with - binaryTree: S -> % - ++ binaryTree(v) is an non-empty binary tree - ++ with value v, and left and right empty. - ++ - ++X t1:=binaryTree([1,2,3]) - - binaryTree: (%,S,%) -> % - ++ binaryTree(l,v,r) creates a binary tree with - ++ value v with left subtree l and right subtree r. - ++ - ++X t1:=binaryTree([1,2,3]) - ++X t2:=binaryTree([4,5,6]) - ++X binaryTree(t1,[7,8,9],t2) - - Implementation == add - Rep := List Tree S - t1 = t2 == (t1::Rep) =$Rep (t2::Rep) - empty()== [] pretend % - empty()== [] pretend % - node(l,v,r) == cons(tree(v,l:Rep),r:Rep) - binaryTree(l,v,r) == node(l,v,r) - binaryTree(v:S) == node(empty(),v,empty()) - empty? t == empty?(t)$Rep - leaf? t == empty? t or empty? left t and empty? right t - right t == - empty? t => error "binaryTree:no right" - rest t - left t == - empty? t => error "binaryTree:no left" - children first t - value t== - empty? t => error "binaryTree:no value" - value first t - setvalue_! (t,nd)== - empty? t => error "binaryTree:no value to set" - setvalue_!(first(t:Rep),nd) - nd - setleft_!(t1,t2) == - empty? t1 => error "binaryTree:no left to set" - setchildren_!(first(t1:Rep),t2:Rep) - t1 - setright_!(t1,t2) == - empty? t1 => error "binaryTree:no right to set" - setrest_!(t1:List Tree S,t2) - -@ -\section{domain BSTREE BinarySearchTree} -<>= --- tree.spad.pamphlet BinarySearchTree.input -)spool BinarySearchTree.output -)set message test on -)set message auto off -)clear all ---S 1 of 12 -lv := [8,3,5,4,6,2,1,5,7] ---R ---R ---R (1) [8,3,5,4,6,2,1,5,7] ---R Type: List PositiveInteger ---E 1 - ---S 2 of 12 -t := binarySearchTree lv ---R ---R ---R (2) [[[1,2,.],3,[4,5,[5,6,7]]],8,.] ---R Type: BinarySearchTree PositiveInteger ---E 2 - ---S 3 of 12 -emptybst := empty()$BSTREE(INT) ---R ---R ---R (3) [] ---R Type: BinarySearchTree Integer ---E 3 - ---S 4 of 12 -t1 := insert!(8,emptybst) ---R ---R ---R (4) 8 ---R Type: BinarySearchTree Integer ---E 4 - ---S 5 of 12 -insert!(3,t1) ---R ---R ---R (5) [3,8,.] ---R Type: BinarySearchTree Integer ---E 5 - ---S 6 of 12 -leaves t ---R ---R ---R (6) [1,4,5,7] ---R Type: List PositiveInteger ---E 6 - ---S 7 of 12 -split(3,t) ---R ---R ---R (7) [less= [1,2,.],greater= [[.,3,[4,5,[5,6,7]]],8,.]] ---RType: Record(less: BinarySearchTree PositiveInteger,greater: BinarySearchTree PositiveInteger) ---E 7 - ---S 8 of 12 -insertRoot: (INT,BSTREE INT) -> BSTREE INT ---R ---R Type: Void ---E 8 - ---S 9 of 12 -insertRoot(x, t) == - a := split(x, t) - node(a.less, x, a.greater) ---R ---R Type: Void ---E 9 - ---S 10 of 12 -buildFromRoot ls == reduce(insertRoot,ls,emptybst) ---R ---R Type: Void ---E 10 - ---S 11 of 12 -rt := buildFromRoot reverse lv ---R ---R Compiling function buildFromRoot with type List PositiveInteger -> ---R BinarySearchTree Integer ---R Compiling function insertRoot with type (Integer,BinarySearchTree ---R Integer) -> BinarySearchTree Integer ---R ---R (11) [[[1,2,.],3,[4,5,[5,6,7]]],8,.] ---R Type: BinarySearchTree Integer ---E 11 - ---S 12 of 12 -(t = rt)@Boolean ---R ---R ---R (12) true ---R Type: Boolean ---E 12 -)spool -)lisp (bye) -@ -<>= -==================================================================== -BinarySearchTree examples -==================================================================== - -BinarySearchTree(R) is the domain of binary trees with elements of -type R, ordered across the nodes of the tree. A non-empty binary -search tree has a value of type R, and right and left binary search -subtrees. If a subtree is empty, it is displayed as a period ("."). - -Define a list of values to be placed across the tree. The resulting -tree has 8 at the root; all other elements are in the left subtree. - - lv := [8,3,5,4,6,2,1,5,7] - [8, 3, 5, 4, 6, 2, 1, 5, 7] - Type: List PositiveInteger - -A convenient way to create a binary search tree is to apply the -operation binarySearchTree to a list of elements. - - t := binarySearchTree lv - [[[1, 2, .], 3, [4, 5, [5, 6, 7]]], 8, .] - Type: BinarySearchTree PositiveInteger - -Another approach is to first create an empty binary search tree of integers. - - emptybst := empty()$BSTREE(INT) - [] - Type: BinarySearchTree Integer - -Insert the value 8. This establishes 8 as the root of the binary -search tree. Values inserted later that are less than 8 get stored in -the left subtree, others in the right subtree. - - t1 := insert!(8,emptybst) - 8 - Type: BinarySearchTree Integer - -Insert the value 3. This number becomes the root of the left subtree -of t1. For optimal retrieval, it is thus important to insert the -middle elements first. - - insert!(3,t1) - [3, 8, .] - Type: BinarySearchTree Integer - -We go back to the original tree t. The leaves of the binary search -tree are those which have empty left and right subtrees. - - leaves t - [1, 4, 5, 7] - Type: List PositiveInteger - -The operation split(k,t) returns a record containing the two subtrees: -one with all elements "less" than k, another with elements "greater" -than k. - - split(3,t) - [less=[1, 2, .], greater=[[., 3, [4, 5, [5, 6, 7]]], 8, .]] - Type: Record(less: BinarySearchTree PositiveInteger,greater: - BinarySearchTree PositiveInteger) - -Define insertRoot to insert new elements by creating a new node. - - insertRoot: (INT,BSTREE INT) -> BSTREE INT - Type: Void - -The new node puts the inserted value between its "less" tree and -"greater" tree. - - - insertRoot(x, t) == - a := split(x, t) - node(a.less, x, a.greater) - Type: Void - - -Function buildFromRoot builds a binary search tree from a list -of elements ls and the empty tree emptybst. - - buildFromRoot ls == reduce(insertRoot,ls,emptybst) - Type: Void - -Apply this to the reverse of the list lv. - - rt := buildFromRoot reverse lv - [[[1, 2, . ], 3, [4, 5, [5, 6, 7]]], 8, .] - Type: BinarySearchTree Integer - -Have Axiom check that these are equal. - - (t = rt)@Boolean - true - Type: Boolean - -See Also: -o )show BinarySearchTree -o $AXIOM/doc/src/algebra/tree.spad.dvi - -@ -<>= -)abbrev domain BSTREE BinarySearchTree -++ Description: BinarySearchTree(S) is the domain of -++ a binary trees where elements are ordered across the tree. -++ A binary search tree is either empty or has -++ a value which is an S, and a -++ right and left which are both BinaryTree(S) -++ Elements are ordered across the tree. -BinarySearchTree(S: OrderedSet): Exports == Implementation where - Exports == BinaryTreeCategory(S) with - shallowlyMutable - finiteAggregate - binarySearchTree: List S -> % - ++ binarySearchTree(l) \undocumented - ++ - ++X binarySearchTree [1,2,3,4] - - insert_!: (S,%) -> % - ++ insert!(x,b) inserts element x as leaves into binary search tree b. - ++ - ++X t1:=binarySearchTree [1,2,3,4] - ++X insert!(5,t1) - - insertRoot_!: (S,%) -> % - ++ insertRoot!(x,b) inserts element x as a root of binary search tree b. - ++ - ++X t1:=binarySearchTree [1,2,3,4] - ++X insertRoot!(5,t1) - - split: (S,%) -> Record(less: %, greater: %) - ++ split(x,b) splits binary tree b into two trees, one with elements - ++ greater than x, the other with elements less than x. - ++ - ++X t1:=binarySearchTree [1,2,3,4] - ++X split(3,t1) - - Implementation == BinaryTree(S) add - Rep := BinaryTree(S) - binarySearchTree(u:List S) == - null u => empty() - tree := binaryTree(first u) - for x in rest u repeat insert_!(x,tree) - tree - insert_!(x,t) == - empty? t => binaryTree(x) - x >= value t => - setright_!(t,insert_!(x,right t)) - t - setleft_!(t,insert_!(x,left t)) - t - split(x,t) == - empty? t => [empty(),empty()] - x > value t => - a := split(x,right t) - [node(left t, value t, a.less), a.greater] - a := split(x,left t) - [a.less, node(a.greater, value t, right t)] - insertRoot_!(x,t) == - a := split(x,t) - node(a.less, x, a.greater) - -@ -\section{domain BTOURN BinaryTournament} -A BinaryTournament(S) is the domain of binary trees where elements are -ordered down the tree. A binary search tree is either empty or is a -node containing a value of type S, and a right and a left which are -both BinaryTree(S) -<>= -)abbrev domain BTOURN BinaryTournament -BinaryTournament(S: OrderedSet): Exports == Implementation where - Exports == BinaryTreeCategory(S) with - shallowlyMutable - binaryTournament: List S -> % - ++ binaryTournament(ls) creates a binary tournament with the - ++ elements of ls as values at the nodes. - ++ - ++X binaryTournament [1,2,3,4] - - insert_!: (S,%) -> % - ++ insert!(x,b) inserts element x as leaves into binary tournament b. - ++ - ++X t1:=binaryTournament [1,2,3,4] - ++X insert!(5,t1) - ++X t1 - - Implementation == BinaryTree(S) add - Rep := BinaryTree(S) - binaryTournament(u:List S) == - null u => empty() - tree := binaryTree(first u) - for x in rest u repeat insert_!(x,tree) - tree - insert_!(x,t) == - empty? t => binaryTree(x) - x > value t => - setleft_!(t,copy t) - setvalue_!(t,x) - setright_!(t,empty()) - setright_!(t,insert_!(x,right t)) - t - -@ -\section{domain BBTREE BalancedBinaryTree} -<>= --- tree.spad.pamphlet BalancedBinaryTree.input -)spool BalancedBinaryTree.output -)set message test on -)set message auto off -)clear all ---S 1 -lm := [3,5,7,11] ---R ---R ---R (1) [3,5,7,11] ---R Type: List PositiveInteger ---E 1 - ---S 2 -modTree(12,lm) ---R ---R ---R (2) [0,2,5,1] ---R Type: List Integer ---E 2 - ---S 3 -t := balancedBinaryTree(#lm, 0) ---R ---R ---R (3) [[0,0,0],0,[0,0,0]] ---R Type: BalancedBinaryTree NonNegativeInteger ---E 3 - ---S 4 -setleaves!(t,lm) ---R ---R ---R (4) [[3,0,5],0,[7,0,11]] ---R Type: BalancedBinaryTree NonNegativeInteger ---E 4 - ---S 5 -mapUp!(t,_*) ---R ---R ---R (5) 1155 ---R Type: PositiveInteger ---E 5 - ---S 6 -t ---R ---R ---R (6) [[3,15,5],1155,[7,77,11]] ---R Type: BalancedBinaryTree NonNegativeInteger ---E 6 - ---S 7 -mapDown!(t,12,_rem) ---R ---R ---R (7) [[0,12,2],12,[5,12,1]] ---R Type: BalancedBinaryTree NonNegativeInteger ---E 7 - ---S 8 -leaves % ---R ---R ---R (8) [0,2,5,1] ---R Type: List NonNegativeInteger ---E 8 - ---S 9 -squares := [x**2 rem m for x in % for m in lm] ---R ---R ---R (9) [0,4,4,1] ---R Type: List NonNegativeInteger ---E 9 - ---S 10 -chineseRemainder(%,lm) ---R ---R ---R (10) 144 ---R Type: PositiveInteger ---E 10 -)spool -)lisp (bye) -@ -<>= -==================================================================== -BalancedBinaryTree examples -==================================================================== - -BalancedBinaryTrees(S) is the domain of balanced binary trees with -elements of type S at the nodes. A binary tree is either empty or -else consists of a node having a value and two branches, each branch a -binary tree. A balanced binary tree is one that is balanced with -respect its leaves. One with 2^k leaves is perfectly "balanced": the -tree has minimum depth, and the left and right branch of every -interior node is identical in shape. - -Balanced binary trees are useful in algebraic computation for -so-called "divide-and-conquer" algorithms. Conceptually, the data -for a problem is initially placed at the root of the tree. The -original data is then split into two subproblems, one for each -subtree. And so on. Eventually, the problem is solved at the leaves -of the tree. A solution to the original problem is obtained by some -mechanism that can reassemble the pieces. In fact, an implementation -of the Chinese Remainder Algorithm using balanced binary trees was -first proposed by David Y. Y. Yun at the IBM T. J. Watson Research -Center in Yorktown Heights, New York, in 1978. It served as the -prototype for polymorphic algorithms in Axiom. - -In what follows, rather than perform a series of computations with a -single expression, the expression is reduced modulo a number of -integer primes, a computation is done with modular arithmetic for each -prime, and the Chinese Remainder Algorithm is used to obtain the -answer to the original problem. We illustrate this principle with the -computation of 12^2 = 144. - -A list of moduli: - - lm := [3,5,7,11] - [3,5,7,11] - Type: PositiveInteger - -The expression modTree(n, lm) creates a balanced binary tree with leaf -values n mod m for each modulus m in lm. - - modTree(12,lm) - [0, 2, 5, 1] - Type: List Integer - -Operation modTree does this using operations on balanced binary trees. -We trace its steps. Create a balanced binary tree t of zeros with -four leaves. - - t := balancedBinaryTree(#lm, 0) - [[0, 0, 0], 0, [0, 0, 0]] - Type: BalancedBinaryTree NonNegativeInteger - -The leaves of the tree are set to the individual moduli. - - setleaves!(t,lm) - [[3, 0, 5], 0, [7, 0, 11]] - Type: BalancedBinaryTree NonNegativeInteger - -mapUp! to do a bottom-up traversal of t, setting each interior node to -the product of the values at the nodes of its children. - - mapUp!(t,_*) - 1155 - Type: PositiveInteger - -The value at the node of every subtree is the product of the moduli -of the leaves of the subtree. - - t - [[3, 15, 5], 1155, [7, 77, 11]] - Type: BalancedBinaryTree NonNegativeInteger - -Operation mapDown!(t,a,fn) replaces the value v at each node of t by -fn(a,v). - - mapDown!(t,12,_rem) - [[0, 12, 2], 12, [5, 12, 1]] - Type: BalancedBinaryTree NonNegativeInteger - -The operation leaves returns the leaves of the resulting tree. In -this case, it returns the list of 12 mod m for each modulus m. - - leaves % - [0, 2, 5, 1] - Type: List NonNegativeInteger - -Compute the square of the images of 12 modulo each m. - - squares := [x**2 rem m for x in % for m in lm] - [0, 4, 4, 1] - Type: List NonNegativeInteger - -Call the Chinese Remainder Algorithm to get the answer for 12^2. - - chineseRemainder(%,lm) - 144 - Type: PositiveInteger - -See Also: -o )show BalancedBinaryTree -o $AXIOM/doc/src/algebra/tree.spad.dvi - -@ -<>= -)abbrev domain BBTREE BalancedBinaryTree -++ Description: \spadtype{BalancedBinaryTree(S)} is the domain of balanced -++ binary trees (bbtree). A balanced binary tree of \spad{2**k} leaves, -++ for some \spad{k > 0}, is symmetric, that is, the left and right -++ subtree of each interior node have identical shape. -++ In general, the left and right subtree of a given node can differ -++ by at most leaf node. -BalancedBinaryTree(S: SetCategory): Exports == Implementation where - Exports == BinaryTreeCategory(S) with - finiteAggregate - shallowlyMutable --- BUG: applies wrong fnct for balancedBinaryTree(0,[1,2,3,4]) --- balancedBinaryTree: (S, List S) -> % --- ++ balancedBinaryTree(s, ls) creates a balanced binary tree with --- ++ s at the interior nodes and elements of ls at the --- ++ leaves. - balancedBinaryTree: (NonNegativeInteger, S) -> % - ++ balancedBinaryTree(n, s) creates a balanced binary tree with - ++ n nodes each with value s. - ++ - ++X balancedBinaryTree(4, 0) - - setleaves_!: (%, List S) -> % - ++ setleaves!(t, ls) sets the leaves of t in left-to-right order - ++ to the elements of ls. - ++ - ++X t1:=balancedBinaryTree(4, 0) - ++X setleaves!(t1,[1,2,3,4]) - - mapUp_!: (%, (S,S) -> S) -> S - ++ mapUp!(t,f) traverses balanced binary tree t in an "endorder" - ++ (left then right then node) fashion returning t with the value - ++ at each successive interior node of t replaced by - ++ f(l,r) where l and r are the values at the immediate - ++ left and right nodes. - ++ - ++X T1:=BalancedBinaryTree Integer - ++X t2:=balancedBinaryTree(4, 0)$T1 - ++X setleaves!(t2,[1,2,3,4]::List(Integer)) - ++X adder(a:Integer,b:Integer):Integer == a+b - ++X mapUp!(t2,adder) - ++X t2 - - mapUp_!: (%, %, (S,S,S,S) -> S) -> % - ++ mapUp!(t,t1,f) traverses balanced binary tree t in an "endorder" - ++ (left then right then node) fashion returning t with the value - ++ at each successive interior node of t replaced by - ++ f(l,r,l1,r1) where l and r are the values at the immediate - ++ left and right nodes. Values l1 and r1 are values at the - ++ corresponding nodes of a balanced binary tree t1, of identical - ++ shape at t. - ++ - ++X T1:=BalancedBinaryTree Integer - ++X t2:=balancedBinaryTree(4, 0)$T1 - ++X setleaves!(t2,[1,2,3,4]::List(Integer)) - ++X adder4(i:INT,j:INT,k:INT,l:INT):INT == i+j+k+l - ++X mapUp!(t2,t2,adder4) - ++X t2 - - mapDown_!: (%,S,(S,S) -> S) -> % - ++ mapDown!(t,p,f) returns t after traversing t in "preorder" - ++ (node then left then right) fashion replacing the successive - ++ interior nodes as follows. The root value x is - ++ replaced by q := f(p,x). The mapDown!(l,q,f) and - ++ mapDown!(r,q,f) are evaluated for the left and right subtrees - ++ l and r of t. - ++ - ++X T1:=BalancedBinaryTree Integer - ++X t2:=balancedBinaryTree(4, 0)$T1 - ++X setleaves!(t2,[1,2,3,4]::List(Integer)) - ++X adder(i:Integer,j:Integer):Integer == i+j - ++X mapDown!(t2,4::INT,adder) - ++X t2 - - mapDown_!: (%,S, (S,S,S) -> List S) -> % - ++ mapDown!(t,p,f) returns t after traversing t in "preorder" - ++ (node then left then right) fashion replacing the successive - ++ interior nodes as follows. Let l and r denote the left and - ++ right subtrees of t. The root value x of t is replaced by p. - ++ Then f(value l, value r, p), where l and r denote the left - ++ and right subtrees of t, is evaluated producing two values - ++ pl and pr. Then \spad{mapDown!(l,pl,f)} and \spad{mapDown!(l,pr,f)} - ++ are evaluated. - ++ - ++X T1:=BalancedBinaryTree Integer - ++X t2:=balancedBinaryTree(4, 0)$T1 - ++X setleaves!(t2,[1,2,3,4]::List(Integer)) - ++X adder3(i:Integer,j:Integer,k:Integer):List Integer == [i+j,j+k] - ++X mapDown!(t2,4::INT,adder3) - ++X t2 - - Implementation == BinaryTree(S) add - Rep := BinaryTree(S) - leaf? x == - empty? x => false - empty? left x and empty? right x --- balancedBinaryTree(x: S, u: List S) == --- n := #u --- n = 0 => empty() --- setleaves_!(balancedBinaryTree(n, x), u) - setleaves_!(t, u) == - n := #u - n = 0 => - empty? t => t - error "the tree and list must have the same number of elements" - n = 1 => - setvalue_!(t,first u) - t - m := n quo 2 - acc := empty()$(List S) - for i in 1..m repeat - acc := [first u,:acc] - u := rest u - setleaves_!(left t, reverse_! acc) - setleaves_!(right t, u) - t - balancedBinaryTree(n: NonNegativeInteger, val: S) == - n = 0 => empty() - n = 1 => node(empty(),val,empty()) - m := n quo 2 - node(balancedBinaryTree(m, val), val, - balancedBinaryTree((n - m) pretend NonNegativeInteger, val)) - mapUp_!(x,fn) == - empty? x => error "mapUp! called on a null tree" - leaf? x => x.value - x.value := fn(mapUp_!(x.left,fn),mapUp_!(x.right,fn)) - mapUp_!(x,y,fn) == - empty? x => error "mapUp! is called on a null tree" - leaf? x => - leaf? y => x - error "balanced binary trees are incompatible" - leaf? y => error "balanced binary trees are incompatible" - mapUp_!(x.left,y.left,fn) - mapUp_!(x.right,y.right,fn) - x.value := fn(x.left.value,x.right.value,y.left.value,y.right.value) - x - mapDown_!(x: %, p: S, fn: (S,S) -> S ) == - empty? x => x - x.value := fn(p, x.value) - mapDown_!(x.left, x.value, fn) - mapDown_!(x.right, x.value, fn) - x - mapDown_!(x: %, p: S, fn: (S,S,S) -> List S) == - empty? x => x - x.value := p - leaf? x => x - u := fn(x.left.value, x.right.value, p) - mapDown_!(x.left, u.1, fn) - mapDown_!(x.right, u.2, fn) - x - -@ -\section{domain PENDTREE PendantTree} -A PendantTree(S)is either a leaf? and is an S or has -a left and a right both PendantTree(S)'s -<>= -)abbrev domain PENDTREE PendantTree -PendantTree(S: SetCategory): T == C where - T == BinaryRecursiveAggregate(S) with - ptree : S->% - ++ ptree(s) is a leaf? pendant tree - ++ - ++X t1:=ptree([1,2,3]) - - ptree:(%, %)->% - ++ ptree(x,y) \undocumented - ++ - ++X t1:=ptree([1,2,3]) - ++X ptree(t1,ptree([1,2,3])) - - coerce:%->Tree S - ++ coerce(x) \undocumented - ++ - ++X t1:=ptree([1,2,3]) - ++X t2:=ptree(t1,ptree([1,2,3])) - ++X t2::Tree List PositiveInteger - - C == add - Rep := Tree S - import Tree S - coerce (t:%):Tree S == t pretend Tree S - ptree(n) == tree(n,[])$Rep pretend % - ptree(l,r) == tree(value(r:Rep)$Rep,cons(l,children(r:Rep)$Rep)):% - leaf? t == empty?(children(t)$Rep) - t1=t2 == (t1:Rep) = (t2:Rep) - left b == - leaf? b => error "ptree:no left" - first(children(b)$Rep) - right b == - leaf? b => error "ptree:no right" - tree(value(b)$Rep,rest (children(b)$Rep)) - value b == - leaf? b => value(b)$Rep - error "the pendant tree has no value" - coerce(b:%): OutputForm == - leaf? b => value(b)$Rep :: OutputForm - paren blankSeparate [left b::OutputForm,right b ::OutputForm] - -@ -\section{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. -@ -<<*>>= - -<> -<> -<> -<> -<> -<> -@ -\eject -\begin{thebibliography}{99} -\bibitem{1} nothing -\end{thebibliography} -\end{document} diff --git a/src/algebra/triset.spad.pamphlet b/src/algebra/triset.spad.pamphlet index 83ddc04..6ec6e71 100644 --- a/src/algebra/triset.spad.pamphlet +++ b/src/algebra/triset.spad.pamphlet @@ -9,116 +9,6 @@ \eject \tableofcontents \eject -\section{domain GTSET GeneralTriangularSet} -<>= -)abbrev domain GTSET GeneralTriangularSet -++ Author: Marc Moreno Maza (marc@nag.co.uk) -++ Date Created: 10/06/1995 -++ Date Last Updated: 06/12/1996 -++ Basic Functions: -++ Related Constructors: -++ Also See: -++ AMS Classifications: -++ Keywords: -++ Description: -++ A domain constructor of the category \axiomType{TriangularSetCategory}. -++ The only requirement for a list of polynomials to be a member of such -++ a domain is the following: no polynomial is constant and two distinct -++ polynomials have distinct main variables. Such a triangular set may -++ not be auto-reduced or consistent. Triangular sets are stored -++ as sorted lists w.r.t. the main variables of their members but they -++ are displayed in reverse order.\newline -++ References : -++ [1] P. AUBRY, D. LAZARD and M. MORENO MAZA "On the Theories -++ of Triangular Sets" Journal of Symbol. Comp. (to appear) -++ Version: 1 - -GeneralTriangularSet(R,E,V,P) : Exports == Implementation where - - R : IntegralDomain - E : OrderedAbelianMonoidSup - V : OrderedSet - P : RecursivePolynomialCategory(R,E,V) - N ==> NonNegativeInteger - Z ==> Integer - B ==> Boolean - LP ==> List P - PtoP ==> P -> P - - Exports == TriangularSetCategory(R,E,V,P) - - Implementation == add - - Rep ==> LP - - rep(s:$):Rep == s pretend Rep - per(l:Rep):$ == l pretend $ - - copy ts == - per(copy(rep(ts))$LP) - empty() == - per([]) - empty?(ts:$) == - empty?(rep(ts)) - parts ts == - rep(ts) - members ts == - rep(ts) - map (f : PtoP, ts : $) : $ == - construct(map(f,rep(ts))$LP)$$ - map! (f : PtoP, ts : $) : $ == - construct(map!(f,rep(ts))$LP)$$ - member? (p,ts) == - member?(p,rep(ts))$LP - - unitIdealIfCan() == - "failed"::Union($,"failed") - roughUnitIdeal? ts == - false - - -- the following assume that rep(ts) is decreasingly sorted - -- w.r.t. the main variavles of the polynomials in rep(ts) - coerce(ts:$) : OutputForm == - lp : List(P) := reverse(rep(ts)) - brace([p::OutputForm for p in lp]$List(OutputForm))$OutputForm - mvar ts == - empty? ts => error"failed in mvar : $ -> V from GTSET" - mvar(first(rep(ts)))$P - first ts == - empty? ts => "failed"::Union(P,"failed") - first(rep(ts))::Union(P,"failed") - last ts == - empty? ts => "failed"::Union(P,"failed") - last(rep(ts))::Union(P,"failed") - rest ts == - empty? ts => "failed"::Union($,"failed") - per(rest(rep(ts)))::Union($,"failed") - coerce(ts:$) : (List P) == - rep(ts) - collectUpper (ts,v) == - empty? ts => ts - lp := rep(ts) - newlp : Rep := [] - while (not empty? lp) and (mvar(first(lp)) > v) repeat - newlp := cons(first(lp),newlp) - lp := rest lp - per(reverse(newlp)) - collectUnder (ts,v) == - empty? ts => ts - lp := rep(ts) - while (not empty? lp) and (mvar(first(lp)) >= v) repeat - lp := rest lp - per(lp) - - -- for another domain of TSETCAT build on this domain GTSET - -- the following operations must be redefined - extendIfCan(ts:$,p:P) == - ground? p => "failed"::Union($,"failed") - empty? ts => (per([unitCanonical(p)]$LP))::Union($,"failed") - not (mvar(ts) < mvar(p)) => "failed"::Union($,"failed") - (per(cons(p,rep(ts))))::Union($,"failed") - -@ \section{package PSETPK PolynomialSetUtilitiesPackage} <>= )abbrev package PSETPK PolynomialSetUtilitiesPackage @@ -939,560 +829,6 @@ PolynomialSetUtilitiesPackage (R,E,V,P) : Exports == Implementation where toSave @ -\section{domain WUTSET WuWenTsunTriangularSet} -<>= --- triset.spad.pamphlet WuWenTsunTriangularSet.input -)spool WuWenTsunTriangularSet.output -)set message test on -)set message auto off -)clear all ---S 1 of 16 -R := Integer ---R ---R ---R (1) Integer ---R Type: Domain ---E 1 - ---S 2 of 16 -ls : List Symbol := [x,y,z,t] ---R ---R ---R (2) [x,y,z,t] ---R Type: List Symbol ---E 2 - ---S 3 of 16 -V := OVAR(ls) ---R ---R ---R (3) OrderedVariableList [x,y,z,t] ---R Type: Domain ---E 3 - ---S 4 of 16 -E := IndexedExponents V ---R ---R ---R (4) IndexedExponents OrderedVariableList [x,y,z,t] ---R Type: Domain ---E 4 - ---S 5 of 16 -P := NSMP(R, V) ---R ---R ---R (5) NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t]) ---R Type: Domain ---E 5 - ---S 6 of 16 -x: P := 'x ---R ---R ---R (6) x ---R Type: NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t]) ---E 6 - ---S 7 of 16 -y: P := 'y ---R ---R ---R (7) y ---R Type: NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t]) ---E 7 - ---S 8 of 16 -z: P := 'z ---R ---R ---R (8) z ---R Type: NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t]) ---E 8 - ---S 9 of 16 -t: P := 't ---R ---R ---R (9) t ---R Type: NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t]) ---E 9 - ---S 10 of 16 -T := WUTSET(R,E,V,P) ---R ---R ---R (10) ---R WuWenTsunTriangularSet(Integer,IndexedExponents OrderedVariableList [x,y,z,t] ---R ,OrderedVariableList [x,y,z,t],NewSparseMultivariatePolynomial(Integer,Ordere ---R dVariableList [x,y,z,t])) ---R Type: Domain ---E 10 - ---S 11 of 16 -p1 := x ** 31 - x ** 6 - x - y ---R ---R ---R 31 6 ---R (11) x - x - x - y ---R Type: NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t]) ---E 11 - ---S 12 of 16 -p2 := x ** 8 - z ---R ---R ---R 8 ---R (12) x - z ---R Type: NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t]) ---E 12 - ---S 13 of 16 -p3 := x ** 10 - t ---R ---R ---R 10 ---R (13) x - t ---R Type: NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t]) ---E 13 - ---S 14 of 16 -lp := [p1, p2, p3] ---R ---R ---R 31 6 8 10 ---R (14) [x - x - x - y,x - z,x - t] ---RType: List NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t]) ---E 14 - ---S 15 of 16 -characteristicSet(lp)$T ---R ---R ---R (15) ---R 5 4 4 2 2 3 4 7 4 6 6 3 3 3 3 ---R {z - t ,t z y + 2t z y + (- t + 2t - t)z + t z,(t - 1)z x - z y - t } ---RType: Union(WuWenTsunTriangularSet(Integer,IndexedExponents OrderedVariableList [x,y,z,t],OrderedVariableList [x,y,z,t],NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t])),...) ---E 15 - ---S 16 of 16 -zeroSetSplit(lp)$T ---R ---R ---R (16) ---R 3 5 4 3 3 2 ---R [{t,z,y,x}, {t - 1,z - t ,z y + t ,z x - t}, ---R 5 4 4 2 2 3 4 7 4 6 6 3 3 3 3 ---R {z - t ,t z y + 2t z y + (- t + 2t - t)z + t z,(t - 1)z x - z y - t }] ---RType: List WuWenTsunTriangularSet(Integer,IndexedExponents OrderedVariableList [x,y,z,t],OrderedVariableList [x,y,z,t],NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t])) ---E 16 -)spool -)lisp (bye) -@ -<>= -==================================================================== -WuWenTsunTriangularSet examples -==================================================================== - -The WuWenTsunTriangularSet domain constructor implements the -characteristic set method of Wu Wen Tsun. This algorithm computes a -list of triangular sets from a list of polynomials such that the -algebraic variety defined by the given list of polynomials decomposes -into the union of the regular-zero sets of the computed triangular -sets. The constructor takes four arguments. The first one, R, is the -coefficient ring of the polynomials; it must belong to the category -IntegralDomain. The second one, E, is the exponent monoid of the -polynomials; it must belong to the category OrderedAbelianMonoidSup. -The third one, V, is the ordered set of variables; it must belong to -the category OrderedSet. The last one is the polynomial ring; it must -belong to the category RecursivePolynomialCategory(R,E,V). The -abbreviation for WuWenTsunTriangularSet is WUTSET. - -Let us illustrate the facilities by an example. - -Define the coefficient ring. - - R := Integer - Integer - Type: Domain - -Define the list of variables, - - ls : List Symbol := [x,y,z,t] - [x,y,z,t] - Type: List Symbol - -and make it an ordered set; - - V := OVAR(ls) - OrderedVariableList [x,y,z,t] - Type: Domain - -then define the exponent monoid. - - E := IndexedExponents V - IndexedExponents OrderedVariableList [x,y,z,t] - Type: Domain - -Define the polynomial ring. - - P := NSMP(R, V) - NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t]) - Type: Domain - -Let the variables be polynomial. - - x: P := 'x - x - Type: NewSparseMultivariatePolynomial(Integer, - OrderedVariableList [x,y,z,t]) - - y: P := 'y - y - Type: NewSparseMultivariatePolynomial(Integer, - OrderedVariableList [x,y,z,t]) - - z: P := 'z - z - Type: NewSparseMultivariatePolynomial(Integer, - OrderedVariableList [x,y,z,t]) - - t: P := 't - t - Type: NewSparseMultivariatePolynomial(Integer, - OrderedVariableList [x,y,z,t]) - -Now call the WuWenTsunTriangularSet domain constructor. - - T := WUTSET(R,E,V,P) - WuWenTsunTriangularSet(Integer,IndexedExponents OrderedVariableList [x,y,z,t] - ,OrderedVariableList [x,y,z,t],NewSparseMultivariatePolynomial(Integer,Ordere - dVariableList [x,y,z,t])) - Type: Domain - -Define a polynomial system. - - p1 := x ** 31 - x ** 6 - x - y - 31 6 - x - x - x - y - Type: NewSparseMultivariatePolynomial(Integer, - OrderedVariableList [x,y,z,t]) - - p2 := x ** 8 - z - 8 - x - z - Type: NewSparseMultivariatePolynomial(Integer, - OrderedVariableList [x,y,z,t]) - - p3 := x ** 10 - t - 10 - x - t - Type: NewSparseMultivariatePolynomial(Integer, - OrderedVariableList [x,y,z,t]) - - lp := [p1, p2, p3] - 31 6 8 10 - [x - x - x - y,x - z,x - t] - Type: List NewSparseMultivariatePolynomial(Integer, - OrderedVariableList [x,y,z,t]) - -Compute a characteristic set of the system. - - characteristicSet(lp)$T - 5 4 4 2 2 3 4 7 4 6 6 3 3 3 3 - {z - t ,t z y + 2t z y + (- t + 2t - t)z + t z,(t - 1)z x - z y - t } - Type: Union(WuWenTsunTriangularSet(Integer, - IndexedExponents OrderedVariableList [x,y,z,t], - OrderedVariableList [x,y,z,t], - NewSparseMultivariatePolynomial(Integer, - OrderedVariableList [x,y,z,t])),...) - -Solve the system. - - zeroSetSplit(lp)$T - 3 5 4 3 3 2 - [{t,z,y,x}, {t - 1,z - t ,z y + t ,z x - t}, - 5 4 4 2 2 3 4 7 4 6 6 3 3 3 3 - {z - t ,t z y + 2t z y + (- t + 2t - t)z + t z,(t - 1)z x - z y - t }] - Type: List WuWenTsunTriangularSet(Integer, - IndexedExponents OrderedVariableList [x,y,z,t], - OrderedVariableList [x,y,z,t], - NewSparseMultivariatePolynomial(Integer, - OrderedVariableList [x,y,z,t])) - -The RegularTriangularSet and SquareFreeRegularTriangularSet domain -constructors, the LazardSetSolvingPackage package constructors as well as, -SquareFreeRegularTriangularSet and ZeroDimensionalSolvePackage package -constructors also provide operations to compute triangular decompositions -of algebraic varieties. These five constructor use a special kind of -characteristic sets, called regular triangular sets. These special -characteristic sets have better properties than the general ones. -Regular triangular sets and their related concepts are presented in -the paper "On the Theories of Triangular sets" By P. Aubry, D. Lazard -and M. Moreno Maza (to appear in the Journal of Symbolic Computation). -The decomposition algorithm (due to the third author) available in the -four above constructors provide generally better timings than the -characteristic set method. In fact, the WUTSET constructor -remains interesting for the purpose of manipulating characteristic -sets whereas the other constructors are more convenient for solving -polynomial systems. - -Note that the way of understanding triangular decompositions is detailed -in the example of the RegularTriangularSet constructor. - -See Also: -o )help RecursivePolynomialCategory -o )help RegularTriangularSet -o )help SquareFreeRegularTriangularSet -o )help LazardSetSolvingPackage -o )help ZeroDimensionalSolvePackage -o )show WuWenTsunTriangularSet -o $AXIOM/doc/src/algebra/triset.spad.dvi - -@ -<>= -)abbrev domain WUTSET WuWenTsunTriangularSet -++ Author: Marc Moreno Maza (marc@nag.co.uk) -++ Date Created: 11/18/1995 -++ Date Last Updated: 12/15/1998 -++ Basic Functions: -++ Related Constructors: -++ Also See: -++ AMS Classifications: -++ Keywords: -++ Description: A domain constructor of the category \axiomType{GeneralTriangularSet}. -++ The only requirement for a list of polynomials to be a member of such -++ a domain is the following: no polynomial is constant and two distinct -++ polynomials have distinct main variables. Such a triangular set may -++ not be auto-reduced or consistent. The \axiomOpFrom{construct}{WuWenTsunTriangularSet} operation -++ does not check the previous requirement. Triangular sets are stored -++ as sorted lists w.r.t. the main variables of their members. -++ Furthermore, this domain exports operations dealing with the -++ characteristic set method of Wu Wen Tsun and some optimizations -++ mainly proposed by Dong Ming Wang.\newline -++ References : -++ [1] W. T. WU "A Zero Structure Theorem for polynomial equations solving" -++ MM Research Preprints, 1987. -++ [2] D. M. WANG "An implementation of the characteristic set method in Maple" -++ Proc. DISCO'92. Bath, England. -++ Version: 3 - -WuWenTsunTriangularSet(R,E,V,P) : Exports == Implementation where - - R : IntegralDomain - E : OrderedAbelianMonoidSup - V : OrderedSet - P : RecursivePolynomialCategory(R,E,V) - N ==> NonNegativeInteger - Z ==> Integer - B ==> Boolean - LP ==> List P - A ==> FiniteEdge P - H ==> FiniteSimpleHypergraph P - GPS ==> GeneralPolynomialSet(R,E,V,P) - RBT ==> Record(bas:$,top:LP) - RUL ==> Record(chs:Union($,"failed"),rfs:LP) - pa ==> PolynomialSetUtilitiesPackage(R,E,V,P) - NLpT ==> SplittingNode(LP,$) - ALpT ==> SplittingTree(LP,$) - O ==> OutputForm - OP ==> OutputPackage - - Exports == TriangularSetCategory(R,E,V,P) with - - medialSet : (LP,((P,P)->B),((P,P)->P)) -> Union($,"failed") - ++ \axiom{medialSet(ps,redOp?,redOp)} returns \axiom{bs} a basic set - ++ (in Wu Wen Tsun sense w.r.t the reduction-test \axiom{redOp?}) - ++ of some set generating the same ideal as \axiom{ps} (with - ++ rank not higher than any basic set of \axiom{ps}), if no non-zero - ++ constant polynomials appear during the computatioms, else - ++ \axiom{"failed"} is returned. In the former case, \axiom{bs} has to be - ++ understood as a candidate for being a characteristic set of \axiom{ps}. - ++ In the original algorithm, \axiom{bs} is simply a basic set of \axiom{ps}. - medialSet: LP -> Union($,"failed") - ++ \axiom{medial(ps)} returns the same as - ++ \axiom{medialSet(ps,initiallyReduced?,initiallyReduce)}. - characteristicSet : (LP,((P,P)->B),((P,P)->P)) -> Union($,"failed") - ++ \axiom{characteristicSet(ps,redOp?,redOp)} returns a non-contradictory - ++ characteristic set of \axiom{ps} in Wu Wen Tsun sense w.r.t the - ++ reduction-test \axiom{redOp?} (using \axiom{redOp} to reduce - ++ polynomials w.r.t a \axiom{redOp?} basic set), if no - ++ non-zero constant polynomial appear during those reductions, - ++ else \axiom{"failed"} is returned. - ++ The operations \axiom{redOp} and \axiom{redOp?} must satisfy - ++ the following conditions: \axiom{redOp?(redOp(p,q),q)} holds - ++ for every polynomials \axiom{p,q} and there exists an integer - ++ \axiom{e} and a polynomial \axiom{f} such that we have - ++ \axiom{init(q)^e*p = f*q + redOp(p,q)}. - characteristicSet: LP -> Union($,"failed") - ++ \axiom{characteristicSet(ps)} returns the same as - ++ \axiom{characteristicSet(ps,initiallyReduced?,initiallyReduce)}. - characteristicSerie : (LP,((P,P)->B),((P,P)->P)) -> List $ - ++ \axiom{characteristicSerie(ps,redOp?,redOp)} returns a list \axiom{lts} - ++ of triangular sets such that the zero set of \axiom{ps} is the - ++ union of the regular zero sets of the members of \axiom{lts}. - ++ This is made by the Ritt and Wu Wen Tsun process applying - ++ the operation \axiom{characteristicSet(ps,redOp?,redOp)} - ++ to compute characteristic sets in Wu Wen Tsun sense. - characteristicSerie: LP -> List $ - ++ \axiom{characteristicSerie(ps)} returns the same as - ++ \axiom{characteristicSerie(ps,initiallyReduced?,initiallyReduce)}. - - Implementation == GeneralTriangularSet(R,E,V,P) add - - removeSquares: $ -> Union($,"failed") - - Rep ==> LP - - rep(s:$):Rep == s pretend Rep - per(l:Rep):$ == l pretend $ - - removeAssociates (lp:LP):LP == - removeDuplicates [primPartElseUnitCanonical(p) for p in lp] - - medialSetWithTrace (ps:LP,redOp?:((P,P)->B),redOp:((P,P)->P)):Union(RBT,"failed") == - qs := rewriteIdealWithQuasiMonicGenerators(ps,redOp?,redOp)$pa - contradiction : B := any?(ground?,ps) - contradiction => "failed"::Union(RBT,"failed") - rs : LP := qs - bs : $ - while (not empty? rs) and (not contradiction) repeat - rec := basicSet(rs,redOp?) - contradiction := (rec case "failed")@B - if not contradiction - then - bs := (rec::RBT).bas - rs := (rec::RBT).top - rs := rewriteIdealWithRemainder(rs,bs) --- contradiction := ((not empty? rs) and (one? first(rs))) - contradiction := ((not empty? rs) and (first(rs) = 1)) - if (not empty? rs) and (not contradiction) - then - rs := rewriteSetWithReduction(rs,bs,redOp,redOp?) --- contradiction := ((not empty? rs) and (one? first(rs))) - contradiction := ((not empty? rs) and (first(rs) = 1)) - if (not empty? rs) and (not contradiction) - then - rs := removeDuplicates concat(rs,members(bs)) - rs := rewriteIdealWithQuasiMonicGenerators(rs,redOp?,redOp)$pa --- contradiction := ((not empty? rs) and (one? first(rs))) - contradiction := ((not empty? rs) and (first(rs) = 1)) - contradiction => "failed"::Union(RBT,"failed") - ([bs,qs]$RBT)::Union(RBT,"failed") - - medialSet(ps:LP,redOp?:((P,P)->B),redOp:((P,P)->P)) == - foo: Union(RBT,"failed") := medialSetWithTrace(ps,redOp?,redOp) - (foo case "failed") => "failed" :: Union($,"failed") - ((foo::RBT).bas) :: Union($,"failed") - - medialSet(ps:LP) == medialSet(ps,initiallyReduced?,initiallyReduce) - - characteristicSetUsingTrace(ps:LP,redOp?:((P,P)->B),redOp:((P,P)->P)):Union($,"failed") == - ps := removeAssociates ps - ps := remove(zero?,ps) - contradiction : B := any?(ground?,ps) - contradiction => "failed"::Union($,"failed") - rs : LP := ps - qs : LP := ps - ms : $ - while (not empty? rs) and (not contradiction) repeat - rec := medialSetWithTrace (qs,redOp?,redOp) - contradiction := (rec case "failed")@B - if not contradiction - then - ms := (rec::RBT).bas - qs := (rec::RBT).top - qs := rewriteIdealWithRemainder(qs,ms) --- contradiction := ((not empty? qs) and (one? first(qs))) - contradiction := ((not empty? qs) and (first(qs) = 1)) - if not contradiction - then - rs := rewriteSetWithReduction(qs,ms,lazyPrem,reduced?) --- contradiction := ((not empty? rs) and (one? first(rs))) - contradiction := ((not empty? rs) and (first(rs) = 1)) - if (not contradiction) and (not empty? rs) - then - qs := removeDuplicates(concat(rs,concat(members(ms),qs))) - contradiction => "failed"::Union($,"failed") - ms::Union($,"failed") - - characteristicSet(ps:LP,redOp?:((P,P)->B),redOp:((P,P)->P)) == - characteristicSetUsingTrace(ps,redOp?,redOp) - - characteristicSet(ps:LP) == characteristicSet(ps,initiallyReduced?,initiallyReduce) - - characteristicSerie(ps:LP,redOp?:((P,P)->B),redOp:((P,P)->P)) == - a := [[ps,empty()$$]$NLpT]$ALpT - while ((esl := extractSplittingLeaf(a)) case ALpT) repeat - ps := value(value(esl::ALpT)$ALpT)$NLpT - charSet? := characteristicSetUsingTrace(ps,redOp?,redOp) - if not (charSet? case $) - then - setvalue!(esl::ALpT,[nil()$LP,empty()$$,true]$NLpT) - updateStatus!(a) - else - cs := (charSet?)::$ - lics := initials(cs) - lics := removeRedundantFactors(lics)$pa - lics := sort(infRittWu?,lics) - if empty? lics - then - setvalue!(esl::ALpT,[ps,cs,true]$NLpT) - updateStatus!(a) - else - ln : List NLpT := [[nil()$LP,cs,true]$NLpT] - while not empty? lics repeat - newps := cons(first(lics),concat(cs::LP,ps)) - lics := rest lics - newps := removeDuplicates newps - newps := sort(infRittWu?,newps) - ln := cons([newps,empty()$$,false]$NLpT,ln) - splitNodeOf!(esl::ALpT,a,ln) - remove(empty()$$,conditions(a)) - - characteristicSerie(ps:LP) == characteristicSerie (ps,initiallyReduced?,initiallyReduce) - - if R has GcdDomain - then - - removeSquares (ts:$):Union($,"failed") == - empty?(ts)$$ => ts::Union($,"failed") - p := (first ts)::P - rsts : Union($,"failed") - rsts := removeSquares((rest ts)::$) - not(rsts case $) => "failed"::Union($,"failed") - newts := rsts::$ - empty? newts => - p := squareFreePart(p) - (per([primitivePart(p)]$LP))::Union($,"failed") - zero? initiallyReduce(init(p),newts) => "failed"::Union($,"failed") - p := primitivePart(removeZero(p,newts)) - ground? p => "failed"::Union($,"failed") - not (mvar(newts) < mvar(p)) => "failed"::Union($,"failed") - p := squareFreePart(p) - (per(cons(unitCanonical(p),rep(newts))))::Union($,"failed") - - zeroSetSplit lp == - lts : List $ := characteristicSerie(lp,initiallyReduced?,initiallyReduce) - lts := removeDuplicates(lts)$(List $) - newlts : List $ := [] - while not empty? lts repeat - ts := first lts - lts := rest lts - iic := removeSquares(ts) - if iic case $ - then - newlts := cons(iic::$,newlts) - newlts := removeDuplicates(newlts)$(List $) - sort(infRittWu?, newlts) - - else - - zeroSetSplit lp == - lts : List $ := characteristicSerie(lp,initiallyReduced?,initiallyReduce) - sort(infRittWu?, removeDuplicates lts) - -@ \section{License} <>= --Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd. @@ -1529,9 +865,7 @@ WuWenTsunTriangularSet(R,E,V,P) : Exports == Implementation where <<*>>= <> -<> <> -<> @ \eject \begin{thebibliography}{99} diff --git a/src/algebra/tube.spad.pamphlet b/src/algebra/tube.spad.pamphlet index 9d74406..82fd5bd 100644 --- a/src/algebra/tube.spad.pamphlet +++ b/src/algebra/tube.spad.pamphlet @@ -9,61 +9,6 @@ \eject \tableofcontents \eject -\section{domain TUBE TubePlot} -<>= -)abbrev domain TUBE TubePlot -++ Author: Clifton J. Williamson -++ Date Created: Bastille Day 1989 -++ Date Last Updated: 5 June 1990 -++ Keywords: -++ Examples: -++ Description: -++ Package for constructing tubes around 3-dimensional parametric curves. -++ Domain of tubes around 3-dimensional parametric curves. -TubePlot(Curve): Exports == Implementation where - Curve : PlottableSpaceCurveCategory - B ==> Boolean - L ==> List - Pt ==> Point DoubleFloat - - Exports ==> with - getCurve: % -> Curve - ++ getCurve(t) returns the \spadtype{PlottableSpaceCurveCategory} - ++ representing the parametric curve of the given tube plot t. - listLoops: % -> L L Pt - ++ listLoops(t) returns the list of lists of points, or the 'loops', - ++ of the given tube plot t. - closed?: % -> B - ++ closed?(t) tests whether the given tube plot t is closed. - open?: % -> B - ++ open?(t) tests whether the given tube plot t is open. - setClosed: (%,B) -> B - ++ setClosed(t,b) declares the given tube plot t to be closed if - ++ b is true, or if b is false, t is set to be open. - tube: (Curve,L L Pt,B) -> % - ++ tube(c,ll,b) creates a tube of the domain \spadtype{TubePlot} from a - ++ space curve c of the category \spadtype{PlottableSpaceCurveCategory}, - ++ a list of lists of points (loops) ll and a boolean b which if - ++ true indicates a closed tube, or if false an open tube. - - Implementation ==> add - ---% representation - - Rep := Record(parCurve:Curve,loops:L L Pt,closedTube?:B) - - getCurve plot == plot.parCurve - - listLoops plot == plot.loops - - closed? plot == plot.closedTube? - open? plot == not plot.closedTube? - - setClosed(plot,flag) == plot.closedTube? := flag - - tube(curve,ll,b) == [curve,ll,b] - -@ \section{package TUBETOOL TubePlotTools} <>= )abbrev package TUBETOOL TubePlotTools @@ -496,7 +441,6 @@ NumericTubePlot(Curve): Exports == Implementation where <<*>>= <> -<> <> <> <> diff --git a/src/axiom-website/patches.html b/src/axiom-website/patches.html index 7377e11..eef4097 100644 --- a/src/axiom-website/patches.html +++ b/src/axiom-website/patches.html @@ -811,6 +811,8 @@ bookvol10.3 add domains
bookvol7.1 give complete path to htadd
20081216.02.tpd.patch biquat.input fix regression failure
+20081216.03.tpd.patch +bookvol10.3 add domains
\ No newline at end of file