aboutsummaryrefslogtreecommitdiff
path: root/src/algebra/combinat.spad.pamphlet
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2011-10-25 03:47:29 +0000
committerdos-reis <gdr@axiomatics.org>2011-10-25 03:47:29 +0000
commit2092a554d70524bc90440d96367e32c9ede28ee8 (patch)
treef60d455b9d03bfe6454bb2ae33b82114aeb3f91b /src/algebra/combinat.spad.pamphlet
parent99aeb02edd1614d30e308a9267325f138617d58f (diff)
downloadopen-axiom-2092a554d70524bc90440d96367e32c9ede28ee8.tar.gz
* 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.
Diffstat (limited to 'src/algebra/combinat.spad.pamphlet')
-rw-r--r--src/algebra/combinat.spad.pamphlet20
1 files changed, 13 insertions, 7 deletions
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