ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 25 Jun 2018 14:12:25 -0500codomain could not be determinedhttp://ask.sagemath.org/question/42732/codomain-could-not-be-determined/ I created an InfiniteDimensionalFreeAlgebra using CombinatorialFreeModule. It looks something like this:
class InfiniteDimensionalFreeAlgebra(CombinatorialFreeModule):
r""" The algebra generated by ``a[0], a[1], a[2], ...`` over the integers. """
def __init__(self,
base_ring=IntegerRing(),
prefix='a',
index_set=NonNegativeIntegerSemiring()):
self._base_ring = base_ring
self._basis_monoid = FreeMonoid(index_set=index_set, commutative=True, prefix=prefix)
# category
category = Algebras(self._base_ring.category()).WithBasis().Commutative()
category = category.or_subcategory(category)
# init
CombinatorialFreeModule.__init__(
self,
self._base_ring,
self._basis_monoid,
category=category,
prefix='',
bracket=False)
Now I want to view it as a *ring* and take symmetric polynomials over the ring. For example, in 2 variables, the following is one such symmetric polynomial:
2a[7] * x[1] + 2a[7] * x[2] + x[1]x[2] + 5
In my code, I attempt to initialize some Schur symmetric functions over this ring with something like:
a = InfiniteDimensionalFreeAlgebra()
sym = SymmetricFunctions(a)
s = sym.s()
one = s.one()
one_poly = one.expand(2)
at which point I run into the error `codomain could not be determined` when it attempts to apply some sort of morphism to the Schur function `one`. The full stacktrace is
Traceback (most recent call last):
File "./test_all.py", line 1162, in <module>
h = double_homogeneous(1, 1)
File "/Users/Matthew/programming/sage/morse-code/k_combinat_for_sage/all.py", line 664, in double_homogeneous
one_poly = one.expand(n)
File "/Users/Matthew/programming/sage/official-git-repo/local/lib/python2.7/site-packages/sage/combinat/sf/schur.py", line 537, in expand
return self._expand(condition, n, alphabet)
File "/Users/Matthew/programming/sage/official-git-repo/local/lib/python2.7/site-packages/sage/combinat/sf/sfa.py", line 4986, in _expand
return parent._apply_module_morphism(self, f)
File "/Users/Matthew/programming/sage/official-git-repo/local/lib/python2.7/site-packages/sage/categories/modules_with_basis.py", line 1096, in _apply_module_morphism
raise ValueError('codomain could not be determined')
ValueError: codomain could not be determined
and the full code can be found at [k_combinat_for_sage](https://github.com/MareoRaft/k_combinat_for_sage/blob/master/k_combinat_for_sage/all.py).
Thank you, your help is greatly appreciated.ml9nnMon, 25 Jun 2018 14:12:25 -0500http://ask.sagemath.org/question/42732/