In [61]:
[(p, Gamma(p).index(), Gamma(p).ncusps(), Gamma1(p).index(), Gamma1(p).ncusps(), Gamma0(p).index()) for p in primes(50)]
Out[61]:
In [321]:
[Gamma1(p).cusps() for p in primes(3,12)]
Out[321]:
In [320]:
Gamma(3).cusps()
Out[320]:
In [187]:
[2 * Gamma(p).ncusps() / Gamma1(p).ncusps() - 1 for p in primes(3,50)]
Out[187]:
In [177]:
p = 5
vals = frozenset((3/5,))
ts = frozenset(QQ(r) for r in Gamma1(p).cusps() if r != Infinity)
gs = frozenset(g^i for g in Gamma1(p).gens() for i in (1, -1))
while len(ts & vals) == 0:
vals = frozenset(g.acton(r) for g in gs for r in vals)
ts = frozenset(g.acton(r) for g in gs for r in ts)
ts & vals
Out[177]:
In [184]:
frozenset((g, i, (g^i).acton(0)) for g in Gamma1(p).gens() for i in (1, -1))
Out[184]:
In [168]:
vals = frozenset((Cusp(3/5),))
vals = frozenset(g.acton(r) for g in gs for r in vals)
print list(vals)[3], list(ts)[2], list(vals)[3] == list(ts)[2]
In [173]:
type(list(ts)[2])
Out[173]:
In [175]:
type(list(vals)[3])
Out[175]:
In [68]:
Gamma1(11).genus()
Out[68]:
In [191]:
Gamma0(2).genus()
Out[191]:
In [190]:
Gamma0(2).nu2()
Out[190]:
In [79]:
Gamma1(2).nu3()
Out[79]:
In [209]:
[p for p in primes(50) if Gamma0(p).genus() == 1]
Out[209]:
In [340]:
G.coset_reps()
Out[340]:
In [216]:
S, T = Gamma(1).gens()
In [341]:
[I, T, S, S*T, T*S, T*S*T]
Out[341]:
In [236]:
(T^(-1) * S * T * S)
Out[236]:
In [235]:
T^(-2) * S * T^(-1)
Out[235]:
In [237]:
T*S*T*S
Out[237]:
In [389]:
def growset(s):
return set(g^i * h^j for g in s for h in s for i in (-1, 1) for j in (-1, 1) if not (g == T^2 and h == T^2))
In [407]:
G = Gamma(2)
pm1 = (-1, 1)
gens = set(G.gens() + (I,))
gens2 = growset(gens)
gens3 = growset(gens2)
print len(gens), len(gens2), len(gens3)
In [310]:
[parametric_plot(f1, (t, 0, 1), color=col) + parametric_plot(f2, (t, 0, .9999),color=col) for g in gs for f1, f2 in (dofns(g),) for col in (hue(random()),)]
Out[310]:
In [353]:
GGG = growset(GG)
In [411]:
gs = gens3
def dofns(g):
f1c(t) = g.acton(exp(pi*ii*(3+t)/6))
f2c(t) = g.acton(-1/2 + ii*(sqrt(3)/2 - log(1-t)))
f1r(t) = real(f1c(t))
f1i(t) = imag(f1c(t))
f2r(t) = real(f2c(t))
f2i(t) = imag(f2c(t))
f1 = (f1r(t), f1i(t))
f2 = (f2r(t), f2i(t))
return (f1, f2)
P = sum([parametric_plot(f1, (t, 0, 1), color='red') + parametric_plot(f2, (t, 0, .9999), color='red') for g in gs for f1, f2 in (dofns(g),) for col in (hue(random()),)])
In [412]:
P1 = P
In [354]:
G = Gamma(2)
G.coset_reps()
Out[354]:
In [413]:
(P1 + P2).show(ymin=0,ymax=2,xmin=-1,xmax=2)
In [264]:
exp(log(23))
Out[264]:
In [278]:
imag(3)
Out[278]:
In [294]:
hue(random())
Out[294]:
In [308]:
f1
Out[308]:
In [334]:
G.coset_reps()
Out[334]:
In [336]:
T = G.coset_reps()[1]
S = G.coset_reps()[2]
print S, T
In [316]:
b=var('b')
In [328]:
type(m)
Out[328]:
In [331]:
G.coset_reps()[0]
Out[331]:
In [433]:
for D in range(-100, 0):
if is_fundamental_discriminant(D) and hilbert_class_polynomial(D).degree() == 5:
print D
In [425]:
fundamental_discriminant(-2)
Out[425]:
In [428]:
is_fundamental_discriminant(-2)
Out[428]:
In [432]:
def norm_equation(D,p):
""" Solves the norm equation 4p=t^2-v^2D for t and v given D and a probable prime p. Either returns a solution (t,v) or () if no solution exists """
assert D < 0
if -D >= 4*p: return ()
if p==2:
if is_square(D+8): return (sqrt(D+8),1)
return ()
if kronecker(D,p) == -1: return ()
F=GF(p,proof=false)
x0=F(D).sqrt().lift()
assert not (x0^2 - D) % p # just in case p isn't prime
if (x0-D)%2: x0 = p - x0
a = 2*p; t=x0; m = floor(2*sqrt(p))
while t > m: (a,t)=(t,a%t)
if (4*p-t^2) % (-D): return ()
c = ZZ((4*p-t^2)/(-D))
if not is_square(c): return ()
v=sqrt(c)
assert 4*p == t^2-v^2*D
return (t,v)
In [511]:
l = 2
D = -79
for p in primes(2000):
tv = norm_equation(D, p)
if tv != ():
t, v = tv
if (l^3).divides(v):
for j, n in hilbert_class_polynomial(D).change_ring(GF(p)).roots():
A = 3*j*(1728-j)
B = 2*j*(1728-j)^2
E = EllipticCurve([A, B])
In [450]:
kronecker(-47, 2)
Out[450]:
In [466]:
%latex
Hello \[ x=f(x) \]
In [474]:
E.j_invariant() in Graph({E.j_invariant(): []})
Out[474]:
In [599]:
def isogeny_graph(l, E):
from sage.graphs.graph_plot import _circle_embedding
j = E.j_invariant()
G = Graph({j: []}, loops=True)
frontier = set([(E, j)])
while len(frontier) > 0:
newfrontier = set()
for E0, j0 in frontier:
for iso in E0.isogenies_prime_degree(l):
E1 = iso.codomain()
j1 = E1.j_invariant()
if j1 not in G:
G.add_vertex(j1)
newfrontier.add((E1, j1))
G.add_edge(j0, j1)
frontier = newfrontier
cycs = G.cycle_basis()
assert len(cycs) == 1
surface = cycs[0]
n = len(surface)
pos = {}
for i in range(len(surface)):
v0 = surface[i]
ang = 2*pi*i/n
tree = G.subgraph(v for v in G if len(G.all_paths(v,v0)) == 1).layout(layout='tree', tree_root=v0, tree_orientation='right')
x0, y0 = tree[v0]
tree0 = {v: (x - x0, y - y0) for v, (x, y) in tree.iteritems()}
c, s = cos(ang), sin(ang)
x1, y1 = 2*c, 2*s
newpos = {v: (x1 + x*c - y*s, y1 + x*s + y*c) for v, (x, y) in tree0.iteritems()}
if v0 == 383:
print tree
print tree0
print newpos
pos.update(newpos)
G.layout(pos=pos, save_pos=True)
G.name(str(l) + '-isogeny graph of ' + str(E))
return G
In [600]:
G = isogeny_graph(l, E)
col = {'#7777FF': G.cycle_basis()[0]}
G.plot(vertex_colors=col)
Out[600]:
In [620]:
v0 = 321
H = G.subgraph(v for v in G if len(G.all_paths(v,v0)) == 1)
print H.layout(layout='tree', tree_root=v0, tree_orientation='right', save_pos=True)
H.plot()
Out[620]:
In [610]:
383 in H
Out[610]:
In [497]:
from sage.graphs.graph_plot import _circle_embedding
In [512]:
isos = E.isogenies_prime_degree(2)
In [507]:
iso = isos[0]
In [508]:
iso.is_injective()
Out[508]:
In [513]:
[iso.is_injective() for iso in isos]
Out[513]:
In [514]:
G.cycle_basis()
Out[514]:
In [546]:
G.layout_spring(save_pos=True);
In [540]:
G.plot()
Out[540]:
In [547]:
G._pos
Out[547]:
In [543]:
G.plot()
Out[543]:
In [549]:
G.all_paths(321,1300)
Out[549]:
In [593]:
s = G.subgraph(v for v in G if len(G.all_paths(321,v)) == 1)
s.layout(layout='tree', tree_orientation='right', tree_root=321, save_pos=True)
s.plot()
Out[593]:
In [576]:
s._pos
Out[576]:
In [569]:
In [577]:
a = {1: (2, 3)}
In [578]:
a.update({3: (4, 5)})
In [575]:
a
Out[575]:
In [579]:
[x + y + z for x, (y, z) in a.iteritems()]
Out[579]:
In [ ]: