Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemath
GitHub Repository: sagemath/sagelib
Path: blob/master/sage/modular/modform/j_invariant.py
4076 views
1
from eis_series import eisenstein_series_qexp
2
from vm_basis import delta_qexp
3
from sage.rings.all import QQ
4
5
def j_invariant_qexp(prec=10, K=QQ):
6
r"""
7
Return the $q$-expansion of the $j$-invariant to
8
precision prec in the field $K$.
9
10
WARNING: Stupid algorithm -- we divide by Delta, which is slow.
11
12
EXAMPLES:
13
sage: j_invariant_qexp(4)
14
q^-1 + 744 + 196884*q + 21493760*q^2 + 864299970*q^3 + O(q^4)
15
sage: j_invariant_qexp(2)
16
q^-1 + 744 + 196884*q + O(q^2)
17
sage: j_invariant_qexp(100, GF(2))
18
q^-1 + q^7 + q^15 + q^31 + q^47 + q^55 + q^71 + q^87 + O(q^100)
19
"""
20
if prec <= -1:
21
raise ValueError, "the prec must be nonnegative."
22
prec += 2
23
g6 = -504*eisenstein_series_qexp(6, prec, K=QQ)
24
Delta = delta_qexp(prec).change_ring(QQ)
25
j = (g6*g6) * (~Delta) + 1728
26
if K != QQ:
27
return j.change_ring(K)
28
else:
29
return j
30
31
32
# NOTE: this needs to be sped up. The pari code src/basemath/trans3.c is
33
# faster.
34
35