Ask Your Question

Implementing a new Ring and its elements.

asked 2012-10-06 11:19:14 -0500

SLOtoSF gravatar image


Say I have a class which I defined as class MyRing(Ring): ...

And another class which I defined as: class MyRingElements(SageObject): ...

I've read the material on Coercion so that I can create the operations of + and * on my ring, but what do I have to do to MyRingElements or MyRing to let them know who their parents and elements are?


edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2012-10-08 04:39:56 -0500

You might find Simon King's coercion and categories tutorial useful as well. Since the public worksheets are disabled, I guess trac ticket #11490 is the best place to get it.

edit flag offensive delete link more

answered 2012-10-07 05:06:09 -0500

When defining MyRing, you could have:

class MyRing(Ring):

    Element = MyRingElement # usually the element class name doesn't end with an "s"

    def __init__(...):

or have the entire class MyRingElement called "Element" and nested in the ring class:

class MyRing(Ring):

    def __init__(self, ...):

    def other_methods(self, ...):

    class Element(SageObect):

        def __init__(self, ...):

Look at the source code for examples: sage.algebras.free_algebra, sage.algebras.steenrod.steenrod_algebra, sage.algebras.iwahori_hecke_algebra, and I'm sure also in sage.rings and in sage.categories.examples.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2012-10-06 11:19:14 -0500

Seen: 75 times

Last updated: Oct 08 '12