# Lists of Manin symbols (elements of $$\mathbb{P}^1(\ZZ/N\ZZ)$$) over $$\QQ$$¶

class sage.modular.modsym.p1list.P1List

Bases: object

The class for $$\mathbb{P}^1(\ZZ/N\ZZ)$$, the projective line modulo $$N$$.

EXAMPLES:

sage: P = P1List(12); P
The projective line over the integers modulo 12
sage: list(P)
[(0, 1), (1, 0), (1, 1), (1, 2), (1, 3), (1, 4), (1, 5), (1, 6), (1, 7), (1, 8), (1, 9), (1, 10), (1, 11), (2, 1), (2, 3), (2, 5), (3, 1), (3, 2), (3, 4), (3, 7), (4, 1), (4, 3), (4, 5), (6, 1)]


sage: loads(dumps(P)) == P
True

N()

Returns the level or modulus of this P1List.

EXAMPLES:

sage: L = P1List(120)
sage: L.N()
120

apply_I(i)

Return the index of the result of applying the matrix $$I=[-1,0;0,1]$$ to the $$i$$‘th element of this P1List.

INPUT:

• i - integer (the index of the element to act on).

EXAMPLES:

sage: L = P1List(120)
sage: L[10]
(1, 9)
sage: L.apply_I(10)
112
sage: L[112]
(1, 111)
sage: L.normalize(-1,9)
(1, 111)

This operation is an involution::

sage: all([L.apply_I(L.apply_I(i))==i for i in xrange(len(L))])
True

apply_S(i)

Return the index of the result of applying the matrix $$S=[0,-1;1,0]$$ to the $$i$$‘th element of this P1List.

INPUT:

• i - integer (the index of the element to act on).

EXAMPLES:

sage: L = P1List(120)
sage: L[10]
(1, 9)
sage: L.apply_S(10)
159
sage: L[159]
(3, 13)
sage: L.normalize(-9,1)
(3, 13)

This operation is an involution::

sage: all([L.apply_S(L.apply_S(i))==i for i in xrange(len(L))])
True

apply_T(i)

Return the index of the result of applying the matrix $$T=[0,1;-1,-1]$$ to the $$i$$‘th element of this P1List.

INPUT:

• i - integer (the index of the element to act on).

EXAMPLES:

sage: L = P1List(120)
sage: L[10]
(1, 9)
sage: L.apply_T(10)
157
sage: L[157]
(3, 10)
sage: L.normalize(9,-10)
(3, 10)

This operation has order three::

sage: all([L.apply_T(L.apply_T(L.apply_T(i)))==i for i in xrange(len(L))])
True

index(u, v)

Returns the index of the class of $$(u,v)$$ in the fixed list of representatives of $$\mathbb{P}^1(\ZZ/N\ZZ)$$.

INPUT:

• u, v - integers, with $$\gcd(u,v,N)=1$$.

OUTPUT:

• i - the index of $$u$$, $$v$$, in the P1list.

EXAMPLES:

sage: L = P1List(120)
sage: L[100]
(1, 99)
sage: L.index(1,99)
100
sage: all([L.index(L[i][0],L[i][1])==i for i in range(len(L))])
True

index_of_normalized_pair(u, v)

Returns the index of the class of $$(u,v)$$ in the fixed list of representatives of $$\mathbb{P}^1(\ZZ/N\ZZ)$$.

INPUT:

• u, v - integers, with $$\gcd(u,v,N)=1$$, normalized so they lie in the list.

OUTPUT:

• i - the index of $$(u:v)$$, in the P1list.

EXAMPLES:

sage: L = P1List(120)
sage: L[100]
(1, 99)
sage: L.index_of_normalized_pair(1,99)
100
sage: all([L.index_of_normalized_pair(L[i][0],L[i][1])==i for i in range(len(L))])
True

lift_to_sl2z(i)

Lift the $$i$$‘th element of this P1list to an element of $$SL(2,\ZZ)$$.

If the $$i$$‘th element is $$(c,d)$$, this function computes and returns a list $$[a,b, c',d']$$ that defines a 2x2 matrix with determinant 1 and integer entries, such that $$c=c'$$ (mod $$N$$) and $$d=d'$$ (mod $$N$$).

INPUT:

• i - integer (the index of the element to lift).

EXAMPLES:

sage: p = P1List(11)
sage: p.list()[3]
(1, 2)

sage: p.lift_to_sl2z(3)
[0, -1, 1, 2]


AUTHORS:

• Justin Walker
list()

Returns the underlying list of this P1List object.

EXAMPLES:

sage: L = P1List(8)
sage: type(L)
<type 'sage.modular.modsym.p1list.P1List'>
sage: type(L.list())
<type 'list'>

normalize(u, v)

Returns a normalised element of $$\mathbb{P}^1(\ZZ/N\ZZ)$$.

INPUT:

• u, v - integers, with $$\gcd(u,v,N)=1$$.

OUTPUT:

