K.<v> notation in Python 2

Viewed 137

In one example of Sage math (search for octahedral) there is this line:

K.<v> = sage.groups.matrix_gps.finitely_generated.CyclotomicField(10)

What does this .<v> do?

1 Answers

SageMath code is not Python, albeit very similar. The syntax

A.<b> = C(d, e, f)

in SageMath is roughly equivalent to the following Python code

A = C(d, e, f, names=('b',))
b = A.gen()

I.e., first the parent ring A is created, with generator named 'b', then a variable b is initialized to the generator of A.

You can see what any SageMath statement is translated to using the function preparse():

sage: preparse('A.<b> = C(d, e, f)')
"A = C(d, e, f, names=('b',)); (b,) = A._first_ngens(1)"
Related