Skip to content

Commit 61fe97e

Browse files
Merge pull request #6269 from assaferan/master
modifying display of q-expansion to always have 100 coefficients
2 parents c48efd7 + 27558fd commit 61fe97e

File tree

5 files changed

+11
-73
lines changed

5 files changed

+11
-73
lines changed

lmfdb/classical_modular_forms/templates/cmf_full_gamma1_space.html

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -103,31 +103,14 @@ <h2> Dimensions </h2>
103103

104104
{% if space.dim > 0 %}
105105
{% if space.has_trace_form %}
106-
<script>
107-
function show_qexp(qstyle) {
108-
$('.smalloutput').hide();
109-
$('.mediumoutput').hide();
110-
$('.'+qstyle).show();
111-
var elementBottom = $('#qexp-anchor').offset().top + $('#qexp-anchor').outerHeight();
112-
var viewportTop = $(window).scrollTop();
113-
return elementBottom < viewportTop;
114-
}
115-
</script>
116106
<h2 id="qexp-anchor"> {{ KNOWL('cmf.space_trace_form', title='Trace form') }} </h2>
117107
<div id="qexp">
118108
<form>
119109
<table class="qexp-table">
120110
<tr>
121-
<td class="qexp-output smalloutput">{{ space.trace_expansion(prec_max=10) | safe }}</td>
122-
<td class="qexp-output mediumoutput nodisplay">{{ space.trace_expansion(prec_max=100) | safe }}</td>
111+
<td class="qexp-output mediumoutput">{{ space.trace_expansion(prec_max=100) | safe }}</td>
123112
</tr>
124113
</table>
125-
<p>
126-
<div class="toggle">Display
127-
<span class='smalloutput'><a onclick="show_qexp('mediumoutput'); return false;" href='#'>100 coefficients</a></span>
128-
<span class='mediumoutput nodisplay'><a onclick="return show_qexp('smalloutput');" href='#qexp-anchor'>10 coefficients</a></span>
129-
</div>
130-
</p>
131114
</form>
132115
</div>
133116
{% endif %}

lmfdb/classical_modular_forms/templates/cmf_newform_common.html

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -189,16 +189,6 @@ <h2> Embedding invariants </h2>
189189
</table>
190190
{% endif %}
191191

192-
<script>
193-
function show_qexp(qstyle) {
194-
$('.smalloutput').hide();
195-
$('.mediumoutput').hide();
196-
$('.'+qstyle).show();
197-
var elementBottom = $('#qexp-anchor').offset().top + $('#qexp-anchor').outerHeight();
198-
var viewportTop = $(window).scrollTop();
199-
return elementBottom < viewportTop;
200-
}
201-
</script>
202192
{% if newform.has_exact_qexp or (newform.embedding_label and newform.has_complex_qexp) %}
203193

204194
<h2 id="qexp-anchor"> {{ KNOWL('cmf.q-expansion',title='$q$-expansion')}}</h2>
@@ -219,25 +209,16 @@ <h2 id="qexp-anchor"> {{ KNOWL('cmf.q-expansion',title='$q$-expansion')}}</h2>
219209
<tr>
220210
<td class="fdef">\(f(q)\)</td>
221211
<td class="op">\(=\)</td>
222-
<td class="qexp-output smalloutput">{{ newform.q_expansion(prec_max=10) | safe }}</td>
223-
<td class="qexp-output mediumoutput nodisplay">{{ newform.q_expansion(prec_max=100) | safe }}</td>
212+
<td class="qexp-output mediumoutput">{{ newform.q_expansion(prec_max=100) | safe }}</td>
224213
</tr>
225214
{% if newform.dim > 1 %}
226215
<tr>
227216
<td class="topspace fdef">\(\operatorname{Tr}(f)(q)\)</td>
228217
<td class="op topspace">\(=\)</td>
229-
<td class="qexp-output topspace smalloutput">{{ newform.trace_expansion(prec_max=10) | safe }}</td>
230-
<td class="qexp-output topspace mediumoutput nodisplay">{{ newform.trace_expansion(prec_max=100) | safe }}</td>
218+
<td class="qexp-output topspace mediumoutput">{{ newform.trace_expansion(prec_max=100) | safe }}</td>
231219
</tr>
232220
{% endif %}
233221
</table>
234-
235-
<p>
236-
<div class="toggle" style="padding-left:9px;">Display
237-
<span class='smalloutput'><a onclick="show_qexp('mediumoutput'); return false;" href='#'>100 coefficients</a></span>
238-
<span class='mediumoutput nodisplay'><a onclick="return show_qexp('smalloutput');" href='#qexp-anchor'>10 coefficients</a></span>
239-
</div>
240-
</p>
241222
</form>
242223

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

