1 | initial version |
Here is a variation on the answer of rburing. Does it still look correct ?
def subfield(m, L):
K = CyclotomicField(m, 'z')
z = K.zeta(m)
G = K.galois_group()
power_list = [z**k for k in range(m)]
convert = ((sigma, power_list.index(sigma(z)))
for sigma in G)
G_gens = [g for g, i in convert if i in L]
return G.subgroup(G_gens).fixed_field()