From 9243e259b6f2f65827642ffc437df05904d5e1e0 Mon Sep 17 00:00:00 2001 From: Sujeet Kumar Singh Date: Fri, 8 May 2026 09:39:29 +0530 Subject: [PATCH 1/9] Random_element_improved --- src/hilbert_modgroup/extended/group_class.py | 75 ++++++++++++++------ 1 file changed, 54 insertions(+), 21 deletions(-) diff --git a/src/hilbert_modgroup/extended/group_class.py b/src/hilbert_modgroup/extended/group_class.py index 6cdd154..429e6c8 100644 --- a/src/hilbert_modgroup/extended/group_class.py +++ b/src/hilbert_modgroup/extended/group_class.py @@ -1,5 +1,5 @@ import logging - +from random import choice import sage from sage.all import Integer from sage.arith.misc import divisors @@ -15,7 +15,6 @@ from sage.rings.number_field.number_field import QuadraticField from hilbert_modgroup.upper_half_plane import ComplexPlaneProductElement__class - from .cusp import ( NFCusp_wrt_lattice_ideal, fundamental_unit_generator, @@ -405,25 +404,11 @@ def generators(self): """ gens = [] tp_units = self.tp_units() - lattice_ideal = self.lattice_ideal() level_ideal = self.level_ideal() number_field = self.number_field() - Lreps = list_of_representatives(level_ideal) - for d in level_ideal.residues(): - if d != 0 and d != 1 and number_field.fractional_ideal(d).is_coprime(level_ideal): - Lds = [ - P * lattice_ideal * level_ideal - for P in Lreps - if (P * lattice_ideal * level_ideal).is_principal() - ] - C = Lds[0] - c = (C).gens_reduced()[0] - A1 = c * (lattice_ideal.inverse()) - A2 = number_field.fractional_ideal(d) - r = A1.element_1_mod(A2) - b = -r / c - a = (1 - r) / d - gens.append(self.create_element(a, b, c, d)) + coprime_residue = [u for u in level_ideal.residues() if u != 0 and level_ideal.is_coprime(u)] + for x in coprime_residue: + gens.append(self.R(x)) for x in self.lattice_ideal().inverse().basis(): gens.append(self.T(x)) for x in (self.lattice_ideal() * self.level_ideal()).basis(): @@ -434,6 +419,46 @@ def generators(self): gens.append(self.E(x)) return gens + @cached_method + def R(self, d): + """ + Return the lift of any element in (OK/(level_ideal))^* in self: + + INPUT: + + - ``d`` -- integer in number field coprime to d (default=1) + + EXAMPLES:: + + sage: from hilbert_modgroup.extended.all import ExtendedHilbertModularGroup + sage: K1. = QuadraticField(2) + sage: level_ideal = K1.fractional_ideal(3) + sage: H = ExtendedHilbertModularGroup(K1, level_ideal = level_ideal) + sage: d = K1(5) + sage: level_ideal.is_coprime(d) + True + sage: H.R(d) + [-1 -2] + [ 3 5] + """ + level_ideal = self.level_ideal() + lattice_ideal = self.lattice_ideal() + number_field = self.number_field() + Lreps = list_of_representatives(level_ideal * d) + Lds = [ + P * lattice_ideal * level_ideal + for P in Lreps if (P * lattice_ideal * level_ideal).is_principal() + ] + C = Lds[0] + c = (C).gens_reduced()[0] + A1 = c * (lattice_ideal.inverse()) + A2 = number_field.fractional_ideal(d) + r = A1.element_1_mod(A2) + b = -r / c + a = (1 - r) / d + return self([a, b, c, d]) + + @cached_method def S(self): """ @@ -582,6 +607,12 @@ def random_element(self, matrix_type=None, **kwds): a = self.lattice_ideal().inverse().random_element(**kwds) b = (self.lattice_ideal() * self.level_ideal()).random_element(**kwds) K = self.number_field() + level_ideal = self.level_ideal() + coprime_residue = [u for u in level_ideal.residues() if u != 0 and level_ideal.is_coprime(u)] + if coprime_residue == []: + d =1 + else: + d = choice(coprime_residue) if x is None: x = -5 if y is None: @@ -600,10 +631,12 @@ def random_element(self, matrix_type=None, **kwds): if matrix_type == "Upper": return self(self.T(a)) - if matrix_type == "unit": + if matrix_type == "Unit": return self(self.E(u)) + if matrix_type == "Lift": + return self(self.R(d)) - return self(self.E(u) * self.T(a) * self.L(b)) + return self(self.R(u) * self.E(u) * self.T(a) * self.L(b)) @cached_method def cusps(self): From 94dc7abb2db3199bc45ced25587ba17105552385 Mon Sep 17 00:00:00 2001 From: Sujeet Kumar Singh Date: Fri, 8 May 2026 21:11:52 +0530 Subject: [PATCH 2/9] Added ambient_group in the pullback --- src/hilbert_modgroup/extended/pullback.py | 107 ++++++++++-------- .../extended/pullback_cython.pyx | 6 +- 2 files changed, 62 insertions(+), 51 deletions(-) diff --git a/src/hilbert_modgroup/extended/pullback.py b/src/hilbert_modgroup/extended/pullback.py index 020ac75..faf334f 100644 --- a/src/hilbert_modgroup/extended/pullback.py +++ b/src/hilbert_modgroup/extended/pullback.py @@ -90,8 +90,13 @@ def __init__(self, G): """ if not isinstance(G, ExtendedHilbertModularGroup_class): raise ValueError("Need a Extended Hilbert modular group") + ambient_group = ExtendedHilbertModularGroup(G.number_field(), + lattice_ideal = G.lattice_ideal(), + tp_units = G.tp_units()) + self._ambient_group = ambient_group self._group = G + def __eq__(self, other): r""" Check if ``self`` is equal to ``other``. @@ -162,6 +167,12 @@ def group(self): """ return self._group + def ambient_group(self): + """ + Return the ambient group of ``self``. + """ + return self._ambient_group + def _check_upper_half_plane_element(self, z): r""" Check if z is an element of type UpperHalfPlaneProductElement__class @@ -198,12 +209,12 @@ def _check_upper_half_plane_element(self, z): """ if ( not isinstance(z, UpperHalfPlaneProductElement__class) - or z.degree() != self.group().number_field().degree() + or z.degree() != self.ambient_group().number_field().degree() ): msg = ( f"Need an element of type: " f"UpperHalfPlaneProductElement__class of degree " - f"{self.group().number_field().degree()}" + f"{self.ambient_group().number_field().degree()}" ) raise ValueError(msg) return True @@ -231,8 +242,8 @@ def fundamental_units(self): sage: P4.fundamental_units() [a, a + 6] """ - K = self.group().number_field() - tp_units = self.group().tp_units() + K = self.ambient_group().number_field() + tp_units = self.ambient_group().tp_units() if tp_units: return totally_positive_unit_group_generators(K) else: @@ -271,7 +282,7 @@ def basis_matrix_logarithmic_unit_lattice(self, prec=53): [ 1.31695789692482] """ - n = self.group().number_field().degree() + n = self.ambient_group().number_field().degree() entries = [ [x.abs().log() for x in u.complex_embeddings(prec)] for u in self.fundamental_units() ] @@ -349,7 +360,7 @@ def Y(self, z, return_error_estimate=False): 1.2227344030925683e-29) """ self._check_upper_half_plane_element(z) - normalized_imag = z / z.imag_norm() ** (1 / self.group().number_field().degree()) + normalized_imag = z / z.imag_norm() ** (1 / self.ambient_group().number_field().degree()) log_vector = matrix(vector(normalized_imag.imag_log())).transpose() B = self.basis_matrix_logarithmic_unit_lattice(prec=z.base_ring().prec()) coordinate_vector = B.solve_right(log_vector, check=False) @@ -403,17 +414,17 @@ def reduce_by_units(self, z, return_map=False): # Doing ) """ - tp_units = self.group().tp_units() + tp_units = self.ambient_group().tp_units() units = self.fundamental_units() # Only include the units != -1 # To avoid overflow it is more efficient to apply the map, # e.g. compute (z*u**-k)/u**k instead of z*u**-(2k) if tp_units: floors = [-stable_floor(y) for y in self.Y(z)] - reducing_map = prod([self.group().E(u**y) for u, y in zip(units, floors, strict=False)]) + reducing_map = prod([self.ambient_group().E(u**y) for u, y in zip(units, floors, strict=False)]) else: floors = [-stable_floor(y / 2) for y in self.Y(z)] - reducing_map = prod([self.group().E(u**y) for u, y in zip(units, floors, strict=False)]) + reducing_map = prod([self.ambient_group().E(u**y) for u, y in zip(units, floors, strict=False)]) reduced_point = z.apply(reducing_map) if return_map: return reduced_point, reducing_map @@ -455,7 +466,7 @@ def is_reduced_by_units(self, z): True """ - tp_units = self.group().tp_units() + tp_units = self.ambient_group().tp_units() if tp_units: return all(-1 / 2 <= y < 1 / 2 for y in self.Y(z)) else: @@ -480,19 +491,19 @@ def _construct_ideal(self, a, b=None): Fractional ideal (1/2) """ if a is None: - ideala = self.group().number_field().ring_of_integers().fractional_ideal(1) + ideala = self.ambient_group().number_field().ring_of_integers().fractional_ideal(1) elif isinstance(a, NumberFieldIdeal): if b: ideala = a / b else: ideala = a - elif a in self.group().number_field().ring_of_integers() and not b: - ideala = self.group().number_field().ring_of_integers().fractional_ideal(a) + elif a in self.ambient_group().number_field().ring_of_integers() and not b: + ideala = self.ambient_group().number_field().ring_of_integers().fractional_ideal(a) elif ( - a in self.group().number_field().ring_of_integers() - and b in self.group().number_field().ring_of_integers() + a in self.ambient_group().number_field().ring_of_integers() + and b in self.ambient_group().number_field().ring_of_integers() ): - ideala = self.group().ideal(a, b) + ideala = self.ambient_group().ideal(a, b) else: raise ValueError(f"Could not construct a number field ideal from a={a} and b={b}") return ideala @@ -530,7 +541,7 @@ def basis_matrix_ideal(self, a=None, prec=53): """ ideala = self._construct_ideal(a) entries = [list(beta.complex_embeddings(prec)) for beta in ideala.integral_basis()] - n = self.group().number_field().degree() + n = self.ambient_group().number_field().degree() return matrix(RealField(prec), n, n, entries).transpose() # @cached_method @@ -834,7 +845,7 @@ def basis_matrix_ideal_plusz(self, z, a=None): (z * z.parent()(beta)).real() + (z * z.parent()(beta)).imag() for beta in ideala.integral_basis() ] - n = self.group().base_ring().degree() + n = self.ambient_group().base_ring().degree() return matrix(RealField(prec), 2 * n, 2 * n, entries) def _shortest_vectors_ideal_plusz(self, z, a=None, return_scaled_matrix=False): @@ -1039,7 +1050,7 @@ def _construct_cusp(self, c, d=None): sage: P1._construct_cusp(0, 1) Cusp [0: 1] of Number Field in a with defining polynomial x^2 - 3 with a = 1.732050807568878? """ - lattice_ideal = self.group().lattice_ideal() + lattice_ideal = self.ambient_group().lattice_ideal() if isinstance(c, NFCusp_wrt_lattice_ideal) and c.number_field() == self.number_field(): return c if isinstance(c, NFCusp_wrt_lattice_ideal) and c.number_field() != self.number_field(): @@ -1067,7 +1078,7 @@ def number_field(self): Number Field in a with defining polynomial x^3 - 36*x - 1 """ - return self.group().number_field() + return self.ambient_group().number_field() def reduce_in_cuspidal_region(self, z, cusp=None, return_map=False): # needcheking r""" @@ -1157,8 +1168,8 @@ def reduce_in_cuspidal_region(self, z, cusp=None, return_map=False): # needchek """ self._check_upper_half_plane_element(z) if cusp is None: - cusp = self.group().cusps()[0] - ideala = ((self.group().lattice_ideal()) ** -1) * (cusp.ideal() ** -2) + cusp = self.ambient_group().cusps()[0] + ideala = ((self.ambient_group().lattice_ideal()) ** -1) * (cusp.ideal() ** -2) # Then reduce with respect to the units, followed by reduction by translation with respect # to the ideal (lattice_ideal**-1)*(a**-2) if return_map: @@ -1225,7 +1236,7 @@ def find_closest_cusp(self, z, return_multiple=False, as_cusp=True): # Doing closest_cusp = find_closest_cusp( self, z, return_multiple=return_multiple, use_lll=True, use_norm_bound=True ) - lattice_ideal = self.group().lattice_ideal() + lattice_ideal = self.ambient_group().lattice_ideal() if as_cusp and return_multiple: return [NFCusp_wrt_lattice_ideal(lattice_ideal, c[0], c[1]) for c in closest_cusp] if as_cusp: @@ -1369,7 +1380,7 @@ def max_ideal_norm(self): # Need to work 1 """ - return max([x.norm() for x in self.group().ideal_cusp_representatives()]) + return max([x.norm() for x in self.ambient_group().ideal_cusp_representatives()]) def _matrix_BLambda_row_sum(self, i=None): # Need to work r""" @@ -1427,7 +1438,7 @@ def _matrix_BLambda_row_sum(self, i=None): # Need to work """ K = self.number_field() - lattice_ideal = self.group().lattice_ideal() + lattice_ideal = self.ambient_group().lattice_ideal() # level_ideal = self.group().level_ideal() H = ExtendedHilbertModularGroup(K, lattice_ideal=lattice_ideal, tp_units=False) P = ExtendedHilbertPullback(H) @@ -1552,7 +1563,7 @@ def Di(self, i=None): # Doing sage: P4.Di(1) 1.9318516525781364 """ - n = self.group().number_field().degree() + n = self.ambient_group().number_field().degree() return float(self.max_ideal_norm() ** (1 / n) * self._exp_matrix_BLambda_row_sum(i).sqrt()) @cached_method() @@ -1582,7 +1593,7 @@ def D(self): sage: P4.D() [1.9318516525781362, 1.9318516525781364] """ - n = self.group().number_field().degree() + n = self.ambient_group().number_field().degree() return [self.Di(i) for i in range(n)] def _bound_for_closest_cusp(self): @@ -1612,7 +1623,7 @@ def _bound_for_closest_cusp(self): 0.0358983848622454 """ - n = self.group().number_field().degree() + n = self.ambient_group().number_field().degree() return self.max_ideal_norm() ** (-1) * 2 ** (-n / 2.0) / self._exp_matrix_BLambda_row_sum() def _Dzi(self, z, i, initial_bd_d=None, use_initial_bd_d=True): @@ -1668,11 +1679,11 @@ def _Dzi(self, z, i, initial_bd_d=None, use_initial_bd_d=True): 1.93185165257814 """ - n = self.group().number_field().degree() + n = self.ambient_group().number_field().degree() if not use_initial_bd_d: return self.Di(i) * z.imag_norm() ** (-1 / (2 * n)) dist_to_infinity_bd = z.imag_norm() ** (-1 / 2) - dist_to_zero_bd = ((self.group().lattice_ideal().inverse().norm()) ** -1) * ( + dist_to_zero_bd = ((self.ambient_group().lattice_ideal().inverse().norm()) ** -1) * ( z.abs_square_norm() / z.imag_norm() ) ** (0.5) # Need to work if initial_bd_d: @@ -1853,7 +1864,7 @@ def _bound_for_sigma_coordinates(self, z, initial_bd_d=None, prec=16, use_initia """ self._check_upper_half_plane_element(z) - n = self.group().number_field().degree() + n = self.ambient_group().number_field().degree() d = self._Dz(z, initial_bd_d=initial_bd_d, use_initial_bd_d=use_initial_bd_d) bounds = [] B = self.basis_matrix_ideal().inverse() @@ -1916,10 +1927,10 @@ def _bound_for_rho_embeddings( """ self._check_upper_half_plane_element(z) - n = self.group().number_field().degree() + n = self.ambient_group().number_field().degree() d = self._Dz(z, initial_bd_d=initial_bd_d, use_initial_bd_d=use_initial_bd_d) if not isinstance(sigma, list): - sigma = self.group().number_field()(sigma) + sigma = self.ambient_group().number_field()(sigma) sigma = sigma.complex_embeddings() bounds = [] for i in range(n): @@ -1986,10 +1997,10 @@ def _bound_for_rho_coordinates( [3.904, 3.904] """ self._check_upper_half_plane_element(z) - n = self.group().number_field().degree() + n = self.ambient_group().number_field().degree() d = self._Dz(z, initial_bd_d=initial_bd_d, use_initial_bd_d=use_initial_bd_d) if not isinstance(sigma, list): - sigma = self.group().number_field()(sigma) + sigma = self.ambient_group().number_field()(sigma) sigma = sigma.complex_embeddings() bounds = [] factor = 1.01 @@ -2295,7 +2306,7 @@ def _candidate_closest_cusps( if as_cusps: # Convert to cusps cusps = [] - lattice_ideal = self.group().lattice_ideal() + lattice_ideal = self.ambient_group().lattice_ideal() for rho, sigma in cusp_candidates: c = NFCusp_wrt_lattice_ideal(lattice_ideal, rho, sigma) if c not in cusps: @@ -2393,21 +2404,21 @@ def reduce(self, z, return_map=False): """ - K = self.number_field() - lattice_ideal = self.group().lattice_ideal() - level_ideal = K.fractional_ideal(1) - tp_units = self.group().tp_units() - H = ExtendedHilbertModularGroup( - K, lattice_ideal=lattice_ideal, level_ideal=level_ideal, tp_units=tp_units - ) - P = ExtendedHilbertPullback(H) + #K = self.number_field() + #lattice_ideal = self.group().lattice_ideal() + #level_ideal = K.fractional_ideal(1) + #tp_units = self.group().tp_units() + #H = ExtendedHilbertModularGroup( + # K, lattice_ideal=lattice_ideal, level_ideal=level_ideal, tp_units=tp_units + #) + #P = ExtendedHilbertPullback(H) if z.norm() == 0: raise ValueError("Can not reduce point at the boundary of one of the half-planes.") - c = P.find_closest_cusp(z, return_multiple=False, as_cusp=True) - c_rep, Umu = P.group().cusp_representative(c, return_map=True) - A = P._group.cusp_normalizing_map(c_rep) + c = self.find_closest_cusp(z, return_multiple=False, as_cusp=True) + c_rep, Umu = self.ambient_group().cusp_representative(c, return_map=True) + A = self.ambient_group().cusp_normalizing_map(c_rep) w = z.apply(A.inverse() * Umu) - w, B = P.reduce_in_cuspidal_region(w, c_rep, return_map=True) + w, B = self.reduce_in_cuspidal_region(w, c_rep, return_map=True) w = w.apply(A) M = A * B * A.inverse() * Umu Mat = self.level_reduction_matrix(M) diff --git a/src/hilbert_modgroup/extended/pullback_cython.pyx b/src/hilbert_modgroup/extended/pullback_cython.pyx index bd2506d..52873d5 100644 --- a/src/hilbert_modgroup/extended/pullback_cython.pyx +++ b/src/hilbert_modgroup/extended/pullback_cython.pyx @@ -213,10 +213,10 @@ cpdef find_closest_cusp(p, z, return_multiple=False, use_lll=True, use_norm_boun break # We have already filtered away identical cusps but as a final stage # we also check if the minimal cusps are equal to any of the fixed representatives. - if p.group().ncusps() == 1: + if p.ambient_group().ncusps() == 1: return min_cusp result = [] - for cusp in p.group().cusps()[1:]: + for cusp in p.ambient_group().cusps()[1:]: c, d = cusp.numerator(), cusp.denominator() quo = c / d if return_multiple: @@ -288,7 +288,7 @@ cpdef distance_to_cusp_eg(SageObject p, NumberFieldElement_base r, """ cdef list rlist, slist - ideal_rs = p.group().ideal((r, s)) + ideal_rs = p.ambient_group().ideal((r, s)) rlist = r.complex_embeddings() slist = s.complex_embeddings() n = len(slist) From ff821030e381776c380fa6546073b721f0b9705c Mon Sep 17 00:00:00 2001 From: Sujeet Kumar Singh Date: Wed, 13 May 2026 22:37:39 +0530 Subject: [PATCH 3/9] Reorganize extended examples and small code changes --- .gitignore | 9 +- examples_extended/Ext_Exam17_and_19.ipynb | 523 -------- examples_extended/Ext_Example23.ipynb | 1187 ----------------- examples_extended/Ext_Example25.ipynb | 315 ----- examples_extended/Paper_Example12.ipynb | 305 +++++ examples_extended/Paper_Example15.ipynb | 539 ++++++++ ..._Example22.ipynb => Paper_Example17.ipynb} | 468 ++++--- ..._Example24.ipynb => Paper_Example18.ipynb} | 358 ++--- examples_extended/Paper_Example19.ipynb | 386 ++++++ examples_extended/other_exm1.ipynb | 406 ------ examples_extended/other_exm2.ipynb | 511 ------- examples_extended/other_exm3.ipynb | 1134 ---------------- examples_extended/other_exm4.ipynb | 613 --------- examples_extended/other_exm5.ipynb | 283 ---- examples_extended/other_exm6.ipynb | 315 ----- src/hilbert_modgroup/extended/group_class.py | 84 +- .../extended/group_element.pyx | 2 +- src/hilbert_modgroup/extended/pullback.py | 137 +- 18 files changed, 1710 insertions(+), 5865 deletions(-) delete mode 100644 examples_extended/Ext_Exam17_and_19.ipynb delete mode 100644 examples_extended/Ext_Example23.ipynb delete mode 100644 examples_extended/Ext_Example25.ipynb create mode 100644 examples_extended/Paper_Example12.ipynb create mode 100644 examples_extended/Paper_Example15.ipynb rename examples_extended/{Ext_Example22.ipynb => Paper_Example17.ipynb} (53%) rename examples_extended/{Ext_Example24.ipynb => Paper_Example18.ipynb} (67%) create mode 100644 examples_extended/Paper_Example19.ipynb delete mode 100644 examples_extended/other_exm1.ipynb delete mode 100644 examples_extended/other_exm2.ipynb delete mode 100644 examples_extended/other_exm3.ipynb delete mode 100644 examples_extended/other_exm4.ipynb delete mode 100644 examples_extended/other_exm5.ipynb delete mode 100644 examples_extended/other_exm6.ipynb diff --git a/.gitignore b/.gitignore index 0811582..338ce97 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,11 @@ dist *.egg-info *.pgf .ipynb_checkpoints -src/hilbert_modgroup/version.py \ No newline at end of file +src/hilbert_modgroup/version.py +.idea/ +.cache/ +.tox/ +.sage/ +.local/ +__pycache__/ +*.DISABLED diff --git a/examples_extended/Ext_Exam17_and_19.ipynb b/examples_extended/Ext_Exam17_and_19.ipynb deleted file mode 100644 index b4d42c7..0000000 --- a/examples_extended/Ext_Exam17_and_19.ipynb +++ /dev/null @@ -1,523 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "50bb7938-23da-417e-b968-4fc81c41722e", - "metadata": {}, - "source": [ - "# Computing Cusp Representatives -- Examples 17 " - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "id": "00c6772f-04c4-447e-8861-7d7fcc2838a0", - "metadata": {}, - "outputs": [], - "source": [ - "from hilbert_modgroup.extended.all import ExtendedHilbertModularGroup, ExtendedHilbertPullback, NFCusp_wrt_lattice_ideal\n", - "from sage.modular.modsym.p1list_nf import psi" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "id": "1c27755e-13cd-49dd-a980-bc5b5fe55c22", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[Cusp [0: -2*a] of Number Field in a with defining polynomial x^2 - 3 with a = 1.732050807568878? with respect to lattice_ideal,\n", - " Cusp [1: 2*a + 12] of Number Field in a with defining polynomial x^2 - 3 with a = 1.732050807568878? with respect to lattice_ideal,\n", - " Cusp Infinity of Number Field in a with defining polynomial x^2 - 3 with a = 1.732050807568878? with respect to lattice_ideal]" - ] - }, - "execution_count": 2, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "K. = QuadraticField(3)\n", - "lattice_ideal = K.different()\n", - "level_ideal = K.fractional_ideal((2*a+1)**2)\n", - "H1 = ExtendedHilbertModularGroup(K, lattice_ideal, level_ideal = level_ideal, tp_units = True)\n", - "H1.cusps()" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "id": "28ff2bfc-8a6a-4198-9967-b8131366601a", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[Cusp [0: -2*a] of Number Field in a with defining polynomial x^2 - 3 with a = 1.732050807568878? with respect to lattice_ideal,\n", - " Cusp [1: 2*a + 12] of Number Field in a with defining polynomial x^2 - 3 with a = 1.732050807568878? with respect to lattice_ideal,\n", - " Cusp [-5: 2*a + 12] of Number Field in a with defining polynomial x^2 - 3 with a = 1.732050807568878? with respect to lattice_ideal,\n", - " Cusp Infinity of Number Field in a with defining polynomial x^2 - 3 with a = 1.732050807568878? with respect to lattice_ideal]" - ] - }, - "execution_count": 3, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "H2 = ExtendedHilbertModularGroup(K, lattice_ideal = lattice_ideal, level_ideal = level_ideal, tp_units = False)\n", - "H2.cusps()" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "id": "003b3c7f-1744-4946-bb6b-341c40ad606f", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "Cusp [-5: 2*a + 12] of Number Field in a with defining polynomial x^2 - 3 with a = 1.732050807568878? with respect to lattice_ideal" - ] - }, - "execution_count": 4, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "c = H2.cusps()[2]\n", - "c" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "id": "b676487a-5359-4e86-8800-d6ad550d71e0", - "metadata": {}, - "outputs": [], - "source": [ - "cusp, A = H1.cusp_representative(c, return_map = True)" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "id": "3c688e80-c7c0-49b4-a92d-6cba4cc9fd12", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "Cusp [1: 2*a + 12] of Number Field in a with defining polynomial x^2 - 3 with a = 1.732050807568878? with respect to lattice_ideal" - ] - }, - "execution_count": 6, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "cusp" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "id": "330fde9a-da88-4150-8973-6f68d43457a5", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[ 2 -1/6*a + 1]\n", - "[24852*a - 43014 14555*a - 25199]" - ] - }, - "execution_count": 7, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "A" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "id": "396b6367-7218-48be-96cd-dd8bef23c8bc", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "Cusp [1: 2*a + 12] of Number Field in a with defining polynomial x^2 - 3 with a = 1.732050807568878? with respect to lattice_ideal" - ] - }, - "execution_count": 8, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "c.apply(list(A))" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "id": "0480e76e-fa13-4503-974b-4f746d2173cc", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "-2911*a + 5042" - ] - }, - "execution_count": 9, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "u = A.determinant()\n", - "u" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "id": "da00bf6d-395e-4b84-9771-e7a450925d7a", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "True" - ] - }, - "execution_count": 10, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "u.is_unit()" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "id": "0ac1bd19-5f3b-4043-b53d-89534a4c3d07", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "True" - ] - }, - "execution_count": 11, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "u.is_totally_positive()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "e3933e3f-fd1c-43e8-882f-63004190154e", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "32d1f446-7cba-46ab-9173-4b96dca88ed4", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "61321961-e63e-434a-b91e-4012f849e4eb", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "markdown", - "id": "71b75480-e86d-4315-970a-d34b87cdaeaf", - "metadata": {}, - "source": [ - "# Computing Right Coset Representatives -- Example 19" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "c265ad03-0aa0-404d-878d-b1464c31bb18", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": 12, - "id": "c2c9d0ee-6305-403b-a1c7-628050f95fd9", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "4" - ] - }, - "execution_count": 12, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "K. = QuadraticField(10)\n", - "lattice_ideal = K.fractional_ideal(2, a)\n", - "level_ideal = K.fractional_ideal(3, 1+a)\n", - "H1 = ExtendedHilbertModularGroup(K, lattice_ideal, level_ideal = level_ideal, tp_units = True)\n", - "psi(level_ideal)" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "id": "e44e7fa5-32fd-4154-90d8-46a32a1f8d20", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[\n", - "[ 1 -3/2*a + 3] [ 1 1/2*a - 2]\n", - "[ a + 2 -8], [ a + 2 -a + 2],\n", - "\n", - "[ a + 6 17/2*a - 17] [1 0]\n", - "[ a + 2 -2*a + 12], [0 1]\n", - "]" - ] - }, - "execution_count": 13, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "right_coset = H1.coset_matrices()\n", - "right_coset" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "id": "43ef754d-d244-4ddf-b9ec-26debd69e786", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "1\n", - "1\n", - "1\n", - "1\n" - ] - } - ], - "source": [ - "for A in right_coset:\n", - " print(A.determinant())" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "cac20638-fa62-447f-a3fb-fe58776310c2", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "5dc86e79-181d-499e-aa07-29053393db78", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "9d5bd8d8-d714-460b-9372-1932d2f533d5", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "ed189427-47aa-40cc-a6b4-9a6d346744ae", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "e34fd00c-6956-4ec1-95ff-cb239607a0ec", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "26a16cf5-28db-4d08-bc74-88ef2d52542c", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "52e7a1bc-194a-439c-bdf9-b8f2ca3191ec", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "28275c77-2f47-4be0-80a0-9731cdfdc1e1", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "f5f84ef1-3ab6-424d-80cc-8c9931e91458", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "f4e10ca7-17ca-4e48-8dee-71d2cd457d52", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "8a79d6e5-eda0-4dae-9a11-f15132f8f48c", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "8aa0562f-7767-4261-bbb6-695605eba1de", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "81e0a86f-197d-4dad-8443-2762a79a8709", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "79ebdf87-1ced-4eea-9951-9ddde4eed084", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "8d1e289e-c246-42a8-a259-5ce0435426f5", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "1815db89-37a8-4a65-a789-2075d2cf4b01", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "6edf1c20-b84d-4b4d-8e66-775148dd72d1", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "8bf9eef2-c6a8-453e-bf0b-5ffd6f75fed3", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "fa1512b7-b5a2-4141-b5fe-83fc208ce3e0", - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "SageMath 10.5 (PassageMath)", - "language": "python", - "name": "sagemath" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.4" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} diff --git a/examples_extended/Ext_Example23.ipynb b/examples_extended/Ext_Example23.ipynb deleted file mode 100644 index 9fda557..0000000 --- a/examples_extended/Ext_Example23.ipynb +++ /dev/null @@ -1,1187 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "5632f5ad-4529-4fac-b2fb-3d57c12f0752", - "metadata": {}, - "source": [ - "# Reduction for $\\widehat{\\Gamma}(\\mathcal{O}_K\\oplus \\mathfrak{a})$, where $\\mathfrak{a} = (2, \\sqrt{10})$." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "e1566197-98b3-45d8-8646-b229724c7457", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": 2, - "id": "b2f1025a-2705-4558-8a96-35de62b66496", - "metadata": {}, - "outputs": [], - "source": [ - "from hilbert_modgroup.extended.all import ExtendedHilbertModularGroup, ExtendedHilbertPullback, NFCusp_wrt_lattice_ideal\n", - "from hilbert_modgroup.all import UpperHalfPlaneProductElement\n", - "#from sage.rings.cc import CC\n", - "K. = QuadraticField(10)\n", - "lattice_ideal = K.fractional_ideal(2, a)\n", - "H = ExtendedHilbertModularGroup(K, lattice_ideal = lattice_ideal)\n", - "P = ExtendedHilbertPullback(H)" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "id": "35f89450-090c-4c61-aed4-0dba5980c142", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[0.456756758127628 + 0.342308124772711*I, -0.456756758127628 + 0.342308124772711*I]" - ] - }, - "execution_count": 3, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "z = UpperHalfPlaneProductElement([I/4, 4+I/4])\n", - "P.reduce(z)" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "id": "37aa548d-c870-43ac-8b12-41cfafc19213", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "40" - ] - }, - "execution_count": 4, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "K.discriminant()" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "id": "5ab5e569-33b2-4e8a-a1be-581d217acd31", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[Cusp Infinity of Number Field in a with defining polynomial x^2 - 10 with a = 3.162277660168380? with respect to lattice_ideal,\n", - " Cusp [0: -2] of Number Field in a with defining polynomial x^2 - 10 with a = 3.162277660168380? with respect to lattice_ideal]" - ] - }, - "execution_count": 5, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "H.cusps()" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "id": "c7a6685b-b730-4d08-8871-0466936d8e08", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[-6*a + 19]" - ] - }, - "execution_count": 6, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "P.fundamental_units()" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "id": "82edfdb9-0e7e-416e-9017-16df23a1983f", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[ 3.63689291846413]\n", - "[-3.63689291846414]" - ] - }, - "execution_count": 7, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "P.basis_matrix_logarithmic_unit_lattice()" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "id": "bdd6e792-fcf1-4c9c-8787-110fd5d4aac3", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "Cusp [-a - 4: -2] of Number Field in a with defining polynomial x^2 - 10 with a = 3.162277660168380? with respect to lattice_ideal" - ] - }, - "execution_count": 8, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "c1 = P.find_closest_cusp(z)\n", - "c1" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "id": "37cf36ee-cf9f-4ad9-9fa5-b6bf9d65f4ec", - "metadata": {}, - "outputs": [], - "source": [ - "c_rep, Umu1 = P.group().cusp_representative(c1, return_map = True)" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "id": "0db9bb23-d1c8-48df-944e-975646546939", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "Cusp [0: -2] of Number Field in a with defining polynomial x^2 - 10 with a = 3.162277660168380? with respect to lattice_ideal" - ] - }, - "execution_count": 13, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "c_rep" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "id": "f05fba3f-d4e6-4d14-b7b0-fb1986ebbb25", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[ 1 -1/2*a - 2]\n", - "[ 0 1]" - ] - }, - "execution_count": 14, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "Umu1" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "id": "2d52736a-4572-4fcc-86a7-8b4a3ad06705", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "Cusp [0: -2] of Number Field in a with defining polynomial x^2 - 10 with a = 3.162277660168380? with respect to lattice_ideal" - ] - }, - "execution_count": 15, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "c1.apply(list(Umu1))" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "id": "b7d66366-9cc5-442a-8b32-b0990f85e4d3", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[ 0 1/2]\n", - "[ -2 0]" - ] - }, - "execution_count": 16, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "A = P._group.cusp_normalizing_map(c_rep)\n", - "A" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "id": "231e1e56-6e95-4197-bb66-d5d8d51fab79", - "metadata": {}, - "outputs": [], - "source": [ - "z1 = z.apply(A.inverse() * Umu1)" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "id": "942c6574-0b2c-436e-949d-ae5efe25f600", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[0.440082512570376 + 0.262666095701131*I, -0.440082512570377 + 0.262666095701132*I]" - ] - }, - "execution_count": 18, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "z1" - ] - }, - { - "cell_type": "code", - "execution_count": 20, - "id": "8a16491a-6488-4d95-a812-000ac7be6d74", - "metadata": {}, - "outputs": [], - "source": [ - "z2, B = P.reduce_in_cuspidal_region(z1, c_rep, return_map = True)" - ] - }, - { - "cell_type": "code", - "execution_count": 21, - "id": "1d459fbd-dff5-4881-92f8-eb13b663eb5c", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[-0.350486902471718 + 0.262666095701131*I, 0.350486902471718 + 0.262666095701132*I]" - ] - }, - "execution_count": 21, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "z2" - ] - }, - { - "cell_type": "code", - "execution_count": 22, - "id": "6d75d19e-7ebb-4665-ad22-123b22ab5ec5", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[ 1 1/4*a]\n", - "[ 0 1]" - ] - }, - "execution_count": 22, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "B" - ] - }, - { - "cell_type": "code", - "execution_count": 23, - "id": "f3ce7056-dff3-4aea-8293-4686eca3e09c", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[0.456756758127628 + 0.342308124772711*I, -0.456756758127628 + 0.342308124772711*I]" - ] - }, - "execution_count": 23, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "z_star = z2.apply(A)\n", - "z_star" - ] - }, - { - "cell_type": "code", - "execution_count": 25, - "id": "825303e4-473c-47aa-aa41-92d70ff8ea5e", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[ 1 -1/2*a - 2]\n", - "[ -a 2*a + 6]" - ] - }, - "execution_count": 25, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "reducing_matrix = A*B*(A.inverse())*Umu1\n", - "reducing_matrix " - ] - }, - { - "cell_type": "code", - "execution_count": 26, - "id": "e18d06de-54fd-42ea-860e-3e70c3e349fb", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[0.456756758127628 + 0.342308124772711*I, -0.456756758127628 + 0.342308124772711*I]" - ] - }, - "execution_count": 26, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "reduced = z.apply(reducing_matrix)\n", - "reduced" - ] - }, - { - "cell_type": "code", - "execution_count": 27, - "id": "a7662104-9c96-4b45-abf6-ce87caef34ac", - "metadata": {}, - "outputs": [], - "source": [ - "#z = make_z([3/10 + I/100, -7/10 + I/50])" - ] - }, - { - "cell_type": "code", - "execution_count": 28, - "id": "4cd230cc-608a-4468-bff3-876ce1d8a675", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[ 1 1/2*a - 1]\n", - "[ 0 1]" - ] - }, - "execution_count": 28, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "Mat = H.random_element(matrix_type = 'Upper', x = -1, y = 1)\n", - "Mat" - ] - }, - { - "cell_type": "code", - "execution_count": 29, - "id": "ebf36245-ceae-4d95-a862-60ff4b1bebe2", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[-2.58113883008419 + 0.250000000000000*I, 4.58113883008419 + 0.250000000000000*I]" - ] - }, - "execution_count": 29, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "w = Mat.acton(z)\n", - "w " - ] - }, - { - "cell_type": "code", - "execution_count": 30, - "id": "22270680-a61b-4228-96f0-bded2cb60be0", - "metadata": {}, - "outputs": [], - "source": [ - "w_star = P.reduce(w)" - ] - }, - { - "cell_type": "code", - "execution_count": 31, - "id": "44382bb9-5512-46b8-8153-030f49861aa9", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[-2.22044604925031e-16 + 2.22044604925031e-16*I, 0]" - ] - }, - "execution_count": 31, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "z_star - w_star" - ] - }, - { - "cell_type": "code", - "execution_count": 49, - "id": "d284e896-38a3-4b2b-a98a-3b63b2ff27a7", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "7c08a3bf-36be-4722-a2fe-35ba4ad949d7", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "fe7d6fcc-c112-44fb-934b-b83a461766a7", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "328eaad7-eace-4991-85f5-4049beb4270a", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "a95bcf51-6193-4662-abfc-050cf8b53d7d", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "bd367a17-9b2e-4c4c-a2d3-a3fe35051886", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "0d88ae4a-7fe3-4777-b0d1-ff31b690b614", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "02fd9974-1386-4f35-9f21-19b4debdc84b", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "0c663c00-0f03-4d0c-8116-75f31ba8d764", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "4f95033c-b1b5-4b35-b054-ddb907e3686f", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "4623f07c-88a7-4c74-9f97-a760cf677941", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "df4779ed-67c8-4344-bdd4-bcab5f976a26", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "19558c50-6c9c-4869-8da2-e72a23359fbb", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "0494690e-cd41-4328-88a1-dbb24c9c8d8b", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "20692756-365b-4f18-b034-57489d0a7ac8", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "1977850d-ec37-4244-8998-adbf2ebc1949", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "2db6dfe8-22de-4960-8192-a343d2d3c624", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "92a6c064-f01f-41c1-932d-44de2ede79de", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "73d5ce08-c542-4d88-8e87-a84b9c647efe", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "0963d1f1-8efe-43e4-97b2-a9e3ed2fd94a", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "01eb813b-1551-47ef-ac04-0e54919841e2", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "f2e92546-84a0-4a95-9c03-bcbce694c5fb", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "f8e35792-701b-4ad5-a607-66fca3642730", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "484d3e70-c6b4-4fba-bdb8-b8121c78beda", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "35c3a210-5323-4165-9adf-56b4358bd578", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": 11, - "id": "e232b796-b964-49b4-84e2-56f362b0ef94", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "54204117-0b0d-4c22-b401-95012db2f23f", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "da3bbac9-3be9-40d4-bdcd-a9502fed0b19", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "27906bd5-9eb2-4a46-a6bb-2f72b1ddfda9", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "ffa68a0f-dc85-4cb1-a9ac-70a0b4093499", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "de9bcc9a-e8d2-411e-bf5d-755423d33983", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "aa31bf7f-c450-420a-9441-94aeb5ff4cc4", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "cd1d8bc6-103a-498a-b517-fc815bad7a49", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "d58c9765-0fb2-4363-94bb-e8671fc58da2", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "c287b3a6-047c-4f06-a1b4-5c4b7ef12434", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "1068d2b8-5f73-43a8-8752-6fd8a40f0607", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "0e113242-cbf9-42ca-8e8a-5424c5fa4932", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "bbe2fb22-d88c-4dca-880f-4180891dc40b", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "7e82d0d9-9aa2-4292-ad41-fb634b3bd441", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "4fc1c0f7-c4f7-4c37-8a1a-5e09c883e3f1", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "21a31dff-1f6e-4732-a2d8-d7d3285090b2", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "f70a42b6-b2a8-4f7e-aef5-2c91d1cacba7", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "db0a6c7a-083d-4f05-8476-912be20e8cf6", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "2c9af351-55d6-4337-90d0-bb205365f6d6", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "87a4b9d9-f821-4e4d-a6fd-3a8fa1db2e82", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "a841db7e-801a-4285-99fe-469c9f17b63d", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "e8dfb2a0-8fc2-4900-b63e-94de5918802a", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "a7f64200-6e57-4710-aacc-352e5d21f732", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "b773ab1e-7ef4-4406-a6cf-5eea55536466", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "5c42dc30-b87d-4be1-bf40-d677c95b3199", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "36f1670c-aa07-4bdd-b250-7699037507d1", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "6f612f84-8bea-4d4f-9e4e-68b8879d9327", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "f219614c-5bb9-4996-9e96-a192c4112bf8", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "0abd9b0d-e7d4-4825-81ae-05d9736258a7", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "bf95bc98-da16-44f2-8b77-424e0ccf1b80", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "5c4e140c-df3e-43b3-bee6-3a6be6e02fee", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "a8a62b94-3b00-4bf6-8d9d-5b43530153a6", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "edb3ef8f-2bf0-4b33-93ca-20ab88f89b24", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "611ae910-b073-4d32-9e11-458d6dca81e6", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "2c8e5f20-e749-46ec-a2bb-7aa83e98fde0", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "306f2c55-7a43-4afa-9036-3d1bbf1248dc", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "25c17e82-9353-4461-9f19-16ac8f0caf4a", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "50bce3c1-4572-404c-82af-4d679113c24e", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "21c2e372-5d5a-4b25-9e42-90af4cf9b0dd", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "20ff0c4e-2d01-4874-a7e5-a9f334ac6cf2", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "28e855c8-6d51-4326-a6c6-20797a38c3da", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "44b9f686-be26-44c7-a10d-4e3e45216182", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "029db467-3903-447d-b332-f1527294974f", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "50b55303-f79a-400d-b782-709bc4c4bb31", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "bcb3ed81-641f-492b-bd06-b17c943f6297", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "11150ac3-f38a-4d76-9f61-d4cd147e2400", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "95c99318-a3fc-4198-9cb5-2d47b9662cb1", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "6c9458a7-c371-4214-bb7d-4b3c9dc2c909", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "72d81422-9413-43e2-aac2-60ac86f51ba3", - "metadata": { - "scrolled": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "f78087b5-a8fb-464e-9997-e110e3b89b30", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "ff57d88c-899e-4e70-b735-0cc9ae35965b", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "20bd4b8a-854e-4384-bbc1-3d8d84c17acc", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "14ffbb20-f82c-4f1d-b246-a7e53b498d89", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "afadf901-43fd-4b8a-90d2-a6322713b29c", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "d6861f9b-7aa4-4697-ab05-a77324a832ac", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "35a1212e-6115-43b5-b6d7-85511d0f8ef7", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "f36b9ed5-eb82-411e-a1ed-7430ca373afd", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "bcd0d4fc-2038-4f15-a8f0-2c3ebf2b123b", - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "SageMath 10.5 (PassageMath)", - "language": "python", - "name": "sagemath" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.4" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} diff --git a/examples_extended/Ext_Example25.ipynb b/examples_extended/Ext_Example25.ipynb deleted file mode 100644 index 223b5d4..0000000 --- a/examples_extended/Ext_Example25.ipynb +++ /dev/null @@ -1,315 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "04571be2-5c55-46e9-ba56-39469cfd6510", - "metadata": {}, - "source": [ - "# Reduction for $\\widehat{\\Gamma}(\\mathcal{O}_K\\oplus \\mathfrak{a}, \\mathfrak{n})$, where $K = \\mathbb{Q}(\\alpha)$, $\\alpha$ has minimal polynomial $x^3-x^2-17x-16$." - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "id": "cd5c8271-4764-4dcc-8aaf-ded72499291e", - "metadata": {}, - "outputs": [], - "source": [ - "from hilbert_modgroup.extended.all import ExtendedHilbertModularGroup, ExtendedHilbertPullback, NFCusp_wrt_lattice_ideal\n", - "from hilbert_modgroup.all import UpperHalfPlaneProductElement\n", - "K. = NumberField(x**3 - x**2 - 17*x-16, 'a')\n", - "lattice_ideal = K.different()\n", - "level_ideal = K.fractional_ideal(5, a+2)\n", - "H = ExtendedHilbertModularGroup(K, lattice_ideal = lattice_ideal, level_ideal = level_ideal)\n", - "P = ExtendedHilbertPullback(H)" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "id": "08dca088-23a6-4ddd-87c4-783098c02e22", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "4" - ] - }, - "execution_count": 3, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "K.class_number()" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "id": "b1f0641a-80a8-46b5-8912-2929b3327c1c", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "8069" - ] - }, - "execution_count": 2, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "K.discriminant()" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "id": "096060f5-1fe5-41b8-9642-36cc3e6523a0", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[a^2 + 2*a + 1, a + 3]" - ] - }, - "execution_count": 3, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "P.fundamental_units()" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "id": "14b28613-6d73-4f2d-99aa-2f09c3feebef", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[ 1.32007586210215 -2.73130436295820]\n", - "[-4.91048560762820 0.649277656378310]\n", - "[ 3.59040974552605 2.08202670657989]" - ] - }, - "execution_count": 4, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "P.basis_matrix_logarithmic_unit_lattice()" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "id": "2e9f1bab-9c07-47a1-99ff-c084b57c5a70", - "metadata": {}, - "outputs": [], - "source": [ - "z = UpperHalfPlaneProductElement([ I, I, 1+ 3*I])" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "id": "09b2a59d-0f6e-4e0d-b399-2b08655da870", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[0.670375146488832 + 1.00000000000000*I, 0.102408865307461 + 1.00000000000000*I, -1.77278401179629 + 3.00000000000000*I]" - ] - }, - "execution_count": 6, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "z_star, map = P.reduce(z, True)\n", - "z_star" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "id": "fe5be626-09bb-426b-886e-1297d9eea2ec", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[ 1 -166/8069*a^2 - 3146/8069*a - 2394/8069]\n", - "[ 0 1]" - ] - }, - "execution_count": 7, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "map" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "1960abe9-f7c6-4367-95c0-e4084b86dc0d", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": 8, - "id": "5ef25120-6083-4b8a-b098-9eea97827d49", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[ 1 1/8069*a^2 - 856/8069*a - 2416/8069]\n", - "[ 0 1]" - ] - }, - "execution_count": 8, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "random = H.random_element(matrix_type = 'Upper', x = -1, y = 1)\n", - "random" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "id": "8bcddb11-bea7-4f8c-ba38-b7969d24896f", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[0.0129952282802697 + 1.00000000000000*I, -0.184079798579619 + 1.00000000000000*I, 0.171084570299349 + 3.00000000000000*I]" - ] - }, - "execution_count": 9, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "w = z.apply(random)\n", - "w" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "id": "348f45cf-e48c-47d9-bec6-6253d845275d", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[0.670375146488832 + 1.00000000000000*I, 0.102408865307461 + 1.00000000000000*I, -1.77278401179629 + 3.00000000000000*I]" - ] - }, - "execution_count": 10, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "w_star = P.reduce(w)\n", - "w_star" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "id": "5cf58bf9-9dd3-43de-ac62-b18df28fec7e", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "Cusp Infinity of Number Field in a with defining polynomial x^3 - x^2 - 17*x - 16 with respect to lattice_ideal" - ] - }, - "execution_count": 11, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "c2 = P.find_closest_cusp(w_star)\n", - "c2" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "id": "0a5187f9-b519-4900-9d8c-7a5e21ec17ff", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[-2.22044604925031e-16, -5.55111512312578e-17, 0]" - ] - }, - "execution_count": 12, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "z_star - w_star" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "ed4cf13d-bfe6-4631-9fd3-373c68ddc361", - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "SageMath 10.5 (PassageMath)", - "language": "python", - "name": "sagemath" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.4" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} diff --git a/examples_extended/Paper_Example12.ipynb b/examples_extended/Paper_Example12.ipynb new file mode 100644 index 0000000..0195c7d --- /dev/null +++ b/examples_extended/Paper_Example12.ipynb @@ -0,0 +1,305 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "3b221a5e-d6b4-4421-aad7-988f124ea38d", + "metadata": {}, + "source": [ + "# Computing Right Coset Representatives -- Paper Example 12. \n", + "## $K = \\mathbb{Q}(\\sqrt{10})$, $\\widehat{\\Gamma}(\\mathcal{O}_K\\oplus \\mathfrak{a}, \\mathfrak{n})$, where $\\mathfrak{a} = (2, \\sqrt{10})$, $\\mathfrak{n} = (3, 1+\\sqrt{10})$.\n" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "bc9054af-7a36-4e67-91fe-24a552bcd632", + "metadata": {}, + "outputs": [], + "source": [ + "from hilbert_modgroup.extended.all import ExtendedHilbertModularGroup, ExtendedHilbertPullback, NFCusp_wrt_lattice_ideal\n", + "K. = QuadraticField(10)\n", + "lattice_ideal = K.fractional_ideal(2, a)\n", + "level_ideal = K.fractional_ideal(3, 1+a)\n", + "H1 = ExtendedHilbertModularGroup(K, lattice_ideal, level_ideal = level_ideal, tp_units = True)" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "b2796116-be7f-4415-ae86-3ff9881feef6", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[\n", + "[ 1 3/2*a - 3] [ 1 -1/2*a + 2]\n", + "[ -a - 2 -8], [ -a - 2 -a + 2],\n", + "\n", + "[ a + 6 -17/2*a + 17] [1 0]\n", + "[ -a - 2 -2*a + 12], [0 1]\n", + "]" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "right_coset = H1.coset_matrices()\n", + "right_coset" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "1e81e4eb-145d-44db-b35d-f697a3d0b63c", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "7cf87439-7353-4862-b3b3-cff09b6d226f", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "markdown", + "id": "61707006-487f-4d7f-acc3-4d50400415ec", + "metadata": {}, + "source": [ + "## Algorithm Steps: " + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "id": "151deb13-bcc8-449e-b5ee-c4ec748ee873", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[Fractional ideal (1), Fractional ideal (3, a + 1)]" + ] + }, + "execution_count": 20, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "Div = divisors(level_ideal) #Finding divisors\n", + "Div" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "id": "a60413df-428a-4d3d-94c3-19de66beab31", + "metadata": {}, + "outputs": [], + "source": [ + "delta = Div[0] #Fixing one divisor" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "id": "645dcb4c-adaf-46bc-a56c-fabb6f8eb78b", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Fractional ideal (3, a + 2)" + ] + }, + "execution_count": 26, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "it = K.primes_of_degree_one_iter() #Finding delta'\n", + "deltap = next(it)\n", + "while not deltap.is_coprime(level_ideal) or not (deltap * delta * lattice_ideal).is_principal():\n", + " deltap = next(it)\n", + "c = (delta * lattice_ideal * deltap).gens_reduced()[0]\n", + "deltap " + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "id": "19dd1229-64d6-4645-be38-cbfe430b8a2c", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "-a - 2" + ] + }, + "execution_count": 29, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "c # Finding c" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "id": "d3895fc8-c902-4f87-b438-0063767cf785", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Fractional ideal (1)" + ] + }, + "execution_count": 24, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "I = delta + level_ideal/delta # Value of I for this delta\n", + "I" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "id": "308468c1-3ffd-4d2a-8bfa-1b093ae9c66c", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[-a, 0, a]" + ] + }, + "execution_count": 25, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "D = [] # Finding residues of O_k/(n/delta)\n", + "for r in (level_ideal/delta).residues():\n", + " D.append(r)\n", + "D" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "id": "2c4a950e-a3b4-46c5-a51d-81116de0b976", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[\n", + "[ 1 3/2*a - 3] [ 1 -1/2*a + 2]\n", + "[ -a - 2 -8], [ -a - 2 -a + 2],\n", + "\n", + "[ a + 6 -17/2*a + 17]\n", + "[ -a - 2 -2*a + 12]\n", + "]" + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "L = [] # Finding all coset representative correspoding to fixed delta\n", + "for r in (level_ideal / delta).residues():\n", + " if I.is_coprime(r):\n", + " M = delta.prime_to_idealM_part(level_ideal / delta)\n", + " u = (deltap * M).element_1_mod(level_ideal / delta)\n", + " d = u * r + (1 - u)\n", + " if d.is_zero():\n", + " L.append(H1.ambient_group().create_element(1, -1 / c, c, d))\n", + " else:\n", + " B = K.fractional_ideal(c * lattice_ideal.inverse()).element_1_mod(K.fractional_ideal(d))\n", + " b = -B / c\n", + " a = (1 - B) / d\n", + " L.append(H1.ambient_group().create_element(a, b, c, d))\n", + "L" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "53e850d1-608e-421c-b554-51ae349cca64", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "92f4ed0f-9b92-4f09-bdba-dcfc02aec635", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c30248ed-5888-49b9-aab3-fbce6d35a234", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b7e620a4-8839-4f85-b50a-a96d8822a738", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "20d520d9-772a-482b-bb06-e938d3dd9d78", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "passagemath 10.8.2", + "language": "sage", + "name": "sagemath" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.4" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/examples_extended/Paper_Example15.ipynb b/examples_extended/Paper_Example15.ipynb new file mode 100644 index 0000000..9ba2409 --- /dev/null +++ b/examples_extended/Paper_Example15.ipynb @@ -0,0 +1,539 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "50bb7938-23da-417e-b968-4fc81c41722e", + "metadata": {}, + "source": [ + "# Computing Cusp Representatives -- Paper Examples 15 \n", + "## $K = \\mathbb{Q}(\\sqrt{3})$, $\\widehat{\\Gamma}_0(\\mathcal{O}_K \\oplus \\mathfrak{a},\\mathfrak{n})$, where $\\mathfrak{a}= \\mathfrak{d}_K=(2\\sqrt{3})$, $\\mathfrak{n}=(4\\sqrt{3}+13)$." + ] + }, + { + "cell_type": "code", + "execution_count": 62, + "id": "1c27755e-13cd-49dd-a980-bc5b5fe55c22", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[Cusp [0: 2*a] of Number Field in a with defining polynomial x^2 - 3 with a = 1.732050807568878? with respect to lattice_ideal,\n", + " Cusp [1: -2*a - 12] of Number Field in a with defining polynomial x^2 - 3 with a = 1.732050807568878? with respect to lattice_ideal,\n", + " Cusp Infinity of Number Field in a with defining polynomial x^2 - 3 with a = 1.732050807568878? with respect to lattice_ideal]" + ] + }, + "execution_count": 62, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "from hilbert_modgroup.extended.all import ExtendedHilbertModularGroup, ExtendedHilbertPullback, NFCusp_wrt_lattice_ideal\n", + "K. = QuadraticField(3)\n", + "lattice_ideal = K.different()\n", + "level_ideal = K.fractional_ideal(4*a+13)\n", + "H1 = ExtendedHilbertModularGroup(K, lattice_ideal, level_ideal = level_ideal, tp_units = True)\n", + "H1.cusps()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9e7be0b7-e73d-4a6b-97a1-b285efcc11b6", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": 63, + "id": "355902da-b862-446f-878b-7929a7773cab", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[Cusp [0: 2*a] of Number Field in a with defining polynomial x^2 - 3 with a = 1.732050807568878? with respect to lattice_ideal,\n", + " Cusp [1: -2*a - 12] of Number Field in a with defining polynomial x^2 - 3 with a = 1.732050807568878? with respect to lattice_ideal,\n", + " Cusp [-5: -2*a - 12] of Number Field in a with defining polynomial x^2 - 3 with a = 1.732050807568878? with respect to lattice_ideal,\n", + " Cusp Infinity of Number Field in a with defining polynomial x^2 - 3 with a = 1.732050807568878? with respect to lattice_ideal]" + ] + }, + "execution_count": 63, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "H2 = ExtendedHilbertModularGroup(K, lattice_ideal = lattice_ideal, level_ideal = level_ideal, tp_units = False)\n", + "H2.cusps()" + ] + }, + { + "cell_type": "code", + "execution_count": 65, + "id": "c8c30f9b-9d67-48f6-9a34-388f45547266", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Cusp [-5: -2*a - 12] of Number Field in a with defining polynomial x^2 - 3 with a = 1.732050807568878? with respect to lattice_ideal" + ] + }, + "execution_count": 65, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "w = H2.cusps()[2]\n", + "w" + ] + }, + { + "cell_type": "code", + "execution_count": 66, + "id": "b95321ba-65ec-47bb-b4b3-08ac0a1a4c93", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Cusp [1: -2*a - 12] of Number Field in a with defining polynomial x^2 - 3 with a = 1.732050807568878? with respect to lattice_ideal" + ] + }, + "execution_count": 66, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "cusp, A = H1.cusp_representative(w, return_map = True)\n", + "cusp" + ] + }, + { + "cell_type": "code", + "execution_count": 67, + "id": "6461e0fc-694a-46df-a6a5-a1d641dd2962", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[ 2 1/6*a - 1]\n", + "[228*a + 378 -75*a - 119]" + ] + }, + "execution_count": 67, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "A" + ] + }, + { + "cell_type": "code", + "execution_count": 68, + "id": "2b11c62c-1c13-4232-bc93-0ba82521e78d", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Cusp [1: -2*a - 12] of Number Field in a with defining polynomial x^2 - 3 with a = 1.732050807568878? with respect to lattice_ideal" + ] + }, + "execution_count": 68, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "w.apply(list(A))" + ] + }, + { + "cell_type": "code", + "execution_count": 69, + "id": "dd260bc4-e961-4abe-ad93-4f6c8765b13a", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "15*a + 26" + ] + }, + "execution_count": 69, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "u = A.determinant()\n", + "u" + ] + }, + { + "cell_type": "code", + "execution_count": 70, + "id": "3293da9f-0668-4e36-85e5-ca679652a2bc", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 70, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "u in K.unit_group() and u.is_totally_positive()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "808750a5-296e-4f05-8e63-d3cd0561f13d", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d3be7bf1-804a-4d89-b55b-108b08305cb9", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "markdown", + "id": "cb637358-7106-45a9-bc52-76490ac5cfb1", + "metadata": {}, + "source": [ + "## Algorithm Steps" + ] + }, + { + "cell_type": "code", + "execution_count": 34, + "id": "e7bdbef6-5140-4330-9510-cf63475cf677", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[Fractional ideal (1),\n", + " Fractional ideal (-2*a - 1),\n", + " Fractional ideal (4*a + 13)]" + ] + }, + "execution_count": 34, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "D = divisors(level_ideal) # finding all divisors\n", + "D" + ] + }, + { + "cell_type": "code", + "execution_count": 35, + "id": "a71062ba-657a-4fbf-b116-0f1c52067272", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[Fractional ideal (1)]" + ] + }, + "execution_count": 35, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "Lreps = H1.ideal_cusp_representatives() # Set A\n", + "Lreps" + ] + }, + { + "cell_type": "code", + "execution_count": 36, + "id": "9518a969-6353-4035-a52c-e5f64d0b7592", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Fractional ideal (-2*a - 1)" + ] + }, + "execution_count": 36, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "d = D[1] # fixing a divisor\n", + "d" + ] + }, + { + "cell_type": "code", + "execution_count": 37, + "id": "e6a7840a-a6bc-4df1-9f03-75e3894bcefb", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "1" + ] + }, + "execution_count": 37, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "G = Lreps[0] #fixing ideal G and H for this divisor\n", + "H = Lreps[0]\n", + "g = (G*H).gens_reduced()[0]\n", + "g" + ] + }, + { + "cell_type": "code", + "execution_count": 38, + "id": "23f03eb0-b22b-406d-9d09-a9dc72683d29", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Fractional ideal (1)" + ] + }, + "execution_count": 38, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "deltap = K.fractional_ideal(1) #fixing delta' = \\ok as deltap*lattice_ideal*d*G is principal\n", + "deltap" + ] + }, + { + "cell_type": "code", + "execution_count": 39, + "id": "b6c7177e-d649-4cf5-b40e-0125d349083e", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "-2*a - 12" + ] + }, + "execution_count": 39, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "c = (deltap*lattice_ideal * d *G ).gens_reduced()[0] # finding c\n", + "c" + ] + }, + { + "cell_type": "code", + "execution_count": 40, + "id": "c26d6d6c-b006-46c8-b0d6-5661804ba995", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Fractional ideal (-2*a - 1)" + ] + }, + "execution_count": 40, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "I = d + level_ideal / d # calculating I\n", + "I" + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "id": "8005eb34-f1ee-4a8d-9702-d08354cf150e", + "metadata": {}, + "outputs": [], + "source": [ + "if H1.tp_units(): # determining generators for units group\n", + " gens = totally_positive_unit_group_generators(K)\n", + "else:\n", + " u = K.unit_group().gens_values()\n", + " gens = [t**2 for t in u]" + ] + }, + { + "cell_type": "code", + "execution_count": 42, + "id": "2a499e72-783c-45de-8562-793ad2ff4a08", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[1]" + ] + }, + "execution_count": 42, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "cop_rep = [] # coprime_residue in I\n", + "for x in I.invertible_residues_mod(gens):\n", + " cop_rep.append(x)\n", + "cop_rep" + ] + }, + { + "cell_type": "code", + "execution_count": 43, + "id": "4f45e127-8619-4ce7-8aeb-b2d84950ec52", + "metadata": {}, + "outputs": [], + "source": [ + "from hilbert_modgroup.extended.cusp import (\n", + " NFCusp_wrt_lattice_ideal,\n", + " fundamental_unit_generator,\n", + " totally_positive_unit_group_generators,\n", + ")\n", + "for b in cop_rep:\n", + " M = d.prime_to_idealM_part(I)\n", + " deltAM = deltap*lattice_ideal *G* M\n", + " u = (H* deltAM).element_1_mod(I)\n", + " v = (I * H).element_1_mod(deltAM)\n", + " newb = u * b + v\n", + " A1 = c * (lattice_ideal.inverse()) * (G.inverse())\n", + " A2 = newb * H.inverse()\n", + " r = A2.element_1_mod(A1)\n", + " a1 = (r / newb) * g\n", + " a2 = -(1 - r) / c * g\n", + " Mat = H1.ambient_group().create_element(a1, a2, c, newb)\n", + " t = NFCusp_wrt_lattice_ideal(lattice_ideal, a1, c, lreps = Lreps)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 44, + "id": "9e46036f-31ae-4209-a3e2-ac52df162330", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[ 1 0]\n", + "[-2*a - 12 1]" + ] + }, + "execution_count": 44, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "Mat" + ] + }, + { + "cell_type": "code", + "execution_count": 45, + "id": "e84e9e1a-82c8-474d-809a-2c899e7830c3", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Cusp [1: -2*a - 12] of Number Field in a with defining polynomial x^2 - 3 with a = 1.732050807568878? with respect to lattice_ideal" + ] + }, + "execution_count": 45, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "t" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9659c4a0-08f5-433c-9760-3b3789b5f892", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b662aec4-258f-447c-a500-4ae7afe65af8", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "e096e20a-1e69-4a31-94fb-9133b72d9fd7", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "passagemath 10.8.2", + "language": "sage", + "name": "sagemath" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.4" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/examples_extended/Ext_Example22.ipynb b/examples_extended/Paper_Example17.ipynb similarity index 53% rename from examples_extended/Ext_Example22.ipynb rename to examples_extended/Paper_Example17.ipynb index aeceba1..547fa3f 100644 --- a/examples_extended/Ext_Example22.ipynb +++ b/examples_extended/Paper_Example17.ipynb @@ -5,7 +5,8 @@ "id": "6ade2f4c-eb40-41ea-adc6-c9e1bdde883e", "metadata": {}, "source": [ - "## Reduction for the group $\\widehat{\\Gamma}(\\mathcal{O}_K\\oplus \\mathcal{O}_K), \\quad K=\\mathbb{Q}(\\sqrt{5})$.\n" + "# Reduction -- Paper Example 17 \n", + "## $K= \\mathbb{Q}(\\sqrt{5})$, $\\widehat{\\Gamma}(\\mathcal{O}_K\\oplus \\mathfrak{a}, \\mathfrak{n})$, where $\\mathfrak{a} = \\mathcal{O}_K$, $\\mathfrak{n} = (3)$.\n" ] }, { @@ -17,39 +18,60 @@ "source": [ "from hilbert_modgroup.extended.all import ExtendedHilbertModularGroup, ExtendedHilbertPullback\n", "from hilbert_modgroup.all import UpperHalfPlaneProductElement, HilbertModularGroup, HilbertPullback\n", - "#from sage.rings.imaginary_unit import I\n", - "#from sage.rings.cc import CC\n", - "K1. = QuadraticField(5)\n", - "H1 = ExtendedHilbertModularGroup(K1)\n", - "P1 = ExtendedHilbertPullback(H1)" + "K. = QuadraticField(5)\n", + "lattice_ideal = K.fractional_ideal(1)\n", + "level_ideal = K.fractional_ideal(3)\n", + "EH = ExtendedHilbertModularGroup(K, lattice_ideal = lattice_ideal, level_ideal = level_ideal, tp_units = True)\n", + "EP = ExtendedHilbertPullback(EH)" ] }, { "cell_type": "code", - "execution_count": 2, - "id": "1ac2eda5-67df-443b-9e80-3f5385d6b93e", + "execution_count": 6, + "id": "0eb78dbd-d426-4f3e-93e5-432555a5f967", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "[0.239351482307234 + 2.11455670135770*I, -0.239351482307235 + 2.11455670135770*I]" + "[0.236067977499790 + 0.250000000000000*I, -0.236067977499789 + 0.250000000000000*I]" ] }, - "execution_count": 2, + "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "z = UpperHalfPlaneProductElement([I/4, 4 + I/4])\n", - "P1.reduce(z)" + "z = UpperHalfPlaneProductElement([I/4, 4+I/4])\n", + "EP.reduce(z)" ] }, { "cell_type": "code", - "execution_count": 3, - "id": "74a36dbc-a5e1-4cc8-82c0-483a46765b8d", + "execution_count": 7, + "id": "4cd0b959-5a4f-4ed0-81a1-f48482c4cccf", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "1" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "K.class_number()" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "id": "857df9c8-5d6e-4855-8c89-3bfebf7b1893", "metadata": {}, "outputs": [ { @@ -58,19 +80,19 @@ "5" ] }, - "execution_count": 3, + "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "K1.discriminant()" + "K.discriminant()" ] }, { "cell_type": "code", - "execution_count": 4, - "id": "c0612712-0058-42c9-bc1e-31b1c9192df7", + "execution_count": 9, + "id": "d4795ef9-783d-44c8-8676-6d8294cc5a87", "metadata": {}, "outputs": [ { @@ -79,51 +101,78 @@ "[-1/2*a + 3/2]" ] }, - "execution_count": 4, + "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "P1.fundamental_units()" + "EP.fundamental_units()" ] }, { "cell_type": "code", - "execution_count": 5, - "id": "351362cb-3692-485f-9be1-b1e8619e40f3", + "execution_count": 21, + "id": "fe0ddf53-6788-497d-b272-4f4b3d93811c", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "Cusp [1/2*a + 3/2: 1/2*a - 1/2] of Number Field in a with defining polynomial x^2 - 5 with a = 2.236067977499790? with respect to lattice_ideal" + "[Cusp Infinity of Number Field in a with defining polynomial x^2 - 5 with a = 2.236067977499790? with respect to lattice_ideal]" ] }, - "execution_count": 5, + "execution_count": 21, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "c = P1.find_closest_cusp(z)\n", - "c" + "EP.ambient_group().cusps() " ] }, { "cell_type": "code", - "execution_count": 6, - "id": "5d3aef69-f50a-482f-9268-a773e4279fca", + "execution_count": null, + "id": "09cef325-b3ce-4b37-89b8-5e007ce511ab", "metadata": {}, "outputs": [], + "source": [] + }, + { + "cell_type": "markdown", + "id": "59492b98-c413-4ada-b151-d84988b5481d", + "metadata": {}, "source": [ - "c_rep, Umu = P1.group().cusp_representative(c, return_map = True)" + "## Algorithm Steps" ] }, { "cell_type": "code", - "execution_count": 7, - "id": "07eb6d9d-1223-46fb-a1e8-c75f35e9aba6", + "execution_count": 22, + "id": "351362cb-3692-485f-9be1-b1e8619e40f3", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Cusp [1/2*a + 3/2: 1/2*a - 1/2] of Number Field in a with defining polynomial x^2 - 5 with a = 2.236067977499790? with respect to lattice_ideal" + ] + }, + "execution_count": 22, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "mu = EP.find_closest_cusp(z) \n", + "mu" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "id": "5d3aef69-f50a-482f-9268-a773e4279fca", "metadata": {}, "outputs": [ { @@ -132,18 +181,19 @@ "Cusp Infinity of Number Field in a with defining polynomial x^2 - 5 with a = 2.236067977499790? with respect to lattice_ideal" ] }, - "execution_count": 7, + "execution_count": 23, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "c_rep" + "mu_rep, U_mu = EP.ambient_group().cusp_representative(mu, return_map = True)\n", + "mu_rep" ] }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 24, "id": "01d79b56-2cb9-46c5-bd65-13153aac8a02", "metadata": {}, "outputs": [ @@ -154,18 +204,18 @@ "[-1/2*a + 1/2 1/2*a + 3/2]" ] }, - "execution_count": 8, + "execution_count": 24, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "Umu" + "U_mu" ] }, { "cell_type": "code", - "execution_count": 67, + "execution_count": 25, "id": "1483c794-226b-4e34-a411-e299bdf66d1c", "metadata": {}, "outputs": [ @@ -175,18 +225,18 @@ "Cusp Infinity of Number Field in a with defining polynomial x^2 - 5 with a = 2.236067977499790? with respect to lattice_ideal" ] }, - "execution_count": 67, + "execution_count": 25, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "c.apply(list(Umu))" + "mu.apply(list(U_mu)) # U_mu(mu) = mu_rep " ] }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 26, "id": "b0244684-b8f5-4c0f-bb06-9471c3571cca", "metadata": {}, "outputs": [ @@ -197,31 +247,21 @@ "[0 1]" ] }, - "execution_count": 9, + "execution_count": 26, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "A = P1._group.cusp_normalizing_map(c_rep)\n", - "A" + "M = EP.ambient_group().cusp_normalizing_map(mu_rep)\n", + "M" ] }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 27, "id": "163237ba-f732-4f0b-bd50-b378781cee13", "metadata": {}, - "outputs": [], - "source": [ - "z1 = z.apply(A.inverse() * Umu)" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "id": "3d3fbe06-82aa-4664-b0e7-7190b7b4cd29", - "metadata": {}, "outputs": [ { "data": { @@ -229,30 +269,21 @@ "[-0.762677835265990 + 0.807688788779780*I, 5.22747165031168 + 5.53598131529332*I]" ] }, - "execution_count": 11, + "execution_count": 27, "metadata": {}, "output_type": "execute_result" } ], "source": [ + "z1 = z.apply(M.inverse() * U_mu)\n", "z1" ] }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 28, "id": "e62969d4-63ea-4365-9a5b-a88a04370300", "metadata": {}, - "outputs": [], - "source": [ - "z2, B = P1.reduce_in_cuspidal_region(z1, c_rep, return_map = True)" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "id": "2997dd9f-d4f0-4c8e-9adf-62bff3f37763", - "metadata": {}, "outputs": [ { "data": { @@ -260,29 +291,42 @@ "[0.239351482307234 + 2.11455670135770*I, -0.239351482307235 + 2.11455670135770*I]" ] }, - "execution_count": 13, + "execution_count": 28, "metadata": {}, "output_type": "execute_result" } ], "source": [ + "z2, C = EP.reduce_in_cuspidal_region(z1, mu_rep, return_map = True) #C = T^{\\alpha}E(\\kappa)\n", "z2" ] }, { "cell_type": "code", - "execution_count": 14, - "id": "a027181c-634d-4816-a583-be14ad624c01", + "execution_count": 29, + "id": "2997dd9f-d4f0-4c8e-9adf-62bff3f37763", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "[-1/2*a + 3/2 -a]\n", + "[ 0 1]" + ] + }, + "execution_count": 29, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "z_star = z2.apply(A)" + "C" ] }, { "cell_type": "code", - "execution_count": 15, - "id": "a6c06cb2-db08-491e-92b6-9dc023d09fa5", + "execution_count": 30, + "id": "4b48f82e-8916-4e3f-b47d-9be53c4bffd3", "metadata": {}, "outputs": [ { @@ -291,187 +335,219 @@ "[0.239351482307234 + 2.11455670135770*I, -0.239351482307235 + 2.11455670135770*I]" ] }, - "execution_count": 15, + "execution_count": 30, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "z_star" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "4fa8e319-6ea5-405f-aebe-4aa666c02fbd", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "markdown", - "id": "29c78e36-db07-4eda-a786-00c7027a116e", - "metadata": {}, - "source": [ - "# Check for the Correctness" + "z_tilde = z2.apply(M)\n", + "z_tilde" ] }, { "cell_type": "code", - "execution_count": 16, - "id": "ea569237-e835-4a7d-95f2-72b06c5d186f", + "execution_count": 31, + "id": "a6c06cb2-db08-491e-92b6-9dc023d09fa5", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "[1 8]\n", - "[0 1]" + "[-1/2*a + 5/2 -a - 3]\n", + "[-1/2*a + 1/2 1/2*a + 3/2]" ] }, - "execution_count": 16, + "execution_count": 31, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "RM = H1.random_element(matrix_type = 'Upper', x = -1, y = 1)\n", - "RM" + "P = M*C*M.inverse()*U_mu\n", + "P" ] }, { "cell_type": "code", - "execution_count": 17, - "id": "06400319-69af-4e1a-ade3-3b147f804694", + "execution_count": 32, + "id": "7666e68b-9fbe-40a5-bd04-ee20a6f4fdb9", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "[8.00000000000000 + 0.250000000000000*I, 12.0000000000000 + 0.250000000000000*I]" + "[\n", + "[ 0 -1] [-1/2*a + 1/2 0]\n", + "[ 1 -3/2*a - 1/2], [ 1 -1/2*a - 1/2],\n", + "\n", + "[1/2*a + 1/2 0] [ 0 -1] [ 1 -1] [ 0 -1]\n", + "[ 1 1/2*a - 1/2], [ 1 -a], [ 1 0], [ 1 a],\n", + "\n", + "[-1/2*a - 1/2 0] [1/2*a - 1/2 0]\n", + "[ 1 -1/2*a + 1/2], [ 1 1/2*a + 1/2],\n", + "\n", + "[ 0 -1] [1 0]\n", + "[ 1 3/2*a + 1/2], [0 1]\n", + "]" ] }, - "execution_count": 17, + "execution_count": 32, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "w = RM.acton(z)\n", - "w" + "EH.coset_matrices()" ] }, { "cell_type": "code", - "execution_count": 18, - "id": "20babc36-3e94-4731-be88-2611bb04be05", + "execution_count": 33, + "id": "4fa8e319-6ea5-405f-aebe-4aa666c02fbd", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "[0.239351482307234 + 2.11455670135770*I, -0.239351482307234 + 2.11455670135770*I]" + "[ 0 -1]\n", + "[ 1 a]" ] }, - "execution_count": 18, + "execution_count": 33, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "w_star = P1.reduce(w)\n", - "w_star" + "B = EP.level_reduction_matrix(P)\n", + "B" ] }, { "cell_type": "code", - "execution_count": 19, - "id": "d01cd2b2-d07b-4aeb-b6b2-9f1b04ad4e62", + "execution_count": 34, + "id": "ee2bfd45-2159-4090-ac9c-74f6d395ad4a", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "[ - 1.33226762955019e-15*I, 4.44089209850063e-16 - 2.66453525910038e-15*I]" + "[0.236067977499790 + 0.250000000000000*I, -0.236067977499789 + 0.250000000000000*I]" ] }, - "execution_count": 19, + "execution_count": 34, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "w_star - z_star" + "z_star = z_tilde.apply(B)\n", + "z_star" ] }, { "cell_type": "code", "execution_count": null, - "id": "8d3c12c3-97d6-4cef-aabf-8d6f1100319f", + "id": "55657e86-2c35-43ca-a9ff-a13e6541f5ab", "metadata": {}, "outputs": [], "source": [] }, + { + "cell_type": "markdown", + "id": "29c78e36-db07-4eda-a786-00c7027a116e", + "metadata": {}, + "source": [ + "# Check for the Correctness" + ] + }, { "cell_type": "code", - "execution_count": null, - "id": "643f14d8-63d1-4e37-a162-c2afd884e04f", + "execution_count": 39, + "id": "8bb042cf-79ca-4a00-a9c0-e734a11d5687", "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "data": { + "text/plain": [ + "[ 1 0]\n", + "[6*a + 3 1]" + ] + }, + "execution_count": 39, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "RM = EH.random_element(matrix_type = 'Lower', x = -1, y = 1) # matrix_type = 'Lower', 'Upper', 'Lift', Unit\n", + "RM" + ] }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 40, "id": "459d496c-bcbb-4b8f-bb1d-7820a28fc78a", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "[-0.0836648831271561 + 0.0321281133425227*I, 0.0600043816228275 + 0.0000560393611571660*I]" + ] + }, + "execution_count": 40, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "H1L = HilbertModularGroup(K1)\n", - "P1L = HilbertPullback(H1L)" + "w = z.apply(RM)\n", + "w" ] }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 41, "id": "f50f6406-7312-4b31-b2df-5fadf949b35c", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "[0.239351482307234 + 2.11455670135770*I, -0.239351482307234 + 2.11455670135770*I]" + "[0.236067977499788 + 0.250000000000000*I, -0.236067977499753 + 0.250000000000004*I]" ] }, - "execution_count": 21, + "execution_count": 41, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "u_star = P1L.reduce(z)\n", - "u_star" + "w_star = EP.reduce(w)\n", + "w_star" ] }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 42, "id": "08171d0e-e4a6-4fbc-8a5e-4e73288277bc", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "[-2.22044604925031e-16, -4.44089209850063e-16 - 4.44089209850063e-16*I]" + "[-1.66533453693773e-15 - 8.32667268468867e-17*I, 3.69149155687865e-14 + 4.38538094726937e-15*I]" ] }, - "execution_count": 22, + "execution_count": 42, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "z_star-u_star" + "w_star - z_star" ] }, { @@ -484,80 +560,96 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 43, "id": "a282df3e-3fb6-46d0-8e2c-f1f306be72dd", "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "data": { + "text/plain": [ + "[1/2*a + 3/2 0]\n", + "[ 0 1]" + ] + }, + "execution_count": 43, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "RM = EH.random_element(matrix_type = 'Unit', x = -1, y = 1)\n", + "RM" + ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 44, "id": "b19a1a20-e613-4535-899d-e615f6149a73", "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "data": { + "text/plain": [ + "[0.0954915028125263*I, 10.4721359549996 + 0.654508497187474*I]" + ] + }, + "execution_count": 44, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "w = z.apply(RM)\n", + "w" + ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 45, "id": "228c04bc-1946-4392-8150-4622e305db6a", "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "data": { + "text/plain": [ + "[0.236067977499789 + 0.250000000000000*I, -0.236067977499789 + 0.250000000000000*I]" + ] + }, + "execution_count": 45, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "w_star = EP.reduce(w)\n", + "w_star" + ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 46, "id": "5149a8e7-3a62-4418-9b7b-e3d29adc9a48", "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "63c3f8ed-c0b3-4618-b12b-0c58aad50770", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "0c51924f-de3d-4742-b08b-59d626be877e", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "6db7f43b-6d6b-4c4c-a869-81b67aa85515", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "37880c5e-495f-4ff5-b162-83bd64f6f97d", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "bcf8a1ed-78b4-4546-bc0e-4a712fe92054", - "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "data": { + "text/plain": [ + "[-2.49800180540660e-16 - 2.77555756156289e-17*I, 3.88578058618805e-16 - 5.55111512312578e-17*I]" + ] + }, + "execution_count": 46, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "w_star - z_star" + ] }, { "cell_type": "code", "execution_count": null, - "id": "edddcb13-7973-4500-bb3a-cad95cb9c43f", + "id": "e706d3b3-face-4aa7-84f5-aa97d11e36c3", "metadata": {}, "outputs": [], "source": [] @@ -565,8 +657,8 @@ ], "metadata": { "kernelspec": { - "display_name": "SageMath 10.5 (PassageMath)", - "language": "python", + "display_name": "passagemath 10.8.2", + "language": "sage", "name": "sagemath" }, "language_info": { diff --git a/examples_extended/Ext_Example24.ipynb b/examples_extended/Paper_Example18.ipynb similarity index 67% rename from examples_extended/Ext_Example24.ipynb rename to examples_extended/Paper_Example18.ipynb index 478cc1b..8c11bba 100644 --- a/examples_extended/Ext_Example24.ipynb +++ b/examples_extended/Paper_Example18.ipynb @@ -5,17 +5,10 @@ "id": "ab02d2d2-83f0-4b1c-9ba3-3aed6a819fb0", "metadata": {}, "source": [ - "# Reduction for $\\widehat{\\Gamma}(\\mathcal{O}_K\\oplus \\mathfrak{a}, \\mathfrak{n})$, where $\\mathfrak{a} = (2, \\sqrt{10})$ and $\\mathfrak{n}=(3, \\sqrt{10}+1)$." + "# Reduction -- Example 18\n", + "## $K = \\mathbb{Q}(\\sqrt{10})$, $\\widehat{\\Gamma}(\\mathcal{O}_K\\oplus \\mathfrak{a}, \\mathfrak{n})$, where $\\mathfrak{a} = (2, \\sqrt{10})$, $\\mathfrak{n}=(3, \\sqrt{10}+1)$." ] }, - { - "cell_type": "code", - "execution_count": null, - "id": "ea5f87c8-6d14-4e04-80f8-ab189e8ebc95", - "metadata": {}, - "outputs": [], - "source": [] - }, { "cell_type": "code", "execution_count": 1, @@ -28,26 +21,20 @@ "K. = QuadraticField(10)\n", "lattice_ideal = K.fractional_ideal(2, a)\n", "level_ideal = K.fractional_ideal(3, 1+a)\n", - "H = ExtendedHilbertModularGroup(K, lattice_ideal = lattice_ideal, level_ideal = level_ideal)\n", - "P = ExtendedHilbertPullback(H)" + "EH = ExtendedHilbertModularGroup(K, lattice_ideal = lattice_ideal, level_ideal = level_ideal)\n", + "EP = ExtendedHilbertPullback(EH)" ] }, { "cell_type": "code", "execution_count": 2, - "id": "ff67c02e-7228-4ac3-850c-26f07bb46c34", + "id": "7b8c7499-9bb4-4c1f-8e85-11b177afb4a2", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "[\n", - "[ 1 -3/2*a + 3] [ 1 1/2*a - 2]\n", - "[ a + 2 -8], [ a + 2 -a + 2],\n", - "\n", - "[ a + 6 17/2*a - 17] [1 0]\n", - "[ a + 2 -2*a + 12], [0 1]\n", - "]" + "[0.975245229684398 + 0.00611853733705364*I, -0.224979444540977 + 0.00979258779752128*I]" ] }, "execution_count": 2, @@ -56,79 +43,77 @@ } ], "source": [ - "H.coset_matrices()" + "z = UpperHalfPlaneProductElement([I/4, 4+I/4])\n", + "EP.reduce(z)" ] }, { "cell_type": "code", - "execution_count": 3, - "id": "a7022d8e-a7bb-4f75-a9d7-68159aa2cc87", + "execution_count": 55, + "id": "af9d3ff2-ba5a-4a5c-b506-75ebff50bdc9", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "[-2.39318949298314 + 0.00108060936105106*I, 1.72936623479836 + 0.0242279021339763*I]" + "2" ] }, - "execution_count": 3, + "execution_count": 55, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "z = UpperHalfPlaneProductElement([I/4, 4+ I/4])\n", - "P.reduce(z)" + "K.class_number()" ] }, { "cell_type": "code", - "execution_count": 4, - "id": "ce828169-f4bf-4124-b3f6-84b7484d2570", + "execution_count": 56, + "id": "22dd00fb-0f84-4de3-b3b0-df171407385d", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "[0.456756758127628 + 0.342308124772711*I, -0.456756758127628 + 0.342308124772711*I]" + "40" ] }, - "execution_count": 4, + "execution_count": 56, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "H1 = ExtendedHilbertModularGroup(K, lattice_ideal = lattice_ideal)\n", - "P1 = ExtendedHilbertPullback(H1)\n", - "P1.reduce(z)" + "K.discriminant()" ] }, { "cell_type": "code", - "execution_count": 5, - "id": "90883fe6-0ce1-4233-9766-8982be5595f9", + "execution_count": 57, + "id": "06f480e4-5417-47a8-995a-720043c439f4", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "40" + "[6*a + 19]" ] }, - "execution_count": 5, + "execution_count": 57, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "K.discriminant()" + "EP.fundamental_units()" ] }, { "cell_type": "code", - "execution_count": 6, - "id": "dcb84df6-ce54-41a8-9fc9-14d070d8d07e", + "execution_count": 58, + "id": "48fb2a9d-c0f3-4297-a4fd-566fc5987561", "metadata": {}, "outputs": [ { @@ -138,61 +123,56 @@ " Cusp [0: -2] of Number Field in a with defining polynomial x^2 - 10 with a = 3.162277660168380? with respect to lattice_ideal]" ] }, - "execution_count": 6, + "execution_count": 58, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "H1.cusps()" + "EP.ambient_group().cusps()" ] }, { "cell_type": "code", - "execution_count": 7, - "id": "25f79669-6459-4750-b4a5-5252c7aced71", + "execution_count": 5, + "id": "dcb84df6-ce54-41a8-9fc9-14d070d8d07e", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "[-6*a + 19]" + "[Cusp Infinity of Number Field in a with defining polynomial x^2 - 10 with a = 3.162277660168380? with respect to lattice_ideal,\n", + " Cusp [0: -2] of Number Field in a with defining polynomial x^2 - 10 with a = 3.162277660168380? with respect to lattice_ideal]" ] }, - "execution_count": 7, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "P1.fundamental_units()" + "EP.ambient_group().cusps()" ] }, { "cell_type": "code", - "execution_count": 8, - "id": "3718e040-31a9-4740-9743-61227b969716", + "execution_count": null, + "id": "c6bdff83-f591-4578-b15c-ee80f4f03d90", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "markdown", + "id": "68e5c6d3-c5fc-436d-b313-280942170ef7", "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[ 3.63689291846413]\n", - "[-3.63689291846414]" - ] - }, - "execution_count": 8, - "metadata": {}, - "output_type": "execute_result" - } - ], "source": [ - "P1.basis_matrix_logarithmic_unit_lattice()" + "## Algorithm Steps" ] }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 6, "id": "d4fb76da-178b-48b6-b7d3-8d441dc00e67", "metadata": {}, "outputs": [ @@ -202,31 +182,21 @@ "Cusp [-a - 4: -2] of Number Field in a with defining polynomial x^2 - 10 with a = 3.162277660168380? with respect to lattice_ideal" ] }, - "execution_count": 9, + "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "c1 = P1.find_closest_cusp(z)\n", - "c1" + "mu = EP.find_closest_cusp(z)\n", + "mu" ] }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 7, "id": "ef861ca9-72c4-4192-8811-01d13637bcc5", "metadata": {}, - "outputs": [], - "source": [ - "c_rep, Umu1 = P1.group().cusp_representative(c1, return_map = True)" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "id": "2311a492-c06c-4222-b2b1-02b2a9abac5a", - "metadata": {}, "outputs": [ { "data": { @@ -234,19 +204,20 @@ "Cusp [0: -2] of Number Field in a with defining polynomial x^2 - 10 with a = 3.162277660168380? with respect to lattice_ideal" ] }, - "execution_count": 11, + "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "c_rep" + "mu_rep, U_mu = EP.ambient_group().cusp_representative(mu, return_map = True)\n", + "mu_rep" ] }, { "cell_type": "code", - "execution_count": 12, - "id": "93b33af3-95a4-474e-a79c-44a3ea638ca9", + "execution_count": 8, + "id": "2311a492-c06c-4222-b2b1-02b2a9abac5a", "metadata": {}, "outputs": [ { @@ -256,18 +227,18 @@ "[ 0 1]" ] }, - "execution_count": 12, + "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "Umu1" + "U_mu" ] }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 9, "id": "26a23f01-7fb7-47bd-ba4f-bc0e3b1f19d4", "metadata": {}, "outputs": [ @@ -277,18 +248,18 @@ "Cusp [0: -2] of Number Field in a with defining polynomial x^2 - 10 with a = 3.162277660168380? with respect to lattice_ideal" ] }, - "execution_count": 13, + "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "c1.apply(list(Umu1))" + "mu.apply(list(U_mu))" ] }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 10, "id": "2f24e4bd-9b23-491d-bd49-dcf35dc5ece5", "metadata": {}, "outputs": [ @@ -299,31 +270,21 @@ "[ -2 0]" ] }, - "execution_count": 14, + "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "A = P1._group.cusp_normalizing_map(c_rep)\n", - "A" + "M = EP.ambient_group().cusp_normalizing_map(mu_rep)\n", + "M" ] }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 11, "id": "781e8031-7b1f-449c-869a-487b01e3c2f1", "metadata": {}, - "outputs": [], - "source": [ - "z1 = z.apply(A.inverse() * Umu1)" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "id": "fdbc9718-eedf-439e-9e2e-43c169444576", - "metadata": {}, "outputs": [ { "data": { @@ -331,30 +292,21 @@ "[0.440082512570376 + 0.262666095701131*I, -0.440082512570377 + 0.262666095701132*I]" ] }, - "execution_count": 16, + "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ + "z1 = z.apply(M.inverse() * U_mu)\n", "z1" ] }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 12, "id": "8899b50d-8056-40e2-b796-d6c64739971f", "metadata": {}, - "outputs": [], - "source": [ - "z2, B = P.reduce_in_cuspidal_region(z1, c_rep, return_map = True)" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "id": "68eb4955-12f5-42af-9b67-b1ba439cbde6", - "metadata": {}, "outputs": [ { "data": { @@ -362,40 +314,19 @@ "[-0.350486902471718 + 0.262666095701131*I, 0.350486902471718 + 0.262666095701132*I]" ] }, - "execution_count": 18, + "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ + "z2, C = EP.reduce_in_cuspidal_region(z1, mu_rep, return_map = True)\n", "z2" ] }, { "cell_type": "code", - "execution_count": 19, - "id": "5d63f91e-6084-4a63-9394-a1169dbecbfd", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[ 1 1/4*a]\n", - "[ 0 1]" - ] - }, - "execution_count": 19, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "B" - ] - }, - { - "cell_type": "code", - "execution_count": 20, + "execution_count": 13, "id": "1e181517-f818-441b-95c6-535717364112", "metadata": {}, "outputs": [ @@ -405,19 +336,19 @@ "[0.456756758127628 + 0.342308124772711*I, -0.456756758127628 + 0.342308124772711*I]" ] }, - "execution_count": 20, + "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "z3 = z2.apply(A)\n", - "z3" + "z_tilde = z2.apply(M)\n", + "z_tilde" ] }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 14, "id": "f0426992-fe92-4a18-8822-52cb54148b00", "metadata": {}, "outputs": [ @@ -428,170 +359,140 @@ "[ -a 2*a + 6]" ] }, - "execution_count": 21, + "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "M = A*B*A.inverse()*Umu1\n", - "M" + "P = M*C*M.inverse()*U_mu\n", + "P" ] }, { "cell_type": "code", - "execution_count": 22, - "id": "951fa010-a35c-4281-82cd-464826235fb2", + "execution_count": 54, + "id": "a78fa9bb-bd4f-4b8e-992a-a2ea554651b9", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "True" + "[\n", + "[ 1 3/2*a - 3] [ 1 -1/2*a + 2]\n", + "[ -a - 2 -8], [ -a - 2 -a + 2],\n", + "\n", + "[ a + 6 -17/2*a + 17] [1 0]\n", + "[ -a - 2 -2*a + 12], [0 1]\n", + "]" ] }, - "execution_count": 22, + "execution_count": 54, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "M in H1" + "EH.coset_matrices()" ] }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 15, "id": "b22bf767-81bd-4818-9132-ff5774eff8a6", "metadata": {}, - "outputs": [], - "source": [ - "Mat = P.level_reduction_matrix(M)" - ] - }, - { - "cell_type": "code", - "execution_count": 24, - "id": "393171de-5a76-4a52-9eb6-d78f30957b50", - "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "[ a + 6 17/2*a - 17]\n", - "[ a + 2 -2*a + 12]" + "[ 1 3/2*a - 3]\n", + "[ -a - 2 -8]" ] }, - "execution_count": 24, + "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "Mat" + "B = EP.level_reduction_matrix(P)\n", + "B" ] }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 16, "id": "37dd6c91-08df-4f23-8e93-61ec882fabaf", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "[-2.39318949298314 + 0.00108060936105106*I, 1.72936623479836 + 0.0242279021339763*I]" + "[0.975245229684398 + 0.00611853733705364*I, -0.224979444540977 + 0.00979258779752128*I]" ] }, - "execution_count": 25, + "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "z_star = z3.apply(Mat)\n", + "z_star = z_tilde.apply(B)\n", "z_star" ] }, { "cell_type": "code", - "execution_count": 28, + "execution_count": null, "id": "3dda9fc7-3789-4bea-90f1-8e4b278de3e1", "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[ 18*a - 79 12*a + 51]\n", - "[-11*a + 22 9*a + 23]" - ] - }, - "execution_count": 28, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "Mat*M " - ] + "outputs": [], + "source": [] }, { - "cell_type": "code", - "execution_count": 29, - "id": "8f7f0df7-2335-4d2b-ab5a-6e696d6f6e8b", + "cell_type": "markdown", + "id": "2f7a25f0-e291-43b9-ae1e-cf772b66d24c", "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "True" - ] - }, - "execution_count": 29, - "metadata": {}, - "output_type": "execute_result" - } - ], "source": [ - "Mat*M in H" + "# Check for the Correctness" ] }, { "cell_type": "code", - "execution_count": 34, + "execution_count": 17, "id": "c1b795f4-13e5-4c39-b128-4180f34cfea1", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "[ 1 1/2*a + 1]\n", - "[ 0 1]" + "[ 1 0]\n", + "[-a + 8 1]" ] }, - "execution_count": 34, + "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "random = H.random_element(matrix_type = 'Upper', x = -1, y = 1)\n", + "random = EH.random_element(matrix_type = 'Lower', x = -1, y = 1)\n", "random" ] }, { "cell_type": "code", - "execution_count": 35, + "execution_count": 18, "id": "29a62779-02c9-4ab1-9b47-264e248307d9", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "[-0.581138830084190 + 0.250000000000000*I, 6.58113883008419 + 0.250000000000000*I]" + "[0.0793923192984840 + 0.0284502219763942*I, 0.196587353637015 + 0.000601508940435959*I]" ] }, - "execution_count": 35, + "execution_count": 18, "metadata": {}, "output_type": "execute_result" } @@ -603,48 +504,39 @@ }, { "cell_type": "code", - "execution_count": 36, + "execution_count": 19, "id": "f1c28a04-4e05-45a4-a388-cd395d49874b", "metadata": {}, - "outputs": [], - "source": [ - "w_star = P.reduce(w)" - ] - }, - { - "cell_type": "code", - "execution_count": 37, - "id": "43654370-c241-458e-ac10-2d38d001e281", - "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "[-2.39318949298314 + 0.00108060936105106*I, 1.72936623479836 + 0.0242279021339763*I]" + "[0.975245229684398 + 0.00611853733705363*I, -0.224979444540977 + 0.00979258779752124*I]" ] }, - "execution_count": 37, + "execution_count": 19, "metadata": {}, "output_type": "execute_result" } ], "source": [ + "w_star = EP.reduce(w)\n", "w_star" ] }, { "cell_type": "code", - "execution_count": 38, + "execution_count": 123, "id": "bd1314cd-244a-4f45-a233-7073c64aefbf", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "[0, 0]" + "[6.93889390390723e-18*I, 5.55111512312578e-17 - 6.93889390390723e-18*I]" ] }, - "execution_count": 38, + "execution_count": 123, "metadata": {}, "output_type": "execute_result" } @@ -655,11 +547,13 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 72, "id": "08fe52cf-b506-4ea9-b3a8-757ea7023fe5", "metadata": {}, "outputs": [], - "source": [] + "source": [ + "#from sage.modular.modsym.p1list_nf import psi" + ] }, { "cell_type": "code", @@ -671,7 +565,7 @@ }, { "cell_type": "code", - "execution_count": 137, + "execution_count": null, "id": "48ee9997-88e8-4dda-a1ce-48dbca9a986a", "metadata": {}, "outputs": [], @@ -687,7 +581,7 @@ }, { "cell_type": "code", - "execution_count": 166, + "execution_count": null, "id": "cd7def51-901e-4ac8-ba88-9d15cf0f26e9", "metadata": {}, "outputs": [], @@ -726,8 +620,8 @@ ], "metadata": { "kernelspec": { - "display_name": "SageMath 10.5 (PassageMath)", - "language": "python", + "display_name": "passagemath 10.8.2", + "language": "sage", "name": "sagemath" }, "language_info": { diff --git a/examples_extended/Paper_Example19.ipynb b/examples_extended/Paper_Example19.ipynb new file mode 100644 index 0000000..cfdecb7 --- /dev/null +++ b/examples_extended/Paper_Example19.ipynb @@ -0,0 +1,386 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "04571be2-5c55-46e9-ba56-39469cfd6510", + "metadata": {}, + "source": [ + "# Reduction -- Example 19\n", + "## $K = \\mathbb{Q}(\\alpha)$, $\\alpha$ has minimal polynomial $x^3-x^2-17x-16$, \n", + "## $\\widehat{\\Gamma}(\\mathcal{O}_K\\oplus \\mathfrak{a}, \\mathfrak{n})$, where $\\mathfrak{a} = \\mathfrak{d}_K$, $\\mathfrak{n} = (5)$." + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "cd5c8271-4764-4dcc-8aaf-ded72499291e", + "metadata": {}, + "outputs": [], + "source": [ + "from hilbert_modgroup.extended.all import ExtendedHilbertModularGroup, ExtendedHilbertPullback, NFCusp_wrt_lattice_ideal\n", + "from hilbert_modgroup.all import UpperHalfPlaneProductElement\n", + "K. = NumberField(x**3 - x**2 - 17*x-16, 'a')\n", + "lattice_ideal = K.different()\n", + "level_ideal = K.fractional_ideal(5)\n", + "EH = ExtendedHilbertModularGroup(K, lattice_ideal = lattice_ideal, level_ideal = level_ideal)\n", + "EP = ExtendedHilbertPullback(EH)" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "08dca088-23a6-4ddd-87c4-783098c02e22", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "4" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "K.class_number()" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "ae7718a0-1a1e-46b9-9814-af9c3ce5e13a", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Fractional ideal (-3*a^2 + 2*a + 17)" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "lattice_ideal" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "b1f0641a-80a8-46b5-8912-2929b3327c1c", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "8069" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "K.discriminant()" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "096060f5-1fe5-41b8-9642-36cc3e6523a0", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[a^2 + 2*a + 1, a + 3]" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "EP.fundamental_units()" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "id": "9f181e33-b078-4b35-9472-fbee8224aa96", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[Cusp Infinity of Number Field in a with defining polynomial x^3 - x^2 - 17*x - 16 with respect to lattice_ideal,\n", + " Cusp [-a^2 + 5*a - 2: -19*a^2 + 101*a + 322] of Number Field in a with defining polynomial x^3 - x^2 - 17*x - 16 with respect to lattice_ideal,\n", + " Cusp [-9*a^2 + 35*a + 48: 57*a^2 - 283*a - 4] of Number Field in a with defining polynomial x^3 - x^2 - 17*x - 16 with respect to lattice_ideal,\n", + " Cusp [a^2 + 2*a - 3: -19*a - 107] of Number Field in a with defining polynomial x^3 - x^2 - 17*x - 16 with respect to lattice_ideal]" + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "EP.ambient_group().cusps()" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "id": "2e9f1bab-9c07-47a1-99ff-c084b57c5a70", + "metadata": {}, + "outputs": [], + "source": [ + "z = UpperHalfPlaneProductElement([ 1+I, -1+I, 1+I])" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "id": "09b2a59d-0f6e-4e0d-b399-2b08655da870", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[-0.405456812891293 + 1.00000000000000*I, 0.0122270294253704 + 1.00000000000000*I, 1.39322978346592 + 1.00000000000000*I]" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "z_star, BP = EP.reduce(z, True)\n", + "z_star" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "id": "812ce9f2-37f1-422c-bcb1-665d3589e1ba", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[ 1 -1429/8069*a^2 + 4805/8069*a + 15070/8069]\n", + "[ 0 1]" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "BP" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "id": "204623a0-c3ea-4e38-9d94-cd9edc30b0d1", + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "text/plain": [ + "[\n", + "[ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069]\n", + "[ -3*a^2 + 2*a + 17 -2*a^2 - 2*a - 2], [ -3*a^2 + 2*a + 17 -a^2 - 2*a - 2], [ -3*a^2 + 2*a + 17 -2*a - 2], [ -3*a^2 + 2*a + 17 a^2 - 2*a - 2], [ -3*a^2 + 2*a + 17 2*a^2 - 2*a - 2], [ -3*a^2 + 2*a + 17 -2*a^2 - a - 2], [ -3*a^2 + 2*a + 17 -a^2 - a - 2], [ -3*a^2 + 2*a + 17 -a - 2], [ -3*a^2 + 2*a + 17 a^2 - a - 2], [ -3*a^2 + 2*a + 17 2*a^2 - a - 2], [ -3*a^2 + 2*a + 17 -2*a^2 - 2], [ -3*a^2 + 2*a + 17 -a^2 - 2], [ -3*a^2 + 2*a + 17 -2], [ -3*a^2 + 2*a + 17 a^2 - 2], [ -3*a^2 + 2*a + 17 2*a^2 - 2], [ -3*a^2 + 2*a + 17 -2*a^2 + a - 2], [ -3*a^2 + 2*a + 17 -a^2 + a - 2], [ -3*a^2 + 2*a + 17 a - 2], [ -3*a^2 + 2*a + 17 a^2 + a - 2], [ -3*a^2 + 2*a + 17 2*a^2 + a - 2], [ -3*a^2 + 2*a + 17 -2*a^2 + 2*a - 2], [ -3*a^2 + 2*a + 17 -a^2 + 2*a - 2], [ -3*a^2 + 2*a + 17 2*a - 2], [ -3*a^2 + 2*a + 17 a^2 + 2*a - 2], [ -3*a^2 + 2*a + 17 2*a^2 + 2*a - 2], [ -3*a^2 + 2*a + 17 -2*a^2 - 2*a - 1],\n", + "\n", + "[12*a^2 - 25*a - 177 0] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069]\n", + "[ -3*a^2 + 2*a + 17 -a^2 - 2*a - 1], [ -3*a^2 + 2*a + 17 -2*a - 1], [ -3*a^2 + 2*a + 17 a^2 - 2*a - 1], [ -3*a^2 + 2*a + 17 2*a^2 - 2*a - 1], [ -3*a^2 + 2*a + 17 -2*a^2 - a - 1], [ -3*a^2 + 2*a + 17 -a^2 - a - 1],\n", + "\n", + "[ -a^2 + 2*a + 15 0] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069]\n", + "[-3*a^2 + 2*a + 17 -a - 1], [ -3*a^2 + 2*a + 17 a^2 - a - 1], [ -3*a^2 + 2*a + 17 2*a^2 - a - 1], [ -3*a^2 + 2*a + 17 -2*a^2 - 1], [ -3*a^2 + 2*a + 17 -a^2 - 1],\n", + "\n", + "[ -1 0] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 1 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069]\n", + "[-3*a^2 + 2*a + 17 -1], [ -3*a^2 + 2*a + 17 a^2 - 1], [ -3*a^2 + 2*a + 17 2*a^2 - 1], [ -3*a^2 + 2*a + 17 -2*a^2 + a - 1], [ -3*a^2 + 2*a + 17 -a^2 + a - 1], [ -3*a^2 + 2*a + 17 a - 1], [ -3*a^2 + 2*a + 17 a^2 + a - 1], [ -3*a^2 + 2*a + 17 2*a^2 + a - 1], [ -3*a^2 + 2*a + 17 -2*a^2 + 2*a - 1], [ -3*a^2 + 2*a + 17 -a^2 + 2*a - 1], [ -3*a^2 + 2*a + 17 2*a - 1], [ -3*a^2 + 2*a + 17 a^2 + 2*a - 1], [ -3*a^2 + 2*a + 17 2*a^2 + 2*a - 1], [ -3*a^2 + 2*a + 17 -2*a^2 - 2*a], [ -3*a^2 + 2*a + 17 -a^2 - 2*a], [ -3*a^2 + 2*a + 17 -2*a], [ -3*a^2 + 2*a + 17 a^2 - 2*a], [ -3*a^2 + 2*a + 17 2*a^2 - 2*a], [ -3*a^2 + 2*a + 17 -2*a^2 - a], [ -3*a^2 + 2*a + 17 -a^2 - a], [ -3*a^2 + 2*a + 17 -a], [ -3*a^2 + 2*a + 17 a^2 - a], [ -3*a^2 + 2*a + 17 2*a^2 - a], [ -3*a^2 + 2*a + 17 -2*a^2], [ -3*a^2 + 2*a + 17 -a^2], [ -3*a^2 + 2*a + 17 0], [ -3*a^2 + 2*a + 17 a^2], [ -3*a^2 + 2*a + 17 2*a^2], [ -3*a^2 + 2*a + 17 -2*a^2 + a], [ -3*a^2 + 2*a + 17 -a^2 + a], [ -3*a^2 + 2*a + 17 a], [ -3*a^2 + 2*a + 17 a^2 + a], [ -3*a^2 + 2*a + 17 2*a^2 + a], [ -3*a^2 + 2*a + 17 -2*a^2 + 2*a], [ -3*a^2 + 2*a + 17 -a^2 + 2*a], [ -3*a^2 + 2*a + 17 2*a], [ -3*a^2 + 2*a + 17 a^2 + 2*a], [ -3*a^2 + 2*a + 17 2*a^2 + 2*a], [ -3*a^2 + 2*a + 17 -2*a^2 - 2*a + 1], [ -3*a^2 + 2*a + 17 -a^2 - 2*a + 1], [ -3*a^2 + 2*a + 17 -2*a + 1], [ -3*a^2 + 2*a + 17 a^2 - 2*a + 1], [ -3*a^2 + 2*a + 17 2*a^2 - 2*a + 1], [ -3*a^2 + 2*a + 17 -2*a^2 - a + 1], [ -3*a^2 + 2*a + 17 -a^2 - a + 1], [ -3*a^2 + 2*a + 17 -a + 1], [ -3*a^2 + 2*a + 17 a^2 - a + 1], [ -3*a^2 + 2*a + 17 2*a^2 - a + 1], [ -3*a^2 + 2*a + 17 -2*a^2 + 1], [ -3*a^2 + 2*a + 17 -a^2 + 1],\n", + "\n", + "[ 1 0] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069]\n", + "[-3*a^2 + 2*a + 17 1], [ -3*a^2 + 2*a + 17 a^2 + 1], [ -3*a^2 + 2*a + 17 2*a^2 + 1], [ -3*a^2 + 2*a + 17 -2*a^2 + a + 1], [ -3*a^2 + 2*a + 17 -a^2 + a + 1],\n", + "\n", + "[ a^2 - 2*a - 15 0] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069]\n", + "[-3*a^2 + 2*a + 17 a + 1], [ -3*a^2 + 2*a + 17 a^2 + a + 1], [ -3*a^2 + 2*a + 17 2*a^2 + a + 1], [ -3*a^2 + 2*a + 17 -2*a^2 + 2*a + 1], [ -3*a^2 + 2*a + 17 -a^2 + 2*a + 1], [ -3*a^2 + 2*a + 17 2*a + 1],\n", + "\n", + "[-12*a^2 + 25*a + 177 0] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069] [ 0 104/8069*a^2 - 265/8069*a - 1125/8069]\n", + "[ -3*a^2 + 2*a + 17 a^2 + 2*a + 1], [ -3*a^2 + 2*a + 17 2*a^2 + 2*a + 1], [ -3*a^2 + 2*a + 17 -2*a^2 - 2*a + 2], [ -3*a^2 + 2*a + 17 -a^2 - 2*a + 2], [ -3*a^2 + 2*a + 17 -2*a + 2], [ -3*a^2 + 2*a + 17 a^2 - 2*a + 2], [ -3*a^2 + 2*a + 17 2*a^2 - 2*a + 2], [ -3*a^2 + 2*a + 17 -2*a^2 - a + 2], [ -3*a^2 + 2*a + 17 -a^2 - a + 2], [ -3*a^2 + 2*a + 17 -a + 2], [ -3*a^2 + 2*a + 17 a^2 - a + 2], [ -3*a^2 + 2*a + 17 2*a^2 - a + 2], [ -3*a^2 + 2*a + 17 -2*a^2 + 2], [ -3*a^2 + 2*a + 17 -a^2 + 2], [ -3*a^2 + 2*a + 17 2], [ -3*a^2 + 2*a + 17 a^2 + 2], [ -3*a^2 + 2*a + 17 2*a^2 + 2], [ -3*a^2 + 2*a + 17 -2*a^2 + a + 2], [ -3*a^2 + 2*a + 17 -a^2 + a + 2], [ -3*a^2 + 2*a + 17 a + 2], [ -3*a^2 + 2*a + 17 a^2 + a + 2], [ -3*a^2 + 2*a + 17 2*a^2 + a + 2], [ -3*a^2 + 2*a + 17 -2*a^2 + 2*a + 2], [ -3*a^2 + 2*a + 17 -a^2 + 2*a + 2], [ -3*a^2 + 2*a + 17 2*a + 2], [ -3*a^2 + 2*a + 17 a^2 + 2*a + 2], [ -3*a^2 + 2*a + 17 2*a^2 + 2*a + 2],\n", + "\n", + "[1 0]\n", + "[0 1]\n", + "]" + ] + }, + "execution_count": 17, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "coset = EH.coset_matrices()\n", + "coset" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "id": "909ca504-a812-49c0-a4ef-f9b4fff466c8", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "126" + ] + }, + "execution_count": 18, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "len(coset)" + ] + }, + { + "cell_type": "markdown", + "id": "e9aa99d1-5e36-48d3-ac10-2bc4e443facd", + "metadata": {}, + "source": [ + "# Check for the Correctness" + ] + }, + { + "cell_type": "code", + "execution_count": 87, + "id": "1960abe9-f7c6-4367-95c0-e4084b86dc0d", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[1 1]\n", + "[0 1]" + ] + }, + "execution_count": 87, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "random = EH.random_element(matrix_type = 'Upper', x = -1, y = 1)\n", + "random" + ] + }, + { + "cell_type": "code", + "execution_count": 88, + "id": "8bcddb11-bea7-4f8c-ba38-b7969d24896f", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[2.00000000000000 + 1.00000000000000*I, 1.00000000000000*I, 2.00000000000000 + 1.00000000000000*I]" + ] + }, + "execution_count": 88, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "w = z.apply(random)\n", + "w" + ] + }, + { + "cell_type": "code", + "execution_count": 89, + "id": "348f45cf-e48c-47d9-bec6-6253d845275d", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[-0.405456812891293 + 1.00000000000000*I, 0.0122270294253706 + 1.00000000000000*I, 1.39322978346592 + 1.00000000000000*I]" + ] + }, + "execution_count": 89, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "w_star = EP.reduce(w)\n", + "w_star" + ] + }, + { + "cell_type": "code", + "execution_count": 90, + "id": "0a5187f9-b519-4900-9d8c-7a5e21ec17ff", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[0, -2.22044604925031e-16, 0]" + ] + }, + "execution_count": 90, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "z_star - w_star" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ed4cf13d-bfe6-4631-9fd3-373c68ddc361", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "passagemath 10.8.2", + "language": "sage", + "name": "sagemath" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.4" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/examples_extended/other_exm1.ipynb b/examples_extended/other_exm1.ipynb deleted file mode 100644 index ef37449..0000000 --- a/examples_extended/other_exm1.ipynb +++ /dev/null @@ -1,406 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": 1, - "id": "1cae5937-556f-46ad-ae3d-4b23751ce045", - "metadata": {}, - "outputs": [], - "source": [ - "%matplotlib inline\n", - "import warnings\n", - "warnings.filterwarnings('ignore', category=UserWarning) \n", - "from examples.plot import plot_polygon\n", - "from hilbert_modgroup.extended.all import ExtendedHilbertModularGroup, ExtendedHilbertPullback\n", - "from hilbert_modgroup.all import UpperHalfPlaneProductElement\n", - "from sage.rings.imaginary_unit import I\n", - "from sage.rings.cc import CC\n", - "from sage.rings.infinity import Infinity\n", - "from sage.modular.cusps_nf import NFCusp\n", - "K1. = QuadraticField(5)\n", - "H1 = ExtendedHilbertModularGroup(K1)\n", - "P1 = ExtendedHilbertPullback(H1)" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "id": "1ac2eda5-67df-443b-9e80-3f5385d6b93e", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[0.523606797749979 + 1.04721359549996*I, 0.381966011250105 + 1.14589803375032*I]" - ] - }, - "execution_count": 2, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "z = UpperHalfPlaneProductElement([2 + I/2,1 + I/3])\n", - "P1.reduce(z)" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "id": "6a9642e2-e417-4f7c-bac0-4ef94f100ea5", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[-0.618033988749895 + 0.500000000000000*I, 0.618033988749895 + 0.333333333333333*I]" - ] - }, - "execution_count": 9, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "w = H1.random_element(matrix_type = 'Upper', x = -1, y = 1).acton(z)\n", - "w" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "id": "248aba4d-9d95-4ec8-8bab-994e7a405ced", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[ - 2.22044604925031e-16*I, 4.44089209850063e-16 - 2.22044604925031e-16*I]" - ] - }, - "execution_count": 10, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "P1.reduce(z) - P1.reduce(w)" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "id": "74a36dbc-a5e1-4cc8-82c0-483a46765b8d", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "5" - ] - }, - "execution_count": 11, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "K1.discriminant()" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "id": "c0612712-0058-42c9-bc1e-31b1c9192df7", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[-1/2*a + 3/2]" - ] - }, - "execution_count": 12, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "P1.fundamental_units()" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "id": "0b7688ea-f8c6-46f3-86f0-b4bbbd072d04", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[ 0.962423650119207]\n", - "[-0.962423650119207]" - ] - }, - "execution_count": 13, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "P1.basis_matrix_logarithmic_unit_lattice()" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "id": "c36af5ce-aa04-4be6-90c0-e79918417324", - "metadata": {}, - "outputs": [], - "source": [ - "#for c in P1._candidate_closest_cusps(z):\n", - "# print(f\"({str(c[0]):<3} : {str(c[1]):>3})\",P1.distance_to_cusp_eg(c,z))" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "id": "351362cb-3692-485f-9be1-b1e8619e40f3", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "Cusp [1/2*a + 3/2: 1/2*a + 3/2] of Number Field in a with defining polynomial x^2 - 5 with a = 2.236067977499790? with respect to lattice_ideal" - ] - }, - "execution_count": 14, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "c = P1.find_closest_cusp(z)\n", - "c" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "id": "5d3aef69-f50a-482f-9268-a773e4279fca", - "metadata": {}, - "outputs": [], - "source": [ - "c_rep, Umu = P1.group().cusp_representative(c, return_map = True)" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "id": "01d79b56-2cb9-46c5-bd65-13153aac8a02", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[ 0 -1/2*a + 3/2]\n", - "[-1/2*a - 3/2 1/2*a + 3/2]" - ] - }, - "execution_count": 16, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "Umu" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "id": "1483c794-226b-4e34-a411-e299bdf66d1c", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "Cusp Infinity of Number Field in a with defining polynomial x^2 - 5 with a = 2.236067977499790? with respect to lattice_ideal" - ] - }, - "execution_count": 17, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "c.apply(list(Umu))" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "id": "b0244684-b8f5-4c0f-bb06-9471c3571cca", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[1 0]\n", - "[0 1]" - ] - }, - "execution_count": 13, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "A = P1._group.cusp_normalizing_map(c_rep)\n", - "A" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "id": "163237ba-f732-4f0b-bd50-b378781cee13", - "metadata": {}, - "outputs": [], - "source": [ - "w = z.apply(A.inverse() * Umu)" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "id": "3d3fbe06-82aa-4664-b0e7-7190b7b4cd29", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[-5.48328157299975 + 2.74164078649987*I, 0.437694101250946*I]" - ] - }, - "execution_count": 15, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "w" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "id": "e62969d4-63ea-4365-9a5b-a88a04370300", - "metadata": {}, - "outputs": [], - "source": [ - "w, B = P1.reduce_in_cuspidal_region(w, c_rep, return_map = True)" - ] - }, - { - "cell_type": "code", - "execution_count": 21, - "id": "a027181c-634d-4816-a583-be14ad624c01", - "metadata": {}, - "outputs": [], - "source": [ - "z_star = w.apply(A)" - ] - }, - { - "cell_type": "code", - "execution_count": 22, - "id": "a6c06cb2-db08-491e-92b6-9dc023d09fa5", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[0.523606797749979 + 1.04721359549996*I, 0.381966011250105 + 1.14589803375032*I]" - ] - }, - "execution_count": 22, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "z_star" - ] - }, - { - "cell_type": "code", - "execution_count": 19, - "id": "0c51924f-de3d-4742-b08b-59d626be877e", - "metadata": {}, - "outputs": [], - "source": [ - "from hilbert_modgroup.all import HilbertModularGroup, HilbertPullback\n", - "H1L = HilbertModularGroup(K1)\n", - "P1L = HilbertPullback(H1L)" - ] - }, - { - "cell_type": "code", - "execution_count": 20, - "id": "6db7f43b-6d6b-4c4c-a869-81b67aa85515", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[0.523606797749979 + 1.04721359549996*I, 0.381966011250105 + 1.14589803375032*I]" - ] - }, - "execution_count": 20, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "P1L.reduce(z)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "37880c5e-495f-4ff5-b162-83bd64f6f97d", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "bcf8a1ed-78b4-4546-bc0e-4a712fe92054", - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "SageMath 10.5 (PassageMath)", - "language": "python", - "name": "sagemath" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.4" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} diff --git a/examples_extended/other_exm2.ipynb b/examples_extended/other_exm2.ipynb deleted file mode 100644 index 6804fd3..0000000 --- a/examples_extended/other_exm2.ipynb +++ /dev/null @@ -1,511 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": 2, - "id": "2450479a-1add-47e8-9cfa-88887aa9bc54", - "metadata": {}, - "outputs": [], - "source": [ - "%matplotlib inline\n", - "import warnings\n", - "warnings.filterwarnings('ignore', category=UserWarning) \n", - "from examples.plot import plot_polygon\n", - "from hilbert_modgroup.extended.all import ExtendedHilbertModularGroup, ExtendedHilbertPullback\n", - "from hilbert_modgroup.all import UpperHalfPlaneProductElement\n", - "from sage.rings.imaginary_unit import I\n", - "from sage.rings.cc import CC\n", - "from sage.rings.infinity import Infinity\n", - "from sage.modular.cusps_nf import NFCusp\n", - "K. = QuadraticField(3)\n", - "H = ExtendedHilbertModularGroup(K)\n", - "P = ExtendedHilbertPullback(H)" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "id": "d841dad6-c68c-494f-8b19-d40c37a66d34", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[-0.758778906564500 + 0.534561979912464*I, 0.866520262514823 + 1.82305340081506*I]" - ] - }, - "execution_count": 3, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "z = UpperHalfPlaneProductElement([0.025+I/2,1.0233+I])\n", - "P.reduce(z)" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "id": "bff11704-caea-48b5-b68b-837d471218ba", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[-1.70705080756888 + 0.500000000000000*I, 2.75535080756888 + 1.00000000000000*I]" - ] - }, - "execution_count": 4, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "w = H.random_element(matrix_type = 'Upper', x = -1, y = 1).acton(z)\n", - "w" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "id": "90ee1bb3-7c8e-4a64-a7be-779463d5c184", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[-1.11022302462516e-16, 2.22044604925031e-16*I]" - ] - }, - "execution_count": 6, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "P.reduce(z) - P.reduce(w)" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "id": "c853d989-8ee4-426e-8388-f7cf90ed3d33", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "12" - ] - }, - "execution_count": 7, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "K.discriminant()" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "id": "1f2dcdb4-e206-454d-ba2a-3ac5c0e94edc", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[-a + 2]" - ] - }, - "execution_count": 8, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "P.fundamental_units()" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "id": "e9f9ded9-9b6c-4201-91dd-a083a241c5bf", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[ 1.31695789692482]\n", - "[-1.31695789692482]" - ] - }, - "execution_count": 9, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "P.basis_matrix_logarithmic_unit_lattice()" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "id": "f76d192f-0b3d-40f0-81d7-db1de65e4926", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "Cusp [0: 1] of Number Field in a with defining polynomial x^2 - 3 with a = 1.732050807568878? with respect to lattice_ideal" - ] - }, - "execution_count": 10, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "c = P.find_closest_cusp(z)\n", - "c" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "id": "754134e2-8455-4d1e-b383-0f8203847d4f", - "metadata": {}, - "outputs": [], - "source": [ - "c_rep, Umu = P.group().cusp_representative(c, return_map = True)" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "id": "d1f07c24-e198-4538-b2d6-1455deb60c7a", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "Cusp Infinity of Number Field in a with defining polynomial x^2 - 3 with a = 1.732050807568878? with respect to lattice_ideal" - ] - }, - "execution_count": 12, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "c_rep" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "id": "09cb3d9a-5ba4-4cbb-a6af-e90124bfdf4c", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[ 0 1]\n", - "[-1 0]" - ] - }, - "execution_count": 13, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "Umu" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "id": "75c6ff64-4b71-415f-a919-a5952bef7967", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "Cusp Infinity of Number Field in a with defining polynomial x^2 - 3 with a = 1.732050807568878? with respect to lattice_ideal" - ] - }, - "execution_count": 14, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "c.apply(list(Umu))" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "id": "569fe90f-eb1b-4bdd-bd0e-e1dc1209e08e", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[1 0]\n", - "[0 1]" - ] - }, - "execution_count": 15, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "A = P._group.cusp_normalizing_map(c_rep)\n", - "A" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "id": "ad989eca-c6b6-4ad6-a956-f7f4ba2e1848", - "metadata": {}, - "outputs": [], - "source": [ - "w = z.apply(A.inverse() * Umu)" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "id": "6c9a9ecc-dd47-4971-ba00-258f76362aa5", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[-0.0997506234413965 + 1.99501246882793*I, -0.499867403002826 + 0.488485686507208*I]" - ] - }, - "execution_count": 17, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "w" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "id": "ee379b68-fe99-4b8b-a964-a1a459c3b8be", - "metadata": {}, - "outputs": [], - "source": [ - "w, B = P.reduce_in_cuspidal_region(w, c_rep, return_map = True)" - ] - }, - { - "cell_type": "code", - "execution_count": 19, - "id": "3761c793-8eea-4022-ae5c-22db2ddf504a", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[-0.758778906564500 + 0.534561979912464*I, 0.866520262514823 + 1.82305340081506*I]" - ] - }, - "execution_count": 19, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "w" - ] - }, - { - "cell_type": "code", - "execution_count": 20, - "id": "2d31bcfa-132d-4f88-9c16-040426509a77", - "metadata": {}, - "outputs": [], - "source": [ - "z_star = w.apply(A)" - ] - }, - { - "cell_type": "code", - "execution_count": 21, - "id": "7cc0e5ff-085d-46cd-b545-ef6a9bd38125", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[-0.758778906564500 + 0.534561979912464*I, 0.866520262514823 + 1.82305340081506*I]" - ] - }, - "execution_count": 21, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "z_star" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "598aee11-02b1-425a-b84d-d2dfa4be9a91", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "60f92f98-6a9c-4945-894d-af756ad57483", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "bcd6af3b-7e0a-4b9c-ba21-9c609a533c97", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "aaf8c8c9-7b8d-439f-8eb8-1c1ca998db1f", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "79b83634-90c9-477f-83b1-d6a8fdc75116", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": 20, - "id": "8d9e209d-1cc6-4496-9a28-96a1f600afc0", - "metadata": {}, - "outputs": [], - "source": [ - "from hilbert_modgroup.all import HilbertModularGroup, HilbertPullback\n", - "HL = HilbertModularGroup(K)\n", - "PL = HilbertPullback(HL)" - ] - }, - { - "cell_type": "code", - "execution_count": 21, - "id": "832e2f94-bf73-43dc-afa5-73674ad5bfe1", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[-0.0997506234413965 + 1.99501246882793*I, -0.499867403002826 + 0.488485686507208*I]" - ] - }, - "execution_count": 21, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "PL.reduce(z)" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "id": "a6a53fd4-1666-41db-a20b-82e6a01a8bfa", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "1.01298093447631" - ] - }, - "execution_count": 8, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "P.distance_to_cusp_eg(c, z)" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "id": "207e22c1-9382-4359-94d4-ef73d91e4042", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "1.01298093447631" - ] - }, - "execution_count": 11, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "P.distance_to_cusp_eg(Mat.acton(c), z.apply(Mat))" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "6ddfb7f6-d804-48e2-9449-eda1b1291c9c", - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "SageMath 10.5 (PassageMath)", - "language": "python", - "name": "sagemath" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.4" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} diff --git a/examples_extended/other_exm3.ipynb b/examples_extended/other_exm3.ipynb deleted file mode 100644 index f6696a8..0000000 --- a/examples_extended/other_exm3.ipynb +++ /dev/null @@ -1,1134 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": 93, - "id": "b2f1025a-2705-4558-8a96-35de62b66496", - "metadata": {}, - "outputs": [], - "source": [ - "from hilbert_modgroup.extended.all import ExtendedHilbertModularGroup, ExtendedHilbertPullback, NFCusp_wrt_lattice_ideal\n", - "#from hilbert_modgroup.extended.cusp import totally_positive_unit_group_generators, fundamental_unit_generator\n", - "from hilbert_modgroup.all import UpperHalfPlaneProductElement\n", - "from sage.rings.cc import CC\n", - "from sage.rings.infinity import Infinity\n", - "K. = QuadraticField(10)\n", - "lattice_ideal = K.fractional_ideal(2, a)\n", - "H = ExtendedHilbertModularGroup(K, lattice_ideal = lattice_ideal)\n", - "P = ExtendedHilbertPullback(H)\n", - "CF = ComplexField(200)\n", - "def make_z(coords):\n", - " return UpperHalfPlaneProductElement(\n", - " [CF(z.real(), z.imag()) for z in coords])\n" - ] - }, - { - "cell_type": "code", - "execution_count": 94, - "id": "35f89450-090c-4c61-aed4-0dba5980c142", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[-0.0819366941320231 + 0.492366857878166*I, 0.164803329846921 + 0.534871480315674*I]" - ] - }, - "execution_count": 94, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "z = UpperHalfPlaneProductElement([3/10+ I/100, -7/10 + I/50])\n", - "P.reduce(z)" - ] - }, - { - "cell_type": "code", - "execution_count": 59, - "id": "37aa548d-c870-43ac-8b12-41cfafc19213", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "40" - ] - }, - "execution_count": 59, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "K.discriminant()" - ] - }, - { - "cell_type": "code", - "execution_count": 92, - "id": "5ab5e569-33b2-4e8a-a1be-581d217acd31", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[Cusp Infinity of Number Field in a with defining polynomial x^2 - 10 with a = 3.162277660168380? with respect to lattice_ideal,\n", - " Cusp [0: -2] of Number Field in a with defining polynomial x^2 - 10 with a = 3.162277660168380? with respect to lattice_ideal]" - ] - }, - "execution_count": 92, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "H.cusps()" - ] - }, - { - "cell_type": "code", - "execution_count": 60, - "id": "c7a6685b-b730-4d08-8871-0466936d8e08", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[-6*a + 19]" - ] - }, - "execution_count": 60, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "P.fundamental_units()" - ] - }, - { - "cell_type": "code", - "execution_count": 61, - "id": "82edfdb9-0e7e-416e-9017-16df23a1983f", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[ 3.63689291846413]\n", - "[-3.63689291846414]" - ] - }, - "execution_count": 61, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "P.basis_matrix_logarithmic_unit_lattice()" - ] - }, - { - "cell_type": "code", - "execution_count": 62, - "id": "bdd6e792-fcf1-4c9c-8787-110fd5d4aac3", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "Cusp [a + 4: -2*a - 4] of Number Field in a with defining polynomial x^2 - 10 with a = 3.162277660168380? with respect to lattice_ideal" - ] - }, - "execution_count": 62, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "c1 = P.find_closest_cusp(z)\n", - "c1" - ] - }, - { - "cell_type": "code", - "execution_count": 63, - "id": "37cf36ee-cf9f-4ad9-9fa5-b6bf9d65f4ec", - "metadata": {}, - "outputs": [], - "source": [ - "c_rep, Umu1 = P.group().cusp_representative(c1, return_map = True)" - ] - }, - { - "cell_type": "code", - "execution_count": 64, - "id": "0db9bb23-d1c8-48df-944e-975646546939", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "Cusp [0: -2] of Number Field in a with defining polynomial x^2 - 10 with a = 3.162277660168380? with respect to lattice_ideal" - ] - }, - "execution_count": 64, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "c_rep" - ] - }, - { - "cell_type": "code", - "execution_count": 65, - "id": "f05fba3f-d4e6-4d14-b7b0-fb1986ebbb25", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[ a + 2 1/2*a + 2]\n", - "[ a - 2 1]" - ] - }, - "execution_count": 65, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "Umu1" - ] - }, - { - "cell_type": "code", - "execution_count": 66, - "id": "2d52736a-4572-4fcc-86a7-8b4a3ad06705", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "Cusp [0: -2] of Number Field in a with defining polynomial x^2 - 10 with a = 3.162277660168380? with respect to lattice_ideal" - ] - }, - "execution_count": 66, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "c1.apply(list(Umu1))" - ] - }, - { - "cell_type": "code", - "execution_count": 67, - "id": "b7d66366-9cc5-442a-8b32-b0990f85e4d3", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[ 0 1/2]\n", - "[ -2 0]" - ] - }, - "execution_count": 67, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "A = P._group.cusp_normalizing_map(c_rep)\n", - "A" - ] - }, - { - "cell_type": "code", - "execution_count": 68, - "id": "231e1e56-6e95-4197-bb66-d5d8d51fab79", - "metadata": {}, - "outputs": [], - "source": [ - "z1 = z.apply(A.inverse() * Umu1)" - ] - }, - { - "cell_type": "code", - "execution_count": 69, - "id": "942c6574-0b2c-436e-949d-ae5efe25f600", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[1.87278935866172 + 0.494068936070186*I, 0.0779025941103813 + 0.426875908593031*I]" - ] - }, - "execution_count": 69, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "z1" - ] - }, - { - "cell_type": "code", - "execution_count": 70, - "id": "8a16491a-6488-4d95-a812-000ac7be6d74", - "metadata": {}, - "outputs": [], - "source": [ - "z2, B = P.reduce_in_cuspidal_region(z1, c_rep, return_map = True)" - ] - }, - { - "cell_type": "code", - "execution_count": 71, - "id": "1d459fbd-dff5-4881-92f8-eb13b663eb5c", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[0.0822199436196294 + 0.494068936070186*I, -0.131527990847524 + 0.426875908593031*I]" - ] - }, - "execution_count": 71, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "z2" - ] - }, - { - "cell_type": "code", - "execution_count": 72, - "id": "6d75d19e-7ebb-4665-ad22-123b22ab5ec5", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[ 1 1/4*a - 1]\n", - "[ 0 1]" - ] - }, - "execution_count": 72, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "B" - ] - }, - { - "cell_type": "code", - "execution_count": 73, - "id": "f3ce7056-dff3-4aea-8293-4686eca3e09c", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[-0.0819366941320231 + 0.492366857878166*I, 0.164803329846921 + 0.534871480315674*I]" - ] - }, - "execution_count": 73, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "z_star = z2.apply(A)\n", - "z_star" - ] - }, - { - "cell_type": "code", - "execution_count": 74, - "id": "a7662104-9c96-4b45-abf6-ce87caef34ac", - "metadata": {}, - "outputs": [], - "source": [ - "#z = make_z([3/10 + I/100, -7/10 + I/50])" - ] - }, - { - "cell_type": "code", - "execution_count": 87, - "id": "4cd230cc-608a-4468-bff3-876ce1d8a675", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[1 1]\n", - "[0 1]" - ] - }, - "execution_count": 87, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "Mat = H.random_element(matrix_type = 'Upper', x = -1, y = 1)\n", - "Mat" - ] - }, - { - "cell_type": "code", - "execution_count": 88, - "id": "ebf36245-ceae-4d95-a862-60ff4b1bebe2", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[1.30000000000000 + 0.0100000000000000*I, 0.300000000000000 + 0.0200000000000000*I]" - ] - }, - "execution_count": 88, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "w = Mat.acton(z)\n", - "w " - ] - }, - { - "cell_type": "code", - "execution_count": 89, - "id": "22270680-a61b-4228-96f0-bded2cb60be0", - "metadata": {}, - "outputs": [], - "source": [ - "w_star = P.reduce(w)" - ] - }, - { - "cell_type": "code", - "execution_count": 90, - "id": "44382bb9-5512-46b8-8153-030f49861aa9", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[4.59354776438659e-15 + 2.94209101525666e-15*I, 2.66453525910038e-15*I]" - ] - }, - "execution_count": 90, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "z_star - w_star" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "d284e896-38a3-4b2b-a98a-3b63b2ff27a7", - "metadata": {}, - "outputs": [], - "source": [ - "#Done" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "7c08a3bf-36be-4722-a2fe-35ba4ad949d7", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "fe7d6fcc-c112-44fb-934b-b83a461766a7", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "328eaad7-eace-4991-85f5-4049beb4270a", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "a95bcf51-6193-4662-abfc-050cf8b53d7d", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "bd367a17-9b2e-4c4c-a2d3-a3fe35051886", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "0d88ae4a-7fe3-4777-b0d1-ff31b690b614", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "02fd9974-1386-4f35-9f21-19b4debdc84b", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "0c663c00-0f03-4d0c-8116-75f31ba8d764", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "4f95033c-b1b5-4b35-b054-ddb907e3686f", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "4623f07c-88a7-4c74-9f97-a760cf677941", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "df4779ed-67c8-4344-bdd4-bcab5f976a26", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "19558c50-6c9c-4869-8da2-e72a23359fbb", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "0494690e-cd41-4328-88a1-dbb24c9c8d8b", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "20692756-365b-4f18-b034-57489d0a7ac8", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "1977850d-ec37-4244-8998-adbf2ebc1949", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "2db6dfe8-22de-4960-8192-a343d2d3c624", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "92a6c064-f01f-41c1-932d-44de2ede79de", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "73d5ce08-c542-4d88-8e87-a84b9c647efe", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "0963d1f1-8efe-43e4-97b2-a9e3ed2fd94a", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "01eb813b-1551-47ef-ac04-0e54919841e2", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "f2e92546-84a0-4a95-9c03-bcbce694c5fb", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "f8e35792-701b-4ad5-a607-66fca3642730", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "484d3e70-c6b4-4fba-bdb8-b8121c78beda", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "35c3a210-5323-4165-9adf-56b4358bd578", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": 11, - "id": "e232b796-b964-49b4-84e2-56f362b0ef94", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "54204117-0b0d-4c22-b401-95012db2f23f", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "da3bbac9-3be9-40d4-bdcd-a9502fed0b19", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "27906bd5-9eb2-4a46-a6bb-2f72b1ddfda9", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "ffa68a0f-dc85-4cb1-a9ac-70a0b4093499", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "de9bcc9a-e8d2-411e-bf5d-755423d33983", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "aa31bf7f-c450-420a-9441-94aeb5ff4cc4", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "cd1d8bc6-103a-498a-b517-fc815bad7a49", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "d58c9765-0fb2-4363-94bb-e8671fc58da2", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "c287b3a6-047c-4f06-a1b4-5c4b7ef12434", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "1068d2b8-5f73-43a8-8752-6fd8a40f0607", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "0e113242-cbf9-42ca-8e8a-5424c5fa4932", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "bbe2fb22-d88c-4dca-880f-4180891dc40b", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "7e82d0d9-9aa2-4292-ad41-fb634b3bd441", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "4fc1c0f7-c4f7-4c37-8a1a-5e09c883e3f1", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "21a31dff-1f6e-4732-a2d8-d7d3285090b2", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "f70a42b6-b2a8-4f7e-aef5-2c91d1cacba7", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "db0a6c7a-083d-4f05-8476-912be20e8cf6", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "2c9af351-55d6-4337-90d0-bb205365f6d6", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "87a4b9d9-f821-4e4d-a6fd-3a8fa1db2e82", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "a841db7e-801a-4285-99fe-469c9f17b63d", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "e8dfb2a0-8fc2-4900-b63e-94de5918802a", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "a7f64200-6e57-4710-aacc-352e5d21f732", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "b773ab1e-7ef4-4406-a6cf-5eea55536466", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "5c42dc30-b87d-4be1-bf40-d677c95b3199", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "36f1670c-aa07-4bdd-b250-7699037507d1", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "6f612f84-8bea-4d4f-9e4e-68b8879d9327", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "f219614c-5bb9-4996-9e96-a192c4112bf8", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "0abd9b0d-e7d4-4825-81ae-05d9736258a7", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "bf95bc98-da16-44f2-8b77-424e0ccf1b80", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "5c4e140c-df3e-43b3-bee6-3a6be6e02fee", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "a8a62b94-3b00-4bf6-8d9d-5b43530153a6", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "edb3ef8f-2bf0-4b33-93ca-20ab88f89b24", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "611ae910-b073-4d32-9e11-458d6dca81e6", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "2c8e5f20-e749-46ec-a2bb-7aa83e98fde0", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "306f2c55-7a43-4afa-9036-3d1bbf1248dc", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "25c17e82-9353-4461-9f19-16ac8f0caf4a", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "50bce3c1-4572-404c-82af-4d679113c24e", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "21c2e372-5d5a-4b25-9e42-90af4cf9b0dd", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "20ff0c4e-2d01-4874-a7e5-a9f334ac6cf2", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "28e855c8-6d51-4326-a6c6-20797a38c3da", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "44b9f686-be26-44c7-a10d-4e3e45216182", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "029db467-3903-447d-b332-f1527294974f", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "50b55303-f79a-400d-b782-709bc4c4bb31", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "bcb3ed81-641f-492b-bd06-b17c943f6297", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "11150ac3-f38a-4d76-9f61-d4cd147e2400", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "95c99318-a3fc-4198-9cb5-2d47b9662cb1", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "6c9458a7-c371-4214-bb7d-4b3c9dc2c909", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "72d81422-9413-43e2-aac2-60ac86f51ba3", - "metadata": { - "scrolled": true - }, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "f78087b5-a8fb-464e-9997-e110e3b89b30", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "ff57d88c-899e-4e70-b735-0cc9ae35965b", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "20bd4b8a-854e-4384-bbc1-3d8d84c17acc", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "14ffbb20-f82c-4f1d-b246-a7e53b498d89", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "afadf901-43fd-4b8a-90d2-a6322713b29c", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "d6861f9b-7aa4-4697-ab05-a77324a832ac", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "35a1212e-6115-43b5-b6d7-85511d0f8ef7", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "f36b9ed5-eb82-411e-a1ed-7430ca373afd", - "metadata": {}, - "outputs": [], - "source": [] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "bcd0d4fc-2038-4f15-a8f0-2c3ebf2b123b", - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "SageMath 10.5 (PassageMath)", - "language": "python", - "name": "sagemath" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.4" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} diff --git a/examples_extended/other_exm4.ipynb b/examples_extended/other_exm4.ipynb deleted file mode 100644 index d32b33e..0000000 --- a/examples_extended/other_exm4.ipynb +++ /dev/null @@ -1,613 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": 1, - "id": "f01d942c-22c1-4f3f-b6f7-95c5605b75ba", - "metadata": {}, - "outputs": [], - "source": [ - "from hilbert_modgroup.extended.all import ExtendedHilbertModularGroup, ExtendedHilbertPullback, NFCusp_wrt_lattice_ideal\n", - "#from hilbert_modgroup.extended.cusp import totally_positive_unit_group_generators, fundamental_unit_generator\n", - "from hilbert_modgroup.all import UpperHalfPlaneProductElement\n", - "from sage.rings.cc import CC\n", - "from sage.rings.infinity import Infinity\n", - "K. = QuadraticField(10)\n", - "lattice_ideal = K.fractional_ideal(2, a)\n", - "level_ideal = K.fractional_ideal(3, 1+a)\n", - "H = ExtendedHilbertModularGroup(K, lattice_ideal = lattice_ideal, level_ideal = level_ideal)\n", - "P = ExtendedHilbertPullback(H)\n", - "CF = ComplexField(200)\n", - "def make_z(coords):\n", - " return UpperHalfPlaneProductElement(\n", - " [CF(z.real(), z.imag()) for z in coords])" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "id": "ff67c02e-7228-4ac3-850c-26f07bb46c34", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[\n", - "[ 1 -3/2*a + 3] [ 1 1/2*a - 2]\n", - "[ a + 2 -8], [ a + 2 -a + 2],\n", - "\n", - "[ a + 6 17/2*a - 17] [1 0]\n", - "[ a + 2 -2*a + 12], [0 1]\n", - "]" - ] - }, - "execution_count": 2, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "H.coset_matrices()" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "id": "a7022d8e-a7bb-4f75-a9d7-68159aa2cc87", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[-0.0819366941320231 + 0.492366857878166*I, 0.164803329846921 + 0.534871480315674*I]" - ] - }, - "execution_count": 3, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "z = UpperHalfPlaneProductElement([3/10+ I/100, -7/10 + I/50])\n", - "H1 = ExtendedHilbertModularGroup(K, lattice_ideal = lattice_ideal)\n", - "P1 = ExtendedHilbertPullback(H1)\n", - "P1.reduce(z)" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "id": "90883fe6-0ce1-4233-9766-8982be5595f9", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "40" - ] - }, - "execution_count": 4, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "K.discriminant()" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "id": "dcb84df6-ce54-41a8-9fc9-14d070d8d07e", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[Cusp Infinity of Number Field in a with defining polynomial x^2 - 10 with a = 3.162277660168380? with respect to lattice_ideal,\n", - " Cusp [0: -2] of Number Field in a with defining polynomial x^2 - 10 with a = 3.162277660168380? with respect to lattice_ideal]" - ] - }, - "execution_count": 5, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "H1.cusps()" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "id": "25f79669-6459-4750-b4a5-5252c7aced71", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[-6*a + 19]" - ] - }, - "execution_count": 6, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "P1.fundamental_units()" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "id": "3718e040-31a9-4740-9743-61227b969716", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[ 3.63689291846413]\n", - "[-3.63689291846414]" - ] - }, - "execution_count": 7, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "P1.basis_matrix_logarithmic_unit_lattice()" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "id": "d4fb76da-178b-48b6-b7d3-8d441dc00e67", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "Cusp [a + 4: -2*a - 4] of Number Field in a with defining polynomial x^2 - 10 with a = 3.162277660168380? with respect to lattice_ideal" - ] - }, - "execution_count": 8, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "c1 = P1.find_closest_cusp(z)\n", - "c1" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "id": "ef861ca9-72c4-4192-8811-01d13637bcc5", - "metadata": {}, - "outputs": [], - "source": [ - "c_rep, Umu1 = P1.group().cusp_representative(c1, return_map = True)" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "id": "2311a492-c06c-4222-b2b1-02b2a9abac5a", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "Cusp [0: -2] of Number Field in a with defining polynomial x^2 - 10 with a = 3.162277660168380? with respect to lattice_ideal" - ] - }, - "execution_count": 10, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "c_rep" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "id": "93b33af3-95a4-474e-a79c-44a3ea638ca9", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[ a + 2 1/2*a + 2]\n", - "[ a - 2 1]" - ] - }, - "execution_count": 11, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "Umu1" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "id": "26a23f01-7fb7-47bd-ba4f-bc0e3b1f19d4", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "Cusp [0: -2] of Number Field in a with defining polynomial x^2 - 10 with a = 3.162277660168380? with respect to lattice_ideal" - ] - }, - "execution_count": 12, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "c1.apply(list(Umu1))" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "id": "2f24e4bd-9b23-491d-bd49-dcf35dc5ece5", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[ 0 1/2]\n", - "[ -2 0]" - ] - }, - "execution_count": 13, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "A = P1._group.cusp_normalizing_map(c_rep)\n", - "A" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "id": "781e8031-7b1f-449c-869a-487b01e3c2f1", - "metadata": {}, - "outputs": [], - "source": [ - "z1 = z.apply(A.inverse() * Umu1)" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "id": "fdbc9718-eedf-439e-9e2e-43c169444576", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[1.87278935866172 + 0.494068936070186*I, 0.0779025941103813 + 0.426875908593031*I]" - ] - }, - "execution_count": 15, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "z1" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "id": "8899b50d-8056-40e2-b796-d6c64739971f", - "metadata": {}, - "outputs": [], - "source": [ - "z2, B = P.reduce_in_cuspidal_region(z1, c_rep, return_map = True)" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "id": "68eb4955-12f5-42af-9b67-b1ba439cbde6", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[0.0822199436196294 + 0.494068936070186*I, -0.131527990847524 + 0.426875908593031*I]" - ] - }, - "execution_count": 17, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "z2" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "id": "5d63f91e-6084-4a63-9394-a1169dbecbfd", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[ 1 1/4*a - 1]\n", - "[ 0 1]" - ] - }, - "execution_count": 18, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "B" - ] - }, - { - "cell_type": "code", - "execution_count": 19, - "id": "1e181517-f818-441b-95c6-535717364112", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[-0.0819366941320231 + 0.492366857878166*I, 0.164803329846921 + 0.534871480315674*I]" - ] - }, - "execution_count": 19, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "z3 = z2.apply(A)\n", - "z3" - ] - }, - { - "cell_type": "code", - "execution_count": 20, - "id": "f0426992-fe92-4a18-8822-52cb54148b00", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[ a + 2 1/2*a + 2]\n", - "[ 3*a - 4 4]" - ] - }, - "execution_count": 20, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "M = A*B*A.inverse()*Umu1\n", - "M" - ] - }, - { - "cell_type": "code", - "execution_count": 21, - "id": "951fa010-a35c-4281-82cd-464826235fb2", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "True" - ] - }, - "execution_count": 21, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "M in H1" - ] - }, - { - "cell_type": "code", - "execution_count": 22, - "id": "b22bf767-81bd-4818-9132-ff5774eff8a6", - "metadata": {}, - "outputs": [], - "source": [ - "Mat = P.level_reduction_matrix(M)" - ] - }, - { - "cell_type": "code", - "execution_count": 33, - "id": "393171de-5a76-4a52-9eb6-d78f30957b50", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[ 1 -3/2*a + 3]\n", - "[ a + 2 -8]" - ] - }, - "execution_count": 33, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "Mat" - ] - }, - { - "cell_type": "code", - "execution_count": 23, - "id": "37dd6c91-08df-4f23-8e93-61ec882fabaf", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[-0.968655266746232 + 0.00783863543019639*I, 0.217291491385015 + 0.00910642711285245*I]" - ] - }, - "execution_count": 23, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "z_star = z3.apply(Mat)\n", - "z_star" - ] - }, - { - "cell_type": "code", - "execution_count": 43, - "id": "c1b795f4-13e5-4c39-b128-4180f34cfea1", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[ 1 1/2*a]\n", - "[ 0 1]" - ] - }, - "execution_count": 43, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "random = H.random_element(matrix_type = 'Upper', x = -1, y = 1)\n", - "random" - ] - }, - { - "cell_type": "code", - "execution_count": 44, - "id": "29a62779-02c9-4ab1-9b47-264e248307d9", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[-1.28113883008419 + 0.0100000000000000*I, 0.881138830084190 + 0.0200000000000000*I]" - ] - }, - "execution_count": 44, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "w = z.apply(random)\n", - "w" - ] - }, - { - "cell_type": "code", - "execution_count": 45, - "id": "f1c28a04-4e05-45a4-a388-cd395d49874b", - "metadata": {}, - "outputs": [], - "source": [ - "w_star = P.reduce(w)" - ] - }, - { - "cell_type": "code", - "execution_count": 46, - "id": "43654370-c241-458e-ac10-2d38d001e281", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[-0.968655266746231 + 0.00783863543019665*I, 0.217291491385015 + 0.00910642711285243*I]" - ] - }, - "execution_count": 46, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "w_star" - ] - }, - { - "cell_type": "code", - "execution_count": 47, - "id": "bd1314cd-244a-4f45-a233-7073c64aefbf", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[5.55111512312578e-16 + 2.55004350968591e-16*I, 1.11022302462516e-16 - 2.42861286636753e-17*I]" - ] - }, - "execution_count": 47, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "w_star - z_star" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "08fe52cf-b506-4ea9-b3a8-757ea7023fe5", - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "SageMath 10.5 (PassageMath)", - "language": "python", - "name": "sagemath" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.4" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} diff --git a/examples_extended/other_exm5.ipynb b/examples_extended/other_exm5.ipynb deleted file mode 100644 index 0ca92c5..0000000 --- a/examples_extended/other_exm5.ipynb +++ /dev/null @@ -1,283 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": 1, - "id": "a6c37553-d447-4ad2-bfdb-43070a71f0ad", - "metadata": {}, - "outputs": [], - "source": [ - "from hilbert_modgroup.extended.all import ExtendedHilbertModularGroup, ExtendedHilbertPullback, NFCusp_wrt_lattice_ideal\n", - "#from hilbert_modgroup.extended.cusp import totally_positive_unit_group_generators, fundamental_unit_generator\n", - "from hilbert_modgroup.all import UpperHalfPlaneProductElement\n", - "from sage.rings.cc import CC\n", - "from sage.rings.infinity import Infinity\n", - "K. = NumberField(x**3-3*x+1, 'a')\n", - "lattice_ideal = K.different()\n", - "level_ideal = K.fractional_ideal(2)\n", - "H = ExtendedHilbertModularGroup(K, lattice_ideal = lattice_ideal, level_ideal = level_ideal)\n", - "P = ExtendedHilbertPullback(H)\n", - "CF = ComplexField(200)\n", - "def make_z(coords):\n", - " return UpperHalfPlaneProductElement(\n", - " [CF(z.real(), z.imag()) for z in coords])" - ] - }, - { - "cell_type": "code", - "execution_count": 30, - "id": "c8bcb051-c17d-4645-ba92-b133386b2ea5", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "81" - ] - }, - "execution_count": 30, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "K.discriminant()" - ] - }, - { - "cell_type": "code", - "execution_count": 33, - "id": "1d63b503-39f5-4334-9a60-63ad15289341", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[a^2, a + 2]" - ] - }, - "execution_count": 33, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "P.fundamental_units()" - ] - }, - { - "cell_type": "code", - "execution_count": 34, - "id": "e007c570-f64c-4632-96b4-7004d02421f9", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[ 1.26188944840409 -2.11515362714987]\n", - "[-2.11515362714987 0.853264178745778]\n", - "[0.853264178745778 1.26188944840409]" - ] - }, - "execution_count": 34, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "P1.basis_matrix_logarithmic_unit_lattice()" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "id": "839b3f79-b497-4d50-858a-009397803876", - "metadata": {}, - "outputs": [], - "source": [ - "z = UpperHalfPlaneProductElement([3 + 2*I, 2 + 3*I, 1 + I])" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "id": "e4448670-1481-4cd0-a61a-882c525b15d2", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[0.126129186486541 + 2.00000000000000*I, -0.0158781627669460 + 3.00000000000000*I, -0.110251023719595 + 1.00000000000000*I]" - ] - }, - "execution_count": 10, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "z_star = P.reduce(z)\n", - "z_star" - ] - }, - { - "cell_type": "code", - "execution_count": 24, - "id": "13042965-99b2-499a-96bd-3714b1d69ebe", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[ 1 1/3*a]\n", - "[ 0 1]" - ] - }, - "execution_count": 24, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "random = H.random_element(matrix_type = 'Upper', x = -1, y = 1)\n", - "random" - ] - }, - { - "cell_type": "code", - "execution_count": 25, - "id": "3ad9b284-ee5e-4ca9-839a-da2992471f10", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[2.37353825280939 + 2.00000000000000*I, 2.11576545177795 + 3.00000000000000*I, 1.51069629541265 + 1.00000000000000*I]" - ] - }, - "execution_count": 25, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "w = z.apply(random)\n", - "w" - ] - }, - { - "cell_type": "code", - "execution_count": 26, - "id": "79175815-4a90-48f4-ad7b-edf05e82e7d5", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[0.126129186486541 + 2.00000000000000*I, -0.0158781627669464 + 3.00000000000000*I, -0.110251023719596 + 1.00000000000000*I]" - ] - }, - "execution_count": 26, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "w_star = P.reduce(w)\n", - "w_star" - ] - }, - { - "cell_type": "code", - "execution_count": 27, - "id": "5454052e-c834-46ee-97e0-f263da5461b7", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[-4.44089209850063e-16, 4.44089209850063e-16, 2.22044604925031e-16]" - ] - }, - "execution_count": 27, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "z_star - w_star" - ] - }, - { - "cell_type": "code", - "execution_count": 28, - "id": "35fd26e1-2269-4014-b7a8-55f323cf5659", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "Fractional ideal (3*a + 3)" - ] - }, - "execution_count": 28, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "K.different()" - ] - }, - { - "cell_type": "code", - "execution_count": 29, - "id": "ec100bb8-6496-4c4f-b93b-1e59ab6460cc", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "1" - ] - }, - "execution_count": 29, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "K.class_number()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "38e036e2-1d82-4d75-87bc-6a9724f8f5ce", - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "SageMath 10.5 (PassageMath)", - "language": "python", - "name": "sagemath" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.4" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} diff --git a/examples_extended/other_exm6.ipynb b/examples_extended/other_exm6.ipynb deleted file mode 100644 index 62a0b0e..0000000 --- a/examples_extended/other_exm6.ipynb +++ /dev/null @@ -1,315 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": 2, - "id": "cd5c8271-4764-4dcc-8aaf-ded72499291e", - "metadata": {}, - "outputs": [], - "source": [ - "from hilbert_modgroup.extended.all import ExtendedHilbertModularGroup, ExtendedHilbertPullback, NFCusp_wrt_lattice_ideal\n", - "#from hilbert_modgroup.extended.cusp import totally_positive_unit_group_generators, fundamental_unit_generator\n", - "from hilbert_modgroup.all import UpperHalfPlaneProductElement\n", - "from sage.rings.cc import CC\n", - "from sage.rings.infinity import Infinity\n", - "K. = NumberField(x**3 - 36*x-1, 'a')\n", - "lattice_ideal = K.different()\n", - "level_ideal = K.fractional_ideal(5, a+2)\n", - "H = ExtendedHilbertModularGroup(K, lattice_ideal = lattice_ideal, level_ideal = level_ideal)\n", - "P = ExtendedHilbertPullback(H)\n", - "CF = ComplexField(200)\n", - "def make_z(coords):\n", - " return UpperHalfPlaneProductElement(\n", - " [CF(z.real(), z.imag()) for z in coords])" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "id": "b1f0641a-80a8-46b5-8912-2929b3327c1c", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "20733" - ] - }, - "execution_count": 3, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "K.discriminant()" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "id": "096060f5-1fe5-41b8-9642-36cc3e6523a0", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[a^2, a + 6]" - ] - }, - "execution_count": 4, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "P.fundamental_units()" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "id": "14b28613-6d73-4f2d-99aa-2f09c3feebef", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[ 3.57886772948841 -4.27317838834468]\n", - "[-7.16699500767405 1.78711898997458]\n", - "[ 3.58812727818564 2.48605939837008]" - ] - }, - "execution_count": 5, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "P.basis_matrix_logarithmic_unit_lattice()" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "id": "2e9f1bab-9c07-47a1-99ff-c084b57c5a70", - "metadata": {}, - "outputs": [], - "source": [ - "z = UpperHalfPlaneProductElement([0 + I, 0 + I, 1 + 3*I])" - ] - }, - { - "cell_type": "code", - "execution_count": 25, - "id": "ddf6fcce-8f9d-42c1-9a4d-d5891e08da60", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "Cusp Infinity of Number Field in a with defining polynomial x^3 - 36*x - 1 with respect to lattice_ideal" - ] - }, - "execution_count": 25, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "P.find_closest_cusp(z)" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "id": "ff3ad88f-4283-43b8-9316-36420dfbbe97", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[-0.333723197419941 + 1.00000000000000*I, -0.00152190642905473 + 1.00000000000000*I, 0.335245103848995 + 3.00000000000000*I]" - ] - }, - "execution_count": 9, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "z_star = P.reduce(z)\n", - "z_star" - ] - }, - { - "cell_type": "code", - "execution_count": 24, - "id": "b843c22b-6be1-4411-8059-fabf30ff6516", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "Cusp Infinity of Number Field in a with defining polynomial x^3 - 36*x - 1 with respect to lattice_ideal" - ] - }, - "execution_count": 24, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "c1 = P.find_closest_cusp(z_star)\n", - "c1" - ] - }, - { - "cell_type": "code", - "execution_count": 23, - "id": "1960abe9-f7c6-4367-95c0-e4084b86dc0d", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "True" - ] - }, - "execution_count": 23, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "z_star == P.reduce(z_star)" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "id": "5ef25120-6083-4b8a-b098-9eea97827d49", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[ 1 5/20733*a^2 + 5471/20733*a + 68990/20733]\n", - "[ 0 1]" - ] - }, - "execution_count": 18, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "random = H.random_element(matrix_type = 'Upper', x = -1, y = 1)\n", - "random" - ] - }, - { - "cell_type": "code", - "execution_count": 19, - "id": "8bcddb11-bea7-4f8c-ba38-b7969d24896f", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[1.75659172909393 + 1.00000000000000*I, 3.32021552011124 + 1.00000000000000*I, 5.92319275079483 + 3.00000000000000*I]" - ] - }, - "execution_count": 19, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "w = z.apply(random)\n", - "w" - ] - }, - { - "cell_type": "code", - "execution_count": 20, - "id": "348f45cf-e48c-47d9-bec6-6253d845275d", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[-0.333723197419940 + 1.00000000000000*I, -0.00152190642905436 + 1.00000000000000*I, 0.335245103848996 + 3.00000000000000*I]" - ] - }, - "execution_count": 20, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "w_star = P.reduce(w)\n", - "w_star" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "5cf58bf9-9dd3-43de-ac62-b18df28fec7e", - "metadata": {}, - "outputs": [], - "source": [ - "c2 = P.find_closest_cusp(w_star)" - ] - }, - { - "cell_type": "code", - "execution_count": 21, - "id": "0a5187f9-b519-4900-9d8c-7a5e21ec17ff", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[-4.44089209850063e-16, -3.60822483003176e-16, -4.44089209850063e-16]" - ] - }, - "execution_count": 21, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "z_star - w_star" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "ed4cf13d-bfe6-4631-9fd3-373c68ddc361", - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "SageMath 10.5 (PassageMath)", - "language": "python", - "name": "sagemath" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.4" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} diff --git a/src/hilbert_modgroup/extended/group_class.py b/src/hilbert_modgroup/extended/group_class.py index 429e6c8..9abda58 100644 --- a/src/hilbert_modgroup/extended/group_class.py +++ b/src/hilbert_modgroup/extended/group_class.py @@ -298,6 +298,27 @@ def OK(self): """ return self._OK + def ambient_group(self): + """ + Return the ambient group associated to self, i.e., with level_ideal = O_K + + + Examples:: + + sage: from hilbert_modgroup.extended.all import ExtendedHilbertModularGroup + sage: K. = QuadraticField(5) + sage: lattice_ideal = K.fractional_ideal(2) + sage: level_ideal = K.fractional_ideal(3) + sage: H = ExtendedHilbertModularGroup(K, lattice_ideal = lattice_ideal, level_ideal = level_ideal) + sage: H.ambient_group() + Hilbert modular group PGL_2^+(...) ... x^2 - 5 with a = 2.236067977499790? ... + sage: H.ambient_group().level_ideal() + Fractional ideal (1) + """ + return ExtendedHilbertModularGroup(self.number_field(), + lattice_ideal = self.lattice_ideal(), + tp_units = self.tp_units()) + def __contains__(self, x): r""" Return whether ``x`` is an element of ``self``. @@ -385,8 +406,8 @@ def generators(self): [-a + 1 0] [-1 0] [a + 1 0] [ a -1] [-a -1] [ 3 -a - 1], [ 3 -1], [ 3 a - 1], [ 3 -a], [ 3 a], - [-a - 1 0] [a - 1 0] [1 1] [1 a] [1 0] [ 1 0] - [ 3 -a + 1], [ 3 a + 1], [0 1], [0 1], [3 1], [3*a 1], + [-a - 1 0] [1 0] [a - 1 0] [1 1] [1 a] [1 0] [ 1 0] + [ 3 -a + 1], [3 1], [ 3 a + 1], [0 1], [0 1], [3 1], [3*a 1], [2*a + 3 0] [ 0 1] @@ -397,8 +418,8 @@ def generators(self): [-a + 1 0] [-1 0] [a + 1 0] [ a -1] [-a -1] [ 3 -a - 1], [ 3 -1], [ 3 a - 1], [ 3 -a], [ 3 a], - [-a - 1 0] [a - 1 0] [1 1] [1 a] [1 0] [ 1 0] - [ 3 -a + 1], [ 3 a + 1], [0 1], [0 1], [3 1], [3*a 1] + [-a - 1 0] [1 0] [a - 1 0] [1 1] [1 a] [1 0] [ 1 0] + [ 3 -a + 1], [3 1], [ 3 a + 1], [0 1], [0 1], [3 1], [3*a 1] ] """ @@ -701,7 +722,7 @@ def cusps(self): A2 = newb * B.inverse() r = A2.element_1_mod(A1) a1 = (r / newb) * g - -(1 - r) / c * g + a2 = -(1 - r) / c * g Lcusps.append(NFCusp_wrt_lattice_ideal(lattice_ideal, a1, c, lreps=Lreps)) cusp = NFCusp_wrt_lattice_ideal(self.lattice_ideal(), 1, 0) for c in Lcusps: @@ -998,38 +1019,35 @@ def coset_matrices(self): N = self.level_ideal() K = self.number_field() lattice_ideal = self.lattice_ideal() - H = ExtendedHilbertModularGroup(K, lattice_ideal) + H = self.ambient_group() L = [] for D in divisors(N): - if (D * lattice_ideal).is_principal(): - Dp = K.fractional_ideal(1) - c = (D * lattice_ideal * Dp).gens_reduced()[0] + if D == N: + L.append(H.create_element(1, 0, 0, 1)) else: - it = K.primes_of_degree_one_iter() - Dp = next(it) - while not Dp.is_coprime(N) or not (Dp * D * lattice_ideal).is_principal(): + if (D * lattice_ideal).is_principal(): + Dp = K.fractional_ideal(1) + c = (D * lattice_ideal * Dp).gens_reduced()[0] + else: + it = K.primes_of_degree_one_iter() Dp = next(it) - c = (D * lattice_ideal * Dp).gens_reduced()[0] - I = D + N / D - for r in (N / D).residues(): - if I.is_coprime(r): - M = D.prime_to_idealM_part(N / D) - u = (Dp * M).element_1_mod(N / D) - d = u * r + (1 - u) - if d.is_zero(): - L.append(H.create_element(1, -1 / c, c, d)) - else: - B = K.fractional_ideal(c * lattice_ideal.inverse()).element_1_mod( - K.fractional_ideal(d) - ) - b = -B / c - a = (1 - B) / d - L.append(H.create_element(a, b, c, d)) - for x in L: - if x in self: - idx = L.index(x) - L[idx] = H.create_element(1, 0, 0, 1) - break + while not Dp.is_coprime(N) or not (Dp * D * lattice_ideal).is_principal(): + Dp = next(it) + c = (D * lattice_ideal * Dp).gens_reduced()[0] + I = D + N / D + for r in (N / D).residues(): + if I.is_coprime(r): + M = D.prime_to_idealM_part(N / D) + u = (Dp * M).element_1_mod(N / D) + d = u * r + (1 - u) + if d.is_zero(): + L.append(H.create_element(1, -1 / c, c, d)) + else: + B = K.fractional_ideal(c * lattice_ideal.inverse()).element_1_mod( + K.fractional_ideal(d)) + b = -B / c + a = (1 - B) / d + L.append(H.create_element(a, b, c, d)) if not len(L) == psi(N): raise ValueError("Condition is not satisfying. Check again") return L diff --git a/src/hilbert_modgroup/extended/group_element.pyx b/src/hilbert_modgroup/extended/group_element.pyx index bc13be2..fb4f6da 100644 --- a/src/hilbert_modgroup/extended/group_element.pyx +++ b/src/hilbert_modgroup/extended/group_element.pyx @@ -52,7 +52,7 @@ cdef class ExtendedHilbertModularGroupElement(MultiplicativeGroupElement): raise ValueError("parent (= {0}) must be a Extended Hilbert Modular group".format(parent)) x = MatrixSpace(parent.base_ring(), 2, 2)(x, copy=True, coerce=True) if parent.tp_units(): - if not (x.determinant().is_unit() and x.determinant().is_totally_positive()): + if not (x.determinant() in parent.number_field().unit_group() and x.determinant().is_totally_positive()): raise TypeError("matrix must have determinant equal to totally positive unit") else: if not (x.determinant() == 1): diff --git a/src/hilbert_modgroup/extended/pullback.py b/src/hilbert_modgroup/extended/pullback.py index faf334f..6748b48 100644 --- a/src/hilbert_modgroup/extended/pullback.py +++ b/src/hilbert_modgroup/extended/pullback.py @@ -90,11 +90,8 @@ def __init__(self, G): """ if not isinstance(G, ExtendedHilbertModularGroup_class): raise ValueError("Need a Extended Hilbert modular group") - ambient_group = ExtendedHilbertModularGroup(G.number_field(), - lattice_ideal = G.lattice_ideal(), - tp_units = G.tp_units()) - self._ambient_group = ambient_group self._group = G + self._ambient_group = G.ambient_group() def __eq__(self, other): @@ -170,6 +167,19 @@ def group(self): def ambient_group(self): """ Return the ambient group of ``self``. + + Examples:: + + sage: from hilbert_modgroup.extended.all import ExtendedHilbertModularGroup, ExtendedHilbertPullback + sage: K. = QuadraticField(5) + sage: lattice_ideal = K.fractional_ideal(2) + sage: level_ideal = K.fractional_ideal(3) + sage: H = ExtendedHilbertModularGroup(K, lattice_ideal = lattice_ideal, level_ideal = level_ideal) + sage: P = ExtendedHilbertPullback(H) + sage: P.ambient_group() + Hilbert modular group PGL_2^+(...) ... x^2 - 5 with a = 2.236067977499790? ... + sage: P.ambient_group().level_ideal() + Fractional ideal (1) """ return self._ambient_group @@ -544,110 +554,6 @@ def basis_matrix_ideal(self, a=None, prec=53): n = self.ambient_group().number_field().degree() return matrix(RealField(prec), n, n, entries).transpose() - # @cached_method - # def basis_matrix_ideal_on_power_basis(self, a=None): - # r""" - # Return the Basis matrix corresponding to an integer basis of an ideal a - # in terms of the standard power basis. - - # INPUT: - - # - ``a`` -- ideal or number field element. - - # EXAMPLES:: - - # sage: from hilbert_modgroup.extended.all import * - # sage: H1 = ExtendedHilbertModularGroup(5) - # sage: P1 = ExtendedHilbertPullback(H1) - # sage: P1.basis_matrix_ideal_on_power_basis() - # [ 1 -1/2] - # [ 0 1/2] - # sage: P1.basis_matrix_ideal_on_power_basis(2) - # [ 2 -1] - # [ 0 1] - # sage: H2=ExtendedHilbertModularGroup(10) - # sage: P2 = ExtendedHilbertPullback(H2) - # sage: P2.basis_matrix_ideal_on_power_basis() - # [1 0] - # [0 1] - # sage: a=H2.OK().gen(1) - # sage: P2.basis_matrix_ideal_on_power_basis(a+1) - # [9 1] - # [0 1] - - # """ - # ideala = self._construct_ideal(a) - # entries = [list(beta.vector()) for beta in ideala.integral_basis()] - # n = self.group().number_field().degree() - # return matrix(self.number_field(), n, n, entries).transpose() - - # def coordinates_in_number_field_ideal(self, x, a = None): - # r""" - # Return the coordinates of x with respect to an integral basis of a. - - # INPUT: - - # - ``x`` -- element of ideal a - # - ``a`` -- ideal or number field element. - - # EXAMPLES:: - - # sage: from hilbert_modgroup.extended.all import * - # sage: H1 = ExtendedHilbertModularGroup(5) - # sage: P1 = ExtendedHilbertPullback(H1) - # sage: b1,b2=P1.number_field().fractional_ideal(1).basis() - # sage: P1.coordinates_in_number_field_ideal(b1) - # (1, 0) - # sage: P1.coordinates_in_number_field_ideal(b2) - # (0, 1) - # sage: H2 = ExtendedHilbertModularGroup(10) - # sage: P2 = ExtendedHilbertPullback(H2) - # sage: b1,b2 = P2.number_field().fractional_ideal(1).basis() - # sage: P2.coordinates_in_number_field_ideal(b1) - # (1, 0) - # sage: P2.coordinates_in_number_field_ideal(b2) - # (0, 1) - - # """ - # B = self.basis_matrix_ideal_on_power_basis(a = a) - # return B.inverse() * x.vector() - - # @cached_method - # def basis_matrix_ideal__norm(self, a=None, prec=53, row=None): - # r""" - # Return the Basis matrix corresponding to an integer basis of an ideal a. - - # INPUT: - - # - ``a`` -- ideal or number field element. - # - ``prec`` -- integer (default=53) - - # EXAMPLES:: - - # sage: from hilbert_modgroup.extended.all import * - # sage: H1 = ExtendedHilbertModularGroup(5) - # sage: P1 = ExtendedHilbertPullback(H1) - # sage: P1.basis_matrix_ideal__norm() # abs tol 1e-10 - # 2.61803398874989 - # sage: P1.basis_matrix_ideal__norm(2) # abs tol 1e-10 - # 5.23606797749979 - # sage: H2=ExtendedHilbertModularGroup(10) - # sage: P2 = ExtendedHilbertPullback(H2) - # sage: P2.basis_matrix_ideal__norm() # abs tol 1e-10 - # 4.16227766016838 - # sage: a=H2.OK().gen(1) - # sage: P2.basis_matrix_ideal__norm(a+1) # abs tol 1e-10 - # 13.16227766016838 - - # """ - # B = self.basis_matrix_ideal(a, prec=prec) - # if row is None: - # return B.norm(Infinity) - # elif 0 <= row < B.nrows(): - # return sum([abs(x) for x in B.row(row)]) - # else: - # raise ValueError(f"Can not find row:{row}") - def X(self, z, a=None): r""" Coordinate of z with respect to the integral basis of an ideal. @@ -1443,13 +1349,6 @@ def _matrix_BLambda_row_sum(self, i=None): # Need to work H = ExtendedHilbertModularGroup(K, lattice_ideal=lattice_ideal, tp_units=False) P = ExtendedHilbertPullback(H) B = P.basis_matrix_logarithmic_unit_lattice() - # tp_units = self.group().tp_units() - # if tp_units: - # if i is not None: - # return 1/2* sum([abs(x) for x in B[i]]) - # else: - # return 1/2 * sum([sum([abs(x) for x in row]) for row in B]) - # else: if i is not None: return sum([abs(x) for x in B[i]]) else: @@ -2404,14 +2303,6 @@ def reduce(self, z, return_map=False): """ - #K = self.number_field() - #lattice_ideal = self.group().lattice_ideal() - #level_ideal = K.fractional_ideal(1) - #tp_units = self.group().tp_units() - #H = ExtendedHilbertModularGroup( - # K, lattice_ideal=lattice_ideal, level_ideal=level_ideal, tp_units=tp_units - #) - #P = ExtendedHilbertPullback(H) if z.norm() == 0: raise ValueError("Can not reduce point at the boundary of one of the half-planes.") c = self.find_closest_cusp(z, return_multiple=False, as_cusp=True) From 87ba454297f8a7e29816de7be2d2e1a37624b1e0 Mon Sep 17 00:00:00 2001 From: Sujeet Kumar Singh Date: Wed, 13 May 2026 23:31:03 +0530 Subject: [PATCH 4/9] Fix lint issues --- src/hilbert_modgroup/extended/group_class.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/hilbert_modgroup/extended/group_class.py b/src/hilbert_modgroup/extended/group_class.py index 9abda58..8bee25f 100644 --- a/src/hilbert_modgroup/extended/group_class.py +++ b/src/hilbert_modgroup/extended/group_class.py @@ -1,5 +1,6 @@ import logging from random import choice + import sage from sage.all import Integer from sage.arith.misc import divisors @@ -15,6 +16,7 @@ from sage.rings.number_field.number_field import QuadraticField from hilbert_modgroup.upper_half_plane import ComplexPlaneProductElement__class + from .cusp import ( NFCusp_wrt_lattice_ideal, fundamental_unit_generator, @@ -722,7 +724,7 @@ def cusps(self): A2 = newb * B.inverse() r = A2.element_1_mod(A1) a1 = (r / newb) * g - a2 = -(1 - r) / c * g + #a2 = -(1 - r) / c * g Lcusps.append(NFCusp_wrt_lattice_ideal(lattice_ideal, a1, c, lreps=Lreps)) cusp = NFCusp_wrt_lattice_ideal(self.lattice_ideal(), 1, 0) for c in Lcusps: From 91bacaf346b628463a0d70f2d3572c79d926119f Mon Sep 17 00:00:00 2001 From: Sujeet Kumar Singh Date: Mon, 18 May 2026 16:58:21 +0530 Subject: [PATCH 5/9] Renamed extended example notebooks --- .../{Paper_Example12.ipynb => Example_coset.ipynb} | 2 +- examples_extended/{Paper_Example15.ipynb => Example_cusp.ipynb} | 2 +- .../{Paper_Example17.ipynb => Example_reduction1.ipynb} | 2 +- .../{Paper_Example18.ipynb => Example_reduction2.ipynb} | 2 +- .../{Paper_Example19.ipynb => Example_reduction3.ipynb} | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) rename examples_extended/{Paper_Example12.ipynb => Example_coset.ipynb} (99%) rename examples_extended/{Paper_Example15.ipynb => Example_cusp.ipynb} (99%) rename examples_extended/{Paper_Example17.ipynb => Example_reduction1.ipynb} (99%) rename examples_extended/{Paper_Example18.ipynb => Example_reduction2.ipynb} (99%) rename examples_extended/{Paper_Example19.ipynb => Example_reduction3.ipynb} (99%) diff --git a/examples_extended/Paper_Example12.ipynb b/examples_extended/Example_coset.ipynb similarity index 99% rename from examples_extended/Paper_Example12.ipynb rename to examples_extended/Example_coset.ipynb index 0195c7d..1c5dc93 100644 --- a/examples_extended/Paper_Example12.ipynb +++ b/examples_extended/Example_coset.ipynb @@ -5,7 +5,7 @@ "id": "3b221a5e-d6b4-4421-aad7-988f124ea38d", "metadata": {}, "source": [ - "# Computing Right Coset Representatives -- Paper Example 12. \n", + "# Computing Right Coset Representatives. \n", "## $K = \\mathbb{Q}(\\sqrt{10})$, $\\widehat{\\Gamma}(\\mathcal{O}_K\\oplus \\mathfrak{a}, \\mathfrak{n})$, where $\\mathfrak{a} = (2, \\sqrt{10})$, $\\mathfrak{n} = (3, 1+\\sqrt{10})$.\n" ] }, diff --git a/examples_extended/Paper_Example15.ipynb b/examples_extended/Example_cusp.ipynb similarity index 99% rename from examples_extended/Paper_Example15.ipynb rename to examples_extended/Example_cusp.ipynb index 9ba2409..30a07c0 100644 --- a/examples_extended/Paper_Example15.ipynb +++ b/examples_extended/Example_cusp.ipynb @@ -5,7 +5,7 @@ "id": "50bb7938-23da-417e-b968-4fc81c41722e", "metadata": {}, "source": [ - "# Computing Cusp Representatives -- Paper Examples 15 \n", + "# Computing Cusp Representatives.\n", "## $K = \\mathbb{Q}(\\sqrt{3})$, $\\widehat{\\Gamma}_0(\\mathcal{O}_K \\oplus \\mathfrak{a},\\mathfrak{n})$, where $\\mathfrak{a}= \\mathfrak{d}_K=(2\\sqrt{3})$, $\\mathfrak{n}=(4\\sqrt{3}+13)$." ] }, diff --git a/examples_extended/Paper_Example17.ipynb b/examples_extended/Example_reduction1.ipynb similarity index 99% rename from examples_extended/Paper_Example17.ipynb rename to examples_extended/Example_reduction1.ipynb index 547fa3f..cbe27f8 100644 --- a/examples_extended/Paper_Example17.ipynb +++ b/examples_extended/Example_reduction1.ipynb @@ -5,7 +5,7 @@ "id": "6ade2f4c-eb40-41ea-adc6-c9e1bdde883e", "metadata": {}, "source": [ - "# Reduction -- Paper Example 17 \n", + "# Reduction.\n", "## $K= \\mathbb{Q}(\\sqrt{5})$, $\\widehat{\\Gamma}(\\mathcal{O}_K\\oplus \\mathfrak{a}, \\mathfrak{n})$, where $\\mathfrak{a} = \\mathcal{O}_K$, $\\mathfrak{n} = (3)$.\n" ] }, diff --git a/examples_extended/Paper_Example18.ipynb b/examples_extended/Example_reduction2.ipynb similarity index 99% rename from examples_extended/Paper_Example18.ipynb rename to examples_extended/Example_reduction2.ipynb index 8c11bba..f5ddba5 100644 --- a/examples_extended/Paper_Example18.ipynb +++ b/examples_extended/Example_reduction2.ipynb @@ -5,7 +5,7 @@ "id": "ab02d2d2-83f0-4b1c-9ba3-3aed6a819fb0", "metadata": {}, "source": [ - "# Reduction -- Example 18\n", + "# Reduction.\n", "## $K = \\mathbb{Q}(\\sqrt{10})$, $\\widehat{\\Gamma}(\\mathcal{O}_K\\oplus \\mathfrak{a}, \\mathfrak{n})$, where $\\mathfrak{a} = (2, \\sqrt{10})$, $\\mathfrak{n}=(3, \\sqrt{10}+1)$." ] }, diff --git a/examples_extended/Paper_Example19.ipynb b/examples_extended/Example_reduction3.ipynb similarity index 99% rename from examples_extended/Paper_Example19.ipynb rename to examples_extended/Example_reduction3.ipynb index cfdecb7..000dcc2 100644 --- a/examples_extended/Paper_Example19.ipynb +++ b/examples_extended/Example_reduction3.ipynb @@ -5,7 +5,7 @@ "id": "04571be2-5c55-46e9-ba56-39469cfd6510", "metadata": {}, "source": [ - "# Reduction -- Example 19\n", + "# Reduction.\n", "## $K = \\mathbb{Q}(\\alpha)$, $\\alpha$ has minimal polynomial $x^3-x^2-17x-16$, \n", "## $\\widehat{\\Gamma}(\\mathcal{O}_K\\oplus \\mathfrak{a}, \\mathfrak{n})$, where $\\mathfrak{a} = \\mathfrak{d}_K$, $\\mathfrak{n} = (5)$." ] From 4261e57d8e8675dd417ecdadacc6e1c67422c7ff Mon Sep 17 00:00:00 2001 From: Fredrik Stromberg Date: Mon, 15 Jun 2026 23:09:08 +0200 Subject: [PATCH 6/9] fix: address review feedback on extended group - random_element: use R(d) (coprime residue) instead of R(u) (a unit). - random_element: tidy `d = 1`, `if not coprime_residue`. - random_element: docstring lists current modes {'Lower','Upper','Unit','Lift'} and adds structural doctests for each mode plus a Lift test with non-trivial level_ideal. - R(d): docstring corrected ("coprime to level_ideal", no default). - cusps(): drop dead `#a2 = ...` line. - coset_matrices(): fix 3-space indentation to 4 spaces. - ExtendedHilbertPullback.__init__: remove stray double blank line. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/hilbert_modgroup/extended/group_class.py | 99 +++++++++++++++----- src/hilbert_modgroup/extended/pullback.py | 9 +- 2 files changed, 79 insertions(+), 29 deletions(-) diff --git a/src/hilbert_modgroup/extended/group_class.py b/src/hilbert_modgroup/extended/group_class.py index 8bee25f..a471fa8 100644 --- a/src/hilbert_modgroup/extended/group_class.py +++ b/src/hilbert_modgroup/extended/group_class.py @@ -317,9 +317,9 @@ def ambient_group(self): sage: H.ambient_group().level_ideal() Fractional ideal (1) """ - return ExtendedHilbertModularGroup(self.number_field(), - lattice_ideal = self.lattice_ideal(), - tp_units = self.tp_units()) + return ExtendedHilbertModularGroup( + self.number_field(), lattice_ideal=self.lattice_ideal(), tp_units=self.tp_units() + ) def __contains__(self, x): r""" @@ -429,7 +429,9 @@ def generators(self): tp_units = self.tp_units() level_ideal = self.level_ideal() number_field = self.number_field() - coprime_residue = [u for u in level_ideal.residues() if u != 0 and level_ideal.is_coprime(u)] + coprime_residue = [ + u for u in level_ideal.residues() if u != 0 and level_ideal.is_coprime(u) + ] for x in coprime_residue: gens.append(self.R(x)) for x in self.lattice_ideal().inverse().basis(): @@ -445,11 +447,11 @@ def generators(self): @cached_method def R(self, d): """ - Return the lift of any element in (OK/(level_ideal))^* in self: + Return the lift of any element in (OK/(level_ideal))^* in self. INPUT: - - ``d`` -- integer in number field coprime to d (default=1) + - ``d`` -- element of the number field, coprime to ``self.level_ideal()`` EXAMPLES:: @@ -470,7 +472,8 @@ def R(self, d): Lreps = list_of_representatives(level_ideal * d) Lds = [ P * lattice_ideal * level_ideal - for P in Lreps if (P * lattice_ideal * level_ideal).is_principal() + for P in Lreps + if (P * lattice_ideal * level_ideal).is_principal() ] C = Lds[0] c = (C).gens_reduced()[0] @@ -481,7 +484,6 @@ def R(self, d): a = (1 - r) / d return self([a, b, c, d]) - @cached_method def S(self): """ @@ -614,7 +616,8 @@ def random_element(self, matrix_type=None, **kwds): INPUT: - - ``mode`` -- one of {'Lower', 'Upper', 'unit'} or None (default) + - ``matrix_type`` -- one of {'Lower', 'Upper', 'Unit', 'Lift'} or None + (default). If None, returns a product of all four factors. - ``kwds`` -- passed to the random element generators EXAMPLES:: @@ -624,6 +627,48 @@ def random_element(self, matrix_type=None, **kwds): sage: A = H.random_element() sage: A in H True + + The ``"Lower"`` mode returns a lower-triangular matrix with ones on the + diagonal:: + + sage: A = H.random_element(matrix_type="Lower") + sage: A in H + True + sage: A[0, 0] == 1 and A[0, 1] == 0 and A[1, 1] == 1 + True + + The ``"Upper"`` mode returns an upper-triangular matrix with ones on the + diagonal:: + + sage: A = H.random_element(matrix_type="Upper") + sage: A in H + True + sage: A[0, 0] == 1 and A[1, 0] == 0 and A[1, 1] == 1 + True + + The ``"Unit"`` mode returns a diagonal matrix coming from a unit:: + + sage: A = H.random_element(matrix_type="Unit") + sage: A in H + True + sage: A[0, 1] == 0 and A[1, 0] == 0 + True + + The ``"Lift"`` mode returns a lift of an element of (O_K/N)^* into the + ambient group:: + + sage: K. = QuadraticField(2) + sage: HN = ExtendedHilbertModularGroup(K, level_ideal=K.fractional_ideal(3)) + sage: A = HN.random_element(matrix_type="Lift") + sage: A in HN.ambient_group() + True + + With no ``matrix_type`` set, the result is a product of all four + factors:: + + sage: A = HN.random_element() + sage: A in HN.ambient_group() + True """ x = kwds.pop("x", None) y = kwds.pop("y", None) @@ -631,9 +676,11 @@ def random_element(self, matrix_type=None, **kwds): b = (self.lattice_ideal() * self.level_ideal()).random_element(**kwds) K = self.number_field() level_ideal = self.level_ideal() - coprime_residue = [u for u in level_ideal.residues() if u != 0 and level_ideal.is_coprime(u)] - if coprime_residue == []: - d =1 + coprime_residue = [ + u for u in level_ideal.residues() if u != 0 and level_ideal.is_coprime(u) + ] + if not coprime_residue: + d = 1 else: d = choice(coprime_residue) if x is None: @@ -659,7 +706,7 @@ def random_element(self, matrix_type=None, **kwds): if matrix_type == "Lift": return self(self.R(d)) - return self(self.R(u) * self.E(u) * self.T(a) * self.L(b)) + return self(self.R(d) * self.E(u) * self.T(a) * self.L(b)) @cached_method def cusps(self): @@ -724,7 +771,6 @@ def cusps(self): A2 = newb * B.inverse() r = A2.element_1_mod(A1) a1 = (r / newb) * g - #a2 = -(1 - r) / c * g Lcusps.append(NFCusp_wrt_lattice_ideal(lattice_ideal, a1, c, lreps=Lreps)) cusp = NFCusp_wrt_lattice_ideal(self.lattice_ideal(), 1, 0) for c in Lcusps: @@ -1034,22 +1080,23 @@ def coset_matrices(self): it = K.primes_of_degree_one_iter() Dp = next(it) while not Dp.is_coprime(N) or not (Dp * D * lattice_ideal).is_principal(): - Dp = next(it) + Dp = next(it) c = (D * lattice_ideal * Dp).gens_reduced()[0] I = D + N / D for r in (N / D).residues(): if I.is_coprime(r): - M = D.prime_to_idealM_part(N / D) - u = (Dp * M).element_1_mod(N / D) - d = u * r + (1 - u) - if d.is_zero(): - L.append(H.create_element(1, -1 / c, c, d)) - else: - B = K.fractional_ideal(c * lattice_ideal.inverse()).element_1_mod( - K.fractional_ideal(d)) - b = -B / c - a = (1 - B) / d - L.append(H.create_element(a, b, c, d)) + M = D.prime_to_idealM_part(N / D) + u = (Dp * M).element_1_mod(N / D) + d = u * r + (1 - u) + if d.is_zero(): + L.append(H.create_element(1, -1 / c, c, d)) + else: + B = K.fractional_ideal(c * lattice_ideal.inverse()).element_1_mod( + K.fractional_ideal(d) + ) + b = -B / c + a = (1 - B) / d + L.append(H.create_element(a, b, c, d)) if not len(L) == psi(N): raise ValueError("Condition is not satisfying. Check again") return L diff --git a/src/hilbert_modgroup/extended/pullback.py b/src/hilbert_modgroup/extended/pullback.py index 6748b48..33d8f35 100644 --- a/src/hilbert_modgroup/extended/pullback.py +++ b/src/hilbert_modgroup/extended/pullback.py @@ -93,7 +93,6 @@ def __init__(self, G): self._group = G self._ambient_group = G.ambient_group() - def __eq__(self, other): r""" Check if ``self`` is equal to ``other``. @@ -431,10 +430,14 @@ def reduce_by_units(self, z, return_map=False): # Doing # e.g. compute (z*u**-k)/u**k instead of z*u**-(2k) if tp_units: floors = [-stable_floor(y) for y in self.Y(z)] - reducing_map = prod([self.ambient_group().E(u**y) for u, y in zip(units, floors, strict=False)]) + reducing_map = prod( + [self.ambient_group().E(u**y) for u, y in zip(units, floors, strict=False)] + ) else: floors = [-stable_floor(y / 2) for y in self.Y(z)] - reducing_map = prod([self.ambient_group().E(u**y) for u, y in zip(units, floors, strict=False)]) + reducing_map = prod( + [self.ambient_group().E(u**y) for u, y in zip(units, floors, strict=False)] + ) reduced_point = z.apply(reducing_map) if return_map: return reduced_point, reducing_map From 9bb4a3e3d07c913e5d615626803ca772de8246aa Mon Sep 17 00:00:00 2001 From: Fredrik Stromberg Date: Tue, 16 Jun 2026 00:06:57 +0200 Subject: [PATCH 7/9] refactor: convert random_element branches to elif and reject unknown matrix_type Previously an unrecognized matrix_type fell through to the default product path silently. Now raise ValueError so typos like the recently renamed "unit" (now "Unit") fail loudly instead of silently returning the wrong shape. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/hilbert_modgroup/extended/group_class.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/hilbert_modgroup/extended/group_class.py b/src/hilbert_modgroup/extended/group_class.py index a471fa8..e2b89af 100644 --- a/src/hilbert_modgroup/extended/group_class.py +++ b/src/hilbert_modgroup/extended/group_class.py @@ -697,15 +697,14 @@ def random_element(self, matrix_type=None, **kwds): u = prod(g**e for g, e in zip(gens, exponents, strict=False)) if matrix_type == "Lower": return self(self.L(b)) - - if matrix_type == "Upper": + elif matrix_type == "Upper": return self(self.T(a)) - - if matrix_type == "Unit": + elif matrix_type == "Unit": return self(self.E(u)) - if matrix_type == "Lift": + elif matrix_type == "Lift": return self(self.R(d)) - + elif matrix_type: + raise ValueError(f"Unknown matrix_type: {matrix_type}") return self(self.R(d) * self.E(u) * self.T(a) * self.L(b)) @cached_method From ebea8a61000407a0005bef7526e2273067378aff Mon Sep 17 00:00:00 2001 From: Fredrik Stromberg Date: Tue, 16 Jun 2026 00:07:14 +0200 Subject: [PATCH 8/9] test: add regression doctest for ambient_group level-independence Asserts that quantities derived from the ambient group only -- fundamental_units and basis_matrix_logarithmic_unit_lattice -- agree between a pullback constructed at a non-trivial level and one constructed at the trivial level, and that ambient_group() correctly strips the level. Covers the wider self.group() -> self.ambient_group() refactor in pullback.py. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/hilbert_modgroup/extended/pullback.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/hilbert_modgroup/extended/pullback.py b/src/hilbert_modgroup/extended/pullback.py index 33d8f35..2bc2ec5 100644 --- a/src/hilbert_modgroup/extended/pullback.py +++ b/src/hilbert_modgroup/extended/pullback.py @@ -179,6 +179,24 @@ def ambient_group(self): Hilbert modular group PGL_2^+(...) ... x^2 - 5 with a = 2.236067977499790? ... sage: P.ambient_group().level_ideal() Fractional ideal (1) + + Quantities derived from the ambient group only -- such as the + fundamental units and the logarithmic unit lattice -- do not depend + on the level:: + + sage: H_trivial = ExtendedHilbertModularGroup(K, lattice_ideal=lattice_ideal) + sage: P_trivial = ExtendedHilbertPullback(H_trivial) + sage: P.fundamental_units() == P_trivial.fundamental_units() + True + sage: ( + P.basis_matrix_logarithmic_unit_lattice() + == P_trivial.basis_matrix_logarithmic_unit_lattice() + ) + True + sage: P.ambient_group().lattice_ideal() == H_trivial.lattice_ideal() + True + sage: P.ambient_group().level_ideal() == H_trivial.level_ideal() + True """ return self._ambient_group From 42c5fcda9a297152b6fcc9dedd3f2be02788f2ce Mon Sep 17 00:00:00 2001 From: Fredrik Stromberg Date: Tue, 16 Jun 2026 00:13:06 +0200 Subject: [PATCH 9/9] fix: split ambient_group doctest into intermediate vars ruff-format kept folding the long basis_matrix_logarithmic_unit_lattice comparison into a parenthesized multiline that the sage doctest parser rejects (needs `....:` continuations, not bare indentation). Assign each matrix to a short-named local first so every doctest line fits the 100-char limit on its own. Verified locally: src/hilbert_modgroup/extended/ all 1226 tests pass. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/hilbert_modgroup/extended/pullback.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/hilbert_modgroup/extended/pullback.py b/src/hilbert_modgroup/extended/pullback.py index 2bc2ec5..58ea976 100644 --- a/src/hilbert_modgroup/extended/pullback.py +++ b/src/hilbert_modgroup/extended/pullback.py @@ -184,18 +184,17 @@ def ambient_group(self): fundamental units and the logarithmic unit lattice -- do not depend on the level:: - sage: H_trivial = ExtendedHilbertModularGroup(K, lattice_ideal=lattice_ideal) - sage: P_trivial = ExtendedHilbertPullback(H_trivial) - sage: P.fundamental_units() == P_trivial.fundamental_units() + sage: H_triv = ExtendedHilbertModularGroup(K, lattice_ideal=lattice_ideal) + sage: P_triv = ExtendedHilbertPullback(H_triv) + sage: P.fundamental_units() == P_triv.fundamental_units() True - sage: ( - P.basis_matrix_logarithmic_unit_lattice() - == P_trivial.basis_matrix_logarithmic_unit_lattice() - ) + sage: B = P.basis_matrix_logarithmic_unit_lattice() + sage: B_triv = P_triv.basis_matrix_logarithmic_unit_lattice() + sage: B == B_triv True - sage: P.ambient_group().lattice_ideal() == H_trivial.lattice_ideal() + sage: P.ambient_group().lattice_ideal() == H_triv.lattice_ideal() True - sage: P.ambient_group().level_ideal() == H_trivial.level_ideal() + sage: P.ambient_group().level_ideal() == H_triv.level_ideal() True """ return self._ambient_group