ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 27 Feb 2012 15:35:54 -0600How to make a vector space with basis a *graded* one, and how to do linear algebra on its homogeneous parts?http://ask.sagemath.org/question/8671/how-to-make-a-vector-space-with-basis-a-graded-one-and-how-to-do-linear-algebra-on-its-homogeneous-parts/I was sent here from [StackOverflow](http://stackoverflow.com/questions/9018933).
I have a vector space with given basis (it is also a Hopf algebra, but this is not part of the problem). How do I make it into a graded vector space? E. g., I know that in order to make it into an algebra, I have to define a function called `product_on_basis` somewhere in its definition, and that in order to make it into a coalgebra, I have to define a function called `coproduct_on_basis`; but what function do I have to define in order to make it into a graded vector space? How can I find out the name of this function? (It is not given in http://www.sagemath.org/doc/reference/sage/categories/graded_modules_with_basis.html . I know the names of the functions for the multiplication and the comultiplication from python2.6/site-packages/sage/categories/examples/hopf_algebras_with_basis.py , but I don't see such a .py file for graded vector spaces.)
Once this is done, I would like to do linear algebra on the graded components. They are each finite-dimensional, with basis a part of the combinatorial basis of the big space, so there shouldn't be any problem. I have defined two maps and want to know, e. g., whether the image of one lies inside the image of the other. Is there an abstract way to do this in Sage or do I have to translate these maps into matrices?
**Context (not important):** I have (successfully, albeit stupidly) implemented the Malvenuto-Reutenauer Hopf algebra of permutations:
[html version][1] resp. [sws file][2]
Now I want to check [some of its properties][3]. This checking cannot be automated on the *whole* space, but it is a finite problem on each of its graded components, so I would like to check it, say, on the fifth one.
[1]: http://mit.edu/~darij/www/mrh.htm
[2]: http://mit.edu/~darij/www/mrh.sws
[3]: http://mathoverflow.net/questions/84345/Thu, 26 Jan 2012 06:12:18 -0600http://ask.sagemath.org/question/8671/how-to-make-a-vector-space-with-basis-a-graded-one-and-how-to-do-linear-algebra-on-its-homogeneous-parts/Answer by niles for <p>I was sent here from <a href="http://stackoverflow.com/questions/9018933">StackOverflow</a>.</p>
<p>I have a vector space with given basis (it is also a Hopf algebra, but this is not part of the problem). How do I make it into a graded vector space? E. g., I know that in order to make it into an algebra, I have to define a function called <code>product_on_basis</code> somewhere in its definition, and that in order to make it into a coalgebra, I have to define a function called <code>coproduct_on_basis</code>; but what function do I have to define in order to make it into a graded vector space? How can I find out the name of this function? (It is not given in <a href="http://www.sagemath.org/doc/reference/sage/categories/graded_modules_with_basis.html">http://www.sagemath.org/doc/reference...</a> . I know the names of the functions for the multiplication and the comultiplication from python2.6/site-packages/sage/categories/examples/hopf_algebras_with_basis.py , but I don't see such a .py file for graded vector spaces.)</p>
<p>Once this is done, I would like to do linear algebra on the graded components. They are each finite-dimensional, with basis a part of the combinatorial basis of the big space, so there shouldn't be any problem. I have defined two maps and want to know, e. g., whether the image of one lies inside the image of the other. Is there an abstract way to do this in Sage or do I have to translate these maps into matrices?</p>
<p><strong>Context (not important):</strong> I have (successfully, albeit stupidly) implemented the Malvenuto-Reutenauer Hopf algebra of permutations:</p>
<p><a href="http://mit.edu/~darij/www/mrh.htm">html version</a> resp. <a href="http://mit.edu/~darij/www/mrh.sws">sws file</a></p>
<p>Now I want to check <a href="http://mathoverflow.net/questions/84345/">some of its properties</a>. This checking cannot be automated on the <em>whole</em> space, but it is a finite problem on each of its graded components, so I would like to check it, say, on the fifth one.</p>
http://ask.sagemath.org/question/8671/how-to-make-a-vector-space-with-basis-a-graded-one-and-how-to-do-linear-algebra-on-its-homogeneous-parts/?answer=13203#post-id-13203I think [CombinatorialFreeModule](http://www.sagemath.org/doc/reference/sage/combinat/free_module.html) and [CombinatorialAlgebra](http://www.sagemath.org/doc/reference/sage/combinat/combinatorial_algebra.html) are the places to start.
The most sophisticated graded Hopf algebras implemented in Sage are, I think, the [Steenrod Algebras](http://www.sagemath.org/doc/reference/sage/algebras/steenrod/steenrod_algebra.html) (Also see the [online source code](http://hg.sagemath.org/sage-main/file/c239be1054e0/sage/algebras/steenrod/steenrod_algebra.py#l1)), so that implementation may give you some ideas too.
Good luck -- I am personally interested in computations with differential graded algebras so I would love to see how you implement your classes.Fri, 27 Jan 2012 06:00:19 -0600http://ask.sagemath.org/question/8671/how-to-make-a-vector-space-with-basis-a-graded-one-and-how-to-do-linear-algebra-on-its-homogeneous-parts/?answer=13203#post-id-13203Comment by John Palmieri for <p>I think <a href="http://www.sagemath.org/doc/reference/sage/combinat/free_module.html">CombinatorialFreeModule</a> and <a href="http://www.sagemath.org/doc/reference/sage/combinat/combinatorial_algebra.html">CombinatorialAlgebra</a> are the places to start.</p>
<p>The most sophisticated graded Hopf algebras implemented in Sage are, I think, the <a href="http://www.sagemath.org/doc/reference/sage/algebras/steenrod/steenrod_algebra.html">Steenrod Algebras</a> (Also see the <a href="http://hg.sagemath.org/sage-main/file/c239be1054e0/sage/algebras/steenrod/steenrod_algebra.py#l1">online source code</a>), so that implementation may give you some ideas too. </p>
<p>Good luck -- I am personally interested in computations with differential graded algebras so I would love to see how you implement your classes.</p>
http://ask.sagemath.org/question/8671/how-to-make-a-vector-space-with-basis-a-graded-one-and-how-to-do-linear-algebra-on-its-homogeneous-parts/?comment=20400#post-id-20400For this issue, I think you're going to have to look at the source code. Graded objects are not well-developed in Sage. If you follow the link in my answer, you will also find a patch which implements an example of a graded algebra, whose explicit purpose is to be a model on which other people can base their work.Fri, 27 Jan 2012 14:19:14 -0600http://ask.sagemath.org/question/8671/how-to-make-a-vector-space-with-basis-a-graded-one-and-how-to-do-linear-algebra-on-its-homogeneous-parts/?comment=20400#post-id-20400Comment by darijgrinberg for <p>I think <a href="http://www.sagemath.org/doc/reference/sage/combinat/free_module.html">CombinatorialFreeModule</a> and <a href="http://www.sagemath.org/doc/reference/sage/combinat/combinatorial_algebra.html">CombinatorialAlgebra</a> are the places to start.</p>
<p>The most sophisticated graded Hopf algebras implemented in Sage are, I think, the <a href="http://www.sagemath.org/doc/reference/sage/algebras/steenrod/steenrod_algebra.html">Steenrod Algebras</a> (Also see the <a href="http://hg.sagemath.org/sage-main/file/c239be1054e0/sage/algebras/steenrod/steenrod_algebra.py#l1">online source code</a>), so that implementation may give you some ideas too. </p>
<p>Good luck -- I am personally interested in computations with differential graded algebras so I would love to see how you implement your classes.</p>
http://ask.sagemath.org/question/8671/how-to-make-a-vector-space-with-basis-a-graded-one-and-how-to-do-linear-algebra-on-its-homogeneous-parts/?comment=20403#post-id-20403BTW version 2 is up (at the same addresses), but I doubt you can pick up any good programming habits from me...Fri, 27 Jan 2012 10:25:47 -0600http://ask.sagemath.org/question/8671/how-to-make-a-vector-space-with-basis-a-graded-one-and-how-to-do-linear-algebra-on-its-homogeneous-parts/?comment=20403#post-id-20403Comment by darijgrinberg for <p>I think <a href="http://www.sagemath.org/doc/reference/sage/combinat/free_module.html">CombinatorialFreeModule</a> and <a href="http://www.sagemath.org/doc/reference/sage/combinat/combinatorial_algebra.html">CombinatorialAlgebra</a> are the places to start.</p>
<p>The most sophisticated graded Hopf algebras implemented in Sage are, I think, the <a href="http://www.sagemath.org/doc/reference/sage/algebras/steenrod/steenrod_algebra.html">Steenrod Algebras</a> (Also see the <a href="http://hg.sagemath.org/sage-main/file/c239be1054e0/sage/algebras/steenrod/steenrod_algebra.py#l1">online source code</a>), so that implementation may give you some ideas too. </p>
<p>Good luck -- I am personally interested in computations with differential graded algebras so I would love to see how you implement your classes.</p>
http://ask.sagemath.org/question/8671/how-to-make-a-vector-space-with-basis-a-graded-one-and-how-to-do-linear-algebra-on-its-homogeneous-parts/?comment=20404#post-id-20404Thanks for the link to the Steenrod algebra! I got the function, it's unsurprisingly called def homogeneous_component(self, n). I still would like to know how to find out such names in general, rather than by analyzing the source code of Sage. And I still would like to know how to do linear algebra.Fri, 27 Jan 2012 10:23:26 -0600http://ask.sagemath.org/question/8671/how-to-make-a-vector-space-with-basis-a-graded-one-and-how-to-do-linear-algebra-on-its-homogeneous-parts/?comment=20404#post-id-20404Comment by John Palmieri for <p>I think <a href="http://www.sagemath.org/doc/reference/sage/combinat/free_module.html">CombinatorialFreeModule</a> and <a href="http://www.sagemath.org/doc/reference/sage/combinat/combinatorial_algebra.html">CombinatorialAlgebra</a> are the places to start.</p>
<p>The most sophisticated graded Hopf algebras implemented in Sage are, I think, the <a href="http://www.sagemath.org/doc/reference/sage/algebras/steenrod/steenrod_algebra.html">Steenrod Algebras</a> (Also see the <a href="http://hg.sagemath.org/sage-main/file/c239be1054e0/sage/algebras/steenrod/steenrod_algebra.py#l1">online source code</a>), so that implementation may give you some ideas too. </p>
<p>Good luck -- I am personally interested in computations with differential graded algebras so I would love to see how you implement your classes.</p>
http://ask.sagemath.org/question/8671/how-to-make-a-vector-space-with-basis-a-graded-one-and-how-to-do-linear-algebra-on-its-homogeneous-parts/?comment=20399#post-id-20399As far as doing linear algebra, I think that CombinatorialFreeModule is not that great, unfortunately. So I think converting to matrices is the right way to go.Fri, 27 Jan 2012 14:20:23 -0600http://ask.sagemath.org/question/8671/how-to-make-a-vector-space-with-basis-a-graded-one-and-how-to-do-linear-algebra-on-its-homogeneous-parts/?comment=20399#post-id-20399Answer by John Palmieri for <p>I was sent here from <a href="http://stackoverflow.com/questions/9018933">StackOverflow</a>.</p>
<p>I have a vector space with given basis (it is also a Hopf algebra, but this is not part of the problem). How do I make it into a graded vector space? E. g., I know that in order to make it into an algebra, I have to define a function called <code>product_on_basis</code> somewhere in its definition, and that in order to make it into a coalgebra, I have to define a function called <code>coproduct_on_basis</code>; but what function do I have to define in order to make it into a graded vector space? How can I find out the name of this function? (It is not given in <a href="http://www.sagemath.org/doc/reference/sage/categories/graded_modules_with_basis.html">http://www.sagemath.org/doc/reference...</a> . I know the names of the functions for the multiplication and the comultiplication from python2.6/site-packages/sage/categories/examples/hopf_algebras_with_basis.py , but I don't see such a .py file for graded vector spaces.)</p>
<p>Once this is done, I would like to do linear algebra on the graded components. They are each finite-dimensional, with basis a part of the combinatorial basis of the big space, so there shouldn't be any problem. I have defined two maps and want to know, e. g., whether the image of one lies inside the image of the other. Is there an abstract way to do this in Sage or do I have to translate these maps into matrices?</p>
<p><strong>Context (not important):</strong> I have (successfully, albeit stupidly) implemented the Malvenuto-Reutenauer Hopf algebra of permutations:</p>
<p><a href="http://mit.edu/~darij/www/mrh.htm">html version</a> resp. <a href="http://mit.edu/~darij/www/mrh.sws">sws file</a></p>
<p>Now I want to check <a href="http://mathoverflow.net/questions/84345/">some of its properties</a>. This checking cannot be automated on the <em>whole</em> space, but it is a finite problem on each of its graded components, so I would like to check it, say, on the fifth one.</p>
http://ask.sagemath.org/question/8671/how-to-make-a-vector-space-with-basis-a-graded-one-and-how-to-do-linear-algebra-on-its-homogeneous-parts/?answer=13202#post-id-13202You can get some information from the answers to [this question](http://ask.sagemath.org/question/1049/how-can-i-construct-graded-algebras).Fri, 27 Jan 2012 05:58:39 -0600http://ask.sagemath.org/question/8671/how-to-make-a-vector-space-with-basis-a-graded-one-and-how-to-do-linear-algebra-on-its-homogeneous-parts/?answer=13202#post-id-13202Comment by darijgrinberg for <p>You can get some information from the answers to <a href="http://ask.sagemath.org/question/1049/how-can-i-construct-graded-algebras">this question</a>.</p>
http://ask.sagemath.org/question/8671/how-to-make-a-vector-space-with-basis-a-graded-one-and-how-to-do-linear-algebra-on-its-homogeneous-parts/?comment=20214#post-id-20214Okay, John, thanks - I did it at last. I didn't expect that writing everything as a matrix would be as simple as it turned out to be.Mon, 27 Feb 2012 15:35:54 -0600http://ask.sagemath.org/question/8671/how-to-make-a-vector-space-with-basis-a-graded-one-and-how-to-do-linear-algebra-on-its-homogeneous-parts/?comment=20214#post-id-20214