Ask Your Question

Revision history [back]

There may be a better answer to your question, but here is a first attempt.

$ sage -v
SageMath version 7.3, Release Date: 2016-08-04
$ sage -q
sage: zeta7 = QQbar(exp(2*pi*i/7))
sage: zeta7
0.6234898018587335? + 0.7818314824680299?*I
sage: zeta7.parent()
Algebraic Field
sage: a = zeta7 + zeta7.conjugate()
sage: a
1.246979603717467? + 0.?e-18*I
sage: p = a.minpoly()
sage: p
x^3 + x^2 - 2*x - 1
sage: q = zeta7.minpoly()
sage: q
x^6 + x^5 + x^4 + x^3 + x^2 + x + 1
sage: k.<a> = NumberField(p, name='a', embedding=a)
sage: k
Number Field in a with defining polynomial x^3 + x^2 - 2*x - 1
sage: k.gen()
a
sage: q.factor()
x^6 + x^5 + x^4 + x^3 + x^2 + x + 1
sage: kx.<x> = k[]
sage: qq = kx(q)
sage: qq
x^6 + x^5 + x^4 + x^3 + x^2 + x + 1
sage: qq.factor()
(x^2 - a*x + 1) * (x^2 + (-a^2 + 2)*x + 1) * (x^2 + (a^2 + a - 1)*x + 1)
sage: for f, m in qq.factor(): print f(a)
1
2*a^2
a^2 + a + 2
sage: for f, m in qq.factor(): print f(zeta7)
0
1.054958132087372? + 1.322875655532296?*I
1.900968867902420? + 2.383739563481206?*I
sage: