summaryrefslogtreecommitdiffstats
path: root/divers/sageries/racine-17e-de-1
blob: 31af5b9710e89534d8a7486c439b96d40f777754 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
K.<omega> = CyclotomicField(17)
sqrt17 = sum([(-1)^i*omega^(3^i) for i in range(16)])
sub2 = [sum([(-1)^i*omega^(3^j*9^i) for i in range(8)]) for j in range(2)]
sub4 = [sum([(-1)^i*omega^(3^j*13^i) for i in range(4)]) for j in range(4)]
sub8 = [sum([(-1)^i*omega^(3^j*16^i) for i in range(2)]) for j in range(8)]
nice_basis = [1, sqrt17] + sub2 + sub4 + sub8
for i in range(16):
    z = CC(nice_basis[i])
    if z.real_part()<=-0.0001 or (abs(z.real_part())<0.0001 and z.imag_part()<0):
        nice_basis[i] = -nice_basis[i]

sub2 = nice_basis[2:4]
sub4 = nice_basis[4:8]
sub8 = nice_basis[8:16]
m = Matrix(QQ, 16, 16, [(QQ^16)((omega.coordinates_in_terms_of_powers())(x)) for x in nice_basis])
def on_nice_basis(x):
    return (QQ^16)((omega.coordinates_in_terms_of_powers())(x)) * m.inverse()

symbolic_sqrt17 = sqrt(17)
symbolic_basis = [1, symbolic_sqrt17]
def symbolicize(x):
    v = on_nice_basis(x)
    return sum([v[i]*symbolic_basis[i] for i in range(16) if v[i]!=0])

symbolic_sub2 = [sqrt(symbolicize(x^2)) for x in sub2]
symbolic_basis = symbolic_basis + symbolic_sub2
symbolic_sub4 = [sqrt(symbolicize(x^2)) for x in sub4]
symbolic_basis = symbolic_basis + symbolic_sub4
symbolic_sub8 = [sqrt(symbolicize(x^2)) for x in sub8]
symbolic_basis = symbolic_basis + symbolic_sub8
symbolic_cos = symbolicize((omega+omega^-1)/2)
symbolic_omega = symbolicize(omega)