Path: blob/master/src/sage/modular/modform/j_invariant.py
8820 views
from eis_series import eisenstein_series_qexp1from vm_basis import delta_qexp2from sage.rings.all import QQ34def j_invariant_qexp(prec=10, K=QQ):5r"""6Return the $q$-expansion of the $j$-invariant to7precision prec in the field $K$.89WARNING: Stupid algorithm -- we divide by Delta, which is slow.1011EXAMPLES:12sage: j_invariant_qexp(4)13q^-1 + 744 + 196884*q + 21493760*q^2 + 864299970*q^3 + O(q^4)14sage: j_invariant_qexp(2)15q^-1 + 744 + 196884*q + O(q^2)16sage: j_invariant_qexp(100, GF(2))17q^-1 + q^7 + q^15 + q^31 + q^47 + q^55 + q^71 + q^87 + O(q^100)18"""19if prec <= -1:20raise ValueError, "the prec must be nonnegative."21prec += 222g6 = -504*eisenstein_series_qexp(6, prec, K=QQ)23Delta = delta_qexp(prec).change_ring(QQ)24j = (g6*g6) * (~Delta) + 172825if K != QQ:26return j.change_ring(K)27else:28return j293031# NOTE: this needs to be sped up. The pari code src/basemath/trans3.c is32# faster.333435