diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 36 | ||||
-rw-r--r-- | src/algebra/Makefile.in | 1 | ||||
-rw-r--r-- | src/algebra/carten.spad.pamphlet | 22 | ||||
-rw-r--r-- | src/algebra/clifford.spad.pamphlet | 8 | ||||
-rw-r--r-- | src/algebra/combinat.spad.pamphlet | 20 | ||||
-rw-r--r-- | src/algebra/defintef.spad.pamphlet | 2 | ||||
-rw-r--r-- | src/algebra/elfuts.spad.pamphlet | 2 | ||||
-rw-r--r-- | src/algebra/ffnb.spad.pamphlet | 2 | ||||
-rw-r--r-- | src/algebra/fnla.spad.pamphlet | 4 | ||||
-rw-r--r-- | src/algebra/intaux.spad.pamphlet | 2 | ||||
-rw-r--r-- | src/algebra/intfact.spad.pamphlet | 3 | ||||
-rw-r--r-- | src/algebra/lodop.spad.pamphlet | 2 | ||||
-rw-r--r-- | src/algebra/naalgc.spad.pamphlet | 4 | ||||
-rw-r--r-- | src/algebra/numtheor.spad.pamphlet | 4 | ||||
-rw-r--r-- | src/algebra/odealg.spad.pamphlet | 2 | ||||
-rw-r--r-- | src/algebra/padic.spad.pamphlet | 10 | ||||
-rw-r--r-- | src/algebra/patmatch1.spad.pamphlet | 4 | ||||
-rw-r--r-- | src/algebra/perman.spad.pamphlet | 6 | ||||
-rw-r--r-- | src/algebra/puiseux.spad.pamphlet | 4 | ||||
-rw-r--r-- | src/algebra/radix.spad.pamphlet | 8 | ||||
-rw-r--r-- | src/algebra/solvedio.spad.pamphlet | 2 | ||||
-rw-r--r-- | src/algebra/special.spad.pamphlet | 12 | ||||
-rw-r--r-- | src/algebra/sttf.spad.pamphlet | 98 |
23 files changed, 153 insertions, 105 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 3037cb37..b026d971 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,41 @@ 2011-10-24 Gabriel Dos Reis <gdr@cs.tamu.edu> + * algebra/perman.spad.pamphlet (Permanent): Specify type of local + variable j. + * algebra/patmatch1.spad.pamphlet (PatternMatchTools): Tidy. + * algebra/padic.spad.pamphlet: Restrict type of literal constants. + * algebra/sttf.spad.pamphlet: Likewise. + * algebra/puiseux.spad.pamphlet: Likewise. + * algebra/odealg.spad.pamphlet (SystemODESolver) [applyLodo0]: + Specify type of local variable ans. + * algebra/numtheor.spad.pamphlet (IntegerNumberTheoryFunctions): Tidy. + * algebra/naalgc.spad.pamphlet (MonadWithUnit) [rightPower]: + Specify type of local variable res. + [leftPower]: Likewise. + * algebra/lodop.spad.pamphlet (NonCommutativeOperatorDivision) + [leftLcm]: Specify type of local variable v. + * algebra/intfact.spad.pamphlet (IntegerRoots) [approxSqrt]: + Specify type of local variables old and new. + * algebra/elfuts.spad.pamphlet + (EllipticFunctionsUnivariateTaylorSeries): Restrict types of + literal constants. + * algebra/ffnb.spad.pamphlet + (FiniteFieldNormalBasisExtensionByPolynomial): Likewise. + * algebra/fnla.spad.pamphlet (FreeNilpotentLie): Likewise. + * algebra/intaux.spad.pamphlet (IntegrationResult): Likewise. + * algebra/defintef.spad.pamphlet + (ElementaryFunctionDefiniteIntegration) [checkSMP]: Specify type + in the definition of local variable n. + * algebra/combinat.spad.pamphlet (IntegerCombinatoricFunctions): + Tidy definition of local variables. + * algebra/clifford.spad.pamphlet (CliffordAlgebra): Specify type in + the definition of local variables k, exchanges, bz. + * algebra/catdef.spad.pamphlet (CartesianTensor): Specify type in the + definition of local varibles rx and offz. + Remove useless variables zol, xol, oly, and zoly. + +2011-10-24 Gabriel Dos Reis <gdr@cs.tamu.edu> + * interp/compiler.boot (compArgumentsAndTryAgain): Fail only if elaboration of all arguments fails. diff --git a/src/algebra/Makefile.in b/src/algebra/Makefile.in index dcd03071..aad21917 100644 --- a/src/algebra/Makefile.in +++ b/src/algebra/Makefile.in @@ -1164,6 +1164,7 @@ axiom_algebra_layer_10_objects = \ $(addprefix $(OUT)/, \ $(addsuffix .$(FASLEXT),$(axiom_algebra_layer_10))) $(OUT)/ARRAY2.$(FASLEXT): $(OUT)/IFARRAY.$(FASLEXT) +$(OUT)/ORESUP.$(FASLEXT): $(OUT)/PR.$(FASLEXT) axiom_algebra_layer_11 = \ APPLYORE ARRAY1 ARRAY12 ARRAY2 \ diff --git a/src/algebra/carten.spad.pamphlet b/src/algebra/carten.spad.pamphlet index a1fd01f6..7cc2fbbb 100644 --- a/src/algebra/carten.spad.pamphlet +++ b/src/algebra/carten.spad.pamphlet @@ -272,7 +272,7 @@ CartesianTensor(minix, dim, R): Exports == Implementation where v = dim2 => 2 v = dim3 => 3 v = dim4 => 4 - rx := 0 + rx: NNI := 0 while v ~= 0 repeat qr := divide(v, dim) v := qr.quotient @@ -431,7 +431,7 @@ CartesianTensor(minix, dim, R): Exports == Implementation where z coerce(m: SM(dim,R)): % == z := new(dim**2, 0) - offz := 0 + offz: NNI := 0 for i in 0..dim-1 repeat for j in 0..dim-1 repeat set!(z, offz + j, m(i+1,j+1)) @@ -500,7 +500,7 @@ CartesianTensor(minix, dim, R): Exports == Implementation where error "Improper index for contraction" if i > j then (i,j) := (j,i) - rl:= (rx- j) pretend NNI; nl:= dim**rl; zol:= 1; xol:= zol + rl:= (rx- j) pretend NNI; nl:= dim**rl rm:= (j-i-1) pretend NNI; nm:= dim**rm; zom:= nl; xom:= zom*dim rh:= (i - 1) pretend NNI; nh:= dim**rh; zoh:= nl*nm xoh:= zoh*dim**2 @@ -511,7 +511,7 @@ CartesianTensor(minix, dim, R): Exports == Implementation where for m in 1..nm _ for xm in xh.. by xom for zm in zh.. by zom repeat for l in 1..nl _ - for xl in xm.. by xol for zl in zm.. by zol repeat + for xl in xm.. for zl in zm.. repeat set!(z, zl, 0) for k in 1..dim for xk in xl.. by xok repeat set!(z, zl, get(z,zl) + get(x,xk)) @@ -524,11 +524,11 @@ CartesianTensor(minix, dim, R): Exports == Implementation where i < 1 or i > rx or j < 1 or j > ry => error "Improper index for contraction" - rly:= (ry-j) pretend NNI; nly:= dim**rly; oly:= 1; zoly:= 1 + rly:= (ry-j) pretend NNI; nly:= dim**rly rhy:= (j -1) pretend NNI; nhy:= dim**rhy - ohy:= nly*dim; zohy:= zoly*nly + ohy:= nly*dim; zohy:= nly rlx:= (rx-i) pretend NNI; nlx:= dim**rlx - olx:= 1; zolx:= zohy*nhy + zolx:= zohy*nhy rhx:= (i -1) pretend NNI; nhx:= dim**rhx ohx:= nlx*dim; zohx:= zolx*nlx @@ -537,11 +537,11 @@ CartesianTensor(minix, dim, R): Exports == Implementation where for dxh in 1..nhx _ for xh in 0.. by ohx for zhx in 0.. by zohx repeat for dxl in 1..nlx _ - for xl in xh.. by olx for zlx in zhx.. by zolx repeat + for xl in xh.. for zlx in zhx.. by zolx repeat for dyh in 1..nhy _ for yh in 0.. by ohy for zhy in zlx.. by zohy repeat for dyl in 1..nly _ - for yl in yh.. by oly for zly in zhy.. by zoly repeat + for yl in yh.. for zly in zhy.. repeat set!(z, zly, 0) for k in 1..dim _ for xk in xl.. by nlx for yk in yl.. by nly repeat @@ -556,13 +556,13 @@ CartesianTensor(minix, dim, R): Exports == Implementation where error "Improper indicies for transposition" if i > j then (i,j) := (j,i) - rl:= (rx- j) pretend NNI; nl:= dim**rl; zol:= 1; zoi := zol*nl + rl:= (rx- j) pretend NNI; nl:= dim**rl; zoi := nl rm:= (j-i-1) pretend NNI; nm:= dim**rm; zom:= nl*dim; zoj := zom*nm rh:= (i - 1) pretend NNI; nh:= dim**rh; zoh:= nl*nm*dim**2 z := new(#x, 0) for h in 1..nh for zh in 0.. by zoh repeat _ for m in 1..nm for zm in zh.. by zom repeat _ - for l in 1..nl for zl in zm.. by zol repeat _ + for l in 1..nl for zl in zm.. repeat _ for p in 1..dim _ for zp in zl.. by zoi for xp in zl.. by zoj repeat for q in 1..dim _ diff --git a/src/algebra/clifford.spad.pamphlet b/src/algebra/clifford.spad.pamphlet index 2ae3cffb..ab4c481e 100644 --- a/src/algebra/clifford.spad.pamphlet +++ b/src/algebra/clifford.spad.pamphlet @@ -316,7 +316,7 @@ CliffordAlgebra(n, K, Q): T == Impl where bz := b2 for i in 0..n-1 | bit?(b1,i) repeat -- Apply rule ei*ej = -ej*ei for i~=j - k := 0 + k: NNI := 0 for j in i+1..n-1 | bit?(b1, j) repeat k := k+1 for j in 0..i-1 | bit?(bz, j) repeat k := k+1 if odd? k then c := -c @@ -344,7 +344,7 @@ CliffordAlgebra(n, K, Q): T == Impl where -- The Rep assumes n is small so bubble sort is ok. -- Using bubble sort keeps the exchange info obvious. wasordered := false - exchanges := 0 + exchanges: NNI := 0 while not wasordered repeat wasordered := true for i in 1..#lb-1 repeat @@ -356,7 +356,7 @@ CliffordAlgebra(n, K, Q): T == Impl where -- 2. Prepare the basis element -- Apply identity ei*ei = Q(ei). - bz := 0 + bz: NNI := 0 for b in lb repeat bn := (b-1)::NNI if bit?(bz, bn) then @@ -364,7 +364,7 @@ CliffordAlgebra(n, K, Q): T == Impl where bz:= ( bz - 2**bn )::NNI else bz:= bz + 2**bn - [c, bz::NNI] + [c, bz] monomial(c, lb) == r := canonMonom(c, lb) diff --git a/src/algebra/combinat.spad.pamphlet b/src/algebra/combinat.spad.pamphlet index f597f98f..23b4a1eb 100644 --- a/src/algebra/combinat.spad.pamphlet +++ b/src/algebra/combinat.spad.pamphlet @@ -72,8 +72,8 @@ IntegerCombinatoricFunctions(I:IntegerNumberSystem): with n < m::I => P(convert(n)@Z) concat!(P, new((convert(n+1)@Z - m)::N,0)$IndexedFlexibleArray(I,0)) for i in m..convert(n)@Z repeat - s:I := 1 - t:I := 0 + s: I := 1 + t: I := 0 for k in 1.. repeat l := (3*k*k-k) quo 2 l > i => leave @@ -96,18 +96,23 @@ IntegerCombinatoricFunctions(I:IntegerNumberSystem): with F.Fv := f binomial(n, m) == - s,b:I negative? n or negative? m or m > n => 0 m = 0 => 1 n < 2*m => binomial(n, n-m) - (s,b) := (0,1) + s: I := 0 + b: I := 1 if B.Bn = n then B.Bm = m+1 => b := (B.Bv * (m+1)) quo (n-m) B.Bn := n B.Bm := m return(B.Bv := b) - if m >= B.Bm then (s := B.Bm; b := B.Bv) else (s,b) := (0,1) + if m >= B.Bm then + s := B.Bm + b := B.Bv + else + s := 0 + b := 1 for k in convert(s+1)@Z .. convert(m)@Z repeat b := (b*(n-k::I+1)) quo k::I B.Bn := n @@ -122,12 +127,13 @@ IntegerCombinatoricFunctions(I:IntegerNumberSystem): with factorial n quo s permutation(n, m) == - t:I negative? m or n < m => 0 m := n-m p:I := 1 for k in convert(m+1)@Z .. convert(n)@Z by 2 repeat - if k::I = n then t := n else t := (k*(k+1))::I + t: I := + k::I = n => n + (k*(k+1))::I p := p * t p diff --git a/src/algebra/defintef.spad.pamphlet b/src/algebra/defintef.spad.pamphlet index 34eb5e03..fc604038 100644 --- a/src/algebra/defintef.spad.pamphlet +++ b/src/algebra/defintef.spad.pamphlet @@ -131,7 +131,7 @@ ElementaryFunctionDefiniteIntegration(R, F): Exports == Implementation where ((w := checkSMP(t, x, k, a, b)) case "failed") or (w::B) => return w false (v := isPlus p) case List(P) => - n := 0 -- number of summand having a pole + n: Z := 0 -- number of summand having a pole for t in v::List(P) repeat (w := checkSMP(t, x, k, a, b)) case "failed" => return w if w::B then n := n + 1 diff --git a/src/algebra/elfuts.spad.pamphlet b/src/algebra/elfuts.spad.pamphlet index 89b64578..23b4f781 100644 --- a/src/algebra/elfuts.spad.pamphlet +++ b/src/algebra/elfuts.spad.pamphlet @@ -57,7 +57,7 @@ EllipticFunctionsUnivariateTaylorSeries(Coef,UTS): integrate(1,sign*k**2*$UPS scd.1*$UPS scd.2*$UPS dx)] sncndn(z,k) == - empty? z => [0 :: ST,1 :: ST,1::ST] + empty? z => [0@Coef :: ST,1@Coef :: ST,1@Coef::ST] frst z = 0 => YS(sncndnre(k,#1,deriv z,-1),3) error "ELFUTS:sncndn: constant coefficient should be 0" sn(x,k) == series sncndn.(coefficients x,k).1 diff --git a/src/algebra/ffnb.spad.pamphlet b/src/algebra/ffnb.spad.pamphlet index 673fd906..b0b42e01 100644 --- a/src/algebra/ffnb.spad.pamphlet +++ b/src/algebra/ffnb.spad.pamphlet @@ -590,7 +590,7 @@ FiniteFieldNormalBasisExtensionByPolynomial(GF,uni): Exports == _ one? x.i => b ((x.i)::OUT) *$OUT b l:=cons(mon,l)$(List OUT) - null(l)$(List OUT) => (0::OUT) + null(l)$(List OUT) => (0@GF::OUT) r:=reduce("+",l)$(List OUT) r diff --git a/src/algebra/fnla.spad.pamphlet b/src/algebra/fnla.spad.pamphlet index 4feb3a97..b82a1288 100644 --- a/src/algebra/fnla.spad.pamphlet +++ b/src/algebra/fnla.spad.pamphlet @@ -283,12 +283,12 @@ FreeNilpotentLie(n:NNI,class:NNI,R: CommutativeRing): Export == Implement where r::O * mkcomm(mkcomm(coms(k).1)$Com,mkcomm(coms(k).3)$Com)$Com::O shallowExpand(f) == - f = 0 => 0::O + f = 0 => 0@R::O reductum(f) = 0 => shallowE(lC f,lS f) shallowE(lC f,lS f) + shallowExpand(reductum f) deepExpand(f) == - f = 0 => 0::O + f = 0 => 0@R::O reductum(f) = 0 => lC(f)=1 => Fac(value(lS f))::O lC(f)::O * Fac(value(lS f))::O diff --git a/src/algebra/intaux.spad.pamphlet b/src/algebra/intaux.spad.pamphlet index d88eb62b..b5267540 100644 --- a/src/algebra/intaux.spad.pamphlet +++ b/src/algebra/intaux.spad.pamphlet @@ -171,7 +171,7 @@ IntegrationResult(F:Field): Exports == Implementation where l := reverse! [LOG2O f for f in logpart u]$List(O) if ratpart u ~= 0 then l := concat(ratpart(u)::O, l) if not elem? u then l := concat([NE2O f for f in notelem u], l) - null l => 0::O + null l => 0@F::O reduce("+", l) NE2O ne == diff --git a/src/algebra/intfact.spad.pamphlet b/src/algebra/intfact.spad.pamphlet index f405476f..f24922c5 100644 --- a/src/algebra/intfact.spad.pamphlet +++ b/src/algebra/intfact.spad.pamphlet @@ -324,7 +324,8 @@ IntegerRoots(I:IntegerNumberSystem): Exports == Implementation where s := shift(s, n) return ((1 + s + a quo s) quo two) -- initial approximation for the root is within a factor of 2 - (new, old) := (shift(1, n quo two), 1) + old: I := 1 + new: I := shift(1, n quo two) while new ~= old repeat (new, old) := ((1 + new + a quo new) quo two, new) new diff --git a/src/algebra/lodop.spad.pamphlet b/src/algebra/lodop.spad.pamphlet index 53a38c6c..758dcf12 100644 --- a/src/algebra/lodop.spad.pamphlet +++ b/src/algebra/lodop.spad.pamphlet @@ -186,7 +186,7 @@ NonCommutativeOperatorDivision(P, F): PDcat == PDdef where b = 0 =>a b0 := b u := monomial(1,0)$P - v := 0 + v: P := 0 while leadingCoefficient b ~= 0 repeat qr := leftDivide(a,b) (a, b) := (b, qr.remainder) diff --git a/src/algebra/naalgc.spad.pamphlet b/src/algebra/naalgc.spad.pamphlet index c256691a..ce4b81ef 100644 --- a/src/algebra/naalgc.spad.pamphlet +++ b/src/algebra/naalgc.spad.pamphlet @@ -119,12 +119,12 @@ MonadWithUnit(): Category == Monad with expt(x,n pretend PositiveInteger) rightPower(a: %,n: NonNegativeInteger) == zero? n => 1 - res := 1 + res: % := 1 for i in 1..n repeat res := res * a res leftPower(a: %,n: NonNegativeInteger) == zero? n => 1 - res := 1 + res: % := 1 for i in 1..n repeat res := a * res res diff --git a/src/algebra/numtheor.spad.pamphlet b/src/algebra/numtheor.spad.pamphlet index f1251618..4a8101ea 100644 --- a/src/algebra/numtheor.spad.pamphlet +++ b/src/algebra/numtheor.spad.pamphlet @@ -335,8 +335,8 @@ IntegerNumberTheoryFunctions(): Exports == Implementation where fibonacci n == n = 0 => 0 negative? n => (odd? n => 1; -1) * fibonacci(-n) - f1, f2 : I - (f1,f2) := (0,1) + f1: I := 0 + f2: I := 1 for k in length(n)-2 .. 0 by -1 repeat t := f2**2 (f1,f2) := (t+f1**2,t+2*f1*f2) diff --git a/src/algebra/odealg.spad.pamphlet b/src/algebra/odealg.spad.pamphlet index 1a3d355d..b96ffa9d 100644 --- a/src/algebra/odealg.spad.pamphlet +++ b/src/algebra/odealg.spad.pamphlet @@ -205,7 +205,7 @@ SystemODESolver(F, LO): Exports == Implementation where -- computes +/[m(r, i) mm(i, c) for i ranging over the last n columns of m] applyLodo0(m, r, mm, c, n) == - ans := 0 + ans: F := 0 rr := maxRowIndex mm cc := maxColIndex m for i in 1..n repeat diff --git a/src/algebra/padic.spad.pamphlet b/src/algebra/padic.spad.pamphlet index d7265998..260bb580 100644 --- a/src/algebra/padic.spad.pamphlet +++ b/src/algebra/padic.spad.pamphlet @@ -289,7 +289,7 @@ InnerPAdicInteger(p,unBalanced?): Exports == Implementation where showAll?() == true coerce(x:%):OUT == - empty?(st := stream x) => 0 :: OUT + empty?(st := stream x) => 0@I :: OUT count : NNI := _$streamCount$Lisp l : L OUT := empty() n : NNI := 0 @@ -309,8 +309,8 @@ InnerPAdicInteger(p,unBalanced?): Exports == Implementation where explicitlyEmpty? st => l eq?(st,rst st) and frst st = 0 => l concat(prefix("O" :: OUT,[PEXPR ** (n :: OUT)]),l) - empty? l => 0 :: OUT - reduce("+",reverse! l) + empty? l => 0@I :: OUT + reduce(_+,reverse! l) @ \section{domain PADIC PAdicInteger} @@ -515,7 +515,7 @@ PAdicRationalConstructor(p,PADIC): Exports == Implementation where m := getExpon x; zp := getZp x uu := digits zp l : L OUT := empty() - empty? uu => 0 :: OUT + empty? uu => 0@I :: OUT count : NNI := _$streamCount$Lisp n : NNI := 0 while n <= count and not empty? uu repeat @@ -535,7 +535,7 @@ PAdicRationalConstructor(p,PADIC): Exports == Implementation where explicitlyEmpty? uu => l eq?(uu,rst uu) and frst uu = 0 => l concat(prefix("O" :: OUT,[PEXPR ** ((n :: I) + m) :: OUT]),l) - empty? l => 0 :: OUT + empty? l => 0@I :: OUT reduce("+",reverse! l) @ diff --git a/src/algebra/patmatch1.spad.pamphlet b/src/algebra/patmatch1.spad.pamphlet index 2b7da476..e0812ea2 100644 --- a/src/algebra/patmatch1.spad.pamphlet +++ b/src/algebra/patmatch1.spad.pamphlet @@ -532,10 +532,10 @@ PatternMatchTools(S, R, P): Exports == Implementation where l1:PRS := failed() t : P for x in setDifference(ls, bad) - while (t := x; failed?(l1 := pmatch(x, p, l))) repeat 0 + while (t := x; failed?(l1 := pmatch(x, p, l))) repeat nil failed? l1 => for x in bad - while (t := x; failed?(l1 := pmatch(x, p, l))) repeat 0 + while (t := x; failed?(l1 := pmatch(x, p, l))) repeat nil failed? l1 => [addMatchRestricted(p, ident, l, ident), ls] [l1, remove(t, ls)] [l1, remove(t, ls)] diff --git a/src/algebra/perman.spad.pamphlet b/src/algebra/perman.spad.pamphlet index b45620a4..73e20b31 100644 --- a/src/algebra/perman.spad.pamphlet +++ b/src/algebra/perman.spad.pamphlet @@ -164,7 +164,7 @@ Permanent(n : PositiveInteger, R : Ring with commutative("*")): vv : V V I := firstSubsetGray(n)$GRAY -- For the meaning of the elements of vv, see GRAY. w : V R := new(n,0$R) - j := 1 -- Will be the number of the element changed in subset + j: I := 1 -- Will be the number of the element changed in subset while j ~= (n+1) repeat -- we sum over all subsets of (1,...,n) sgn := -sgn b := sgn @@ -209,7 +209,7 @@ Permanent(n : PositiveInteger, R : Ring with commutative("*")): for i in 1..n repeat b := b * w.i a := a+b - j := 1 -- Will be the number of the element changed in subset + j: I := 1 -- Will be the number of the element changed in subset while j ~= n repeat -- we sum over all subsets of (1,...,n-1) sgn := -sgn b := sgn @@ -255,7 +255,7 @@ Permanent(n : PositiveInteger, R : Ring with commutative("*")): for i in 1..n repeat b := b *$R w.i a := a +$R b - j := 1 -- Will be the number of the element changed in subset + j: I := 1 -- Will be the number of the element changed in subset while j ~= n repeat -- we sum over all subsets of (1,...,n-1) sgn := -sgn b := sgn diff --git a/src/algebra/puiseux.spad.pamphlet b/src/algebra/puiseux.spad.pamphlet index b465790c..0abb2891 100644 --- a/src/algebra/puiseux.spad.pamphlet +++ b/src/algebra/puiseux.spad.pamphlet @@ -532,7 +532,7 @@ UnivariatePuiseuxSeries(Coef,var,cen): Exports == Implementation where termsToOutputForm:(RN,RN,ST,OUT) -> OUT termsToOutputForm(m,rat,uu,xxx) == l : L OUT := empty() - empty? uu => 0 :: OUT + empty? uu => 0@Coef :: OUT count : NNI := _$streamCount$Lisp n : NNI := 0 while n <= count and not empty? uu repeat @@ -552,7 +552,7 @@ UnivariatePuiseuxSeries(Coef,var,cen): Exports == Implementation where explicitlyEmpty? uu => l eq?(uu,rst uu) and frst uu = 0 => l concat(prefix("O" :: OUT,[xxx ** (((n::I) * rat + m) :: OUT)]),l) - empty? l => 0 :: OUT + empty? l => 0@Coef :: OUT reduce("+",reverse! l) coerce(upxs:%):OUT == diff --git a/src/algebra/radix.spad.pamphlet b/src/algebra/radix.spad.pamphlet index df8308ad..ae148819 100644 --- a/src/algebra/radix.spad.pamphlet +++ b/src/algebra/radix.spad.pamphlet @@ -113,7 +113,7 @@ RadixExpansion(bb): Exports == Implementation where coerce(a):RN == (wholePart a) :: RN + fractionPart a coerce(n):% == n :: RN :: % coerce(q):% == - s := 1; if negative? q then (s := -1; q := -q) + s: I := 1; if negative? q then (s := -1; q := -q) qr := divide(numer q,denom q) whole := radixInt (qr.quotient,bb) fractn := radixFrac(qr.remainder,denom q,bb) @@ -130,11 +130,11 @@ RadixExpansion(bb): Exports == Implementation where floor a == floor(a::RN) wholePart a == - n0 := 0 + n0: I := 0 for r in a.int repeat n0 := bb*n0 + r a.sgn*n0 fractionPart(a: %): Fraction Integer == - n0 := 0 + n0: I := 0 for r in a.pfx repeat n0 := bb*n0 + r null a.cyc => a.sgn*n0/bb**((#a.pfx)::NNI) @@ -188,7 +188,7 @@ RadixExpansion(bb): Exports == Implementation where if not null a.pfx then le := concat(intgroup a.pfx,le) if not null le then le := concat("." :: OUT,le) if not null a.int then le := concat(intgroup a.int,le) - else le := concat(0 :: OUT,le) + else le := concat(0@I :: OUT,le) rex := exprgroup le if negative? a.sgn then -rex else rex diff --git a/src/algebra/solvedio.spad.pamphlet b/src/algebra/solvedio.spad.pamphlet index f83c9cb6..7b68eb4b 100644 --- a/src/algebra/solvedio.spad.pamphlet +++ b/src/algebra/solvedio.spad.pamphlet @@ -156,7 +156,7 @@ DiophantineSolutionPackage(): Cat == Capsule where verifyMinimality(sol, graph, flag) == -- test whether sol contains a minimal homogeneous solution flag => -- sol is a homogeneous solution - i := 1 + i: I := 1 while sol.i = 0 repeat i := i + 1 x := sol.i diff --git a/src/algebra/special.spad.pamphlet b/src/algebra/special.spad.pamphlet index 8a619f7b..b8c1c293 100644 --- a/src/algebra/special.spad.pamphlet +++ b/src/algebra/special.spad.pamphlet @@ -294,7 +294,8 @@ OrthogonalPolynomialFunctions(R: CommutativeRing): Exports == Impl where laguerreL(n, x) == n = 0 => 1 - (p1, p0) := (-x + 1, 1) + p0: R := 1 + p1: R := -x + 1 for i in 1..n-1 repeat (p1, p0) := ((2*i::R + 1 - x)*p1 - i**2*p0, p1) p1 @@ -312,19 +313,22 @@ OrthogonalPolynomialFunctions(R: CommutativeRing): Exports == Impl where p1 chebyshevT(n, x) == n = 0 => 1 - (p1, p0) := (x, 1) + p0: R := 1 + p1: R := x for i in 1..n-1 repeat (p1, p0) := (2*x*p1 - p0, p1) p1 chebyshevU(n, x) == n = 0 => 1 - (p1, p0) := (2*x, 1) + p0: R := 1 + p1: R := 2*x for i in 1..n-1 repeat (p1, p0) := (2*x*p1 - p0, p1) p1 hermiteH(n, x) == n = 0 => 1 - (p1, p0) := (2*x, 1) + p0: R := 1 + p1: R := 2*x for i in 1..n-1 repeat (p1, p0) := (2*x*p1 - 2*i*p0, p1) p1 diff --git a/src/algebra/sttf.spad.pamphlet b/src/algebra/sttf.spad.pamphlet index f65e7bbc..682d3fb7 100644 --- a/src/algebra/sttf.spad.pamphlet +++ b/src/algebra/sttf.spad.pamphlet @@ -134,7 +134,7 @@ StreamTranscendentalFunctions(Coef): Exports == Implementation where expre(r,e,dx) == lazyIntegrate(r,e*dx) exp z == - empty? z => 1 :: ST + empty? z => 1@Coef :: ST (coef := frst z) = 0 => YS expre(1,#1,deriv z) TRANSFCN => YS expre(exp coef,#1,deriv z) error concat("exp: ",TRCONST) @@ -165,7 +165,7 @@ StreamTranscendentalFunctions(Coef): Exports == Implementation where -- [lazyIntegrate(rs,st1),lazyIntegrate(rc,st2)] sincos z == - empty? z => [0 :: ST,1 :: ST] + empty? z => [0@Coef :: ST,1@Coef :: ST] l := (coef := frst z) = 0 => YS(sincosre(0,1,#1,deriv z,-1),2) TRANSFCN => YS(sincosre(sin coef,cos coef,#1,deriv z,-1),2) @@ -176,7 +176,7 @@ StreamTranscendentalFunctions(Coef): Exports == Implementation where cos z == sincos(z).cos tanre:(Coef,ST,ST,Coef) -> ST - tanre(r,t,dx,sign) == lazyIntegrate(r,((1 :: ST) + sign*t*t)*dx) + tanre(r,t,dx,sign) == lazyIntegrate(r,((1@Coef :: ST) + sign*t*t)*dx) -- When the compiler had difficulties with the above definition, -- I did the following to help it: @@ -191,13 +191,13 @@ StreamTranscendentalFunctions(Coef): Exports == Implementation where -- lazyIntegrate(r,st1) tan z == - empty? z => 0 :: ST + empty? z => 0@Coef :: ST (coef := frst z) = 0 => YS tanre(0,#1,deriv z,1) TRANSFCN => YS tanre(tan coef,#1,deriv z,1) error concat("tan: ",TRCONST) cotre:(Coef,ST,ST) -> ST - cotre(r,t,dx) == lazyIntegrate(r,-((1 :: ST) + t*t)*dx) + cotre(r,t,dx) == lazyIntegrate(r,-((1@Coef :: ST) + t*t)*dx) -- When the compiler had difficulties with the above definition, -- I did the following to help it: @@ -218,7 +218,7 @@ StreamTranscendentalFunctions(Coef): Exports == Implementation where error concat("cot: ",TRCONST) sec z == - empty? z => 1 :: ST + empty? z => 1@Coef :: ST frst z = 0 => recip(cos z) :: ST TRANSFCN => cosz := cos z @@ -245,12 +245,12 @@ StreamTranscendentalFunctions(Coef): Exports == Implementation where "failed" asin z == - empty? z => 0 :: ST + empty? z => 0@Coef :: ST (coef := frst z) = 0 => - integrate(0,powern(-1/2,(1 :: ST) - z*z) * (deriv z)) + integrate(0,powern(-1/2,(1@Coef :: ST) - z*z) * (deriv z)) TRANSFCN => coef = 1 or coef = -1 => - x := (1 :: ST) - z*z + x := (1@Coef :: ST) - z*z -- compute order of 'x' (ord := orderOrFailed x) case "failed" => error concat("asin: ",MAYFPOW) @@ -260,7 +260,7 @@ StreamTranscendentalFunctions(Coef): Exports == Implementation where (quot := (deriv z) exquo squirt) case "failed" => error concat("asin: ",NOTINV) integrate(asin coef,quot :: ST) - integrate(asin coef,powern(-1/2,(1 :: ST) - z*z) * (deriv z)) + integrate(asin coef,powern(-1/2,(1@Coef :: ST) - z*z) * (deriv z)) error concat("asin: ",TRCONST) acos z == @@ -270,7 +270,7 @@ StreamTranscendentalFunctions(Coef): Exports == Implementation where TRANSFCN => coef := frst z coef = 1 or coef = -1 => - x := (1 :: ST) - z*z + x := (1@Coef :: ST) - z*z -- compute order of 'x' (ord := orderOrFailed x) case "failed" => error concat("acos: ",MAYFPOW) @@ -280,15 +280,15 @@ StreamTranscendentalFunctions(Coef): Exports == Implementation where (quot := (-deriv z) exquo squirt) case "failed" => error concat("acos: ",NOTINV) integrate(acos coef,quot :: ST) - integrate(acos coef,-powern(-1/2,(1 :: ST) - z*z) * (deriv z)) + integrate(acos coef,-powern(-1/2,(1@Coef :: ST) - z*z) * (deriv z)) error concat("acos: ",TRCONST) atan z == - empty? z => 0 :: ST + empty? z => 0@Coef :: ST (coef := frst z) = 0 => - integrate(0,(recip((1 :: ST) + z*z) :: ST) * (deriv z)) + integrate(0,(recip((1@Coef :: ST) + z*z) :: ST) * (deriv z)) TRANSFCN => - (y := recip((1 :: ST) + z*z)) case "failed" => + (y := recip((1@Coef :: ST) + z*z)) case "failed" => error concat("atan: ",LOGS) integrate(atan coef,(y :: ST) * (deriv z)) error concat("atan: ",TRCONST) @@ -298,7 +298,7 @@ StreamTranscendentalFunctions(Coef): Exports == Implementation where TRANSFCN => acot(0)$Coef :: ST error concat("acot: ",TRCONST) TRANSFCN => - (y := recip((1 :: ST) + z*z)) case "failed" => + (y := recip((1@Coef :: ST) + z*z)) case "failed" => error concat("acot: ",LOGS) integrate(acot frst z,-(y :: ST) * (deriv z)) error concat("acot: ",TRCONST) @@ -309,7 +309,7 @@ StreamTranscendentalFunctions(Coef): Exports == Implementation where (coef := frst z) = 0 => error "asec: constant coefficient should not be 0" coef = 1 or coef = -1 => - x := z*z - (1 :: ST) + x := z*z - (1@Coef :: ST) -- compute order of 'x' (ord := orderOrFailed x) case "failed" => error concat("asec: ",MAYFPOW) @@ -321,7 +321,7 @@ StreamTranscendentalFunctions(Coef): Exports == Implementation where (quot2 := (quot :: ST) exquo z) case "failed" => error concat("asec: ",NOTINV) integrate(asec coef,quot2 :: ST) - integrate(asec coef,(powern(-1/2,z*z-(1::ST))*(deriv z)) / z) + integrate(asec coef,(powern(-1/2,z*z-(1@Coef::ST))*(deriv z)) / z) error concat("asec: ",TRCONST) acsc z == @@ -330,7 +330,7 @@ StreamTranscendentalFunctions(Coef): Exports == Implementation where (coef := frst z) = 0 => error "acsc: constant coefficient should not be zero" coef = 1 or coef = -1 => - x := z*z - (1 :: ST) + x := z*z - (1@Coef :: ST) -- compute order of 'x' (ord := orderOrFailed x) case "failed" => error concat("acsc: ",MAYFPOW) @@ -342,13 +342,13 @@ StreamTranscendentalFunctions(Coef): Exports == Implementation where (quot2 := (quot :: ST) exquo z) case "failed" => error concat("acsc: ",NOTINV) integrate(acsc coef,quot2 :: ST) - integrate(acsc coef,-(powern(-1/2,z*z-(1::ST))*(deriv z)) / z) + integrate(acsc coef,-(powern(-1/2,z*z-(1@Coef::ST))*(deriv z)) / z) error concat("acsc: ",TRCONST) --% Hyperbolic Trigonometric Functions sinhcosh z == - empty? z => [0 :: ST,1 :: ST] + empty? z => [0@Coef :: ST,1@Coef :: ST] l := (coef := frst z) = 0 => YS(sincosre(0,1,#1,deriv z,1),2) TRANSFCN => YS(sincosre(sinh coef,cosh coef,#1,deriv z,1),2) @@ -359,7 +359,7 @@ StreamTranscendentalFunctions(Coef): Exports == Implementation where cosh z == sinhcosh(z).cosh tanh z == - empty? z => 0 :: ST + empty? z => 0@Coef :: ST (coef := frst z) = 0 => YS tanre(0,#1,deriv z,-1) TRANSFCN => YS tanre(tanh coef,#1,deriv z,-1) error concat("tanh: ",TRCONST) @@ -381,10 +381,10 @@ StreamTranscendentalFunctions(Coef): Exports == Implementation where recip(sinhz) :: ST asinh z == - empty? z => 0 :: ST - (coef := frst z) = 0 => log(z + powern(1/2,(1 :: ST) + z*z)) + empty? z => 0@Coef :: ST + (coef := frst z) = 0 => log(z + powern(1/2,(1@Coef :: ST) + z*z)) TRANSFCN => - x := (1 :: ST) + z*z + x := (1@Coef :: ST) + z*z -- compute order of 'x', in case coefficient(z,0) = +- %i (ord := orderOrFailed x) case "failed" => error concat("asinh: ",MAYFPOW) @@ -401,7 +401,7 @@ StreamTranscendentalFunctions(Coef): Exports == Implementation where TRANSFCN => coef := frst z coef = 1 or coef = -1 => - x := z*z - (1 :: ST) + x := z*z - (1@Coef :: ST) -- compute order of 'x' (ord := orderOrFailed x) case "failed" => error concat("acosh: ",MAYFPOW) @@ -409,16 +409,16 @@ StreamTranscendentalFunctions(Coef): Exports == Implementation where odd? order => error concat("acosh: ",FPOWERS) -- the argument to 'log' must have a non-zero constant term log(z + powern(1/2,x)) - log(z + powern(1/2,z*z - (1 :: ST))) + log(z + powern(1/2,z*z - (1@Coef :: ST))) error concat("acosh: ",TRCONST) atanh z == - empty? z => 0 :: ST + empty? z => 0@Coef :: ST (coef := frst z) = 0 => - (inv(2::RN)::Coef) * log(((1 :: ST) + z)/((1 :: ST) - z)) + (inv(2::RN)::Coef) * log(((1@Coef :: ST) + z)/((1@Coef :: ST) - z)) TRANSFCN => coef = 1 or coef = -1 => error concat("atanh: ",LOGS) - (inv(2::RN)::Coef) * log(((1 :: ST) + z)/((1 :: ST) - z)) + (inv(2::RN)::Coef) * log(((1@Coef :: ST) + z)/((1@Coef :: ST) - z)) error concat("atanh: ",TRCONST) acoth z == @@ -427,7 +427,7 @@ StreamTranscendentalFunctions(Coef): Exports == Implementation where error concat("acoth: ",TRCONST) TRANSFCN => frst z = 1 or frst z = -1 => error concat("acoth: ",LOGS) - (inv(2::RN)::Coef) * log((z + (1 :: ST))/(z - (1 :: ST))) + (inv(2::RN)::Coef) * log((z + (1@Coef :: ST))/(z - (1@Coef :: ST))) error concat("acoth: ",TRCONST) asech z == @@ -435,27 +435,27 @@ StreamTranscendentalFunctions(Coef): Exports == Implementation where TRANSFCN => (coef := frst z) = 0 => error concat("asech: ",NPOWLOG) coef = 1 or coef = -1 => - x := (1 :: ST) - z*z + x := (1@Coef :: ST) - z*z -- compute order of 'x' (ord := orderOrFailed x) case "failed" => error concat("asech: ",MAYFPOW) (order := ord :: I) = -1 => return asech(coef) :: ST odd? order => error concat("asech: ",FPOWERS) - log(((1 :: ST) + powern(1/2,x))/z) - log(((1 :: ST) + powern(1/2,(1 :: ST) - z*z))/z) + log(((1@Coef :: ST) + powern(1/2,x))/z) + log(((1@Coef :: ST) + powern(1/2,(1@Coef :: ST) - z*z))/z) error concat("asech: ",TRCONST) acsch z == empty? z => error "acsch: acsch(0) is undefined" TRANSFCN => frst z = 0 => error concat("acsch: ",NPOWLOG) - x := z*z + (1 :: ST) + x := z*z + (1@Coef :: ST) -- compute order of 'x' (ord := orderOrFailed x) case "failed" => error concat("acsc: ",MAYFPOW) (order := ord :: I) = -1 => return acsch(frst z) :: ST odd? order => error concat("acsch: ",FPOWERS) - log(((1 :: ST) + powern(1/2,x))/z) + log(((1@Coef :: ST) + powern(1/2,x))/z) error concat("acsch: ",TRCONST) @ @@ -563,7 +563,7 @@ StreamTranscendentalFunctionsNonCommutative(Coef): _ --% Exponentials and Logarithms exp z == - empty? z => 1 :: ST + empty? z => 1@Coef :: ST (frst z) = 0 => expx := exp(monom(1,1))$STTF compose(expx,z) @@ -581,21 +581,21 @@ StreamTranscendentalFunctionsNonCommutative(Coef): _ --% Trigonometric Functions sin z == - empty? z => 0 :: ST + empty? z => 0@Coef :: ST (frst z) = 0 => sinx := sin(monom(1,1))$STTF compose(sinx,z) error concat("sin: ",ZERO) cos z == - empty? z => 1 :: ST + empty? z => 1@Coef :: ST (frst z) = 0 => cosx := cos(monom(1,1))$STTF compose(cosx,z) error concat("cos: ",ZERO) tan z == - empty? z => 0 :: ST + empty? z => 0@Coef :: ST (frst z) = 0 => tanx := tan(monom(1,1))$STTF compose(tanx,z) @@ -607,7 +607,7 @@ StreamTranscendentalFunctionsNonCommutative(Coef): _ error concat("cot: ",ZERO) sec z == - empty? z => 1 :: ST + empty? z => 1@Coef :: ST (frst z) = 0 => secx := sec(monom(1,1))$STTF compose(secx,z) @@ -619,14 +619,14 @@ StreamTranscendentalFunctionsNonCommutative(Coef): _ error concat("csc: ",ZERO) asin z == - empty? z => 0 :: ST + empty? z => 0@Coef :: ST (frst z) = 0 => asinx := asin(monom(1,1))$STTF compose(asinx,z) error concat("asin: ",ZERO) atan z == - empty? z => 0 :: ST + empty? z => 0@Coef :: ST (frst z) = 0 => atanx := atan(monom(1,1))$STTF compose(atanx,z) @@ -640,21 +640,21 @@ StreamTranscendentalFunctionsNonCommutative(Coef): _ --% Hyperbolic Trigonometric Functions sinh z == - empty? z => 0 :: ST + empty? z => 0@Coef :: ST (frst z) = 0 => sinhx := sinh(monom(1,1))$STTF compose(sinhx,z) error concat("sinh: ",ZERO) cosh z == - empty? z => 1 :: ST + empty? z => 1@Coef :: ST (frst z) = 0 => coshx := cosh(monom(1,1))$STTF compose(coshx,z) error concat("cosh: ",ZERO) tanh z == - empty? z => 0 :: ST + empty? z => 0@Coef :: ST (frst z) = 0 => tanhx := tanh(monom(1,1))$STTF compose(tanhx,z) @@ -666,7 +666,7 @@ StreamTranscendentalFunctionsNonCommutative(Coef): _ error concat("coth: ",ZERO) sech z == - empty? z => 1 :: ST + empty? z => 1@Coef :: ST (frst z) = 0 => sechx := sech(monom(1,1))$STTF compose(sechx,z) @@ -678,14 +678,14 @@ StreamTranscendentalFunctionsNonCommutative(Coef): _ error concat("csch: ",ZERO) asinh z == - empty? z => 0 :: ST + empty? z => 0@Coef :: ST (frst z) = 0 => asinhx := asinh(monom(1,1))$STTF compose(asinhx,z) error concat("asinh: ",ZERO) atanh z == - empty? z => 0 :: ST + empty? z => 0@Coef :: ST (frst z) = 0 => atanhx := atanh(monom(1,1))$STTF compose(atanhx,z) |