# How can I construct graded algebras?

I am trying to create a graded algebra using generators and relations. I found that sage has a category for such things:

but there are no constructors or examples of how to create these things. Does anyone know where I can find examples of how to construct graded algebras, or more generally how to construct non-commutative algebras?

edit retag close merge delete

Sort by » oldest newest most voted

Since you ask for graded algebras, but refer to the category of graded modules: Which of the two do you need?

General remarks on Sage's category framework

I recommend that you study my public worksheet on categories and coercion.

First of all, the purpose of categories in Sage is not to construct a specific object in that category. It is more or less the other way around: You implement something and inform Sage that it belongs to some category. For example, let someone implement a Python class MyModuleClass whose instances are graded modules. Then, MyModuleClass.__init__ should make sure that the instance is declared as an object of the category of graded modules over the given base ring.

It is possible that some instances of MyModuleClass actually are algebras and not just modules. For example, the set of m by n matrices over a ring R is often just an R-module, but it is an R-algebra if m==n. In that situation, it is not needed that you sub-class MyModuleClass, but you can simply choose a different category during initialisation.

Why is that useful?

• Sometimes one needs to test whether a given object X is an R-module or not. Then, you can simply test it by "if X in Modules(R): <do something>".
• The categories in Sage can provide generic code that is available to all objects of that category - it is not needed that you implement these methods by yourself. For example, the category of commutative additive semigroups provides a method called summation(...), and it is available to the rational field, since it belongs to a sub-category:

sage: QQ.summation.__module__

• In order to belong to a certain category, an object has to satisfy certain algebraic axioms. For example, elements of a commutative ring can be multiplied, and the result does not depend on the multiplication order. The category framework provides some basic tests (of course, it can't be exhaustive) that your implementation is sane:

sage: TestSuite(QQ).run(verbose=True)
running ._test_additive_associativity() . . . pass
running ._test_an_element() . . . pass
running ._test_associativity() . . . pass
running ._test_category() . . . pass
running ._test_distributivity() . . . pass
running ._test_elements() . . .
Running the test suite of self.an_element()
running ._test_category() . . . pass
running ._test_eq() . . . pass
running ._test_not_implemented_methods() . . . pass
running ._test_pickling() . . . pass
pass
running ._test_elements_eq() . . . pass
running ._test_eq() . . . pass
running ._test_not_implemented_methods() . . . pass
running ._test_one() . . . pass
running ._test_pickling() . . . pass
running ._test_prod() . . . pass
running ._test_some_elements() . . . pass
running ._test_zero() . . . pass


So, the category framework helps to implement an algebraic structure. However, it is not the location of the actual implementation.

Where to find actual implementations

If you want to find out what modules or algebras are currently implemented in Sage, then look into sage.modules or sage.algebras (The links are to the relevant chapters of the documentation).

You will find that there are non-commutative algebras, whereas the modules currently available in Sage are only over commutative rings. However, this will change in upcoming versions (hopefully in sage-5.0): Singular, which is a computer algebra system used by Sage for polynomial arithmetic ...

more

Thanks, this was very helpful. I've decided to go ahead and implement what I need myself and your worksheet will be very helpful in making my code play nice with the structure of sage.

( 2012-01-31 04:29:16 -0600 )edit

more