diff options
Diffstat (limited to 'src/algebra')
-rw-r--r-- | src/algebra/asp.spad.pamphlet | 5 | ||||
-rw-r--r-- | src/algebra/carten.spad.pamphlet | 24 | ||||
-rw-r--r-- | src/algebra/clifford.spad.pamphlet | 16 | ||||
-rw-r--r-- | src/algebra/derham.spad.pamphlet | 3 | ||||
-rw-r--r-- | src/algebra/fnla.spad.pamphlet | 1 | ||||
-rw-r--r-- | src/algebra/fourier.spad.pamphlet | 1 | ||||
-rw-r--r-- | src/algebra/multpoly.spad.pamphlet | 6 | ||||
-rw-r--r-- | src/algebra/pfr.spad.pamphlet | 7 | ||||
-rw-r--r-- | src/algebra/polycat.spad.pamphlet | 2 | ||||
-rw-r--r-- | src/algebra/tree.spad.pamphlet | 8 |
10 files changed, 23 insertions, 50 deletions
diff --git a/src/algebra/asp.spad.pamphlet b/src/algebra/asp.spad.pamphlet index 93b26746..d95211a8 100644 --- a/src/algebra/asp.spad.pamphlet +++ b/src/algebra/asp.spad.pamphlet @@ -512,7 +512,6 @@ Asp19(name): Exports == Implementation where s2 : SegmentBinding POLY INT := equation(J@S,seg2) as : FC := assign(FJACC,[I@S::(POLY INT),J@S::(POLY INT)],0.0::EXPR FLOAT) clear : FC := forLoop(s1,forLoop(s2,as)) - j:Integer x:S := XC::S pu:List(S) := [] -- Work out which variables appear in the expressions @@ -685,7 +684,6 @@ Asp20(name): Exports == Implementation where assign(s,j')$FortranCode coerce(u:MAT FEXPR):$ == - j:Integer x:Symbol := X::Symbol n := nrows(u)::PI p:VEC FEXPR := [retract(subscript(x,[j::O])$Symbol)@FEXPR for j in 1..n] @@ -1448,7 +1446,6 @@ Asp31(name): Exports == Implementation where assign(s,j')$FC makeXList(n:Integer):List(Symbol) == - j:Integer y:Symbol := Y::Symbol p:List(Symbol) := [] for j in 1 .. n repeat p:= cons(subscript(y,[j::OutputForm])$Symbol,p) @@ -2090,7 +2087,6 @@ Asp41(nameOne,nameTwo,nameThree): Exports == Implementation where makeCodeOne(jacEps) makeYList(n:Integer):List(Symbol) == - j:Integer y:Symbol := Y::Symbol p:List(Symbol) := [] [subscript(y,[j::OutputForm])$Symbol for j in 1..n] @@ -2306,7 +2302,6 @@ Asp42(nameOne,nameTwo,nameThree): Exports == Implementation where BCEPsym:Symbol:=coerce "BCEP" makeList(n:Integer,s:Symbol):List(Symbol) == - j:Integer p:List(Symbol) := [] for j in 1 .. n repeat p:= cons(subscript(s,[j::OutputForm])$Symbol,p) reverse(p) diff --git a/src/algebra/carten.spad.pamphlet b/src/algebra/carten.spad.pamphlet index ed391bf4..2e0369dd 100644 --- a/src/algebra/carten.spad.pamphlet +++ b/src/algebra/carten.spad.pamphlet @@ -252,8 +252,6 @@ CartesianTensor(minix, dim, R): Exports == Implementation where Rep := IndexedVector(R,0) n: Integer - r,s: R - x,y,z: % ---- Local stuff dim2: NNI := dim**2 @@ -371,23 +369,23 @@ CartesianTensor(minix, dim, R): Exports == Implementation where n := #x lengthRankOrElse n - elt(x) == + elt(x: %) == not one?(#x) => error "Index error (the rank is not 0)" get(x,0) - elt(x, i: I) == + elt(x: %, i: I) == #x ~= dim => error "Index error (the rank is not 1)" get(x,(i-minix)) - elt(x, i: I, j: I) == + elt(x: %, i: I, j: I) == #x ~= dim2 => error "Index error (the rank is not 2)" get(x,(dim*(i-minix) + (j-minix))) - elt(x, i: I, j: I, k: I) == + elt(x: %, i: I, j: I, k: I) == #x ~= dim3 => error "Index error (the rank is not 3)" get(x,(dim2*(i-minix) + dim*(j-minix) + (k-minix))) - elt(x, i: I, j: I, k: I, l: I) == + elt(x: %, i: I, j: I, k: I, l: I) == #x ~= dim4 => error "Index error (the rank is not 4)" get(x,(dim3*(i-minix) + dim2*(j-minix) + dim*(k-minix) + (l-minix))) - elt(x, i: List I) == + elt(x: %, i: List I) == #i ~= rank x => error "Index error (wrong rank)" n: I := 0 for ii in i repeat @@ -473,22 +471,22 @@ CartesianTensor(minix, dim, R): Exports == Implementation where z := new(#x, 0) for i in 0..#x-1 repeat set!(z, i, -get(x,i)) z - n * x == + n: Integer * x: % == -- [n * xi for xi in x] z := new(#x, 0) for i in 0..#x-1 repeat set!(z, i, n * get(x,i)) z - x * n == + x: % * n: Integer == -- [n * xi for xi in x] z := new(#x, 0) for i in 0..#x-1 repeat set!(z, i, n* get(x,i)) -- Commutative!! z - r * x == + r: R * x: % == -- [r * xi for xi in x] z := new(#x, 0) for i in 0..#x-1 repeat set!(z, i, r * get(x,i)) z - x * r == + x: % * r: R == -- [xi*r for xi in x] z := new(#x, 0) for i in 0..#x-1 repeat set!(z, i, r* get(x,i)) -- Commutative!! @@ -500,7 +498,7 @@ CartesianTensor(minix, dim, R): Exports == Implementation where for j in 0..ny-1 repeat set!(z, ioff + j, get(x,i) * get(y,j)) z - x * y == + x: % * y: % == rx := rank x ry := rank y rx = 0 => get(x,0) * y diff --git a/src/algebra/clifford.spad.pamphlet b/src/algebra/clifford.spad.pamphlet index 8e85a25d..2ae3cffb 100644 --- a/src/algebra/clifford.spad.pamphlet +++ b/src/algebra/clifford.spad.pamphlet @@ -285,10 +285,6 @@ CliffordAlgebra(n, K, Q): T == Impl where New ==> new(dim, 0$K)$Rep - x, y, z: % - c: K - m: Integer - characteristic == characteristic$K dimension() == dim::CardinalNumber @@ -300,13 +296,13 @@ CliffordAlgebra(n, K, Q): T == Impl where x + y == (z := New; for i in 0..dim-1 repeat z.i := x.i + y.i; z) x - y == (z := New; for i in 0..dim-1 repeat z.i := x.i - y.i; z) - x == (z := New; for i in 0..dim-1 repeat z.i := - x.i; z) - m * x == (z := New; for i in 0..dim-1 repeat z.i := m*x.i; z) - c * x == (z := New; for i in 0..dim-1 repeat z.i := c*x.i; z) + m: Integer * x: % == (z := New; for i in 0..dim-1 repeat z.i := m*x.i; z) + c: K * x: % == (z := New; for i in 0..dim-1 repeat z.i := c*x.i; z) 0 == New 1 == (z := New; z.0 := 1; z) - coerce(m): % == (z := New; z.0 := m::K; z) - coerce(c): % == (z := New; z.0 := c; z) + coerce(m: Integer): % == (z := New; z.0 := m::K; z) + coerce(c: K): % == (z := New; z.0 := c; z) e b == b::NNI > n => error "No such basis element" @@ -333,7 +329,7 @@ CliffordAlgebra(n, K, Q): T == Impl where z.bz := z.bz + c z - x * y == + x: % * y: % == z := New for ix in 0..dim-1 repeat if x.ix ~= 0 then for iy in 0..dim-1 repeat @@ -388,7 +384,7 @@ CliffordAlgebra(n, K, Q): T == Impl where be := reduce("*", ml) c = 1 => be c::Ex * be - coerce(x): Ex == + coerce(x: %): Ex == tl := [coerceMonom(x.i,i) for i in 0..dim-1 | not zero? x.i] null tl => "0"::Ex reduce("+", tl) diff --git a/src/algebra/derham.spad.pamphlet b/src/algebra/derham.spad.pamphlet index 6e526e21..1ff71c4c 100644 --- a/src/algebra/derham.spad.pamphlet +++ b/src/algebra/derham.spad.pamphlet @@ -75,7 +75,6 @@ ExtAlgBasis(): Export == Implement where Implement == add Rep := L I - x,y : % x = y == x =$Rep y @@ -105,7 +104,7 @@ ExtAlgBasis(): Export == Implement where Nul n == [0 for i in 1..n] - coerce x == coerce(x @ Rep)$(L I) + coerce(x: %) == coerce(x @ Rep)$(L I) @ \section{domain ANTISYM AntiSymm} diff --git a/src/algebra/fnla.spad.pamphlet b/src/algebra/fnla.spad.pamphlet index d2e6b579..4feb3a97 100644 --- a/src/algebra/fnla.spad.pamphlet +++ b/src/algebra/fnla.spad.pamphlet @@ -135,7 +135,6 @@ HallBasis() : Export == Implement where n = 0 => 1 n = 1 => d sum:I := 0 - m:I for m in 1..(n-1) repeat if n rem m = 0 then sum := sum + m * lfunc(d,m) diff --git a/src/algebra/fourier.spad.pamphlet b/src/algebra/fourier.spad.pamphlet index 70d7ff85..320e19a7 100644 --- a/src/algebra/fourier.spad.pamphlet +++ b/src/algebra/fourier.spad.pamphlet @@ -84,7 +84,6 @@ FourierSeries(R:Join(CommutativeRing,Algebra(Fraction Integer)), Rep := List Term multiply : (Term,Term) -> $ w,x1,x2:$ - t1,t2:Term n:NonNegativeInteger z:Integer e:FourierComponent(E) diff --git a/src/algebra/multpoly.spad.pamphlet b/src/algebra/multpoly.spad.pamphlet index b558f0af..b0a45dfc 100644 --- a/src/algebra/multpoly.spad.pamphlet +++ b/src/algebra/multpoly.spad.pamphlet @@ -694,12 +694,10 @@ IndexedExponents(Varset:OrderedSet): C == T where T == IndexedDirectProductOrderedAbelianMonoidSup(NonNegativeInteger,Varset) add Term:= Record(k:Varset,c:NonNegativeInteger) Rep:= List Term - x:% - t:Term - coerceOF(t):OutputForm == -- converts term to OutputForm + coerceOF(t: Term):OutputForm == -- converts term to OutputForm t.c = 1 => (t.k)::OutputForm (t.k)::OutputForm ** (t.c)::OutputForm - coerce(x):OutputForm == -- converts entire exponents to OutputForm + coerce(x: %):OutputForm == -- converts entire exponents to OutputForm null x => 1::Integer::OutputForm null rest x => coerceOF(first x) reduce("*",[coerceOF t for t in x]) diff --git a/src/algebra/pfr.spad.pamphlet b/src/algebra/pfr.spad.pamphlet index 6aec6821..a8de6b27 100644 --- a/src/algebra/pfr.spad.pamphlet +++ b/src/algebra/pfr.spad.pamphlet @@ -192,7 +192,6 @@ PartialFraction(R: EuclideanDomain): Cat == Capsule where b: % := compactFraction a null b.fract => b l : LfTerm := nil - s : fTerm f : R e,d: Integer for s in b.fract repeat @@ -215,7 +214,6 @@ PartialFraction(R: EuclideanDomain): Cat == Capsule where s : fTerm := [(first af).num,(first af).den]$fTerm f : R := nthFactor(s.den,1) e : Integer := nthExponent(s.den,1) - t : fTerm for t in rest af repeat f = nthFactor(t.den,1) => s.num := s.num + (t.num * @@ -237,7 +235,6 @@ PartialFraction(R: EuclideanDomain): Cat == Capsule where coerce(n): % == [(n :: R), nil()$LfTerm] coerce(a): Fraction R == q : Fraction R := (a.whole :: Fraction R) - s : fTerm for s in a.fract repeat q := q + (s.num / (expand s.den)) q @@ -291,7 +288,6 @@ PartialFraction(R: EuclideanDomain): Cat == Capsule where (a :: Fraction R) = (b :: Fraction R) - a == - s: fTerm l: LfTerm := nil for s in reverse a.fract repeat l := cons([- s.num,s.den]$fTerm,l) [- a.whole,l] @@ -301,7 +297,6 @@ PartialFraction(R: EuclideanDomain): Cat == Capsule where r = 1$R => a b : % := (r * a.whole) :: % c : % - s : fTerm for s in reverse a.fract repeat c := normalizeFracTerm [r * s.num, s.den]$fTerm b.whole := b.whole + c.whole @@ -320,7 +315,6 @@ PartialFraction(R: EuclideanDomain): Cat == Capsule where null b.fract => b.whole * a af : % := [0$R, a.fract]$% -- a - a.whole c: % := (a.whole * b) + (b.whole * af) - s,t : fTerm for s in a.fract repeat for t in b.fract repeat c := c + multiplyFracTerms(s,t) @@ -328,7 +322,6 @@ PartialFraction(R: EuclideanDomain): Cat == Capsule where coerce(a): Ex == null a.fract => a.whole :: Ex - s : fTerm l : List Ex if a.whole = 0 then l := nil else l := [a.whole :: Ex] for s in a.fract repeat diff --git a/src/algebra/polycat.spad.pamphlet b/src/algebra/polycat.spad.pamphlet index d3107611..13e15053 100644 --- a/src/algebra/polycat.spad.pamphlet +++ b/src/algebra/polycat.spad.pamphlet @@ -138,7 +138,7 @@ FiniteAbelianMonoidRing(R:Ring, E:OrderedAbelianMonoid): Category == if R has CommutativeRing then binomThmExpt(x,y,nn) == nn = 0 => 1$% - ans,xn,yn: % + ans,yn: % bincoef: Integer powl: List(%):= [x] for i in 2..nn repeat powl:=[x * powl.first, :powl] diff --git a/src/algebra/tree.spad.pamphlet b/src/algebra/tree.spad.pamphlet index be99d1f7..5a56673f 100644 --- a/src/algebra/tree.spad.pamphlet +++ b/src/algebra/tree.spad.pamphlet @@ -55,10 +55,6 @@ Tree(S: SetCategory): T==C where 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 == @@ -89,8 +85,8 @@ Tree(S: SetCategory): T==C where for c in children t repeat map!(fn, c) t tree(s,lt) == [[s,lt]] - tree(s) == [[s,[]]] - tree(ls) == + tree(s: S) == [[s,[]]] + tree(ls: List S) == empty? ls => empty() tree(first ls, [tree s for s in rest ls]) value t == |