Ask Your Question
0

How to define / create a new Ring

asked 2015-03-24 08:58:46 +0200

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 13:27:29 +0200

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 15:33:02 +0200 )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 08:58:46 +0200

Seen: 460 times

Last updated: Mar 24 '15