Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

K.<v> notation in Python 2

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?

like image 996
Martin Ueding Avatar asked Jan 02 '19 18:01

Martin Ueding


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)"
like image 90
Luca De Feo Avatar answered Nov 09 '22 21:11

Luca De Feo