Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def ordernorm(A, n):
- """ Does the quadratic order A contain an element of norm n? """
- K = A.number_field()
- Is = K.ideals_of_bdd_norm(n)[n]
- for I in Is:
- if not I.is_principal(): continue
- g = I.gens_reduced()[0]
- for u in K.roots_of_unity():
- if g*u in A: return True
- return False
- def isos_any_degree(E, n):
- """ Compute all isogenies from E of degree n """
- factors = flatten(list([p]*e for (p, e) in n.factor()))
- isos = E.isogenies_prime_degree(factors[0])
- for f in factors[1:]:
- new_isos = []
- for h in isos:
- EE = h.codomain()
- for j in EE.isogenies_prime_degree(f):
- new_isos.append(j*h)
- isos = new_isos
- return isos
- def has_endo(E, n):
- """ Does E have an endomorphism of degree n? """
- H = isos_any_degree(E, n)
- for h in H:
- if h.codomain().is_isomorphic(E):
- return True
- return False
- def endomorphism_conductor(E):
- """ Compute the conductor of the order which is the endomorphism ring of E. """
- A0 = E.frobenius_order()
- K = A0.number_field()
- if K.degree() != 2: raise ValueError
- if K.disc() % 4:
- t = (K(K.disc()).sqrt() + 1)/2
- else:
- t = K(K.disc()/4).sqrt()
- c0 = ZZ((A0.discriminant() / K.discriminant()).sqrt())
- assert A0 == K.order([c0*t])
- ords = [K.order([c*t]) for c in c0.divisors()]
- auts = len(E.automorphisms())
- ords = [A for A in ords if len(list(u for u in K.roots_of_unity() if u in A)) == auts]
- for n in [2..100]:
- if len(ords) == 1:
- break
- if len(ords) == 0:
- raise ArithmeticError
- #print("Testing n = %s, candidate orders %s" % (n, [A.discriminant() for A in ords]))
- if all(ordernorm(A, n) for A in ords):
- #print("n = %s won't help: all have norm n" % n)
- continue
- elif all (not ordernorm(A, n) for A in ords):
- #print("n = %s won't help: none have norm n" % n)
- continue
- if has_endo(E, n):
- ords = [A for A in ords if ordernorm(A, n)]
- else:
- ords = [A for A in ords if not ordernorm(A, n)]
- else:
- raise ArithmeticError("Can't distinguish orders of conductors %s and %s" % (ords[0].discriminant(), ords[1].discriminant()))
- return (ords[0].discriminant() / K.discriminant()).sqrt()
Add Comment
Please, Sign In to add comment