Yes, you have. To better integrate it into Sage, I would expand the existing functionality of FiniteDimensionalAlgebra (and ideally it would do the basis and multiplication table lazily) . This class would likely need some additional work to get it to do what you eventually want, but it would make for a good project. Note that FiniteDimensionalAlgebra already has a class for ideals.
Sage, in principle, should also be able to construct any subalgebra of a finite-dimensional algebra given by generators using some of its generic code (i.e., not just from a subalgebra of all matrices) through a simple modification of your code. (In practice, I think the matrices are essentially compatible up to dealing with issues of mutability. I don't know how much this has been tested though...) Some general coding advice: Python is an object-oriented programming language. This means you can organize your code into logical groupings called "classes" that give additional information about what the data represents. So rather than having a bunch of unrelated functions, they can become more tied together (of course, when this appropriate). It is wise to take advantage of this. Best, Travis On Sunday, June 12, 2022 at 12:30:27 PM UTC+9 Yingdong Li wrote: > Dear Travis, > > I think my code already has the function you mentioned(the function named > "basis_of_algebra" is used to build a basis, and we can plug it in the > "ideal" function to get the ideal we want, see line 53-139). I'm not sure > whether I misunderstood your advice. Anyway, thanks for your advice and > welcome to point out more problem about my code(we can still discuss it > here)! > > Best wishes, > Li Yingdong > > 在2022年6月10日星期五 UTC+8 08:38:41<Travis Scrimshaw> 写道: > >> One thing you could consider doing is adding an option for the input of >> the finite dimensional algebra code to take the generators as input and >> then use that to generate a basis and feed that back into the finite >> dimensional algebra. I am sure I have written code to compute a basis from >> a generating set in at least one form somewhere in Sage. It seems like this >> code needs to be factored out to be used for purposes like this. >> >> Best, >> Travis >> >> >> On Thursday, May 26, 2022 at 4:12:41 PM UTC+9 Yingdong Li wrote: >> >>> Dear all, >>> >>> I have put my code in GitHub(with some explanation of it) so that you >>> can clearly see it. >>> >>> Here's a link of my code in GitHub(see the code called "Finite generated >>> algebra as a ring") >>> Dongulas/Dongulas: Config files for my GitHub profile. >>> <https://github.com/Dongulas/Dongulas/tree/main> >>> >>> Best wishes, >>> Li Yingdong >>> >>> 在2022年5月17日星期二 UTC+8 21:37:06<Yingdong Li> 写道: >>> >>>> Dear Travis, >>>> >>>> Thanks for your advice! The finite dimensional algebra code in Sage >>>> need a multiplication table, so the second part of our code is used to >>>> find >>>> the multiplication table with the basis of the algebra. And the first part >>>> of our code is used to find the basis with the generators of the >>>> algebra(along with a ideal of the polynomial ring). Our aim is to find the >>>> ring structure of the algebra generated by a list of commuting matrices. >>>> >>>> Best wishes, >>>> Li Yingdong >>>> >>>> 在2022年5月15日星期日 UTC+8 11:16:24<Travis Scrimshaw> 写道: >>>> >>>>> I would advise against having it as an external package if you plan to >>>>> integrate it into Sage. It further fragments the code and makes it more >>>>> likely to bitrot from what I have seen. I would instead create a ticket >>>>> and >>>>> upload the code to that. >>>>> >>>>> Is this a finite dimensional commutative algebra? We already have >>>>> finite dimensional algebras (with no assumptions, e.g., associativity) in >>>>> Sage. How does your code compare with this code? Could they be combined? >>>>> >>>>> Best, >>>>> Travis >>>>> >>>>> >>>>> On Thursday, May 12, 2022 at 9:55:55 PM UTC+9 davida...@gmail.com >>>>> wrote: >>>>> >>>>>> Hello, >>>>>> >>>>>> Most of the SageMath developpment is explained in this guide: >>>>>> >>>>>> https://doc.sagemath.org/html/en/developer/index.html >>>>>> >>>>>> Also, I don't know exactly what is the scale of your code, but I >>>>>> would advise you to first upload your code to Github (if it isn't >>>>>> already >>>>>> done) as an external package. Github is very convenient for sharing >>>>>> code, >>>>>> so it would be easier to share it with the community. Next, I think to >>>>>> contribute to SageMath it is better to start with small contribution. >>>>>> For >>>>>> example, review some tickets or fix some bugs. Then, it becomes easier >>>>>> to >>>>>> contribute to bigger projects. >>>>>> >>>>>> Anyway, welcome to the community and good job on your research >>>>>> project! >>>>>> >>>>>> David Ayotte >>>>>> >>>>>> Le jeudi 12 mai 2022 à 05:45:53 UTC-4, Yingdong Li a écrit : >>>>>> >>>>>>> Dear all, >>>>>>> >>>>>>> I have written some codes in Sage to compute the finite-dimensional >>>>>>> algebra by a list of commuting matrices and I want to contribute it to >>>>>>> Sage. Here is the idea of my codes. >>>>>>> >>>>>>> 1. We can construct the algebra as a quotient of a polynomial >>>>>>> ring(by using the homomorphism which sends each x_i to t_i, where >>>>>>> t_1,...,t_n is the n matrices generate the algebra), we can also get >>>>>>> the >>>>>>> basis by doing this. >>>>>>> >>>>>>> 2. With the basis of the algebra, we can also compute the >>>>>>> multiplication table then use the finite-dimensional algebra command in >>>>>>> Sage to get a description to this algebra. >>>>>>> >>>>>>> Once we have done with these things above, we can get the ring >>>>>>> structure of the algebra. This is very useful in dealing with some >>>>>>> problems >>>>>>> about modular forms since we can further study the prime ideals or >>>>>>> maximal >>>>>>> ideals of Hecke algebra by using its ring structure. >>>>>>> >>>>>>> I'm an undergraduate student and this is part of my research >>>>>>> project. I was wondering how I can contribute the codes to Sage. Could >>>>>>> anyone give me some help me with this(since I'm not so familiar about >>>>>>> the >>>>>>> Sage trac and I'm not sure where I can share my codes)? Thanks in >>>>>>> advance! >>>>>>> >>>>>>> Moreover, if you have some questions or comments on this, we can >>>>>>> discuss about it here. >>>>>>> >>>>>>> Best wishes, >>>>>>> Li Yingdong >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/6d667677-3b05-45b0-908c-17f9d9a9596dn%40googlegroups.com.