Skip to content

Commit

Permalink
Merge pull request #6277 from LMFDB/main
Browse files Browse the repository at this point in the history
main -> dev
  • Loading branch information
roed314 authored Nov 28, 2024
2 parents d27dd17 + 49cc378 commit 63b8da0
Show file tree
Hide file tree
Showing 10 changed files with 139 additions and 109 deletions.
48 changes: 45 additions & 3 deletions lmfdb/characters/main.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@


from lmfdb.app import app
import re
from flask import render_template, url_for, request, redirect, abort
from sage.all import euler_phi, PolynomialRing, QQ, gcd, ZZ
from sage.databases.cremona import class_to_int
from lmfdb.utils import (
to_dict, flash_error, SearchArray, YesNoBox, display_knowl, ParityBox,
TextBox, CountBox, parse_bool, parse_ints, search_wrap, raw_typeset_poly,
StatsDisplay, totaler, proportioners, comma, flash_warning, Downloader)
from lmfdb.utils.interesting import interesting_knowls
from lmfdb.utils.search_parsing import parse_range3
from lmfdb.utils.search_columns import SearchColumns, MathCol, LinkCol, CheckCol, ProcessedCol, MultiProcessedCol
from lmfdb.characters.utils import url_character
from lmfdb.characters.TinyConrey import ConreyCharacter
Expand Down Expand Up @@ -106,6 +106,12 @@ def __init__(self):
example="2",
example_span="2 or 3-5"
)
inducing = TextBox(
"inducing",
label="Induced by",
knowl="character.dirichlet.primitive",
example="3.b"
)
parity = ParityBox(
"parity",
knowl="character.dirichlet.parity",
Expand Down Expand Up @@ -133,12 +139,13 @@ def __init__(self):
count = CountBox()

self.refine_array = [
[modulus, conductor, order, is_real], [parity, is_primitive, is_minimal, count],
[modulus, conductor, order, inducing], [parity, is_primitive, is_minimal, is_real], [count],
]
self.browse_array = [
[modulus],
[conductor],
[order],
[inducing],
[parity],
[is_primitive],
[is_real],
Expand All @@ -156,6 +163,41 @@ def common_parse(info, query):
parse_ints(info, query, "modulus", name="modulus")
parse_ints(info, query, "conductor", name="conductor")
parse_ints(info, query, "order", name="order")
if 'inducing' in info:
try:
validate_label(info['inducing'])
parts_of_label = info['inducing'].split(".")
if len(parts_of_label) != 2:
raise ValueError("Invalid character orbit label format, expected N.a")
if not str.isalpha(parts_of_label[1]):
chi = ConreyCharacter(int(parts_of_label[0]), int(parts_of_label[1]))
label = db.char_dirichlet.lucky({'modulus': chi.modulus, 'first': chi.min_conrey_conj}, projection='label')
parts_of_label = label.split(".")
primitive_modulus = int(parts_of_label[0])
primitive_orbit = class_to_int(parts_of_label[1])+1
if db.char_dirichlet.count({'modulus':primitive_modulus,'is_primitive':True,'orbit':primitive_orbit}) == 0:
raise ValueError("Primitive character orbit not found")

def incompatible(query):
cond = query.get('conductor')
if cond is None:
return False
if isinstance(cond, int):
return cond != primitive_modulus
opts = parse_range3(info['conductor'], lower_bound=1, upper_bound=ORBIT_MAX_MOD)
for opt in opts:
if (isinstance(opt, int) and opt == primitive_modulus
or not isinstance(opt, int) and opt[0] <= primitive_modulus <= opt[1]):
return False
return True
if incompatible(query):
query["primitive_orbit"] = 0
else:
query["conductor"] = primitive_modulus
query["primitive_orbit"] = primitive_orbit
except ValueError:
flash_error("%s is not the label of a primitive character in the database", info['inducing'])
raise ValueError
if 'parity' in info:
parity = info['parity']
if parity == 'even':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,31 +103,14 @@ <h2> Dimensions </h2>

{% if space.dim > 0 %}
{% if space.has_trace_form %}
<script>
function show_qexp(qstyle) {
$('.smalloutput').hide();
$('.mediumoutput').hide();
$('.'+qstyle).show();
var elementBottom = $('#qexp-anchor').offset().top + $('#qexp-anchor').outerHeight();
var viewportTop = $(window).scrollTop();
return elementBottom < viewportTop;
}
</script>
<h2 id="qexp-anchor"> {{ KNOWL('cmf.space_trace_form', title='Trace form') }} </h2>
<div id="qexp">
<form>
<table class="qexp-table">
<tr>
<td class="qexp-output smalloutput">{{ space.trace_expansion(prec_max=10) | safe }}</td>
<td class="qexp-output mediumoutput nodisplay">{{ space.trace_expansion(prec_max=100) | safe }}</td>
<td class="qexp-output mediumoutput">{{ space.trace_expansion(prec_max=100) | safe }}</td>
</tr>
</table>
<p>
<div class="toggle">Display
<span class='smalloutput'><a onclick="show_qexp('mediumoutput'); return false;" href='#'>100 coefficients</a></span>
<span class='mediumoutput nodisplay'><a onclick="return show_qexp('smalloutput');" href='#qexp-anchor'>10 coefficients</a></span>
</div>
</p>
</form>
</div>
{% endif %}
Expand Down
35 changes: 3 additions & 32 deletions lmfdb/classical_modular_forms/templates/cmf_newform_common.html
Original file line number Diff line number Diff line change
Expand Up @@ -189,16 +189,6 @@ <h2> Embedding invariants </h2>
</table>
{% endif %}

<script>
function show_qexp(qstyle) {
$('.smalloutput').hide();
$('.mediumoutput').hide();
$('.'+qstyle).show();
var elementBottom = $('#qexp-anchor').offset().top + $('#qexp-anchor').outerHeight();
var viewportTop = $(window).scrollTop();
return elementBottom < viewportTop;
}
</script>
{% if newform.has_exact_qexp or (newform.embedding_label and newform.has_complex_qexp) %}

<h2 id="qexp-anchor"> {{ KNOWL('cmf.q-expansion',title='$q$-expansion')}}</h2>
Expand All @@ -219,25 +209,16 @@ <h2 id="qexp-anchor"> {{ KNOWL('cmf.q-expansion',title='$q$-expansion')}}</h2>
<tr>
<td class="fdef">\(f(q)\)</td>
<td class="op">\(=\)</td>
<td class="qexp-output smalloutput">{{ newform.q_expansion(prec_max=10) | safe }}</td>
<td class="qexp-output mediumoutput nodisplay">{{ newform.q_expansion(prec_max=100) | safe }}</td>
<td class="qexp-output mediumoutput">{{ newform.q_expansion(prec_max=100) | safe }}</td>
</tr>
{% if newform.dim > 1 %}
<tr>
<td class="topspace fdef">\(\operatorname{Tr}(f)(q)\)</td>
<td class="op topspace">\(=\)</td>
<td class="qexp-output topspace smalloutput">{{ newform.trace_expansion(prec_max=10) | safe }}</td>
<td class="qexp-output topspace mediumoutput nodisplay">{{ newform.trace_expansion(prec_max=100) | safe }}</td>
<td class="qexp-output topspace mediumoutput">{{ newform.trace_expansion(prec_max=100) | safe }}</td>
</tr>
{% endif %}
</table>

<p>
<div class="toggle" style="padding-left:9px;">Display
<span class='smalloutput'><a onclick="show_qexp('mediumoutput'); return false;" href='#'>100 coefficients</a></span>
<span class='mediumoutput nodisplay'><a onclick="return show_qexp('smalloutput');" href='#qexp-anchor'>10 coefficients</a></span>
</div>
</p>
</form>

{% if newform.show_hecke_ring_basis %}
Expand All @@ -251,19 +232,9 @@ <h2> {{ KNOWL('cmf.q-expansion',title='$q$-expansion')}}</h2>

<form id="qexp">
<table><tr><td>
<div class="smalloutput">
<span>\(\operatorname{Tr}(f)(q) = \) {{ newform.trace_expansion(prec_max=10) | safe }}</span>
</div>
<div class="mediumoutput nodisplay">
<div class="mediumoutput">
<span>\(\operatorname{Tr}(f)(q) = \) {{ newform.trace_expansion(prec_max=100) | safe }}</span>
</div></td></tr></table>

<p style="padding-left: 1ch;">
<div class="toggle">Display
<span class='smalloutput'><a onclick="show_qexp('mediumoutput'); return false" href='#'>100 coefficients</a></span>
<span class='mediumoutput nodisplay'><a onclick="show_qexp('smalloutput'); return false" href='#'>10 coefficients</a></span>
</div>
</p>
</form>
{% endif %}

Expand Down
19 changes: 1 addition & 18 deletions lmfdb/classical_modular_forms/templates/cmf_space.html
Original file line number Diff line number Diff line change
Expand Up @@ -142,31 +142,14 @@ <h2> Dimensions </h2>

{% if space.dim > 0 %}
{% if space.has_trace_form %}
<script>
function show_qexp(qstyle) {
$('.smalloutput').hide();
$('.mediumoutput').hide();
$('.'+qstyle).show();
var elementBottom = $('#qexp-anchor').offset().top + $('#qexp-anchor').outerHeight();
var viewportTop = $(window).scrollTop();
return elementBottom < viewportTop;
}
</script>
<h2 id="qexp-anchor"> {{ KNOWL('cmf.space_trace_form', title='Trace form') }} </h2>
<div id="qexp">
<form>
<table class="qexp-table">
<tr>
<td class="qexp-output smalloutput">{{ space.trace_expansion(prec_max=10) | safe }}</td>
<td class="qexp-output mediumoutput nodisplay">{{ space.trace_expansion(prec_max=100) | safe }}</td>
<td class="qexp-output mediumoutput">{{ space.trace_expansion(prec_max=100) | safe }}</td>
</tr>
</table>
<p>
<div class="toggle">Display
<span class='smalloutput'><a onclick="show_qexp('mediumoutput'); return false;" href='#'>100 coefficients</a></span>
<span class='mediumoutput nodisplay'><a onclick="return show_qexp('smalloutput');" href='#qexp-anchor'>10 coefficients</a></span>
</div>
</p>
</form>
</div>
{% endif %}
Expand Down
5 changes: 3 additions & 2 deletions lmfdb/classical_modular_forms/web_space.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from lmfdb.number_fields.web_number_field import nf_display_knowl, cyclolookup, rcyclolookup
from lmfdb.characters.TinyConrey import ConreyCharacter
from lmfdb.utils import (
display_knowl, web_latex, coeff_to_power_series,
display_knowl, raw_typeset_qexp,
web_latex_factored_integer, prop_int_pretty)
from flask import url_for
import re
Expand Down Expand Up @@ -156,7 +156,8 @@ def convert_spacelabel_from_conrey(spacelabel_conrey):

def trace_expansion_generic(space, prec_max=10):
prec = min(len(space.traces)+1, prec_max)
return web_latex(coeff_to_power_series([0] + space.traces[:prec-1],prec=prec),enclose=True)
return raw_typeset_qexp([0] + space.traces[:prec-1])
# return web_latex(coeff_to_power_series([0] + space.traces[:prec-1],prec=prec),enclose=True)


class DimGrid():
Expand Down
2 changes: 1 addition & 1 deletion lmfdb/ecnf/WebEllipticCurve.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ def make_E(self):
self.ntors = web_latex(self.torsion_order)
self.tr = len(self.torsion_structure)
if self.tr == 0:
self.tor_struct_pretty = "trivial"
self.tor_struct_pretty = "$0$"
if self.tr == 1:
self.tor_struct_pretty = r"\(\Z/%s\Z\)" % self.torsion_structure[0]
if self.tr == 2:
Expand Down
Loading

0 comments on commit 63b8da0

Please sign in to comment.