A Betti tally is a special type of
Tally that is printed as a display of graded Betti numbers. The class was created so the function
betti could return something that both prints nicely and from which information can be extracted. The keys are pairs
(i,d), where
i is the homological degree, and
d is a list of integers giving a multidegree. Only the first component of
d is used in printing.
i1 : t = new BettiTally from { (0,{0}) => 1, (1,{1}) => 2, (2,{3}) => 3, (2,{4}) => 4 }
0 1 2
o1 = total: 1 2 7
0: 1 2 .
1: . . 3
2: . . 4
o1 : BettiTally
|
i2 : peek oo
o2 = BettiTally{(0, {0}) => 1}
(1, {1}) => 2
(2, {3}) => 3
(2, {4}) => 4
|
i3 : t#(2,{4})
o3 = 4
|
For convenience, the operations of direct sum (
++), tensor product (
**),
dual, and degree shifting (numbers in brackets), have been implemented for Betti tallies. These operations mimic the corresponding operations on chain complexes.
i4 : t ++ t[-5]
0 1 2 3 4 5 6 7
o4 = total: 1 2 7 . . 1 2 7
-5: . . . . . 1 2 .
-4: . . . . . . . 3
-3: . . . . . . . 4
-2: . . . . . . . .
-1: . . . . . . . .
0: 1 2 . . . . . .
1: . . 3 . . . . .
2: . . 4 . . . . .
o4 : BettiTally
|
i5 : t ** t
0 1 2 3 4
o5 = total: 1 4 18 28 49
0: 1 4 4 . .
1: . . 6 12 .
2: . . 8 16 9
3: . . . . 24
4: . . . . 16
o5 : BettiTally
|
i6 : dual t
-2 -1 0
o6 = total: 7 2 1
-2: 4 . .
-1: 3 . .
0: . 2 1
o6 : BettiTally
|