# multiple algebraic extension I'm looking for a way to formulate a number field which can express corners of a given regular $n$-gon exactly, but which might be faster than AA. I need to be able to check signs of elements of that number field. Here is what I tried:

n = 17
z = QQbar.zeta(n)
ca = z.real()
sa = z.imag()
QQ[ca, sa]


However I get the error message

ValueError: defining polynomial (x^16 - 17/4*x^14 + 119/16*x^12 -
221/32*x^10 + 935/256*x^8 - 561/512*x^6 + 357/2048*x^4 - 51/4096*x^2 +
17/65536) must be irreducible


How can I avoid this?

edit retag close merge delete

Sort by » oldest newest most voted

If you want the (smallest) number field containing the corners of the unit regular n-gon, you can do:

sage: F = CyclotomicField(n)


If you want the (smallest) number field containing real and imaginary parts of the first corner of the unit regular n-gon, you can do:

sage: F = number_field_elements_from_algebraics([ca, sa], minimal=True)
sage: F
(Number Field in a with defining polynomial y^16 - 17*y^14 + 119*y^12 - 442*y^10 + 935*y^8 - 1122*y^6 + 714*y^4 - 204*y^2 + 17,
[1/2*a^14 - 15/2*a^12 + 45*a^10 - 275/2*a^8 + 225*a^6 - 189*a^4 + 70*a^2 - 15/2,
1/2*a],
Ring morphism:
From: Number Field in a with defining polynomial y^16 - 17*y^14 + 119*y^12 - 442*y^10 + 935*y^8 - 1122*y^6 + 714*y^4 - 204*y^2 + 17
To:   Algebraic Real Field
Defn: a |--> 0.7224833323743059?)

more

Noting links to [CyclotomicField](http://www.sagemath.org/doc/reference/number_fields/sage/rings/number_field/number_field.html#sage.rings.number_field.number_field.CyclotomicField) and [number_field_elements_from_algebraics](http://www.sagemath.org/doc/reference/number_fields/sage/rings/qqbar.html?highlight=number_field_elements_from_algebraics#sage.rings.qqbar.number_field_elements_from_algebraics) documentation for reference. Great answer, very helpful! Although CyclotomicField looks better at first glance than at second, since it embeds naturally into $\mathbb C$ not $\mathbb R$. Its elements don't support extracting e.g. a real part.