# SageMath code for working with number field 38.0.2501696311112367702213593384284049957523786814936027691413131289153060507631187229631.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^38 - x^37 + 3*x^36 - 11*x^35 + 44*x^34 + 732*x^33 - 116*x^32 + 2069*x^31 + 2818*x^30 - 12880*x^29 + 93246*x^28 - 145805*x^27 + 92780*x^26 + 2105124*x^25 - 3183002*x^24 - 3104601*x^23 + 12583923*x^22 + 9706311*x^21 + 21916307*x^20 - 49619666*x^19 + 22159929*x^18 - 196911474*x^17 + 1026982112*x^16 + 311788273*x^15 - 1106984612*x^14 - 334730951*x^13 - 1752540110*x^12 + 3801710744*x^11 + 7280378790*x^10 + 1308968234*x^9 - 6926602921*x^8 - 6856588968*x^7 + 18604485712*x^6 + 18058309277*x^5 + 9272912074*x^4 - 5214869030*x^3 - 1463327624*x^2 + 5326526527*x + 2048986499)
# Defining polynomial:
K.defining_polynomial()
# Degree over Q:
K.degree()
# Signature:
K.signature()
# Discriminant:
K.disc()
# Ramified primes:
K.disc().support()
# Autmorphisms:
K.automorphisms()
# Integral basis:
K.integral_basis()
# Class group:
K.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^38 - x^37 + 3*x^36 - 11*x^35 + 44*x^34 + 732*x^33 - 116*x^32 + 2069*x^31 + 2818*x^30 - 12880*x^29 + 93246*x^28 - 145805*x^27 + 92780*x^26 + 2105124*x^25 - 3183002*x^24 - 3104601*x^23 + 12583923*x^22 + 9706311*x^21 + 21916307*x^20 - 49619666*x^19 + 22159929*x^18 - 196911474*x^17 + 1026982112*x^16 + 311788273*x^15 - 1106984612*x^14 - 334730951*x^13 - 1752540110*x^12 + 3801710744*x^11 + 7280378790*x^10 + 1308968234*x^9 - 6926602921*x^8 - 6856588968*x^7 + 18604485712*x^6 + 18058309277*x^5 + 9272912074*x^4 - 5214869030*x^3 - 1463327624*x^2 + 5326526527*x + 2048986499)
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(type='pari')
# Frobenius cycle types:
# to obtain a list of $[e_i,f_i]$ for the factorization of the ideal $p\mathcal{O}_K$ for $p=7$ in Sage:
p = 7; [(e, pr.norm().valuation(p)) for pr,e in K.factor(p)]