Good day everyone,
I am trying to get to grips with CombinatorialFreeModules. The combinatorial basis I am trying to use is 3-coloured partitions. But I'm not sure how to correctly define combinatorial classes.
What I've done so far is the following:
def genThreeColouredPartitions(weight): #generates all triples of partitions with total weight equal to 'weight'
threecolouredpart= []
for i in range(weight+1):
for j in range(weight-i+1):
threecolouredpart+=[[x,y,z] for x in Partitions(i) for y in Partitions(j) for z in Partitions(weight-i-j)]
return threecolouredpart
If I try to use these 3-coloured partitions to define a Combinatorial free module things don't work the way I expect.
M = CombinatorialFreeModule(QQbar,FiniteCombinatorialClass(genThreeColouredPartitions(2))); M
Output=
Free module generated by Combinatorial class with elements in [[[], [],
[2]], [[], [], [1, 1]], [[], [1], [1]], [[], [2], []], [[], [1, 1], []],
[[1], [], [1]], [[1], [1], []], [[2], [], []], [[1, 1], [], []]] over
Algebraic Field
e=M.basis();e
Output=
Lazy family (Term map from Combinatorial class with elements in [[[],
[], [2]], [[], [], [1, 1]], [[], [1], [1]], [[], [2], []], [[], [1, 1],
[]], [[1], [], [1]], [[1], [1], []], [[2], [], []], [[1, 1], [], []]] to
Free module generated by Combinatorial class with elements in [[[], [],
[2]], [[], [], [1, 1]], [[], [1], [1]], [[], [2], []], [[], [1, 1], []],
[[1], [], [1]], [[1], [1], []], [[2], [], []], [[1, 1], [], []]] over
Algebraic Field(i))_{i in Combinatorial class with elements in [[[], [],
[2]], [[], [], [1, 1]], [[], [1], [1]], [[], [2], []], [[], [1, 1], []],
[[1], [], [1]], [[1], [1], []], [[2], [], []], [[1, 1], [], []]]}
Why is this a lazy family and not a finite family? I do not seem to be able to iterate over the basis.
for i in e:
i
Output=
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "_sage_input_11.py", line 10, in <module>
exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("Zm9yIGkgaW4gZToKICAgIGk="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
File "", line 1, in <module>
File "/tmp/tmpm0bNnU/___code___.py", line 2, in <module>
exec compile(u'for i in e:\n i
File "", line 1, in <module>
File "/home/sageuser/sage/local/lib/python2.7/site-packages/sage/sets/family.py", line 952, in __iter__
yield self[i]
File "/home/sageuser/sage/local/lib/python2.7/site-packages/sage/sets/family.py", line 968, in __getitem__
return self.function(i)
File "/home/sageuser/sage/local/lib/python2.7/site-packages/sage/categories/poor_man_map.py", line 125, in __call__
return self._function(*args)
File "/home/sageuser/sage/local/lib/python2.7/site-packages/sage/combinat/free_module.py", line 2176, in _monomial
return self._from_dict( {index: self.base_ring().one()}, remove_zeros = False )
TypeError: unhashable type: 'list'
Can anyone tell me what I am doing wrong?