Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
241852 views
1
from sage.all import polygen, NumberField, EllipticCurve
2
3
from psage.modform.hilbert.sqrt5.tables import primes_of_bounded_norm, F
4
5
a = F.gen()
6
7
import psage.ellcurve.lseries.sqrt5 as sqrt5
8
import psage.modform.hilbert.sqrt5.sqrt5_fast as sqrt5_fast
9
10
def test_ap_via_enumeration(B=1000):
11
a4 = 6912*a - 5643
12
a6 = -131328*a + 298566
13
E = EllipticCurve([a4, a6])
14
D = E.discriminant()
15
for P in primes_of_bounded_norm(B):
16
if D.valuation(P) == 0:
17
R = sqrt5_fast.ResidueRing(P, 1)
18
ap0 = sqrt5.ap_via_enumeration(R(a4), R(a6))
19
k = P.residue_field(); E0 = E.change_ring(k); ap1 = k.cardinality() + 1 - E0.cardinality()
20
assert ap0 == ap1
21
22
23
24