CoCalc Shared Fileswww / cgi-bin / mfd / mfe_charpoly.pyOpen in CoCalc with one click!
Author: William A. Stein
1
#!/usr/bin/python
2
3
import cgi, mfd, sys, mfe_source, constants
4
5
form = cgi.FieldStorage()
6
7
print "Content-Type: text/html"
8
print ""
9
10
if form.has_key("code"):
11
code = form["code"].value
12
else:
13
print "Missing code"
14
sys.exit(0)
15
16
if form.has_key("n"):
17
n = int(form["n"].value)
18
else:
19
print "Missing n"
20
sys.exit(0)
21
22
23
M = mfd.ModSym(code)
24
f = M.charpoly(n)
25
source = M.charpoly_source(n)
26
print "// Characteristic polynomial of T_%s on %s<br>"%(n,code)
27
if source != constants.not_computed:
28
print "// Source of data: %s<br>"%mfe_source.Link(M.source(source))
29
print "f := %s;\n"%f
30
31