The modular group \(\SL_2(\ZZ)\)¶
AUTHORS:
- Niles Johnson (2010-08): Issue #3893: - random_element()should pass on- *argsand- **kwds.
- class sage.modular.arithgroup.congroup_sl2z.SL2Z_class[source]¶
- Bases: - Gamma0_class- The full modular group \(\SL_2(\ZZ)\), regarded as a congruence subgroup of itself. - is_subgroup(right)[source]¶
- Return - Trueif- selfis a subgroup of- right.- EXAMPLES: - sage: SL2Z.is_subgroup(SL2Z) True sage: SL2Z.is_subgroup(Gamma1(1)) True sage: SL2Z.is_subgroup(Gamma0(6)) False - >>> from sage.all import * >>> SL2Z.is_subgroup(SL2Z) True >>> SL2Z.is_subgroup(Gamma1(Integer(1))) True >>> SL2Z.is_subgroup(Gamma0(Integer(6))) False 
 - random_element(bound=100, *args, **kwds)[source]¶
- Return a random element of \(\SL_2(\ZZ)\) with entries whose absolute value is strictly less than bound (default: 100). Additional arguments and keywords are passed to the random_element method of ZZ. - (Algorithm: Generate a random pair of integers at most bound. If they are not coprime, throw them away and start again. If they are, find an element of \(\SL_2(\ZZ)\) whose bottom row is that, and left-multiply it by \(\begin{pmatrix} 1 & w \\ 0 & 1\end{pmatrix}\) for an integer \(w\) randomly chosen from a small enough range that the answer still has entries at most bound.) - It is, unfortunately, not true that all elements of SL2Z with entries < bound appear with equal probability; those with larger bottom rows are favoured, because there are fewer valid possibilities for w. - EXAMPLES: - sage: s = SL2Z.random_element() sage: s.parent() is SL2Z True sage: all(a in range(-99, 100) for a in list(s)) True sage: S = set() sage: while len(S) < 180: ....: s = SL2Z.random_element(5) ....: assert all(a in range(-4, 5) for a in list(s)) ....: assert s.parent() is SL2Z ....: assert s in SL2Z ....: S.add(s) - >>> from sage.all import * >>> s = SL2Z.random_element() >>> s.parent() is SL2Z True >>> all(a in range(-Integer(99), Integer(100)) for a in list(s)) True >>> S = set() >>> while len(S) < Integer(180): ... s = SL2Z.random_element(Integer(5)) ... assert all(a in range(-Integer(4), Integer(5)) for a in list(s)) ... assert s.parent() is SL2Z ... assert s in SL2Z ... S.add(s) - Passes extra positional or keyword arguments through: - sage: SL2Z.random_element(5, distribution='1/n').parent() is SL2Z True - >>> from sage.all import * >>> SL2Z.random_element(Integer(5), distribution='1/n').parent() is SL2Z True 
 - reduce_cusp(c)[source]¶
- Return the unique reduced cusp equivalent to c under the action of - self. Always returns Infinity, since there is only one equivalence class of cusps for \(SL_2(Z)\).- EXAMPLES: - sage: SL2Z.reduce_cusp(Cusps(-1/4)) Infinity - >>> from sage.all import * >>> SL2Z.reduce_cusp(Cusps(-Integer(1)/Integer(4))) Infinity 
 
- sage.modular.arithgroup.congroup_sl2z.is_SL2Z(x)[source]¶
- Return - Trueif x is the modular group \(\SL_2(\ZZ)\).- EXAMPLES: - sage: from sage.modular.arithgroup.all import is_SL2Z sage: is_SL2Z(SL2Z) doctest:warning... DeprecationWarning: The function is_SL2Z is deprecated; use 'isinstance(..., SL2Z_class)' instead. See https://github.com/sagemath/sage/issues/38035 for details. True sage: is_SL2Z(Gamma0(6)) False - >>> from sage.all import * >>> from sage.modular.arithgroup.all import is_SL2Z >>> is_SL2Z(SL2Z) doctest:warning... DeprecationWarning: The function is_SL2Z is deprecated; use 'isinstance(..., SL2Z_class)' instead. See https://github.com/sagemath/sage/issues/38035 for details. True >>> is_SL2Z(Gamma0(Integer(6))) False