Module: sage.combinat.partition_algebra
Partition/Diagram Algebras
Module-level Functions
| letter, k) |
sage: from sage.combinat.partition_algebra import create_set_partition_function
sage: create_set_partition_function('A', 3)
Set partitions of {1, ..., 3, -1, ..., -3}
| k) |
Returns the identity set partition 1, -1, ..., k, -k
sage: import sage.combinat.partition_algebra as pa
sage: pa.identity(2)
{{2, -2}, {1, -1}}
| sp) |
Returns True if the diagram corresponding to the set partition is planar; otherwise, it returns False.
sage: import sage.combinat.partition_algebra as pa sage: pa.is_planar( pa.to_set_partition([[1,-2],[2,-1]])) False sage: pa.is_planar( pa.to_set_partition([[1,-1],[2,-2]])) True
| sp1, sp2) |
Returns a graph consisting of the graphs of set partitions sp1 and sp2 along with edges joining the bottom row (negative numbers) of sp1 to the top row (positive numbers) of sp2.
sage: import sage.combinat.partition_algebra as pa sage: sp1 = pa.to_set_partition([[1,-2],[2,-1]]) sage: sp2 = pa.to_set_partition([[1,-2],[2,-1]]) sage: g = pa.pair_to_graph( sp1, sp2 ); g Graph on 8 vertices
sage: g.vertices() #random [(1, 2), (-1, 1), (-2, 2), (-1, 2), (-2, 1), (2, 1), (2, 2), (1, 1)] sage: g.edges() #random [((1, 2), (-1, 1), None), ((1, 2), (-2, 2), None), ((-1, 1), (2, 1), None), ((-1, 2), (2, 2), None), ((-2, 1), (1, 1), None), ((-2, 1), (2, 2), None)]
| sp) |
Returns the propagating number of the set partition sp. The propagating number is the number of blocks with both a positive and negative number.
sage: import sage.combinat.partition_algebra as pa sage: sp1 = pa.to_set_partition([[1,-2],[2,-1]]) sage: sp2 = pa.to_set_partition([[1,2],[-2,-1]]) sage: pa.propagating_number(sp1) 2 sage: pa.propagating_number(sp2) 0
| sp1, sp2) |
Returns a tuple consisting of the composition of the set partitions sp1 and sp2 and the number of components removed from the middle rows of the graph.
sage: import sage.combinat.partition_algebra as pa sage: sp1 = pa.to_set_partition([[1,-2],[2,-1]]) sage: sp2 = pa.to_set_partition([[1,-2],[2,-1]]) sage: pa.set_partition_composition(sp1, sp2) == (pa.identity(2), 0) True
| sp) |
Returns a graph representing the set partition sp.
sage: import sage.combinat.partition_algebra as pa sage: g = pa.to_graph( pa.to_set_partition([[1,-2],[2,-1]])); g Graph on 4 vertices
sage: g.vertices() #random [1, 2, -2, -1] sage: g.edges() #random [(1, -2, None), (2, -1, None)]
| l, [k=None]) |
Coverts a list of a list of numbers to a set partitions. Each list of numbers in the outer list specifies the numbers contained in one of the blocks in the set partition.
If k is specified, then the set partition will be a set partition of 1, ..., k, -1, ..., -k. Otherwise, k will default to the minimum number needed to contain all of the specified numbers.
sage: import sage.combinat.partition_algebra as pa sage: pa.to_set_partition([[1,-1],[2,-2]]) == pa.identity(2) True
Class: PartitionAlgebra_ak
| self, R, k, n, [name=None]) |
sage: from sage.combinat.partition_algebra import * sage: p = PartitionAlgebra_ak(QQ, 3, 1) sage: p == loads(dumps(p)) True
Special Functions: __init__
Class: PartitionAlgebra_bk
| self, R, k, n, [name=None]) |
sage: from sage.combinat.partition_algebra import * sage: p = PartitionAlgebra_bk(QQ, 3, 1) sage: p == loads(dumps(p)) True
Special Functions: __init__
Class: PartitionAlgebra_generic
| self, R, cclass, n, k, [name=None], [prefix=None]) |
sage: from sage.combinat.partition_algebra import * sage: s = PartitionAlgebra_sk(QQ, 3, 1) sage: s == loads(dumps(s)) True
Special Functions: __init__,
_multiply_basis
| self, left, right) |
sage: from sage.combinat.partition_algebra import * sage: s = PartitionAlgebra_sk(QQ, 3, 1) sage: t12 = s(Set([Set([1,-2]),Set([2,-1]),Set([3,-3])])) sage: t12^2 == s(1) #indirect doctest True
Class: PartitionAlgebra_pk
| self, R, k, n, [name=None]) |
sage: from sage.combinat.partition_algebra import * sage: p = PartitionAlgebra_pk(QQ, 3, 1) sage: p == loads(dumps(p)) True
Special Functions: __init__
Class: PartitionAlgebra_prk
| self, R, k, n, [name=None]) |
sage: from sage.combinat.partition_algebra import * sage: p = PartitionAlgebra_prk(QQ, 3, 1) sage: p == loads(dumps(p)) True
Special Functions: __init__
Class: PartitionAlgebra_rk
| self, R, k, n, [name=None]) |
sage: from sage.combinat.partition_algebra import * sage: p = PartitionAlgebra_rk(QQ, 3, 1) sage: p == loads(dumps(p)) True
Special Functions: __init__
Class: PartitionAlgebra_sk
| self, R, k, n, [name=None]) |
sage: from sage.combinat.partition_algebra import * sage: p = PartitionAlgebra_sk(QQ, 3, 1) sage: p == loads(dumps(p)) True
Special Functions: __init__
Class: PartitionAlgebra_tk
| self, R, k, n, [name=None]) |
sage: from sage.combinat.partition_algebra import * sage: p = PartitionAlgebra_tk(QQ, 3, 1) sage: p == loads(dumps(p)) True
Special Functions: __init__
Class: PartitionAlgebraElement_ak
Class: PartitionAlgebraElement_bk
Class: PartitionAlgebraElement_generic
Class: PartitionAlgebraElement_pk
Class: PartitionAlgebraElement_prk
Class: PartitionAlgebraElement_rk
Class: PartitionAlgebraElement_sk
Class: PartitionAlgebraElement_tk
Class: SetPartitionsAk_k
| self, k) |
TESTS:
sage: A3 = SetPartitionsAk(3); A3
Set partitions of {1, ..., 3, -1, ..., -3}
sage: A3 == loads(dumps(A3))
True
Special Functions: __init__,
__repr__
| self) |
TESTS:
sage: repr(SetPartitionsAk(3))
'Set partitions of {1, ..., 3, -1, ..., -3}'
Class: SetPartitionsAkhalf_k
| self, k) |
TESTS:
sage: A2p5 = SetPartitionsAk(2.5); A2p5
Set partitions of {1, ..., 3, -1, ..., -3} with 3 and -3 in the same block
sage: A2p5 == loads(dumps(A2p5))
True
Functions: count,
iterator
| self) |
TESTS:
sage: SetPartitionsAk(1.5).count() 5 sage: SetPartitionsAk(2.5).count() 52 sage: SetPartitionsAk(3.5).count() 877
| self) |
TESTS:
sage: SetPartitionsAk(1.5).list() #random
[{{1, 2, -2, -1}},
{{2, -2, -1}, {1}},
{{2, -2}, {1, -1}},
{{-1}, {1, 2, -2}},
{{-1}, {2, -2}, {1}}]
sage: ks = [ 1.5, 2.5, 3.5 ] sage: aks = map(SetPartitionsAk, ks) sage: all([ak.count() == len(ak.list()) for ak in aks]) True
Special Functions: __contains__,
__init__,
__repr__
| self, x) |
TESTS:
sage: A2p5 = SetPartitionsAk(2.5) sage: all([ sp in A2p5 for sp in A2p5]) True sage: A3 = SetPartitionsAk(3) sage: len(filter(lambda x: x in A2p5, A3)) 52 sage: A2p5.count() 52
| self) |
TESTS:
sage: repr(SetPartitionsAk(2.5))
'Set partitions of {1, ..., 3, -1, ..., -3} with 3 and -3 in the same
block'
Class: SetPartitionsBk_k
Functions: count,
iterator
| self) |
Returns the number of set partitions in B_k where k is an integer. This is given by (2k)!! = (2k-1)*(2k-3)*...*5*3*1.
sage: SetPartitionsBk(3).count() 15 sage: SetPartitionsBk(2).count() 3 sage: SetPartitionsBk(1).count() 1 sage: SetPartitionsBk(4).count() 105 sage: SetPartitionsBk(5).count() 945
| self) |
TESTS:
sage: SetPartitionsBk(1).list()
[{{1, -1}}]
sage: SetPartitionsBk(2).list() #random
[{{2, -1}, {1, -2}}, {{2, -2}, {1, -1}}, {{1, 2}, {-1, -2}}]
sage: SetPartitionsBk(3).list() #random
[{{2, -2}, {1, -3}, {3, -1}},
{{2, -1}, {1, -3}, {3, -2}},
{{1, -3}, {2, 3}, {-1, -2}},
{{3, -1}, {1, -2}, {2, -3}},
{{3, -2}, {1, -1}, {2, -3}},
{{1, 3}, {2, -3}, {-1, -2}},
{{2, -1}, {3, -3}, {1, -2}},
{{2, -2}, {3, -3}, {1, -1}},
{{1, 2}, {3, -3}, {-1, -2}},
{{-3, -2}, {2, 3}, {1, -1}},
{{1, 3}, {-3, -2}, {2, -1}},
{{1, 2}, {3, -1}, {-3, -2}},
{{-3, -1}, {2, 3}, {1, -2}},
{{1, 3}, {-3, -1}, {2, -2}},
{{1, 2}, {3, -2}, {-3, -1}}]
Check to make sure that the number of elements generated is the same as what is given by count()
sage: bks = [ SetPartitionsBk(i) for i in range(1, 6) ] sage: all( [ bk.count() == len(bk.list()) for bk in bks] ) True
Special Functions: __contains__,
__repr__
| self, x) |
TESTS:
sage: B3 = SetPartitionsBk(3) sage: A3 = SetPartitionsAk(3) sage: len(filter(lambda x: x in B3, A3)) 15 sage: B3.count() 15
| self) |
TESTS:
sage: repr(SetPartitionsBk(2.5))
'Set partitions of {1, ..., 3, -1, ..., -3} with 3 and -3 in the same block
and with block size 2'
Class: SetPartitionsBkhalf_k
Functions: count,
iterator
| self) |
TESTS:
sage: B3p5 = SetPartitionsBk(3.5) sage: B3p5.count() 15
| self) |
TESTS:
sage: B3p5 = SetPartitionsBk(3.5) sage: B3p5.count() 15
sage: B3p5.list() #random
[{{2, -2}, {1, -3}, {4, -4}, {3, -1}},
{{2, -1}, {1, -3}, {4, -4}, {3, -2}},
{{1, -3}, {2, 3}, {4, -4}, {-1, -2}},
{{2, -3}, {1, -2}, {4, -4}, {3, -1}},
{{2, -3}, {1, -1}, {4, -4}, {3, -2}},
{{1, 3}, {4, -4}, {2, -3}, {-1, -2}},
{{2, -1}, {3, -3}, {1, -2}, {4, -4}},
{{2, -2}, {3, -3}, {1, -1}, {4, -4}},
{{1, 2}, {3, -3}, {4, -4}, {-1, -2}},
{{-3, -2}, {2, 3}, {1, -1}, {4, -4}},
{{1, 3}, {-3, -2}, {2, -1}, {4, -4}},
{{1, 2}, {-3, -2}, {4, -4}, {3, -1}},
{{-3, -1}, {2, 3}, {1, -2}, {4, -4}},
{{1, 3}, {-3, -1}, {2, -2}, {4, -4}},
{{1, 2}, {-3, -1}, {4, -4}, {3, -2}}]
Special Functions: __contains__,
__repr__
| self, x) |
TESTS:
sage: A3 = SetPartitionsAk(3) sage: B2p5 = SetPartitionsBk(2.5) sage: all([ sp in B2p5 for sp in B2p5 ]) True sage: len(filter(lambda x: x in B2p5, A3)) 3 sage: B2p5.count() 3
| self) |
TESTS:
sage: repr(SetPartitionsBk(2.5))
'Set partitions of {1, ..., 3, -1, ..., -3} with 3 and -3 in the same block
and with block size 2'
Class: SetPartitionsIk_k
Functions: count,
iterator
| self) |
TESTS:
sage: SetPartitionsIk(2).count() 13
| self) |
TESTS:
sage: SetPartitionsIk(2).list() #random indirect test
[{{1, 2, -1, -2}},
{{2, -1, -2}, {1}},
{{2}, {1, -1, -2}},
{{-1}, {1, 2, -2}},
{{-2}, {1, 2, -1}},
{{1, 2}, {-1, -2}},
{{2}, {-1, -2}, {1}},
{{-1}, {2, -2}, {1}},
{{-2}, {2, -1}, {1}},
{{-1}, {2}, {1, -2}},
{{-2}, {2}, {1, -1}},
{{-1}, {-2}, {1, 2}},
{{-1}, {-2}, {2}, {1}}]
Special Functions: __contains__,
__repr__
| self, x) |
TESTS:
sage: I3 = SetPartitionsIk(3) sage: A3 = SetPartitionsAk(3) sage: all([ sp in I3 for sp in I3]) True sage: len(filter(lambda x: x in I3, A3)) 197 sage: I3.count() 197
| self) |
TESTS:
sage: repr(SetPartitionsIk(3))
'Set partitions of {1, ..., 3, -1, ..., -3} with propagating number < 3'
Class: SetPartitionsIkhalf_k
Functions: count,
iterator
| self) |
TESTS:
sage: SetPartitionsIk(1.5).count() 4 sage: SetPartitionsIk(2.5).count() 50 sage: SetPartitionsIk(3.5).count() 871
| self) |
TESTS:
sage: SetPartitionsIk(1.5).list() #random
[{{1, 2, -2, -1}},
{{2, -2, -1}, {1}},
{{-1}, {1, 2, -2}},
{{-1}, {2, -2}, {1}}]
Special Functions: __contains__,
__repr__
| self, x) |
TESTS:
sage: I2p5 = SetPartitionsIk(2.5) sage: A3 = SetPartitionsAk(3) sage: all([ sp in I2p5 for sp in I2p5]) True sage: len(filter(lambda x: x in I2p5, A3)) 50 sage: I2p5.count() 50
| self) |
TESTS:
sage: repr(SetPartitionsIk(2.5))
'Set partitions of {1, ..., 3, -1, ..., -3} with 3 and -3 in the same block
and propagating number < 3'
Class: SetPartitionsPk_k
Functions: count,
iterator
| self) |
TESTS:
sage: SetPartitionsPk(2).count() 14 sage: SetPartitionsPk(3).count() 132 sage: SetPartitionsPk(4).count() 1430
| self) |
TESTS:
sage: SetPartitionsPk(2).list() #random indirect test
[{{1, 2, -1, -2}},
{{2, -1, -2}, {1}},
{{2}, {1, -1, -2}},
{{-1}, {1, 2, -2}},
{{-2}, {1, 2, -1}},
{{2, -2}, {1, -1}},
{{1, 2}, {-1, -2}},
{{2}, {-1, -2}, {1}},
{{-1}, {2, -2}, {1}},
{{-2}, {2, -1}, {1}},
{{-1}, {2}, {1, -2}},
{{-2}, {2}, {1, -1}},
{{-1}, {-2}, {1, 2}},
{{-1}, {-2}, {2}, {1}}]
Special Functions: __contains__,
__repr__
| self, x) |
TESTS:
sage: P3 = SetPartitionsPk(3) sage: A3 = SetPartitionsAk(3) sage: len(filter(lambda x: x in P3, A3)) 132 sage: P3.count() 132 sage: all([sp in P3 for sp in P3]) True
| self) |
TESTS:
sage: repr(SetPartitionsPk(3))
'Set partitions of {1, ..., 3, -1, ..., -3} that are planar'
Class: SetPartitionsPkhalf_k
Functions: count,
iterator
| self) |
TESTS:
sage: SetPartitionsPk(2.5).count() 42 sage: SetPartitionsPk(1.5).count() 5
| self) |
TESTS:
sage: SetPartitionsPk(1.5).list() #random
[{{1, 2, -2, -1}},
{{2, -2, -1}, {1}},
{{2, -2}, {1, -1}},
{{-1}, {1, 2, -2}},
{{-1}, {2, -2}, {1}}]
Special Functions: __contains__,
__repr__
| self, x) |
TESTS:
sage: A3 = SetPartitionsAk(3) sage: P2p5 = SetPartitionsPk(2.5) sage: all([ sp in P2p5 for sp in P2p5 ]) True sage: len(filter(lambda x: x in P2p5, A3)) 42 sage: P2p5.count() 42
| self) |
TESTS:
sage: repr( SetPartitionsPk(2.5) )
'Set partitions of {1, ..., 3, -1, ..., -3} with 3 and -3 in the same block
and that are planar'
Class: SetPartitionsPRk_k
| self, k) |
TESTS:
sage: PR3 = SetPartitionsPRk(3); PR3
Set partitions of {1, ..., 3, -1, ..., -3} with at most 1 positive and
negative entry in each block and that are planar
sage: PR3 == loads(dumps(PR3))
True
Functions: count,
iterator
| self) |
TESTS:
sage: SetPartitionsPRk(2).count() 6 sage: SetPartitionsPRk(3).count() 20 sage: SetPartitionsPRk(4).count() 70 sage: SetPartitionsPRk(5).count() 252
| self) |
TESTS:
sage: len(SetPartitionsPRk(3).list() ) == SetPartitionsPRk(3).count() True
Special Functions: __contains__,
__init__,
__repr__
| self, x) |
TESTS:
sage: PR3 = SetPartitionsPRk(3) sage: A3 = SetPartitionsAk(3) sage: all([ sp in PR3 for sp in PR3]) True sage: len(filter(lambda x: x in PR3, A3)) 20 sage: PR3.count() 20
| self) |
TESTS:
sage: repr(SetPartitionsPRk(3))
'Set partitions of {1, ..., 3, -1, ..., -3} with at most 1 positive and
negative entry in each block and that are planar'
Class: SetPartitionsPRkhalf_k
Functions: count,
iterator
| self) |
TESTS:
sage: SetPartitionsPRk(2.5).count() 6 sage: SetPartitionsPRk(3.5).count() 20 sage: SetPartitionsPRk(4.5).count() 70
| self) |
TESTS:
sage: list(SetPartitionsPRk(2.5).iterator())
[{{-2}, {-1}, {3, -3}, {2}, {1}},
{{-2}, {3, -3}, {2}, {1, -1}},
{{-1}, {3, -3}, {2}, {1, -2}},
{{-2}, {2, -1}, {3, -3}, {1}},
{{-1}, {2, -2}, {3, -3}, {1}},
{{2, -2}, {3, -3}, {1, -1}}]
sage: len(_)
6
Special Functions: __contains__,
__repr__
| self, x) |
TESTS:
sage: A3 = SetPartitionsAk(3) sage: PR2p5 = SetPartitionsPRk(2.5) sage: all([ sp in PR2p5 for sp in PR2p5 ]) True sage: len(filter(lambda x: x in PR2p5, A3)) 6 sage: PR2p5.count() 6
| self) |
TESTS:
sage: repr(SetPartitionsPRk(2.5))
'Set partitions of {1, ..., 3, -1, ..., -3} with 3 and -3 in the same block
and with at most 1 positive and negative entry in each block and that are
planar'
Class: SetPartitionsRk_k
| self, k) |
TESTS:
sage: R3 = SetPartitionsRk(3); R3
Set partitions of {1, ..., 3, -1, ..., -3} with at most 1 positive and
negative entry in each block
sage: R3 == loads(dumps(R3))
True
Functions: count,
iterator
| self) |
TESTS:
sage: SetPartitionsRk(2).count() 7 sage: SetPartitionsRk(3).count() 34 sage: SetPartitionsRk(4).count() 209 sage: SetPartitionsRk(5).count() 1546
| self) |
TESTS:
sage: len(SetPartitionsRk(3).list() ) == SetPartitionsRk(3).count() True
Special Functions: __contains__,
__init__,
__repr__
| self, x) |
TESTS:
sage: R3 = SetPartitionsRk(3) sage: A3 = SetPartitionsAk(3) sage: all([ sp in R3 for sp in R3]) True sage: len(filter(lambda x: x in R3, A3)) 34 sage: R3.count() 34
| self) |
TESTS:
sage: repr(SetPartitionsRk(3))
'Set partitions of {1, ..., 3, -1, ..., -3} with at most 1 positive and
negative entry in each block'
Class: SetPartitionsRkhalf_k
Functions: count,
iterator
| self) |
TESTS:
sage: SetPartitionsRk(2.5).count() 7 sage: SetPartitionsRk(3.5).count() 34 sage: SetPartitionsRk(4.5).count() 209
| self) |
TESTS:
sage: R2p5 = SetPartitionsRk(2.5)
sage: list(R2p5.iterator()) #random due to sets
[{{-2}, {-1}, {3, -3}, {2}, {1}},
{{-2}, {3, -3}, {2}, {1, -1}},
{{-1}, {3, -3}, {2}, {1, -2}},
{{-2}, {2, -1}, {3, -3}, {1}},
{{-1}, {2, -2}, {3, -3}, {1}},
{{2, -2}, {3, -3}, {1, -1}},
{{2, -1}, {3, -3}, {1, -2}}]
sage: len(_)
7
Special Functions: __contains__,
__repr__
| self, x) |
TESTS:
sage: A3 = SetPartitionsAk(3) sage: R2p5 = SetPartitionsRk(2.5) sage: all([ sp in R2p5 for sp in R2p5 ]) True sage: len(filter(lambda x: x in R2p5, A3)) 7 sage: R2p5.count() 7
| self) |
TESTS:
sage: repr(SetPartitionsRk(2.5))
'Set partitions of {1, ..., 3, -1, ..., -3} with 3 and -3 in the same block
and with at most 1 positive and negative entry in each block'
Class: SetPartitionsSk_k
Functions: count,
iterator
| self) |
Returns k!.
TESTS:
sage: SetPartitionsSk(2).count() 2 sage: SetPartitionsSk(3).count() 6 sage: SetPartitionsSk(4).count() 24 sage: SetPartitionsSk(5).count() 120
| self) |
TESTS:
sage: SetPartitionsSk(3).list() #random
[{{2, -2}, {3, -3}, {1, -1}},
{{1, -1}, {2, -3}, {3, -2}},
{{2, -1}, {3, -3}, {1, -2}},
{{1, -2}, {2, -3}, {3, -1}},
{{1, -3}, {2, -1}, {3, -2}},
{{1, -3}, {2, -2}, {3, -1}}]
sage: ks = range(1, 6)
sage: sks = map(SetPartitionsSk, ks)
sage: all([ sk.count() == len(sk.list()) for sk in sks])
True
Special Functions: __contains__,
__repr__
| self, x) |
TESTS:
sage: A3 = SetPartitionsAk(3) sage: S3 = SetPartitionsSk(3) sage: all([ sp in S3 for sp in S3]) True sage: S3.count() 6 sage: len(filter(lambda x: x in S3, A3)) 6
| self) |
TESTS:
sage: repr(SetPartitionsSk(3))
'Set partitions of {1, ..., 3, -1, ..., -3} with propagating number 3'
Class: SetPartitionsSkhalf_k
Functions: count,
iterator
| self) |
TESTS:
sage: SetPartitionsSk(2.5).count() 2 sage: SetPartitionsSk(3.5).count() 6 sage: SetPartitionsSk(4.5).count() 24
sage: ks = [2.5, 3.5, 4.5, 5.5] sage: sks = [SetPartitionsSk(k) for k in ks] sage: all([ sk.count() == len(sk.list()) for sk in sks]) True
| self) |
TESTS:
sage: SetPartitionsSk(3.5).list() #random indirect test
[{{2, -2}, {3, -3}, {1, -1}, {4, -4}},
{{2, -3}, {1, -1}, {4, -4}, {3, -2}},
{{2, -1}, {3, -3}, {1, -2}, {4, -4}},
{{2, -3}, {1, -2}, {4, -4}, {3, -1}},
{{1, -3}, {2, -1}, {4, -4}, {3, -2}},
{{1, -3}, {2, -2}, {4, -4}, {3, -1}}]
Special Functions: __contains__,
__repr__
| self, x) |
TESTS:
sage: S2p5 = SetPartitionsSk(2.5) sage: A3 = SetPartitionsAk(3) sage: all([sp in S2p5 for sp in S2p5]) True sage: len(filter(lambda x: x in S2p5, A3)) 2 sage: S2p5.count() 2
| self) |
TESTS:
sage: repr(SetPartitionsSk(2.5))
'Set partitions of {1, ..., 3, -1, ..., -3} with 3 and -3 in the same block
and propagating number 3'
Class: SetPartitionsTk_k
Functions: count,
iterator
| self) |
TESTS:
sage: SetPartitionsTk(2).count() 2 sage: SetPartitionsTk(3).count() 5 sage: SetPartitionsTk(4).count() 14 sage: SetPartitionsTk(5).count() 42
| self) |
TESTS:
sage: SetPartitionsTk(3).list() #random
[{{1, -3}, {2, 3}, {-1, -2}},
{{2, -2}, {3, -3}, {1, -1}},
{{1, 2}, {3, -3}, {-1, -2}},
{{-3, -2}, {2, 3}, {1, -1}},
{{1, 2}, {3, -1}, {-3, -2}}]
Special Functions: __contains__,
__repr__
| self, x) |
TESTS:
sage: T3 = SetPartitionsTk(3) sage: A3 = SetPartitionsAk(3) sage: all([ sp in T3 for sp in T3]) True sage: len(filter(lambda x: x in T3, A3)) 5 sage: T3.count() 5
| self) |
TESTS:
sage: repr(SetPartitionsTk(3))
'Set partitions of {1, ..., 3, -1, ..., -3} with block size 2 and that are
planar'
Class: SetPartitionsTkhalf_k
Functions: count,
iterator
| self) |
TESTS:
sage: SetPartitionsTk(2.5).count() 2 sage: SetPartitionsTk(3.5).count() 5 sage: SetPartitionsTk(4.5).count() 14
| self) |
TESTS:
sage: SetPartitionsTk(3.5).list() #random
[{{1, -3}, {2, 3}, {4, -4}, {-1, -2}},
{{2, -2}, {3, -3}, {1, -1}, {4, -4}},
{{1, 2}, {3, -3}, {4, -4}, {-1, -2}},
{{-3, -2}, {2, 3}, {1, -1}, {4, -4}},
{{1, 2}, {-3, -2}, {4, -4}, {3, -1}}]
Special Functions: __contains__,
__repr__
| self, x) |
TESTS:
sage: A3 = SetPartitionsAk(3) sage: T2p5 = SetPartitionsTk(2.5) sage: all([ sp in T2p5 for sp in T2p5 ]) True sage: len(filter(lambda x: x in T2p5, A3)) 2 sage: T2p5.count() 2
| self) |
TESTS:
sage: repr(SetPartitionsTk(2.5))
'Set partitions of {1, ..., 3, -1, ..., -3} with 3 and -3 in the same block
and with block size 2 and that are planar'