Ask Your Question
2

notation appointment

asked 2023-08-11 08:50:52 +0100

PaulC gravatar image

Hello, I was reading about Basic Rings, and the notation ratpoly.<t> = PolynomialRing(QQ) popped up. What is the <> for? It's not a function call, although I can see what it does. And the ratpoly has no meaning. I substituted skunkpoly with the same result. I can't seem to find much about it.

edit retag flag offensive close merge delete

Comments

ratpoly.<t> = PolynomialRing(QQ) defines the ring of polynomials in variable t over the ring QQ. The ratpoly becomes the name for this polynomial ring (like QQ for the rational numbers). Does that answer your question?

Max Alekseyev gravatar imageMax Alekseyev ( 2023-08-11 16:37:04 +0100 )edit

I think the syntax is inspired by Magma.

rburing gravatar imagerburing ( 2023-08-11 17:47:37 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
4

answered 2023-08-11 17:03:51 +0100

Sage syntax is based on Python syntax, but with a "preparser" added. One prominent example of this is that Sage uses ^ for exponentiation, so the preparser turns ^ into ** before passing it on to Python. The <> syntax is another example, and you can find out what it does by explicitly calling the preparser:

sage: preparse('ratpoly.<t> = PolynomialRing(QQ)')
"ratpoly = PolynomialRing(QQ, names=('t',)); (t,) = ratpoly._first_ngens(1)"

So first it does

"ratpoly = PolynomialRing(QQ, names=('t',))

which defines ratpoly to be a polynomial ring, coefficients in QQ, with a single generator named t. The second thing is

(t,) = ratpoly._first_ngens(1)

which defines t to be the generator. So it's shorthand that simultaneously defines both the name of the polynomial ring and its generator.

This is described in the Sage tutorial and has more thorough documentation in the reference manual.

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

1 follower

Stats

Asked: 2023-08-11 08:50:52 +0100

Seen: 103 times

Last updated: Aug 11 '23