File imports for polynomial rings in sage

i like this post (click again to cancel)
0
i dont like this post (click again to cancel)

If i type in the following R.<z1,z2&gt;=polynomialring(gf(5),2,"z") direclty="" to="" sgae="" it="" accepts="" it="" as="" a="" polynomial="" ring="" but="" if="" i="" place="" this="" in="" a="" .py="" file="" and="" load="" it="" from="" this="" sage="" eg="" sage="" my.py="" it="" gives="" me="" a="" syntax="" error="" i="" guess="" i="" need="" a="" module="" loaded="" for="" it="" to="" be="" detected,="" but="" which="" module="" and="" hance="" which="" command="" do="" i="" need="" to="" make="" sage="" accept="" this="" ring<="" p="">

asked Aug 19 '10

ae gravatar image ae
1

3 Answers:

i like this answer (click again to cancel)
2
i dont like this answer (click again to cancel)

I agree, this is hard to read (probably a candidate for "What is broken on this site"). Having said that, I think the question is:

What module do I need to import in my .py file so that the above syntax works as expected?

I guess I don't know this answer, but maybe a workaround: The .< > notation is a shortcut for

R = PolynomialRing(ZZ,2,'z1,z2')

(z1,z2) = R.gens()

and the latter works when loaded from a .py file.

link

posted Aug 19 '10

niles gravatar image niles
3725 7 45 104
http://nilesjohnson.net/
i like this answer (click again to cancel)
1
i dont like this answer (click again to cancel)

The answer; it is impossible to make the notation:

R.<z1,z2> = ZZ[]

work in a .py file, since .py files must be valid Python, and the above isn't. The workaround by niles above is the way to go.

link

posted Aug 19 '10

William Stein gravatar image William Stein
1414 5 20 46
http://wstein.org/
Oh, to use the PolynomialRing command in a .py file, do from sage.rings.all import PolynomialRing William Stein (Aug 19 '10)
i like this answer (click again to cancel)
0
i dont like this answer (click again to cancel)

Could you please edit your question? There are html escaping errors in it. Notice the ampersand gt semicolon?

I see the command, but I don't see a question mark or a question in what you originally typed. Thanks.

link

posted Aug 19 '10

ccanonc gravatar image ccanonc
487 5 19 35
I tried to edit and get a big traceback -- there my thus be a bug in askbot that prevents editing some posts. William Stein (Aug 19 '10)

Your answer

Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
Login/Signup to Post

Question tools

Tags:

Stats:

Asked: Aug 19 '10

Seen: 94 times

Last updated: Aug 19 '10

powered by ASKBOT version 0.7.22
Copyright Sage, 2010. Some rights reserved under creative commons license.