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.
ratpoly.<t> = PolynomialRing(QQ)
defines the ring of polynomials in variablet
over the ringQQ
. Theratpoly
becomes the name for this polynomial ring (likeQQ
for the rational numbers). Does that answer your question?I think the syntax is inspired by Magma.