• a 2-tuple (uu,vv) where $$(uu:vv)$$ is a normalized representative of $$(u:v)$$.

EXAMPLES:

sage: L = P1List(120)
sage: (u,v) = (555555555,7777)
sage: uu,vv = L.normalize(555555555,7777)
sage: (uu,vv)
(15, 13)
sage: (uu*v-vv*u) % L.N() == 0
True

normalize_with_scalar(u, v)

Returns a normalised element of $$\mathbb{P}^1(\ZZ/N\ZZ)$$, together with the normalizing scalar.

INPUT:

• u, v - integers, with $$\gcd(u,v,N)=1$$.

OUTPUT:

• a 3-tuple (uu,vv,ss) where $$(uu:vv)$$ is a normalized representative of $$(u:v)$$, and $$ss$$ is a scalar such that $$(ss*uu, ss*vv) = (u,v)$$ (mod $$N$$).

EXAMPLES:

sage: L = P1List(120)
sage: (u,v) = (555555555,7777)
sage: uu,vv,ss = L.normalize_with_scalar(555555555,7777)
sage: (uu,vv)
(15, 13)
sage: ((ss*uu-u)%L.N(), (ss*vv-v)%L.N())
(0, 0)
sage: (uu*v-vv*u) % L.N() == 0
True

class sage.modular.modsym.p1list.export

Bases: object

x.__init__(...) initializes x; see help(type(x)) for signature

sage.modular.modsym.p1list.lift_to_sl2z(c, d, N)

Return a list of Python ints $$[a,b,c',d']$$ that are the entries of a 2x2 matrix with determinant 1 and lower two entries congruent to $$c,d$$ modulo $$N$$.

INPUT:

• c,d,N - Python ints or longs such that $$\gcd(c,d,N)=1$$.

EXAMPLES:

sage: lift_to_sl2z(2,3,6)
[1, 1, 2, 3]
sage: lift_to_sl2z(2,3,6000000)
[1L, 1L, 2L, 3L] # 32-bit
[1, 1, 2, 3]     # 64-bit


You will get a ValueError exception if the input is invalid. Note that here gcd(15,6,24)=3:

sage: lift_to_sl2z(15,6,24)
Traceback (most recent call last):
...
ValueError: input must have gcd 1


This function is not implemented except for N at most 2**31:

sage: lift_to_sl2z(1,1,2^32)
Traceback (most recent call last):
...
NotImplementedError: N too large

sage.modular.modsym.p1list.lift_to_sl2z_int(c, d, N)

Lift a pair $$(c, d)$$ to an element of $$SL(2, \ZZ)$$.

$$(c,d)$$ is assumed to be an element of $$\mathbb{P}^1(\ZZ/N\ZZ)$$. This function computes and returns a list $$[a, b, c', d']$$ that defines a 2x2 matrix, with determinant 1 and integer entries, such that $$c=c'$$ (mod $$N$$) and $$d=d'$$ (mod $$N$$).

INPUT:

• c,d,N - integers such that $$\gcd(c,d,N)=1$$.

EXAMPLES:

sage: from sage.modular.modsym.p1list import lift_to_sl2z_int
sage: lift_to_sl2z_int(2,6,11)
[1, 8, 2, 17]
sage: m=Matrix(Integers(),2,2,lift_to_sl2z_int(2,6,11))
sage: m
[ 1  8]
[ 2 17]


AUTHOR:

• Justin Walker
sage.modular.modsym.p1list.lift_to_sl2z_llong(c, d, N)

Lift a pair $$(c, d)$$ (modulo $$N$$) to an element of $$SL(2, \ZZ)$$.

$$(c,d)$$ is assumed to be an element of $$\mathbb{P}^1(\ZZ/N\ZZ)$$. This function computes and returns a list $$[a, b, c', d']$$ that defines a 2x2 matrix, with determinant 1 and integer entries, such that $$c=c'$$ (mod $$N$$) and $$d=d'$$ (mod $$N$$).

INPUT:

• c,d,N - integers such that $$\gcd(c,d,N)=1$$.

EXAMPLES:

sage: from sage.modular.modsym.p1list import lift_to_sl2z_llong
sage: lift_to_sl2z_llong(2,6,11)
[1L, 8L, 2L, 17L] # 32-bit
[1, 8, 2, 17]     # 64-bit
sage: m=Matrix(Integers(),2,2,lift_to_sl2z_llong(2,6,11))
sage: m
[ 1  8]
[ 2 17]


AUTHOR:

• Justin Walker
sage.modular.modsym.p1list.p1_normalize(N, u, v)

Computes the canonical representative of $$\mathbb{P}^1(\ZZ/N\ZZ)$$ equivalent to $$(u,v)$$ along with a transforming scalar.

INPUT:

• N - an integer
• u - an integer
• v - an integer

OUTPUT: If gcd(u,v,N) = 1, then returns

• uu - an integer

• vv - an integer

• ss - an integer such that $$(ss*uu, ss*vv)$$ is equivalent to $$(u,v)$$ mod $$N$$;

