Ask Your Question
0

How to define / create a new Ring

asked 2015-03-24 02:58:46 -0600

LRM gravatar image

Hi!

I just installed the version 6.5 of Sage. Then I saw in the help some page/tutorial about Basic Rings but I could not find an article (I googled) or an answer for the following:

How can I create a new ring? For example: How can I create a kind of ring of Integers (called ZZ in Sage) where I have only , say, even numbers?

Examples:

sage: sqrt(4) in myZZ True

sage: 3 in myZZ False

Thank you for any help!

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2015-03-24 07:27:29 -0600

tmonteil gravatar image

You can have a look at this thematic tutorial that explains how to implement new algebraic structures in Sage.

To implement the in feature, you have to implement a __contains__ method.

Do not hesitate to post your preliminary code for more questions.

edit flag offensive delete link more

Comments

I will take a look now. Thank you for your attention.

LRM gravatar imageLRM ( 2015-03-25 09:33:02 -0600 )edit

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-03-24 02:58:46 -0600

Seen: 68 times

Last updated: Mar 24 '15