diff --git a/changelog b/changelog index 377aa85..3ba51a4 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,12 @@ +20080821 tpd src/algebra/Makefile add MappingPackage4 +20080821 tpd src/algebra/exposed.lsp add MappingPackage4 +20080821 tpd src/algebra/mappkg.spad add MAPPKG4 +20080821 tpd src/input/test.input repair regressions +20080820 tpd src/input/test.input fix typos +20080819 tpd src/input/Makefile overload.input added +20080819 dxc src/input/overload.input added +20080819 tpd src/input/Makefile overload.input added +20080819 dxc src/input/overload.input added 20080818 tpd src/input/Makefile biquat.input added 20080818 dxc src/input/biquat.input added 20080818 dxc "David Cyganski" (no known email) diff --git a/src/algebra/Makefile.pamphlet b/src/algebra/Makefile.pamphlet index d140609..7ea5dea 100644 --- a/src/algebra/Makefile.pamphlet +++ b/src/algebra/Makefile.pamphlet @@ -244,7 +244,6 @@ LAYER3=\ annacat.spad.pamphlet (NIPROB ODEPROB PDEPROB OPTPROB NUMINT ODECAT PDECAT OPTCAT) color.spad.pamphlet (COLOR PALETTE) -mappkg.spad.pamphlet (MAPHACK1 MAPHACK2 MAPHACK3 MAPPKG1 MAPPKG2 MAPPKG3) paramete.spad.pamphlet (PARPCURV PARPC2 PARSCURV PARSC2 PARSURF PARSU2 suchthat.spad.pamphlet (SUCH) ystream.spad.pamphlet (YSTREAM) @@ -388,6 +387,8 @@ drawpak.spad.pamphlet (DRAWCX) free.spad.pamphlet (LMOPS FMONOID FGROUP FAMONC IFAMON FAMONOID FAGROUP) fourier.spad.pamphlet (FCOMP FSERIES) functions.spad.pamphlet (BFUNCT) +mappkg.spad.pamphlet (MAPHACK1 MAPHACK2 MAPHACK3 MAPHACK4 + MAPPKG1 MAPPKG2 MAPPKG3 MAPPKG4) mesh.spad.pamphlet (MESH) moebius.spad.pamphlet (MOEBIUS) mring.spad.pamphlet (MRING MRF2) @@ -414,6 +415,7 @@ LAYER10=\ ${OUT}/IPADIC.o ${OUT}/IROOT.o ${OUT}/IR2.o ${OUT}/LEXP.o \ ${OUT}/LIECAT.o ${OUT}/LIECAT-.o ${OUT}/LIST2.o ${OUT}/LIST2MAP.o \ ${OUT}/LMOPS.o ${OUT}/LZSTAGG.o ${OUT}/LZSTAGG-.o ${OUT}/MAGMA.o \ + ${OUT}/MAPPKG4.o \ ${OUT}/MESH.o ${OUT}/MOEBIUS.o ${OUT}/MODFIELD.o ${OUT}/MODOP.o \ ${OUT}/MRING.o ${OUT}/MTHING.o ${OUT}/NCNTFRAC.o ${OUT}/NCODIV.o \ ${OUT}/NUMTUBE.o ${OUT}/ODR.o ${OUT}/OFMONOID.o ${OUT}/ONECOMP.o \ @@ -3130,7 +3132,6 @@ check: document: ${DOCFILES} <> - <> <> <> diff --git a/src/algebra/exposed.lsp.pamphlet b/src/algebra/exposed.lsp.pamphlet index ed6155a..9701e7f 100644 --- a/src/algebra/exposed.lsp.pamphlet +++ b/src/algebra/exposed.lsp.pamphlet @@ -208,6 +208,7 @@ (|MappingPackage1| . MAPPKG1) (|MappingPackage2| . MAPPKG2) (|MappingPackage3| . MAPPKG3) + (|MappingPackage4| . MAPPKG4) (|MathMLFormat| . MMLFORM) (|Matrix| . MATRIX) (|MatrixCategoryFunctions2| . MATCAT2) diff --git a/src/algebra/mappkg.spad.pamphlet b/src/algebra/mappkg.spad.pamphlet index 5ec4358..ca1dc5f 100644 --- a/src/algebra/mappkg.spad.pamphlet +++ b/src/algebra/mappkg.spad.pamphlet @@ -2,7 +2,7 @@ \usepackage{axiom} \begin{document} \title{\$SPAD/src/algebra mappkg.spad} -\author{Stephen M. Watt, William Burge} +\author{Stephen M. Watt, William Burge, Timothy Daly} \maketitle \begin{abstract} \end{abstract} @@ -83,7 +83,8 @@ MappingPackageInternalHacks3(A: SetCategory, B: SetCategory, C: SetCategory):_ )set message test on )set message auto off )clear all ---S 1 + +--S 1 of 26 power(q: FRAC INT, n: INT): FRAC INT == q**n --R --R Function declaration power : (Fraction Integer,Integer) -> Fraction @@ -91,7 +92,7 @@ power(q: FRAC INT, n: INT): FRAC INT == q**n --R Type: Void --E 1 ---S 2 +--S 2 of 26 power(2,3) --R --R Compiling function power with type (Fraction Integer,Integer) -> @@ -101,15 +102,15 @@ power(2,3) --R Type: Fraction Integer --E 2 ---S 3 +--S 3 of 26 rewop := twist power --R --R ---R (3) theMap(MAPPKG3;twist;MM;5!0) +--I (3) theMap(MAPPKG3;twist;MM;5!0) --R Type: ((Integer,Fraction Integer) -> Fraction Integer) --E 3 ---S 4 +--S 4 of 26 rewop(3, 2) --R --R @@ -117,21 +118,21 @@ rewop(3, 2) --R Type: Fraction Integer --E 4 ---S 5 +--S 5 of 26 square: FRAC INT -> FRAC INT --R --R Type: Void --E 5 ---S 6 +--S 6 of 26 square:= curryRight(power, 2) --R --R ---R (6) theMap(MAPPKG3;curryRight;MBM;1!0,0) +--I (6) theMap(MAPPKG3;curryRight;MBM;1!0,0) --R Type: (Fraction Integer -> Fraction Integer) --E 6 ---S 7 +--S 7 of 26 square 4 --R --R @@ -139,15 +140,15 @@ square 4 --R Type: Fraction Integer --E 7 ---S 8 +--S 8 of 26 squirrel:= constantRight(square)$MAPPKG3(FRAC INT,FRAC INT,FRAC INT) --R --R ---R (8) theMap(MAPPKG3;constantRight;MM;3!0) +--I (8) theMap(MAPPKG3;constantRight;MM;3!0) --R Type: ((Fraction Integer,Fraction Integer) -> Fraction Integer) --E 8 ---S 9 +--S 9 of 26 squirrel(1/2, 1/3) --R --R @@ -157,15 +158,15 @@ squirrel(1/2, 1/3) --R Type: Fraction Integer --E 9 ---S 10 +--S 10 of 26 sixteen := curry(square, 4/1) --R --R ---R (10) theMap(MAPPKG2;curry;MAM;2!0,0) +--I (10) theMap(MAPPKG2;curry;MAM;2!0,0) --R Type: (() -> Fraction Integer) --E 10 ---S 11 +--S 11 of 26 sixteen() --R --R @@ -173,15 +174,15 @@ sixteen() --R Type: Fraction Integer --E 11 ---S 12 +--S 12 of 26 square2:=square*square --R --R ---R (12) theMap(MAPPKG3;*;MMM;6!0,0) +--I (12) theMap(MAPPKG3;*;MMM;6!0,0) --R Type: (Fraction Integer -> Fraction Integer) --E 12 ---S 13 +--S 13 of 26 square2 3 --R --R @@ -189,7 +190,7 @@ square2 3 --R Type: Fraction Integer --E 13 ---S 14 +--S 14 of 26 sc(x: FRAC INT): FRAC INT == x + 1 --R --R Function declaration sc : Fraction Integer -> Fraction Integer has @@ -197,23 +198,23 @@ sc(x: FRAC INT): FRAC INT == x + 1 --R Type: Void --E 14 ---S 15 +--S 15 of 26 incfns := [sc**i for i in 0..10] --R --R Compiling function sc with type Fraction Integer -> Fraction Integer --R --R --R (15) ---R [theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0), ---R theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0), ---R theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0), ---R theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0), ---R theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0), ---R theMap(MAPPKG1;**;MNniM;6!0,0)] +--I [theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0), +--I theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0), +--I theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0), +--I theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0), +--I theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0), +--I theMap(MAPPKG1;**;MNniM;6!0,0)] --R Type: List (Fraction Integer -> Fraction Integer) --E 15 ---S 16 +--S 16 of 26 [f 4 for f in incfns] --R --R @@ -221,7 +222,7 @@ incfns := [sc**i for i in 0..10] --R Type: List Fraction Integer --E 16 ---S 17 +--S 17 of 26 times(n:NNI, i:INT):INT == n*i --R --R Function declaration times : (NonNegativeInteger,Integer) -> Integer @@ -229,25 +230,25 @@ times(n:NNI, i:INT):INT == n*i --R Type: Void --E 17 ---S 18 +--S 18 of 26 r := recur(times) --R --R Compiling function times with type (NonNegativeInteger,Integer) -> --R Integer --R ---R (18) theMap(MAPPKG1;recur;2M;7!0,0) +--I (18) theMap(MAPPKG1;recur;2M;7!0,0) --R Type: ((NonNegativeInteger,Integer) -> Integer) --E 18 ---S 19 +--S 19 of 26 fact := curryRight(r, 1) --R --R ---R (19) theMap(MAPPKG3;curryRight;MBM;1!0,0) +--I (19) theMap(MAPPKG3;curryRight;MBM;1!0,0) --R Type: (NonNegativeInteger -> Integer) --E 19 ---S 20 +--S 20 of 26 fact 4 --R --R @@ -255,7 +256,7 @@ fact 4 --R Type: PositiveInteger --E 20 ---S 21 +--S 21 of 26 mto2ton(m, n) == raiser := square^n raiser m @@ -263,7 +264,7 @@ mto2ton(m, n) == --R Type: Void --E 21 ---S 22 +--S 22 of 26 mto2ton(3, 3) --R --R Compiling function mto2ton with type (PositiveInteger, @@ -273,7 +274,7 @@ mto2ton(3, 3) --R Type: Fraction Integer --E 22 ---S 23 +--S 23 of 26 shiftfib(r: List INT) : INT == t := r.1 r.1 := r.2 @@ -285,7 +286,7 @@ shiftfib(r: List INT) : INT == --R Type: Void --E 23 ---S 24 +--S 24 of 26 fibinit: List INT := [0, 1] --R --R @@ -293,16 +294,16 @@ fibinit: List INT := [0, 1] --R Type: List Integer --E 24 ---S 25 +--S 25 of 26 fibs := curry(shiftfib, fibinit) --R --R Compiling function shiftfib with type List Integer -> Integer --R ---R (25) theMap(MAPPKG2;curry;MAM;2!0,0) +--I (25) theMap(MAPPKG2;curry;MAM;2!0,0) --R Type: (() -> Integer) --E 25 ---S 26 +--S 26 of 26 [fibs() for i in 0..30] --R --R @@ -312,6 +313,16 @@ fibs := curry(shiftfib, fibinit) --R 317811, 514229, 832040] --R Type: List Integer --E 26 + +)spool +)lisp (bye) + +@ +\eject +\begin{thebibliography}{99} +\bibitem{1} nothing +\end{thebibliography} +\end{document} )spool )lisp (bye) @ @@ -486,9 +497,10 @@ By currying over the argument we get a function with private state. Type: List Integer See Also: +o )show MappingPackage1 o )help MappingPackage2 o )help MappingPackage3 -o )show MappingPackage1 +o )help MappingPackage4 o $AXIOM/doc/src/algebra/mappkg.spad.dvi @ @@ -595,7 +607,7 @@ power(2,3) rewop := twist power --R --R ---R (3) theMap(MAPPKG3;twist;MM;5!0) +--I (3) theMap(MAPPKG3;twist;MM;5!0) --R Type: ((Integer,Fraction Integer) -> Fraction Integer) --E 3 @@ -617,7 +629,7 @@ square: FRAC INT -> FRAC INT square:= curryRight(power, 2) --R --R ---R (6) theMap(MAPPKG3;curryRight;MBM;1!0,0) +--I (6) theMap(MAPPKG3;curryRight;MBM;1!0,0) --R Type: (Fraction Integer -> Fraction Integer) --E 6 @@ -633,7 +645,7 @@ square 4 squirrel:= constantRight(square)$MAPPKG3(FRAC INT,FRAC INT,FRAC INT) --R --R ---R (8) theMap(MAPPKG3;constantRight;MM;3!0) +--I (8) theMap(MAPPKG3;constantRight;MM;3!0) --R Type: ((Fraction Integer,Fraction Integer) -> Fraction Integer) --E 8 @@ -651,7 +663,7 @@ squirrel(1/2, 1/3) sixteen := curry(square, 4/1) --R --R ---R (10) theMap(MAPPKG2;curry;MAM;2!0,0) +--I (10) theMap(MAPPKG2;curry;MAM;2!0,0) --R Type: (() -> Fraction Integer) --E 10 @@ -667,7 +679,7 @@ sixteen() square2:=square*square --R --R ---R (12) theMap(MAPPKG3;*;MMM;6!0,0) +--I (12) theMap(MAPPKG3;*;MMM;6!0,0) --R Type: (Fraction Integer -> Fraction Integer) --E 12 @@ -694,12 +706,12 @@ incfns := [sc**i for i in 0..10] --R --R --R (15) ---R [theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0), ---R theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0), ---R theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0), ---R theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0), ---R theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0), ---R theMap(MAPPKG1;**;MNniM;6!0,0)] +--I [theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0), +--I theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0), +--I theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0), +--I theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0), +--I theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0), +--I theMap(MAPPKG1;**;MNniM;6!0,0)] --R Type: List (Fraction Integer -> Fraction Integer) --E 15 @@ -725,7 +737,7 @@ r := recur(times) --R Compiling function times with type (NonNegativeInteger,Integer) -> --R Integer --R ---R (18) theMap(MAPPKG1;recur;2M;7!0,0) +--I (18) theMap(MAPPKG1;recur;2M;7!0,0) --R Type: ((NonNegativeInteger,Integer) -> Integer) --E 18 @@ -733,7 +745,7 @@ r := recur(times) fact := curryRight(r, 1) --R --R ---R (19) theMap(MAPPKG3;curryRight;MBM;1!0,0) +--I (19) theMap(MAPPKG3;curryRight;MBM;1!0,0) --R Type: (NonNegativeInteger -> Integer) --E 19 @@ -788,7 +800,7 @@ fibs := curry(shiftfib, fibinit) --R --R Compiling function shiftfib with type List Integer -> Integer --R ---R (25) theMap(MAPPKG2;curry;MAM;2!0,0) +--I (25) theMap(MAPPKG2;curry;MAM;2!0,0) --R Type: (() -> Integer) --E 25 @@ -977,8 +989,9 @@ By currying over the argument we get a function with private state. See Also: o )help MappingPackage1 -o )help MappingPackage3 o )show MappingPackage2 +o )help MappingPackage3 +o )help MappingPackage4 o $AXIOM/doc/src/algebra/mappkg.spad.dvi @ @@ -1052,7 +1065,7 @@ power(2,3) rewop := twist power --R --R ---R (3) theMap(MAPPKG3;twist;MM;5!0) +--I (3) theMap(MAPPKG3;twist;MM;5!0) --R Type: ((Integer,Fraction Integer) -> Fraction Integer) --E 3 @@ -1074,7 +1087,7 @@ square: FRAC INT -> FRAC INT square:= curryRight(power, 2) --R --R ---R (6) theMap(MAPPKG3;curryRight;MBM;1!0,0) +--I (6) theMap(MAPPKG3;curryRight;MBM;1!0,0) --R Type: (Fraction Integer -> Fraction Integer) --E 6 @@ -1090,7 +1103,7 @@ square 4 squirrel:= constantRight(square)$MAPPKG3(FRAC INT,FRAC INT,FRAC INT) --R --R ---R (8) theMap(MAPPKG3;constantRight;MM;3!0) +--I (8) theMap(MAPPKG3;constantRight;MM;3!0) --R Type: ((Fraction Integer,Fraction Integer) -> Fraction Integer) --E 8 @@ -1108,7 +1121,7 @@ squirrel(1/2, 1/3) sixteen := curry(square, 4/1) --R --R ---R (10) theMap(MAPPKG2;curry;MAM;2!0,0) +--I (10) theMap(MAPPKG2;curry;MAM;2!0,0) --R Type: (() -> Fraction Integer) --E 10 @@ -1124,7 +1137,7 @@ sixteen() square2:=square*square --R --R ---R (12) theMap(MAPPKG3;*;MMM;6!0,0) +--I (12) theMap(MAPPKG3;*;MMM;6!0,0) --R Type: (Fraction Integer -> Fraction Integer) --E 12 @@ -1151,12 +1164,12 @@ incfns := [sc**i for i in 0..10] --R --R --R (15) ---R [theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0), ---R theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0), ---R theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0), ---R theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0), ---R theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0), ---R theMap(MAPPKG1;**;MNniM;6!0,0)] +--I [theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0), +--I theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0), +--I theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0), +--I theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0), +--I theMap(MAPPKG1;**;MNniM;6!0,0), theMap(MAPPKG1;**;MNniM;6!0,0), +--I theMap(MAPPKG1;**;MNniM;6!0,0)] --R Type: List (Fraction Integer -> Fraction Integer) --E 15 @@ -1182,7 +1195,7 @@ r := recur(times) --R Compiling function times with type (NonNegativeInteger,Integer) -> --R Integer --R ---R (18) theMap(MAPPKG1;recur;2M;7!0,0) +--I (18) theMap(MAPPKG1;recur;2M;7!0,0) --R Type: ((NonNegativeInteger,Integer) -> Integer) --E 18 @@ -1190,7 +1203,7 @@ r := recur(times) fact := curryRight(r, 1) --R --R ---R (19) theMap(MAPPKG3;curryRight;MBM;1!0,0) +--I (19) theMap(MAPPKG3;curryRight;MBM;1!0,0) --R Type: (NonNegativeInteger -> Integer) --E 19 @@ -1245,7 +1258,7 @@ fibs := curry(shiftfib, fibinit) --R --R Compiling function shiftfib with type List Integer -> Integer --R ---R (25) theMap(MAPPKG2;curry;MAM;2!0,0) +--I (25) theMap(MAPPKG2;curry;MAM;2!0,0) --R Type: (() -> Integer) --E 25 @@ -1436,6 +1449,7 @@ See Also: o )help MappingPackage1 o )help MappingPackage2 o )show MappingPackage3 +o )help MappingPackage4 o $AXIOM/doc/src/algebra/mappkg.spad.dvi @ @@ -1499,6 +1513,320 @@ MappingPackage3(A:SetCategory, B:SetCategory, C:SetCategory):_ fbc*fab == comp(fbc,fab,#1) @ +\section{package MAPPKG4 MappingPackage4} +<>= +-- mappkg.spad.pamphlet MappingPackage4.input +)spool MappingPackage4.output +)set message test on +)set message auto off +)clear all + +--S 1 of 21 +p:=(x:EXPR(INT)):EXPR(INT)+->3*x +--R +--R +--R (1) theMap(Closure) +--R Type: (Expression Integer -> Expression Integer) +--E 1 + +--S 2 of 21 +q:=(x:EXPR(INT)):EXPR(INT)+->2*x+3 +--R +--R +--R (2) theMap(Closure) +--R Type: (Expression Integer -> Expression Integer) +--E 2 + +--S 3 of 21 +(p+q)(4)-(p(4)+q(4)) +--R +--R +--R (3) 0 +--R Type: Expression Integer +--E 3 + +--S 4 of 21 +(p+q)(x)-(p(x)+q(x)) +--R +--R +--R (4) 0 +--R Type: Expression Integer +--E 4 + +--S 5 of 21 +(p-q)(4)-(p(4)-q(4)) +--R +--R +--R (5) 0 +--R Type: Expression Integer +--E 5 + +--S 6 of 21 +(p-q)(x)-(p(x)-q(x)) +--R +--R +--R (6) 0 +--R Type: Expression Integer +--E 6 + +--S 7 of 21 +(p*q)(4)-(p(4)*q(4)) +--R +--R +--R (7) 0 +--R Type: Expression Integer +--E 7 + +--S 8 of 21 +(p*q)(x)-(p(x)*q(x)) +--R +--R +--R (8) 0 +--R Type: Expression Integer +--E 8 + +--S 9 of 21 +(p/q)(4)-(p(4)/q(4)) +--R +--R +--R (9) 0 +--R Type: Expression Integer +--E 9 + +--S 10 of 21 +(p/q)(x)-(p(x)/q(x)) +--R +--R +--R (10) 0 +--R Type: Expression Integer +--E 10 + +--S 11 of 21 +r:=(x:INT):INT+-> (x*x*x) +--R +--R +--R (11) theMap(Closure) +--R Type: (Integer -> Integer) +--E 11 + +--S 12 of 21 +s:=(y:INT):INT+-> (y*y+3) +--R +--R +--R (12) theMap(Closure) +--R Type: (Integer -> Integer) +--E 12 + +--S 13 of 21 +(r+s)(4)-(r(4)+s(4)) +--R +--R +--R (13) 0 +--R Type: NonNegativeInteger +--E 13 + +--S 14 of 21 +(r-s)(4)-(r(4)-s(4)) +--R +--R +--R (14) 0 +--R Type: NonNegativeInteger +--E 14 + +--S 15 of 21 +(r*s)(4)-(r(4)*s(4)) +--R +--R +--R (15) 0 +--R Type: NonNegativeInteger +--E 15 + +--S 16 of 21 +t:=(x:INT):EXPR(INT)+-> (x*x*x) +--R +--R +--R (16) theMap(Closure) +--R Type: (Integer -> Expression Integer) +--E 16 + +--S 17 of 21 +u:=(y:INT):EXPR(INT)+-> (y*y+3) +--R +--R +--R (17) theMap(Closure) +--R Type: (Integer -> Expression Integer) +--E 17 + +--S 18 of 21 +(t/u)(4)-(t(4)/u(4)) +--R +--R +--R (18) 0 +--R Type: Expression Integer +--E 18 + +--S 19 of 21 +h:=(x:EXPR(INT)):EXPR(INT)+->1 +--R +--R (19) theMap(Closure) +--R Type: (Expression Integer -> Expression Integer) +--E 19 + +--S 20 of 21 +(p/h)(x) +--R +--R (20) 3x +--R Type: Expression Integer +--E 20 + +--S 21 of 21 +(q/h)(x) +--R +--R (21) 2x + 3 +--R Type: Expression Integer +--E 21 + +)spool +)lisp (bye) + +@ +\eject +\begin{thebibliography}{99} +\bibitem{1} nothing +\end{thebibliography} +\end{document} +)spool +)lisp (bye) +@ +<>= +==================================================================== +MappingPackage examples +==================================================================== + +We can construct some simple maps that take a variable x +into an equation: + + p:=(x:EXPR(INT)):EXPR(INT)+->3*x + q:=(x:EXPR(INT)):EXPR(INT)+->2*x+3 + +Now we can do the four arithmetic operations, +, -, *, / on these +newly constructed mappings. Since the maps are from the domain +Expression Integer to the same domain we can also use symbolic +values for the argument. All of the following will return 0, +showing that function composition is equivalent to the result +of doing the operations individually. + + (p+q)(4)-(p(4)+q(4)) + (p+q)(x)-(p(x)+q(x)) + + (p-q)(4)-(p(4)-q(4)) + (p-q)(x)-(p(x)-q(x)) + + (p*q)(4)-(p(4)*q(4)) + (p*q)(x)-(p(x)*q(x)) + + (p/q)(4)-(p(4)/q(4)) + (p/q)(x)-(p(x)/q(x)) + +We can construct simple maps from Integer to Integer but this +limits our ability to do division. + + r:=(x:INT):INT+-> (x*x*x) + s:=(y:INT):INT+-> (y*y+3) + +Again, all of these will return 0: + + (r+s)(4)-(r(4)+s(4)) + (r-s)(4)-(r(4)-s(4)) + (r*s)(4)-(r(4)*s(4)) + +If we want to do division with Integer inputs we create the +appropriate map: + + t:=(x:INT):EXPR(INT)+-> (x*x*x) + u:=(y:INT):EXPR(INT)+-> (y*y+3) + + (t/u)(4)-(t(4)/u(4)) + +We can even recover the original functions if we make a map +that always returns the constant 1: + + h:=(x:EXPR(INT)):EXPR(INT)+->1 + + theMap(Closure) + Type: (Expression Integer -> Expression Integer) + + (p/h)(x) + + 3x + Type: Expression Integer + (q/h)(x) + + 2x + 3 + Type: Expression Integer + +See Also: +o )show MappingPackage1 +o )help MappingPackage2 +o )help MappingPackage3 +o )help MappingPackage4 +o $AXIOM/doc/src/algebra/mappkg.spad.dvi + +@ +<>= +)abbrev package MAPPKG4 MappingPackage4 +++ Author: Timothy Daly +++ Description: Functional Composition +++ Given functions f and g, returns the applicable closure +MappingPackage4(A:SetCategory, B:Ring): + with + "+": (A->B, A->B) -> (A->B) + ++ \spad(+) does functional addition + ++ + ++E f:=(x:INT):INT +-> 3*x + ++E g:=(x:INT):INT +-> 2*x+3 + ++E (f+g)(4) + "-": (A->B, A->B) -> (A->B) + ++ \spad(+) does functional addition + ++ + ++E f:=(x:INT):INT +-> 3*x + ++E g:=(x:INT):INT +-> 2*x+3 + ++E (f-g)(4) + "*": (A->B, A->B) -> (A->B) + ++ \spad(+) does functional addition + ++ + ++E f:=(x:INT):INT +-> 3*x + ++E g:=(x:INT):INT +-> 2*x+3 + ++E (f*g)(4) + "/": (A->Expression(Integer), A->Expression(Integer)) -> (A->Expression(Integer)) + ++ \spad(+) does functional addition + ++ + ++E p:=(x:EXPR(INT)):EXPR(INT)+->3*x + ++E q:=(x:EXPR(INT)):EXPR(INT)+->2*x+3 + ++E (p/q)(4) + ++E (p/q)(x) + == add + fab ==> (A -> B) + faei ==> (A -> Expression(Integer)) + + funcAdd(g:fab,h:fab,x:A):B == ((g x) + (h x))$B + + (a:fab)+(b:fab) == funcAdd(a,b,#1) + + funcSub(g:fab,h:fab,x:A):B == ((g x) - (h x))$B + + (a:fab)-(b:fab) == funcSub(a,b,#1) + + funcMul(g:fab,h:fab,x:A):B == ((g x) * (h x))$B + + (a:fab)*(b:fab) == funcMul(a,b,#1) + + funcDiv(g:faei,h:faei,x:A):Expression(Integer) + == ((g x) / (h x))$Expression(Integer) + + (a:faei)/(b:faei) == funcDiv(a,b,#1) + +@ \section{License} <>= --Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd. @@ -1541,6 +1869,7 @@ MappingPackage3(A:SetCategory, B:SetCategory, C:SetCategory):_ <> <> <> +<> @ \eject \begin{thebibliography}{99} diff --git a/src/input/test.input.pamphlet b/src/input/test.input.pamphlet index ea9b453..7ffe5b8 100644 --- a/src/input/test.input.pamphlet +++ b/src/input/test.input.pamphlet @@ -484,7 +484,6 @@ Bracket parsing and empty-set types. Fixed by SCM, verified on 10/30/90 <<*>>= )clear all -@ --S 35 {}$(List INT) --R @@ -827,7 +826,7 @@ m = [[1,2],[2,3]] -- Should return type EQ POLY SQMATRIX(2, INT) --S 64 1+"asd" -- These should both fail in the same way --R ---R There are 11 exposed and 5 unexposed library operations named + +--R There are 12 exposed and 5 unexposed library operations named + --R having 2 argument(s) but none was determined to be applicable. --R Use HyperDoc Browse, or issue --R )display op + @@ -847,7 +846,7 @@ m = [[1,2],[2,3]] -- Should return type EQ POLY SQMATRIX(2, INT) --S 65 1/"asd" --R ---R There are 12 exposed and 12 unexposed library operations named / +--R There are 13 exposed and 12 unexposed library operations named / --R having 2 argument(s) but none was determined to be applicable. --R Use HyperDoc Browse, or issue --R )display op / @@ -1608,7 +1607,7 @@ s - sin(a*x) --E 121 @ -Complex & AlgebraicNumber coercions. fixed by SCM 6/91 +Complex \& AlgebraicNumber coercions. fixed by SCM 6/91 <<*>>= )clear all