252233
<form id="qexp">
253234
<table><tr><td>
254-
<div class="smalloutput">
255-
<span>\(\operatorname{Tr}(f)(q) = \) {{ newform.trace_expansion(prec_max=10) | safe }}</span>
256-
</div>
257-
<div class="mediumoutput nodisplay">
235+
<div class="mediumoutput">
258236
<span>\(\operatorname{Tr}(f)(q) = \) {{ newform.trace_expansion(prec_max=100) | safe }}</span>
259237
</div></td></tr></table>
260-
261-
<p style="padding-left: 1ch;">
262-
<div class="toggle">Display
263-
<span class='smalloutput'><a onclick="show_qexp('mediumoutput'); return false" href='#'>100 coefficients</a></span>
264-
<span class='mediumoutput nodisplay'><a onclick="show_qexp('smalloutput'); return false" href='#'>10 coefficients</a></span>
265-
</div>
266-
</p>
267238
</form>
268239
{% endif %}
269240

lmfdb/classical_modular_forms/templates/cmf_space.html

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -142,31 +142,14 @@ <h2> Dimensions </h2>
142142

143143
{% if space.dim > 0 %}
144144
{% if space.has_trace_form %}
145-
<script>
146-
function show_qexp(qstyle) {
147-
$('.smalloutput').hide();
148-
$('.mediumoutput').hide();
149-
$('.'+qstyle).show();
150-
var elementBottom = $('#qexp-anchor').offset().top + $('#qexp-anchor').outerHeight();
151-
var viewportTop = $(window).scrollTop();
152-
return elementBottom < viewportTop;
153-
}
154-
</script>
155145
<h2 id="qexp-anchor"> {{ KNOWL('cmf.space_trace_form', title='Trace form') }} </h2>
156146
<div id="qexp">
157147
<form>
158148
<table class="qexp-table">
159149
<tr>
160-
<td class="qexp-output smalloutput">{{ space.trace_expansion(prec_max=10) | safe }}</td>
161-
<td class="qexp-output mediumoutput nodisplay">{{ space.trace_expansion(prec_max=100) | safe }}</td>
150+
<td class="qexp-output mediumoutput">{{ space.trace_expansion(prec_max=100) | safe }}</td>
162151
</tr>
163152
</table>
164-
<p>
165-
<div class="toggle">Display
166-
<span class='smalloutput'><a onclick="show_qexp('mediumoutput'); return false;" href='#'>100 coefficients</a></span>
167-
<span class='mediumoutput nodisplay'><a onclick="return show_qexp('smalloutput');" href='#qexp-anchor'>10 coefficients</a></span>
168-
</div>
169-
</p>
170153
</form>
171154
</div>
172155
{% endif %}

lmfdb/classical_modular_forms/web_space.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from lmfdb.number_fields.web_number_field import nf_display_knowl, cyclolookup, rcyclolookup
99
from lmfdb.characters.TinyConrey import ConreyCharacter
1010
from lmfdb.utils import (
11-
display_knowl, web_latex, coeff_to_power_series,
11+
display_knowl, raw_typeset_qexp,
1212
web_latex_factored_integer, prop_int_pretty)
1313
from flask import url_for
1414
import re
@@ -156,7 +156,8 @@ def convert_spacelabel_from_conrey(spacelabel_conrey):
156156

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

161162

162163
class DimGrid():

lmfdb/utils/web_display.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def raw_typeset(raw, typeset='', extra='', compressed=False):
4343
# clean white space
4444
raw = re.sub(r'\s+', ' ', str(raw).strip())
4545
raw = f'<textarea rows="1" cols="{len(raw)}" class="raw-container">{raw}</textarea>'
46-
46+
4747
# the doublesclick behavior is set on load in javascript
4848
out = f"""
4949
<span class="raw-tset-container tset {"compressed" if compressed else ""}">
@@ -587,7 +587,7 @@ def raw_typeset_poly_factor(factors, # list of pairs (f,e)
587587

588588

589589
def raw_typeset_qexp(coeffs_list,
590-
compress_threshold=100,
590+
compress_threshold=200,
591591
coeff_compress_threshold=30,
592592
var=r"\beta",
593593
final_rawvar='b',
@@ -655,7 +655,7 @@ def rawtset_coeff(i, coeffs):
655655
raw += r
656656
if add_to_tset:
657657
tset += t
658-
if add_to_tset and "cdots" in tset:
658+
if add_to_tset and (len(tset) > compress_threshold):
659659
add_to_tset = False
660660
lastt = None
661661
else:

0 commit comments

Comments
 (0)