@@ -87,6 +87,21 @@ def classical_modular_polynomial(l, j=None):
87
87
sage: Y = polygen(parent(j), 'Y')
88
88
sage: classical_modular_polynomial(l,j) == classical_modular_polynomial(l)(j,Y)
89
89
True
90
+ sage: p = 2^216 * 3^137 - 1
91
+ sage: F.<i> = GF(p^2, modulus=[1,0,1])
92
+ sage: l = random_prime(50)
93
+ sage: j = F.random_element()
94
+ sage: Y = polygen(parent(j), 'Y')
95
+ sage: classical_modular_polynomial(l,j) == classical_modular_polynomial(l)(j,Y)
96
+ True
97
+ sage: E = EllipticCurve(F, [0, 6, 0, 1, 0])
98
+ sage: j = E.j_invariant()
99
+ sage: classical_modular_polynomial(l,j) == classical_modular_polynomial(l)(j,Y)
100
+ True
101
+ sage: R.<Y> = QQ['Y']
102
+ sage: j = QQ(1/2)
103
+ sage: classical_modular_polynomial(l, j) == classical_modular_polynomial(l)(j, Y)
104
+ True
90
105
"""
91
106
l = ZZ (l )
92
107
@@ -133,12 +148,14 @@ def classical_modular_polynomial(l, j=None):
133
148
# Now try to get the instantiated modular polynomial directly from PARI.
134
149
# This should be slightly more efficient (in particular regarding memory
135
150
# usage) than computing and evaluating the generic modular polynomial.
151
+ # This currently only works if we are over Z/nZ.
136
152
try :
137
153
pari_Phi = pari .polmodular (l , 0 , j )
154
+ return R (pari_Phi )
138
155
except PariError :
139
156
pass
140
- else :
141
- return R (pari_Phi )
157
+ except TypeError :
158
+ return R (ZZ [ 'Y' ]( pari_Phi ) )
142
159
143
160
# Nothing worked. Fall back to computing the generic modular polynomial
144
161
# and simply evaluating it.
0 commit comments