From bfa4d639628bd9d268aa9ed1ab39e1d2b93bf4ea Mon Sep 17 00:00:00 2001
From: John Jones
Date: Fri, 23 Aug 2024 19:08:31 -0400
Subject: [PATCH 1/6] Start
---
lmfdb/number_fields/templates/nf-show-field.html | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/lmfdb/number_fields/templates/nf-show-field.html b/lmfdb/number_fields/templates/nf-show-field.html
index dd3657fdf8..a43d23c6e7 100644
--- a/lmfdb/number_fields/templates/nf-show-field.html
+++ b/lmfdb/number_fields/templates/nf-show-field.html
@@ -82,6 +82,11 @@ {{ KNOWL('nf.ideal_class_group', title='Class group') }} and {{ KNOWL('nf.
{{ info.grh_label|safe }}
{{ place_code('class_group') }}
+ {% if nf.is_cm_field() %}
+
Date: Mon, 2 Sep 2024 17:03:08 -0400
Subject: [PATCH 2/6] Search for relative class number
---
lmfdb/number_fields/number_field.py | 31 +++++++++++++------
.../templates/nf-show-field.html | 3 +-
lmfdb/number_fields/web_number_field.py | 17 +++++++---
3 files changed, 36 insertions(+), 15 deletions(-)
diff --git a/lmfdb/number_fields/number_field.py b/lmfdb/number_fields/number_field.py
index f350f55060..e614ca7395 100644
--- a/lmfdb/number_fields/number_field.py
+++ b/lmfdb/number_fields/number_field.py
@@ -839,7 +839,7 @@ def number_field_jump(info):
MathCol("torsion_order", "nf.unit_group", "Unit group torsion", align="center", default=False),
MultiProcessedCol("unit_rank", "nf.rank", "Unit group rank", ["r2", "degree"], lambda r2, degree: degree - r2 - 1, align="center", mathmode=True, default=False),
MathCol("regulator", "nf.regulator", "Regulator", align="left", default=False)],
- db_cols=["class_group", "coeffs", "degree", "r2", "disc_abs", "disc_sign", "galois_label", "label", "ramps", "used_grh", "cm", "is_galois", "torsion_order", "regulator", "rd", "grd", "monogenic", "num_ram"])
+ db_cols=["class_group", "coeffs", "degree", "r2", "disc_abs", "disc_sign", "galois_label", "label", "ramps", "used_grh", "cm", "is_galois", "torsion_order", "regulator", "rd", "grd", "monogenic", "num_ram", "relative_class_number"])
def nf_postprocess(res, info, query):
galois_labels = [rec["galois_label"] for rec in res if rec.get("galois_label")]
@@ -895,6 +895,7 @@ def number_field_search(info, query):
parse_floats(info, query, 'rd')
parse_floats(info, query, 'regulator')
parse_posints(info,query,'class_number')
+ parse_posints(info,query,'relative_class_number')
parse_ints(info,query,'num_ram')
parse_bool(info,query,'cm_field',qfield='cm')
parse_bool(info,query,'is_galois')
@@ -1196,6 +1197,11 @@ def __init__(self):
knowl="nf.ideal_class_group",
example="[2,4]",
example_span="[ ], [3], or [2,4]")
+ relative_class_number = TextBox(
+ name="relative_class_number",
+ label="Relative class number",
+ knowl="nf.relative_class_number",
+ example="3")
num_ram = TextBox(
name="num_ram",
label="Ramified prime count",
@@ -1258,13 +1264,20 @@ def __init__(self):
[class_number, class_group],
[ram_primes, ur_primes],
[regulator, cm_field],
- [completion, subfield],
- [index, inessentialprimes],
- [monogenic, is_minimal_sibling],
- [count]]
+ [completion, relative_class_number],
+ [index, subfield],
+ [monogenic, inessentialprimes],
+ [count, is_minimal_sibling]]
self.refine_array = [
- [degree, signature, class_number, class_group, cm_field],
- [num_ram, ram_primes, ur_primes, gal, is_galois],
- [discriminant, rd, grd, regulator, subfield],
- [completion, is_minimal_sibling, monogenic, index, inessentialprimes]]
+ [degree, signature, num_ram, ram_primes, ur_primes ],
+ [gal, is_galois, subfield, class_group, class_number],
+ [discriminant, rd, grd, cm_field, relative_class_number],
+ [regulator, completion, monogenic, index, inessentialprimes],
+ [is_minimal_sibling]]
+
+ #[degree, signature, class_number, class_group, cm_field],
+ #[num_ram, ram_primes, ur_primes, gal, is_galois],
+ #[discriminant, rd, grd, regulator, subfield],
+ #[completion, is_minimal_sibling, monogenic, index, inessentialprimes],
+ #[relative_class_number]]
diff --git a/lmfdb/number_fields/templates/nf-show-field.html b/lmfdb/number_fields/templates/nf-show-field.html
index a43d23c6e7..a9c1e0689e 100644
--- a/lmfdb/number_fields/templates/nf-show-field.html
+++ b/lmfdb/number_fields/templates/nf-show-field.html
@@ -84,7 +84,8 @@ {{ KNOWL('nf.ideal_class_group', title='Class group') }} and {{ KNOWL('nf.
{% if nf.is_cm_field() %}
- Relative class number: {{ nf.relh() }}
+ {{KNOWL('nf.relative_class_number','Relative class number')}}: {{ nf.relh() }}
+ {{ info.grh_label|safe }}
{% endif %}
diff --git a/lmfdb/number_fields/web_number_field.py b/lmfdb/number_fields/web_number_field.py
index 5870c6ab96..895972248c 100644
--- a/lmfdb/number_fields/web_number_field.py
+++ b/lmfdb/number_fields/web_number_field.py
@@ -800,16 +800,18 @@ def units(self): # fundamental units
def cnf(self):
if self.degree()==1:
return r'=\mathstrut & \frac{2^1 (2\pi)^0 \cdot 1\cdot 1}{2\cdot\sqrt 1}' + r'\cr' + r'= \mathstrut & 1'
- if not self.haskey('class_group'):
- return r'$ '+na_text()
- # Otherwise we should have what we need
[r1,r2] = self.signature()
- reg = self.regulator()
- h = self.class_number()
w = self.root_of_1_order()
r1term= r'2^{%s}\cdot'% r1
r2term= r'(2\pi)^{%s}\cdot'% r2
disc = ZZ(self._data['disc_abs'])
+ approx1 = r'= \mathstrut &'
+ if not self.haskey('class_group'):
+ ltx = r'%s\frac{%s%s %s \cdot %s}{%s\cdot\sqrt{%s}}'%(approx1,r1term,r2term,'R','h',w,disc)
+ return ltx+r'\cr\mathstrut & \text{ | some values not computed }'
+ # Otherwise we should have what we need
+ reg = self.regulator()
+ h = self.class_number()
approx1 = r'\approx' if self.unit_rank()>0 else r'='
approx1 += r"\mathstrut &"
ltx = r'%s\frac{%s%s %s \cdot %s}{%s\cdot\sqrt{%s}}'%(approx1,r1term,r2term,str(reg),h,w,disc)
@@ -869,6 +871,11 @@ def can_class_number(self):
return True
return False
+ def relh(self):
+ if self.haskey('relative_class_number'):
+ return self._data['relative_class_number']
+ return dnc
+
def is_null(self):
return self._data is None
From 4c1c99bb95b16c2f9188b3d349d8e9aaae788b44 Mon Sep 17 00:00:00 2001
From: roed314
Date: Wed, 4 Sep 2024 21:33:11 -0400
Subject: [PATCH 3/6] Update nf-show-field.html
Make relative class number latex
---
lmfdb/number_fields/templates/nf-show-field.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lmfdb/number_fields/templates/nf-show-field.html b/lmfdb/number_fields/templates/nf-show-field.html
index a9c1e0689e..a4584b5517 100644
--- a/lmfdb/number_fields/templates/nf-show-field.html
+++ b/lmfdb/number_fields/templates/nf-show-field.html
@@ -84,7 +84,7 @@ {{ KNOWL('nf.ideal_class_group', title='Class group') }} and {{ KNOWL('nf.
{% if nf.is_cm_field() %}
- {{KNOWL('nf.relative_class_number','Relative class number')}}: {{ nf.relh() }}
+ {{KNOWL('nf.relative_class_number','Relative class number')}}: ${{ nf.relh() }}$
{{ info.grh_label|safe }}
{% endif %}
From 00463d9f4eedbb941ecbd6876d3604b781bef402 Mon Sep 17 00:00:00 2001
From: David Roe
Date: Wed, 4 Sep 2024 23:43:07 -0400
Subject: [PATCH 4/6] Move dollar signs to relh function
---
lmfdb/number_fields/templates/nf-show-field.html | 2 +-
lmfdb/number_fields/web_number_field.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lmfdb/number_fields/templates/nf-show-field.html b/lmfdb/number_fields/templates/nf-show-field.html
index a4584b5517..a9c1e0689e 100644
--- a/lmfdb/number_fields/templates/nf-show-field.html
+++ b/lmfdb/number_fields/templates/nf-show-field.html
@@ -84,7 +84,7 @@ {{ KNOWL('nf.ideal_class_group', title='Class group') }} and {{ KNOWL('nf.
{% if nf.is_cm_field() %}
- {{KNOWL('nf.relative_class_number','Relative class number')}}: ${{ nf.relh() }}$
+ {{KNOWL('nf.relative_class_number','Relative class number')}}: {{ nf.relh() }}
{{ info.grh_label|safe }}
{% endif %}
diff --git a/lmfdb/number_fields/web_number_field.py b/lmfdb/number_fields/web_number_field.py
index 895972248c..56eb5953aa 100644
--- a/lmfdb/number_fields/web_number_field.py
+++ b/lmfdb/number_fields/web_number_field.py
@@ -873,7 +873,7 @@ def can_class_number(self):
def relh(self):
if self.haskey('relative_class_number'):
- return self._data['relative_class_number']
+ return '$' + self._data['relative_class_number'] + '$'
return dnc
def is_null(self):
From bc1daaf80ed9ebf7ac9d871363ea053960f49f64 Mon Sep 17 00:00:00 2001
From: David Roe
Date: Wed, 4 Sep 2024 23:44:08 -0400
Subject: [PATCH 5/6] Relative class number is not a string
---
lmfdb/number_fields/web_number_field.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lmfdb/number_fields/web_number_field.py b/lmfdb/number_fields/web_number_field.py
index 56eb5953aa..18f461677e 100644
--- a/lmfdb/number_fields/web_number_field.py
+++ b/lmfdb/number_fields/web_number_field.py
@@ -873,7 +873,7 @@ def can_class_number(self):
def relh(self):
if self.haskey('relative_class_number'):
- return '$' + self._data['relative_class_number'] + '$'
+ return f"${self._data['relative_class_number']}$"
return dnc
def is_null(self):
From c2cb90faf4e878632b2d87473d970e8044e852ad Mon Sep 17 00:00:00 2001
From: David Roe
Date: Wed, 4 Sep 2024 23:49:29 -0400
Subject: [PATCH 6/6] Add test
---
lmfdb/number_fields/test_numberfield.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/lmfdb/number_fields/test_numberfield.py b/lmfdb/number_fields/test_numberfield.py
index 19c2739095..2b4d82c1cb 100644
--- a/lmfdb/number_fields/test_numberfield.py
+++ b/lmfdb/number_fields/test_numberfield.py
@@ -77,6 +77,9 @@ def test_signature_search(self):
self.check_args('/NumberField/?start=0°ree=6&signature=%5B0%2C3%5D&count=100', '6.0.61131.1')
self.check_args('/NumberField/?start=0°ree=7&signature=%5B3%2C2%5D&count=100', '7.3.1420409.1')
+ def test_relative_class_number(self):
+ self.check_args('/NumberField/4.0.1327873600.2', '2108')
+
def test_fundamental_units(self):
self.check_args('NumberField/2.2.10069.1', '43388173')
self.check_args('NumberField/3.3.10004569.1', '22153437467081345')
|