aboutsummaryrefslogtreecommitdiff
path: root/src/input/test.input.pamphlet
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2007-08-14 05:14:52 +0000
committerdos-reis <gdr@axiomatics.org>2007-08-14 05:14:52 +0000
commitab8cc85adde879fb963c94d15675783f2cf4b183 (patch)
treec202482327f474583b750b2c45dedfc4e4312b1d /src/input/test.input.pamphlet
downloadopen-axiom-ab8cc85adde879fb963c94d15675783f2cf4b183.tar.gz
Initial population.
Diffstat (limited to 'src/input/test.input.pamphlet')
-rw-r--r--src/input/test.input.pamphlet654
1 files changed, 654 insertions, 0 deletions
diff --git a/src/input/test.input.pamphlet b/src/input/test.input.pamphlet
new file mode 100644
index 00000000..49460a96
--- /dev/null
+++ b/src/input/test.input.pamphlet
@@ -0,0 +1,654 @@
+\documentclass{article}
+\usepackage{axiom}
+\begin{document}
+\title{\$SPAD/src/input test.input}
+\author{The Axiom Team}
+\maketitle
+\begin{abstract}
+\end{abstract}
+\eject
+\tableofcontents
+\eject
+\section{License}
+<<license>>=
+--Copyright The Numerical Algorithms Group Limited 1991.
+@
+<<*>>=
+<<license>>
+
+
+
+-- File of recently fixed interpreter bugs
+
+--- eval a polynomial with EXPR substitution values
+--- Fixed by SCM, verified on 10/30/90
+
+)clear all
+
+
+eq1:= A*x**2 + B*x*y + C*y**2 +D*x + E*y + F
+
+eq2:= eval(eq1,[x= xdot*cos(t) - ydot*sin(t), y=xdot*sin(t) + ydot*cos(t)])
+
+-- UTS coercions. Fixed by SCM, verified on 10/30/90
+
+)clear all
+
+taylor exp x
+
+s := %
+
+s::(UTS(EXPR FLOAT, x, 0))
+s::(UTS(FLOAT, x, 0))
+
+eval(s,1)
+%::(Stream Float)
+
+-- Another bug, fixed by adding UPXS2 package,
+
+s := series(sin(a*x),x=0)
+eval(s, 1.0)
+
+s - a*x
+
+
+-- grand finale, just fixed on 3/23/91
+eval(s, 1.0)
+
+-- generalized resolve
+-- Fixed (enhanced) by SCM in 3/23/91
+
+)cl all
+
+v := vector [1,2,3]
+(1/2)*v
+
+eval(x**2, x=1/2)
+eval(x**2, x=0.5)
+eval(3**x, x=0.5)
+
+-- overloading interpreter maps on arity
+--- Fixed by SCM, verified on 10/30/90
+
+)clear all
+
+f(x) == x+1
+f(x,y) == x+y
+
+f 3
+f(3,4)
+f(5)
+f(1,x)
+
+-- targetted function requiring a coercion
+--- Fixed by SCM, verified on 10/30/90
+
+)clear all
+series(n +-> bernoulli(n)/factorial(n), t=0)
+
+-- in-homogeneous list mapping
+--- Fixed by SCM, verified on 10/30/90
+
+)clear all
+l := [1,2,-1]
+f : INT -> FRAC INT
+f x == x
+map(f, l)
+
+-- Function args to interpreter functions
+--- Fixed by SCM, verified on 10/30/90
+
+)cl all
+f: INT -> INT
+f x == x+1
+u g == g 3
+u f
+
+-- category modemap requiring a field to be constructed
+--- Fixed by SCM, verified on 10/30/90
+
+)clear all
+
+groebner [x**2 - y, y**3+1]
+
+-- operations requiring polynomials, passed variables
+--- Fixed by SCM, verified on 10/30/90
+
+)clear all
+factor x
+draw(x, x=-1..1)
+
+-- bracket parsing and empty-set types
+--- Fixed by SCM, verified on 10/30/90
+
+)clear all
+brace [] -- {}
+--{}$(List INT)
+brace [1] -- {1}
+-- The following still doesn't work
+union(brace [], brace [1,2]) -- union({}, {1,2})
+
+-- Shouldn't work, but no longer bombs the interpreter
+--- Fixed by SCM, verified on 10/30/90
+
+)clear all
+)set mes test off
+map(variable, [x,y])
+)set mes test on
+
+-- Recursive map type analysis bug
+--- Fixed by SCM, verified on 10/30/90
+)set fun recur off
+)clear all
+
+p(n,x) == if n=0 then 1 else (x+n-1)*p(n-1,x)
+pp(n,x) == if n=0 then 1 else if n<0 then (-1)**n/p(-n,1-x) else p(n,x)
+pp(-1,x) -- should be 1/(x-1)
+
+-- interpret-code mode for iterators is broken
+
+)cl all
+f n ==
+ for i in 1..n repeat
+ j:=2*i
+ m:SQMATRIX(j,?):=1
+ print m
+g n ==
+ j:=2*n
+ m:SQMATRIX(j,?):=1
+ print m
+
+g 3
+f 3
+
+-- Test interpreter list destructuring
+
+)clear all
+mp(x,l) ==
+ l is [a,:b] =>
+ a*x**(#b)+ mp(x,b)
+ 0
+
+mp(x, [1,3,4, 2])
+mp(x, [1,2,-3, 4])
+
+-- Tests compilation of recursive functions
+
+)clear all
+
+f1 n ==
+ if n=0 then 1 else if n=1 then 1 else f1(n-1)+f1(n-2)
+
+f2 n ==
+ m:=n
+ if n=0 then 1 else if n=1 then 1 else f2(n-1)+f2(n-2)
+
+f3 n ==
+ n=0 => 1
+ n=1 => 1
+ f3(n-1)+f3(n-2)
+
+f4 n ==
+ m:=n
+ n=0 => 1
+ n=1 => 1
+ m:=n
+ f4(n-1)+f4(n-2)
+
+f5 n == if n=0 or n=1 then 1 else f5(n-1)+f5(n-2)
+
+[f1 3,f2 3, f3 3,f4 3,f5 3]
+
+-- Input of GDMP types
+-- Fixed by SCM on 1/22/91
+
+)cl all
+
+g: GDMP([x,y], INT, DIRPROD(2, NNI)) := x**2 + y
+
+-- has test with variables
+-- Fixed by SCM on 1/22/91
+
+)cl all
+
+i := INT
+i has Algebra(i)
+
+-- returns in functions
+-- Fixed by SCM on 1/22/91
+
+)cl all
+
+f x == if x<0 then return x else x+1
+
+f 2 -- should be 3
+f(-2) -- should be -2
+
+-- resolveTT not returning Any
+-- Fixed by SCM 1/30/91
+
+)cl all
+
+m = [[1,2],[2,3]] -- Should return type EQ POLY SQMATRIX(2, INT)
+
+[1, "asd"] -- Should be of type List Any
+
+)set mes test off
+1+"asd" -- These should both fail in the same way
+1/"asd"
+)set mes test on
+
+-- Passing type variables to )show
+
+)cl all
+
+t := MPOLY([x,y], INT)
+)show t
+
+-- caching nullary functions
+
+)set fun cache all
+
+u == 1
+
+u
+)set fun cache 0
+
+-- Interpreter Only mode on collects
+-- Fixed by SCM on 3/1/91
+
+factorp: (UP(x,INT),PositiveInteger,PositiveInteger) -> List(UP(x,INT))
+factorp(poly,p,e) ==
+ ppoly:UP(x,PF p):=poly
+ pl := [rec.factor for rec in factors factor ppoly]
+ facl:=pl::List(UP(x,INT))
+
+factorp(x**2+x+5,7,1)
+
+
+-- using "by" with segments
+-- Fixed by SCM on 2/14/91
+
+)cl all
+
+b:= 1..10
+for i in b by 2 repeat output i
+
+-- DMP resolve bug
+-- Fixed by SCM 3/7/91
+
+)cl all
+
+macro RN == FRAC INT
+a51:=x+y+z+t+u;
+a52:=x*y+y*z+z*t+x*u+t*u;
+a53:=x*y*z+y*z*t+x*y*u+x*t*u+z*t*u;
+a54:=x*y*z*t+x*y*z*u+x*y*t*u+x*z*t*u+y*z*t*u;
+a55:=x*y*z*t*u-1;
+
+arnborg5: List HDMP([x,y,z,t,u],RN):=[a51,a52,a53,a54,a55];
+arnborg5l: List DMP([x,y,z,t,u],RN):=[a51,a52,a53,a54,a55];
+
+-- construct in interpret-only mode
+-- Fixed by SCM on 3/7/91
+
+)cl all
+
+factorp(poly,p,e) ==
+ [rec.factor for rec in factors factor (poly::UP(x, PF p))]::List UP(x, INT)
+
+factorp(x**2+x+5,7,1)
+
+-- return in interpret-only mode
+-- fixed by SCM 3/11/91
+
+)cl all
+
+f (x) ==
+ y: PF x := 1
+ x = 3 => return x
+ x = 4 => return(-x)
+ (x+1)
+
+f 3
+
+-- incorrect handling of type of returns
+-- fixed by SCM 3/11/91
+
+)cl all
+
+f (x) ==
+ x = 3 => return x
+ x = 4 => return(-x)
+ return (x+1)
+
+f 3
+
+-- SquareMatrix coercion bug
+-- Fixed by SCM on 4/3/91
+
+)cl all
+
+s:SQMATRIX(2, INT) := matrix [[1,2],[2,3]]
+s::SQMATRIX(2, FRAC INT)
+
+
+-- SquareMatric resolve bug
+
+)cl all
+Mat := SquareMatrix(2, Polynomial Integer)
+s:Mat := matrix [[ 2*x + 1, x], [x, 1]]
+s**3
+%::Polynomial(?)
+
+-- parsing bug
+-- Fixed by BURGE on 4/18/91
+
+)cl all
+-2**2 -- Should return -4
+
+-- # in constructor arguemnt list bug
+-- Fixed by SCM on 4/9/91
+
+)cl all
+f: DMP([x,y], INT) := x**2-y**2
+coefficient(f, degree f)
+
+-- retract from EXPR to POLY
+-- fixed by SCM and SUTOR on 5/1/91
+
+)cl all
+x+1::EXPR INT
+%::POLY INT
+
+-- fixed by SCM in May
+
+)cl all
+solve([[1,2],[2,3]],[-2,3])
+
+
+-- fixed by several people over a period of time
+)cl all
+
+eval(m**2, m=[[1,2],[2,3]])
+
+-- filtering various illegal declarations
+
+)cl all
+
+)set mes test off
+r: Ring
+w: RF INT
+)set mes test on
+
+-- Correct representation of length 1 records
+
+)cl all
+
+r:Record(a: INT) := [1]
+
+-- Fast generation of POLY FLOAT graphics code
+
+)time on
+p: POLY FLOAT := (x-1)**30
+draw(p, x=-1..1)
+
+)time )off
+
+-- Case broken in interpreter
+-- fixed by SCM in early 1991
+
+)cl all
+
+sayBranch x == _
+ if x case INT then output "Integer Branch" _
+ else if x case STRING then output "String Branch" _
+ else if x case FLOAT then output "Float Branch" _
+ else output "don't know"
+
+x:Union(INT,STRING,FLOAT)
+x:=3
+sayBranch(x)
+
+-- bug in evaluateType
+-- fixed by SCM in May 1991
+
+)cl all
+
+RFI := FRAC POLY INT
+g:DMP([x,y], RFI) := a**2*x**2/b**2 - c**2*y**2/d**2
+factor g
+
+-- bug in resolveTTSpecial
+-- Fixed by SCM 6/2/91
+
+)cl all
+
+f(u:DoubleFloat, v:DoubleFloat):DoubleFloat == u+v
+g(u:DoubleFloat, v:DoubleFloat):DoubleFloat == sin(u+v)
+h(u:DoubleFloat, v:DoubleFloat):DoubleFloat == u+cos(v)
+draw(surface(f,g,h), 0..4, 0..2*%pi)
+
+-- check for package calling from categories
+-- fixed by SCM 6/4/91
+
+)cl all
+
+)set mes test off
+(1+1)$Ring
+)set mes test on
+
+-- UnivariateSeries coercions
+-- Fixed by SCM 6/20/91
+
+)cl all
+
+s := series(sin(a*x), x=0)
+s - a*x
+s - sin(a*x)
+
+-- Complex & AlgebraicNumber coercions
+-- fixed by SCM 6/91
+
+)cl all
+
+sin %i
+sin sqrt 2
+%i*sqrt(2)
+sin(%i*sqrt 2)
+%i * sin(x)
+sin(x/sqrt(2))
+
+-- bug in resolve
+-- fixed by SCM 8/12/91
+
+)cl all
+
+)set test msg off
+primaryDecomp xx
+)set test msg on
+
+
+-- functions with ADEFs were broken
+-- fixwd by SCM 8/9/91
+
+)cl all
+
+f l ==
+ reduce((x,y) +-> l.1 + x + y, l)
+
+f [10,2,53]
+
+g l ==
+ (x:INT):INT +-> l.x
+
+w := g [23,1,341,12] ;
+
+w(1) + w(3)
+-- w(-1) removed tpd; causes testing to crash
+
+-- coerces RN to PF and POLY to EXPR
+-- fixed by SCM 8/9/91
+
+)cl all
+
+a := 2/3
+)set mes test off
+a::PF 3
+)set mes test on
+
+b := x+1
+b:: EXPR FLOAT
+
+-- minivector use in coercion functions
+
+)cl all
+
+symbol(s:Symbol,i:Integer):Symbol ==
+ st0:String:= convert(i)
+ st0:= concat(string(s),st0)
+ st0::Symbol
+
+f(a,b) == symbol(a,b)
+
+f('abc,3)
+
+-- coercing undeclared maps to Mapping types
+-- fixed by SCM 9/3/91
+)cl all
+
+f := operator 'f
+y := f(x)
+foo(u) == sin(u)
+eval(y, 'f, foo)
+
+-- package calling constants
+-- fixed by SCM 9/3/91
+
+)cl all
+
+init()$(PF 3)
+
+-- passing ADEFs to functions which require specific mapping types
+
+draw((x,y) +-> x**2 - y**2, -1..1, -1..1)
+
+-- DP bug. Don't know where this came from, but its fixed
+-- DP makes problems:
+
+
+dmp := DMP([u1,u2,u3],Fraction INT)
+p : dmp := 2*u1**4*u2*u3
+e1 := degree p
+-- the following doesn't work
+e2 : DirectProduct(3,NonNegativeInteger) := e1
+sup(e1,e1)
+-- if you give to many infos to the Interpreter it has problems
+sup(e1,e1)$DirectProduct(3,NonNegativeInteger)
+
+-- Some other bug.
+)clear all
+
+sum:=0
+m:=matrix [[1,2],[3,4]]
+lastcol:=ncols(m)
+for r in 1..nrows(m) repeat
+ -- interpreter having a value for "row" would cause it to hide
+ -- the system function
+ Row:=row(m,r)
+ for c in 1..lastcol repeat
+ sum:=sum+Row.c
+sum
+
+
+-- interpOnly mode left things in an incosistent state if it failed twice
+-- fixed by SCM
+
+)cl all
+
+splitPoly(f,var) ==
+ map(g +-> multivariate(g,var),monomials univariate(f,var))
+
+g:=sin(x)+cos(x)
+k:=kernels(g).1
+
+)set mes test off
+splitPoly([g],k) -- this is an incorrect call
+)set mes test on
+splitPoly(numer g,k) -- this is a correct call
+
+-- scoping of lambda variables
+-- fixed by SCM in March, 1992
+
+)cl all
+f x ==
+ g := (y:DoubleFloat):DoubleFloat +-> y+x
+ output(y+1)
+ g(x)
+
+f 3
+
+-- coercing undeclared interpreter function to mapping type with
+-- target which need to be coerced.
+-- fixed by SCM in March, 1992
+
+)cl all
+
+f x == 1/factorial(x)
+
+series(f, x=0)
+
+-- rule dependencies with dependencies on the operator postion
+
+)cl all
+node_a == i1+i2+i3-i5+i6=0
+node_b == -i2-i3+i4-i6=0
+i1 == va/r1
+i2 == (va-vb)/r2
+i3 == (va-vb)/r3
+i4 == vb/r4
+node_a
+node_b
+ans == solve([node_a,node_b],[va,vb]) -- (*)
+x1 == rhs(ans.1.1)
+x2 == rhs(ans.1.2)
+x1 -- (**)
+r1 == 2 -- (***)
+x1 -- (****)
+
+-- look for immediate data in operator position
+-- fixed in March 1992 by SCM and RSS
+
+"asd" "sdfsdf" "dfgdfg"
+
+-- global variables that change type in a loop.
+-- fixed by SCM
+)clear all
+s := 3.4
+while s > 1.0 repeat (s := 1/2; print s)
+s
+
+)cl all
+
+f x ==
+ free s
+ s := x
+ while s > 1.0 repeat (s := 1/2; print s)
+ s
+
+f(3.4)
+
+-- returns in sequences
+-- fixed by SCM
+
+t x ==
+ if x = 1 then (1; return [x])
+ return [2]
+
+t 1
+@
+\eject
+\begin{thebibliography}{99}
+\bibitem{1} nothing
+\end{thebibliography}
+\end{document}