Open with one click!
1
#!/usr/bin/python
2
3
# mfe_qexpansion.py (part of the Modular Forms Explorer)
4
# (c) William Stein, November 2001, [email protected]
5
6
import cgi # cgi-bin
7
import Documents, HTML
8
9
import misc
10
import constants
11
import mfd # modular forms database
12
13
import os, string
14
15
print "Content-Type: text/html" # HTML is following
16
print # blank line, end of headers
17
18
form = cgi.FieldStorage()
19
20
if not form.has_key("code"):
21
print "<h1>Error</h1>"
22
print "The mfe_qexpansion.py script was called from an invalid form."
23
print "This means William Stein ([email protected]) made a mistake somewhere, "
24
print "or our web client did something funny."
25
print "Please let him know how you caused this error message."
26
27
##################################
28
29
code = form["code"].value
30
prec = form["precision"].value
31
if not misc.is_nonnegative_number(prec):
32
prec = 8
33
else:
34
prec = int(prec)
35
f = mfd.ModSym_From_Code(code)
36
N = f.level
37
k = f.weight
38
eps = f.dirchar
39
40
doc = Documents.Document()
41
doc.append(HTML.TITLE('The Modular Forms Explorer: q-Expansion of %s'%code))
42
doc.append(HTML.LINK(rel="stylesheet", type="text/css", \
43
HREF="/mfd/mfd.css", TITLE="was"))
44
45
body = HTML.BODY(klass="top")
46
47
doc.append(body)
48
body.append(HTML.CENTER(HTML.H1('The Modular Forms Explorer')))
49
body.append(HTML.CENTER(HTML.FORM(\
50
HTML.INPUT(type="submit", name="button", value="Go to N=%s, k=%s"%(N,k)),\
51
HTML.INPUT(type="hidden", name="level", value=str(N)), \
52
HTML.INPUT(type="hidden", name="weight", value=str(k)), \
53
HTML.INPUT(type="hidden", name="character", value=eps+":"+str(N)), \
54
HTML.INPUT(type="hidden", name="iso_class", value="0"), \
55
action="%s/mfe_full_html.py"%constants.CGIROOT, method="POST")))
56
57
body.append(HTML.HR())
58
body.append(HTML.H2("The q-Expansion of <b>%s</b> to precision at most %s."%(code,prec)))
59
60
qexp = f.q_expansion(prec)
61
62
if f.hecke_field() != constants.not_computed:
63
body.append("Let a be a root of %s.<br>"%f.hecke_field())
64
65
body.append("<br>The q-expansion of f is:<br><br>%s"%qexp)
66
67
68
print doc
69
70
71
72