if $$\gcd(u,v,N) \not= 1$$, returns 0, 0, 0.

EXAMPLES:

sage: from sage.modular.modsym.p1list import p1_normalize
sage: p1_normalize(90,7,77)
(1, 11, 7)
sage: p1_normalize(90,7,78)
(1, 24, 7)
sage: (7*24-78*1) % 90
0
sage: (7*24) % 90
78

sage: from sage.modular.modsym.p1list import p1_normalize
sage: p1_normalize(50001,12345,54322)
(3, 4667, 4115)
sage: (12345*4667-54321*3) % 50001
3
sage: 4115*3 % 50001
12345
sage: 4115*4667 % 50001 == 54322 % 50001
True

sage.modular.modsym.p1list.p1_normalize_int(N, u, v)

Computes the canonical representative of $$\mathbb{P}^1(\ZZ/N\ZZ)$$ equivalent to $$(u,v)$$ along with a transforming scalar.

INPUT:

• N - an integer
• u - an integer
• v - an integer

OUTPUT: If gcd(u,v,N) = 1, then returns

• uu - an integer

• vv - an integer

• ss - an integer such that $$(ss*uu, ss*vv)$$ is congruent to $$(u,v)$$ (mod $$N$$);

if $$\gcd(u,v,N) \not= 1$$, returns 0, 0, 0.

EXAMPLES:

sage: from sage.modular.modsym.p1list import p1_normalize_int
sage: p1_normalize_int(90,7,77)
(1, 11, 7)
sage: p1_normalize_int(90,7,78)
(1, 24, 7)
sage: (7*24-78*1) % 90
0
sage: (7*24) % 90
78

sage.modular.modsym.p1list.p1_normalize_llong(N, u, v)

Computes the canonical representative of $$\mathbb{P}^1(\ZZ/N\ZZ)$$ equivalent to $$(u,v)$$ along with a transforming scalar.

INPUT:

• N - an integer
• u - an integer
• v - an integer

OUTPUT: If gcd(u,v,N) = 1, then returns

• uu - an integer

• vv - an integer

• ss - an integer such that $$(ss*uu, ss*vv)$$ is equivalent to $$(u,v)$$ mod $$N$$;

if $$\gcd(u,v,N) \not= 1$$, returns 0, 0, 0.

EXAMPLES:

sage: from sage.modular.modsym.p1list import p1_normalize_llong
sage: p1_normalize_llong(90000,7,77)
(1, 11, 7)
sage: p1_normalize_llong(90000,7,78)
(1, 77154, 7)
sage: (7*77154-78*1) % 90000
0
sage: (7*77154) % 90000
78

sage.modular.modsym.p1list.p1list(N)

Returns the elements of the projective line modulo $$N$$, $$\mathbb{P}^1(\ZZ/N\ZZ)$$, as a plain list of 2-tuples.

INPUT:

• N (integer) - a positive integer (less than 2^31).

OUTPUT:

A list of the elements of the projective line $$\mathbb{P}^1(\ZZ/N\ZZ)$$, as plain 2-tuples.

EXAMPLES:

sage: from sage.modular.modsym.p1list import p1list
sage: list(p1list(7))
[(0, 1), (1, 0), (1, 1), (1, 2), (1, 3), (1, 4), (1, 5), (1, 6)]
sage: N=23456
sage: len(p1list(N)) == N*prod([1+1/p for p,e in N.factor()])
True

sage.modular.modsym.p1list.p1list_int(N)

Returns a list of the normalized elements of $$\mathbb{P}^1(\ZZ/N\ZZ)$$.

INPUT:

• N - integer (the level or modulus).

EXAMPLES:

sage: from sage.modular.modsym.p1list import p1list_int
sage: p1list_int(6)
[(0, 1),
(1, 0),
(1, 1),
(1, 2),
(1, 3),
(1, 4),
(1, 5),
(2, 1),
(2, 3),
(2, 5),
(3, 1),
(3, 2)]

sage: p1list_int(120)
[(0, 1),
(1, 0),
(1, 1),
(1, 2),
(1, 3),
...
(30, 7),
(40, 1),
(40, 3),
(40, 11),
(60, 1)]

sage.modular.modsym.p1list.p1list_llong(N)

Returns a list of the normalized elements of $$\mathbb{P}^1(\ZZ/N\ZZ)$$, as a plain list of 2-tuples.

INPUT:

• N - integer (the level or modulus).

EXAMPLES:

sage: from sage.modular.modsym.p1list import p1list_llong
sage: N = 50000
sage: L = p1list_llong(50000)
sage: len(L) == N*prod([1+1/p for p,e in N.factor()])
True
sage: L[0]
(0, 1)
sage: L[len(L)-1]
(25000, 1)


#### Previous topic

Heilbronn matrix computation

#### Next topic

List of coset representatives for $$\Gamma_1(N)$$ in $${\rm SL}_2(\ZZ)$$