Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lmfdb/number_fields/code.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ class_number_formula:
galois_group:
comment: Galois group
sage: K.galois_group()
pari: polgalois(K.pol)
pari: 'if(poldegree(K.pol) > 11, "polgalois only supports degree <= 11", iferr(polgalois(K.pol), E, "polgalois in degrees 8 to 11 requires the optional galdata package", errname(E) == "e_FILE" || errname(E) == "e_PACKAGE"))'
magma: GaloisGroup(K);
oscar: |
G, Gtx = galois_group(K);
Expand Down
21 changes: 21 additions & 0 deletions lmfdb/number_fields/test_numberfield.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,3 +185,24 @@ def test_signature_download(self):
# Also ensure we're not getting quoted strings
assert '"[0, 1]"' not in page
assert '"[2, 0]"' not in page

def test_high_degree_gp_galois_download(self):
# PARI's polgalois hard-errors above degree 11, and needs the optional
# galdata package in degrees 8 to 11, so the snippet must be guarded.
# The committed gp snippet logs only exercise degrees 1 and 2, i.e. the
# branch where polgalois is actually called.
page = self.tc.get('/NumberField/12.4.320979616137216.3/download/gp').get_data(as_text=True)
assert 'poldegree(K.pol) > 11' in page
assert 'polgalois only supports degree <= 11' in page
assert 'requires the optional galdata package' in page
# polgalois is never invoked from an unguarded line
assert not any(line.strip() == 'polgalois(K.pol)' for line in page.split('\n'))

def test_rational_field_magma_download(self):
# Magma's NumberField collapses a degree 1 polynomial to the rationals,
# so 1.1.1.1 uses RationalsAsNumberField() instead, both when defining
# the field and in the self-contained class number formula snippet.
page = self.tc.get('/NumberField/1.1.1.1/download/magma').get_data(as_text=True)
assert page.count('K<a> := RationalsAsNumberField();') == 2
assert 'NumberField(x)' not in page
assert 'DoLinearExtension' not in page
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ gp> [polcoeff (lfunrootres (lfuncreate (K))[1][1][2], -1), 2^K.r1 * (2*Pi)^K.r2
[1.0000000000000000000000000000000000000, 1.0000000000000000000000000000000000000]
gp> L = nfsubfields(K); L[2..length(L)]
[]
gp> polgalois(K.pol)
gp> if(poldegree(K.pol) > 11, "polgalois only supports degree <= 11", iferr(polgalois(K.pol), E, "polgalois in degrees 8 to 11 requires the optional galdata package", errname(E) == "e_FILE" || errname(E) == "e_PACKAGE"))
[1, 1, 1, "S1"]
gp> p = 7; pfac = idealprimedec(K, p); vector(length(pfac), j, [pfac[j][3], pfac[j][4]])
[[1, 1]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ gp> [polcoeff (lfunrootres (lfuncreate (K))[1][1][2], -1), 2^K.r1 * (2*Pi)^K.r2
[0.78539816339744830961566084581987572105, 0.78539816339744830961566084581987572105]
gp> L = nfsubfields(K); L[2..length(L)]
[[x^2 + 1, x]]
gp> polgalois(K.pol)
gp> if(poldegree(K.pol) > 11, "polgalois only supports degree <= 11", iferr(polgalois(K.pol), E, "polgalois in degrees 8 to 11 requires the optional galdata package", errname(E) == "e_FILE" || errname(E) == "e_PACKAGE"))
[2, -1, 1, "S2"]
gp> p = 7; pfac = idealprimedec(K, p); vector(length(pfac), j, [pfac[j][3], pfac[j][4]])
[[1, 2]]
Expand Down
Loading