Dear S., On 2018-11-20, VulK <etn45...@gmail.com> wrote: > I am trying to implement the ring of coordinates of a Lie group in the > perspective of Peter-Weyl theorem. > > Concretely I would like to define a polynomial ring with infinitely many > generators each depending on two points on a lattice. These generators > satisfy many relations but, for the moment, I am happy to forget this fact. > Is this possible in the current sage framework? Which are the classes I > should inherit from? > > From a quick look at available classes it looks like InfinitePolynomialRing > and InfinitePolynomial might be the one I am after but I do not see how to > change the indexing sets as I need apart from brute force: I could keep a > dictionary and hack _repr_ accordingly. Any better idea?
I guess as the author of InfinitePolynomial*, I should chime in. Unfortunately I don't know the background of what you want to achieve. In particular, I don't know what indexing set you need. Of course, changing _repr_ in a sub-class is not a hack but common usage. Perhaps I should try to explain the purpose of InfinitePolynomial: You have a finite list of symbols and for each symbol you have a family of generators indexed by natural numbers. Together, they generate a free commutative K-algebra R (an "infinite polynomial ring"), where K is a field. Then, the symmetric group S of the natural numbers acts on each family of generators by permuting indices. Any ideal J in R that is (as a set) invariant under the S-action is finitely generated in the sense that there is a finite list of elements g1,...,gn of J such that the union of the S-orbits of g1,...,gn generates J as an R-ideal. Moreover, ideal containment can be effectively tested by some flavour of Gröbner basis theory ("symmetric Gröbner bases"). The purpose of my implementation is to compute symmetric Gröbner bases and test ideal containment. Is any of that useful for your application? Or do you just need an algebra with an indexed family of generators? Then, I suppose it is possible to implement it using the stuff in sage.sets.family, together with sage.combinat.free_module.CombinatorialFreeModule Inspite of its name, CombinatorialFreeModule can be used to implement an algebra. Beware, however, that it is all a very *general* implementation in *Python* (not Cython) and (I think) quite convoluted and indirect [e.g., apparently one is supposed to implement multiplication of elements not by providing _mul_ for the elements but by providing a method product_on_basis for the ring, which is then used in a multiplication method (again not of the elements but of the ring) that is provided by the category of AlgebrasWithBasis that is then finally used in a multiplication method for elements that (if I recall correctly) also is implemented in Python and is inherited from the category framework]. So, my impression has been that CombinatorialFreeModule is by design not to be competitive in terms of speed. But I am sure that other people will disagree with me on that point. I would recommend to find an appropriate Cython base class for your elements. You'd sub-class it (in Cython, if you care for speed), by providing _mul_ and _lmul_ for the elements. The parent (i.e., ring) can very well be implemented in Python, as typically speed matters less for the ring than for its elements. I could actually imagine to use CombinatorielFreeModule to implement the ring, but without relying on product_on_basis, and use a Cython class for the elements. And please do use the category and coercion framework! You may want to read this thematic tutorial: http://doc.sagemath.org/html/en/thematic_tutorials/coercion_and_categories.html > In a second moment I would like to be able to evaluate the element of this > ring at point on the group; is there a way to make them callable? There is no default implementation for the __call__() method of ring elements. So, I guess you can just provide it. It's the usual cython way of making something callable. Best regards, Simon -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.