# SageMath code for working with number field 39.39.84353761564911199847976291343170613314905394740747695535193786145446555993900393805995656806508650256842842084529.1.
# Some of these functions may take a long time to execute (this depends on the field).
# Define the number field:
x = polygen(QQ); K. = NumberField(x^39 - x^38 - 456*x^37 + 889*x^36 + 90828*x^35 - 253868*x^34 - 10385180*x^33 + 37136294*x^32 + 753123799*x^31 - 3270550490*x^30 - 36099160776*x^29 + 186756003421*x^28 + 1153888467019*x^27 - 7173288778188*x^26 - 24081982466754*x^25 + 188571229295629*x^24 + 304007530489979*x^23 - 3415756724968728*x^22 - 1675569173908960*x^21 + 42720685818403975*x^20 - 10554063966988809*x^19 - 369187803799463938*x^18 + 273182269941204948*x^17 + 2201019540853979395*x^16 - 2354043730739816544*x^15 - 9001671285085868002*x^14 + 11514879338270450671*x^13 + 24991289927843292457*x^12 - 34615393263055948671*x^11 - 46331426122390477259*x^10 + 64085787618282944397*x^9 + 55701401545562743601*x^8 - 70426823322220439228*x^7 - 40617153217434411375*x^6 + 42835827891298341241*x^5 + 15065589607445769980*x^4 - 13137613446326251666*x^3 - 1795725529019100898*x^2 + 1568527642769879023*x - 143456380943806673)
# Defining polynomial:
K.defining_polynomial()
# Degree over Q:
K.degree()
# Signature:
K.signature()
# Discriminant:
K.disc()
# Ramified primes:
K.disc().support()
# Automorphisms:
K.automorphisms()
# Integral basis:
K.integral_basis()
# Class group:
K.class_group().invariants()
# Narrow class group:
K.narrow_class_group().invariants()
# Unit group:
UK = K.unit_group()
# Unit rank:
UK.rank()
# Generator for roots of unity:
UK.torsion_generator()
# Fundamental units:
UK.fundamental_units()
# Regulator:
K.regulator()
# Analytic class number formula:
# self-contained SageMath code snippet to compute the analytic class number formula
x = polygen(QQ); K. = NumberField(x^39 - x^38 - 456*x^37 + 889*x^36 + 90828*x^35 - 253868*x^34 - 10385180*x^33 + 37136294*x^32 + 753123799*x^31 - 3270550490*x^30 - 36099160776*x^29 + 186756003421*x^28 + 1153888467019*x^27 - 7173288778188*x^26 - 24081982466754*x^25 + 188571229295629*x^24 + 304007530489979*x^23 - 3415756724968728*x^22 - 1675569173908960*x^21 + 42720685818403975*x^20 - 10554063966988809*x^19 - 369187803799463938*x^18 + 273182269941204948*x^17 + 2201019540853979395*x^16 - 2354043730739816544*x^15 - 9001671285085868002*x^14 + 11514879338270450671*x^13 + 24991289927843292457*x^12 - 34615393263055948671*x^11 - 46331426122390477259*x^10 + 64085787618282944397*x^9 + 55701401545562743601*x^8 - 70426823322220439228*x^7 - 40617153217434411375*x^6 + 42835827891298341241*x^5 + 15065589607445769980*x^4 - 13137613446326251666*x^3 - 1795725529019100898*x^2 + 1568527642769879023*x - 143456380943806673)
DK = K.disc(); r1,r2 = K.signature(); RK = K.regulator(); RR = RK.parent()
hK = K.class_number(); wK = K.unit_group().torsion_generator().order();
2^r1 * (2*RR(pi))^r2 * RK * hK / (wK * RR(sqrt(abs(DK))))
# Intermediate fields:
K.subfields()[1:-1]
# Galois group:
K.galois_group()
# Frobenius cycle types:
# to obtain a list of [e_i,f_i] for the factorization of the ideal pO_K for p=7 in Sage:
p = 7; [(e, pr.norm().valuation(p)) for pr,e in K.factor(p)]