passagemath-schemes 10.6.38__cp314-cp314t-macosx_13_0_arm64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of passagemath-schemes might be problematic. Click here for more details.

Files changed (314) hide show
  1. passagemath_schemes/.dylibs/libflint.21.0.dylib +0 -0
  2. passagemath_schemes/.dylibs/libgmp.10.dylib +0 -0
  3. passagemath_schemes/.dylibs/libgmpxx.4.dylib +0 -0
  4. passagemath_schemes/.dylibs/libmpfr.6.dylib +0 -0
  5. passagemath_schemes/__init__.py +3 -0
  6. passagemath_schemes-10.6.38.dist-info/METADATA +204 -0
  7. passagemath_schemes-10.6.38.dist-info/METADATA.bak +205 -0
  8. passagemath_schemes-10.6.38.dist-info/RECORD +314 -0
  9. passagemath_schemes-10.6.38.dist-info/WHEEL +6 -0
  10. passagemath_schemes-10.6.38.dist-info/top_level.txt +3 -0
  11. sage/all__sagemath_schemes.py +23 -0
  12. sage/databases/all__sagemath_schemes.py +7 -0
  13. sage/databases/cremona.py +1723 -0
  14. sage/dynamics/all__sagemath_schemes.py +2 -0
  15. sage/dynamics/arithmetic_dynamics/affine_ds.py +1083 -0
  16. sage/dynamics/arithmetic_dynamics/all.py +14 -0
  17. sage/dynamics/arithmetic_dynamics/berkovich_ds.py +1101 -0
  18. sage/dynamics/arithmetic_dynamics/dynamical_semigroup.py +1543 -0
  19. sage/dynamics/arithmetic_dynamics/endPN_automorphism_group.py +2426 -0
  20. sage/dynamics/arithmetic_dynamics/endPN_minimal_model.py +1169 -0
  21. sage/dynamics/arithmetic_dynamics/generic_ds.py +663 -0
  22. sage/dynamics/arithmetic_dynamics/product_projective_ds.py +339 -0
  23. sage/dynamics/arithmetic_dynamics/projective_ds.py +9558 -0
  24. sage/dynamics/arithmetic_dynamics/projective_ds_helper.cpython-314t-darwin.so +0 -0
  25. sage/dynamics/arithmetic_dynamics/projective_ds_helper.pyx +301 -0
  26. sage/dynamics/arithmetic_dynamics/wehlerK3.py +2576 -0
  27. sage/lfunctions/all.py +18 -0
  28. sage/lfunctions/dokchitser.py +745 -0
  29. sage/lfunctions/pari.py +818 -0
  30. sage/lfunctions/zero_sums.cpython-314t-darwin.so +0 -0
  31. sage/lfunctions/zero_sums.pyx +1847 -0
  32. sage/modular/abvar/abvar.py +5135 -0
  33. sage/modular/abvar/abvar_ambient_jacobian.py +413 -0
  34. sage/modular/abvar/abvar_newform.py +244 -0
  35. sage/modular/abvar/all.py +8 -0
  36. sage/modular/abvar/constructor.py +186 -0
  37. sage/modular/abvar/cuspidal_subgroup.py +371 -0
  38. sage/modular/abvar/finite_subgroup.py +896 -0
  39. sage/modular/abvar/homology.py +720 -0
  40. sage/modular/abvar/homspace.py +998 -0
  41. sage/modular/abvar/lseries.py +415 -0
  42. sage/modular/abvar/morphism.py +935 -0
  43. sage/modular/abvar/torsion_point.py +274 -0
  44. sage/modular/abvar/torsion_subgroup.py +740 -0
  45. sage/modular/all.py +43 -0
  46. sage/modular/arithgroup/all.py +20 -0
  47. sage/modular/arithgroup/arithgroup_element.cpython-314t-darwin.so +0 -0
  48. sage/modular/arithgroup/arithgroup_element.pyx +474 -0
  49. sage/modular/arithgroup/arithgroup_generic.py +1402 -0
  50. sage/modular/arithgroup/arithgroup_perm.py +2692 -0
  51. sage/modular/arithgroup/congroup.cpython-314t-darwin.so +0 -0
  52. sage/modular/arithgroup/congroup.pyx +334 -0
  53. sage/modular/arithgroup/congroup_gamma.py +363 -0
  54. sage/modular/arithgroup/congroup_gamma0.py +692 -0
  55. sage/modular/arithgroup/congroup_gamma1.py +653 -0
  56. sage/modular/arithgroup/congroup_gammaH.py +1469 -0
  57. sage/modular/arithgroup/congroup_generic.py +628 -0
  58. sage/modular/arithgroup/congroup_sl2z.py +267 -0
  59. sage/modular/arithgroup/farey_symbol.cpython-314t-darwin.so +0 -0
  60. sage/modular/arithgroup/farey_symbol.pyx +1066 -0
  61. sage/modular/arithgroup/tests.py +418 -0
  62. sage/modular/btquotients/all.py +4 -0
  63. sage/modular/btquotients/btquotient.py +3753 -0
  64. sage/modular/btquotients/pautomorphicform.py +2570 -0
  65. sage/modular/buzzard.py +100 -0
  66. sage/modular/congroup.py +29 -0
  67. sage/modular/congroup_element.py +13 -0
  68. sage/modular/cusps.py +1109 -0
  69. sage/modular/cusps_nf.py +1270 -0
  70. sage/modular/dims.py +569 -0
  71. sage/modular/dirichlet.py +3310 -0
  72. sage/modular/drinfeld_modform/all.py +2 -0
  73. sage/modular/drinfeld_modform/element.py +446 -0
  74. sage/modular/drinfeld_modform/ring.py +773 -0
  75. sage/modular/drinfeld_modform/tutorial.py +236 -0
  76. sage/modular/etaproducts.py +1065 -0
  77. sage/modular/hecke/algebra.py +746 -0
  78. sage/modular/hecke/all.py +20 -0
  79. sage/modular/hecke/ambient_module.py +1019 -0
  80. sage/modular/hecke/degenmap.py +119 -0
  81. sage/modular/hecke/element.py +325 -0
  82. sage/modular/hecke/hecke_operator.py +780 -0
  83. sage/modular/hecke/homspace.py +206 -0
  84. sage/modular/hecke/module.py +1767 -0
  85. sage/modular/hecke/morphism.py +174 -0
  86. sage/modular/hecke/submodule.py +989 -0
  87. sage/modular/hypergeometric_misc.cpython-314t-darwin.so +0 -0
  88. sage/modular/hypergeometric_misc.pxd +4 -0
  89. sage/modular/hypergeometric_misc.pyx +166 -0
  90. sage/modular/hypergeometric_motive.py +2017 -0
  91. sage/modular/local_comp/all.py +2 -0
  92. sage/modular/local_comp/liftings.py +292 -0
  93. sage/modular/local_comp/local_comp.py +1071 -0
  94. sage/modular/local_comp/smoothchar.py +1825 -0
  95. sage/modular/local_comp/type_space.py +748 -0
  96. sage/modular/modform/all.py +30 -0
  97. sage/modular/modform/ambient.py +815 -0
  98. sage/modular/modform/ambient_R.py +177 -0
  99. sage/modular/modform/ambient_eps.py +306 -0
  100. sage/modular/modform/ambient_g0.py +124 -0
  101. sage/modular/modform/ambient_g1.py +204 -0
  102. sage/modular/modform/constructor.py +545 -0
  103. sage/modular/modform/cuspidal_submodule.py +708 -0
  104. sage/modular/modform/defaults.py +14 -0
  105. sage/modular/modform/eis_series.py +505 -0
  106. sage/modular/modform/eisenstein_submodule.py +663 -0
  107. sage/modular/modform/element.py +4131 -0
  108. sage/modular/modform/find_generators.py +59 -0
  109. sage/modular/modform/half_integral.py +154 -0
  110. sage/modular/modform/hecke_operator_on_qexp.py +247 -0
  111. sage/modular/modform/j_invariant.py +47 -0
  112. sage/modular/modform/l_series_gross_zagier.py +133 -0
  113. sage/modular/modform/l_series_gross_zagier_coeffs.cpython-314t-darwin.so +0 -0
  114. sage/modular/modform/l_series_gross_zagier_coeffs.pyx +177 -0
  115. sage/modular/modform/notes.py +45 -0
  116. sage/modular/modform/numerical.py +514 -0
  117. sage/modular/modform/periods.py +14 -0
  118. sage/modular/modform/ring.py +1257 -0
  119. sage/modular/modform/space.py +1860 -0
  120. sage/modular/modform/submodule.py +118 -0
  121. sage/modular/modform/tests.py +64 -0
  122. sage/modular/modform/theta.py +110 -0
  123. sage/modular/modform/vm_basis.py +381 -0
  124. sage/modular/modform/weight1.py +220 -0
  125. sage/modular/modform_hecketriangle/abstract_ring.py +1932 -0
  126. sage/modular/modform_hecketriangle/abstract_space.py +2528 -0
  127. sage/modular/modform_hecketriangle/all.py +30 -0
  128. sage/modular/modform_hecketriangle/analytic_type.py +590 -0
  129. sage/modular/modform_hecketriangle/constructor.py +416 -0
  130. sage/modular/modform_hecketriangle/element.py +351 -0
  131. sage/modular/modform_hecketriangle/functors.py +752 -0
  132. sage/modular/modform_hecketriangle/graded_ring.py +541 -0
  133. sage/modular/modform_hecketriangle/graded_ring_element.py +2225 -0
  134. sage/modular/modform_hecketriangle/hecke_triangle_group_element.py +3352 -0
  135. sage/modular/modform_hecketriangle/hecke_triangle_groups.py +1432 -0
  136. sage/modular/modform_hecketriangle/readme.py +1214 -0
  137. sage/modular/modform_hecketriangle/series_constructor.py +580 -0
  138. sage/modular/modform_hecketriangle/space.py +1037 -0
  139. sage/modular/modform_hecketriangle/subspace.py +423 -0
  140. sage/modular/modsym/all.py +17 -0
  141. sage/modular/modsym/ambient.py +3846 -0
  142. sage/modular/modsym/boundary.py +1420 -0
  143. sage/modular/modsym/element.py +336 -0
  144. sage/modular/modsym/g1list.py +178 -0
  145. sage/modular/modsym/ghlist.py +182 -0
  146. sage/modular/modsym/hecke_operator.py +73 -0
  147. sage/modular/modsym/manin_symbol.cpython-314t-darwin.so +0 -0
  148. sage/modular/modsym/manin_symbol.pxd +5 -0
  149. sage/modular/modsym/manin_symbol.pyx +497 -0
  150. sage/modular/modsym/manin_symbol_list.py +1295 -0
  151. sage/modular/modsym/modsym.py +400 -0
  152. sage/modular/modsym/modular_symbols.py +384 -0
  153. sage/modular/modsym/p1list.cpython-314t-darwin.so +0 -0
  154. sage/modular/modsym/p1list.pxd +29 -0
  155. sage/modular/modsym/p1list.pyx +1372 -0
  156. sage/modular/modsym/p1list_nf.py +1241 -0
  157. sage/modular/modsym/relation_matrix.py +591 -0
  158. sage/modular/modsym/relation_matrix_pyx.cpython-314t-darwin.so +0 -0
  159. sage/modular/modsym/relation_matrix_pyx.pyx +108 -0
  160. sage/modular/modsym/space.py +2468 -0
  161. sage/modular/modsym/subspace.py +455 -0
  162. sage/modular/modsym/tests.py +375 -0
  163. sage/modular/multiple_zeta.py +2632 -0
  164. sage/modular/multiple_zeta_F_algebra.py +786 -0
  165. sage/modular/overconvergent/all.py +6 -0
  166. sage/modular/overconvergent/genus0.py +1878 -0
  167. sage/modular/overconvergent/hecke_series.py +1187 -0
  168. sage/modular/overconvergent/weightspace.py +778 -0
  169. sage/modular/pollack_stevens/all.py +4 -0
  170. sage/modular/pollack_stevens/distributions.py +874 -0
  171. sage/modular/pollack_stevens/fund_domain.py +1572 -0
  172. sage/modular/pollack_stevens/manin_map.py +859 -0
  173. sage/modular/pollack_stevens/modsym.py +1593 -0
  174. sage/modular/pollack_stevens/padic_lseries.py +417 -0
  175. sage/modular/pollack_stevens/sigma0.py +534 -0
  176. sage/modular/pollack_stevens/space.py +1076 -0
  177. sage/modular/quasimodform/all.py +3 -0
  178. sage/modular/quasimodform/element.py +845 -0
  179. sage/modular/quasimodform/ring.py +828 -0
  180. sage/modular/quatalg/all.py +3 -0
  181. sage/modular/quatalg/brandt.py +1642 -0
  182. sage/modular/ssmod/all.py +8 -0
  183. sage/modular/ssmod/ssmod.py +827 -0
  184. sage/rings/all__sagemath_schemes.py +1 -0
  185. sage/rings/polynomial/all__sagemath_schemes.py +1 -0
  186. sage/rings/polynomial/binary_form_reduce.py +585 -0
  187. sage/schemes/all.py +41 -0
  188. sage/schemes/berkovich/all.py +6 -0
  189. sage/schemes/berkovich/berkovich_cp_element.py +2582 -0
  190. sage/schemes/berkovich/berkovich_space.py +748 -0
  191. sage/schemes/curves/affine_curve.py +2928 -0
  192. sage/schemes/curves/all.py +33 -0
  193. sage/schemes/curves/closed_point.py +434 -0
  194. sage/schemes/curves/constructor.py +381 -0
  195. sage/schemes/curves/curve.py +542 -0
  196. sage/schemes/curves/plane_curve_arrangement.py +1283 -0
  197. sage/schemes/curves/point.py +463 -0
  198. sage/schemes/curves/projective_curve.py +3026 -0
  199. sage/schemes/curves/zariski_vankampen.py +1932 -0
  200. sage/schemes/cyclic_covers/all.py +2 -0
  201. sage/schemes/cyclic_covers/charpoly_frobenius.py +320 -0
  202. sage/schemes/cyclic_covers/constructor.py +137 -0
  203. sage/schemes/cyclic_covers/cycliccover_finite_field.py +1309 -0
  204. sage/schemes/cyclic_covers/cycliccover_generic.py +310 -0
  205. sage/schemes/elliptic_curves/BSD.py +1036 -0
  206. sage/schemes/elliptic_curves/Qcurves.py +592 -0
  207. sage/schemes/elliptic_curves/addition_formulas_ring.py +94 -0
  208. sage/schemes/elliptic_curves/all.py +49 -0
  209. sage/schemes/elliptic_curves/cardinality.py +609 -0
  210. sage/schemes/elliptic_curves/cm.py +1102 -0
  211. sage/schemes/elliptic_curves/constructor.py +1552 -0
  212. sage/schemes/elliptic_curves/ec_database.py +175 -0
  213. sage/schemes/elliptic_curves/ell_curve_isogeny.py +3972 -0
  214. sage/schemes/elliptic_curves/ell_egros.py +459 -0
  215. sage/schemes/elliptic_curves/ell_field.py +2836 -0
  216. sage/schemes/elliptic_curves/ell_finite_field.py +3359 -0
  217. sage/schemes/elliptic_curves/ell_generic.py +3760 -0
  218. sage/schemes/elliptic_curves/ell_local_data.py +1207 -0
  219. sage/schemes/elliptic_curves/ell_modular_symbols.py +775 -0
  220. sage/schemes/elliptic_curves/ell_number_field.py +4220 -0
  221. sage/schemes/elliptic_curves/ell_padic_field.py +107 -0
  222. sage/schemes/elliptic_curves/ell_point.py +4787 -0
  223. sage/schemes/elliptic_curves/ell_rational_field.py +7368 -0
  224. sage/schemes/elliptic_curves/ell_tate_curve.py +671 -0
  225. sage/schemes/elliptic_curves/ell_torsion.py +436 -0
  226. sage/schemes/elliptic_curves/ell_wp.py +352 -0
  227. sage/schemes/elliptic_curves/formal_group.py +760 -0
  228. sage/schemes/elliptic_curves/gal_reps.py +1459 -0
  229. sage/schemes/elliptic_curves/gal_reps_number_field.py +1669 -0
  230. sage/schemes/elliptic_curves/gp_simon.py +152 -0
  231. sage/schemes/elliptic_curves/heegner.py +7335 -0
  232. sage/schemes/elliptic_curves/height.py +2109 -0
  233. sage/schemes/elliptic_curves/hom.py +1406 -0
  234. sage/schemes/elliptic_curves/hom_composite.py +934 -0
  235. sage/schemes/elliptic_curves/hom_frobenius.py +522 -0
  236. sage/schemes/elliptic_curves/hom_scalar.py +531 -0
  237. sage/schemes/elliptic_curves/hom_sum.py +682 -0
  238. sage/schemes/elliptic_curves/hom_velusqrt.py +1290 -0
  239. sage/schemes/elliptic_curves/homset.py +271 -0
  240. sage/schemes/elliptic_curves/isogeny_class.py +1521 -0
  241. sage/schemes/elliptic_curves/isogeny_small_degree.py +2797 -0
  242. sage/schemes/elliptic_curves/jacobian.py +237 -0
  243. sage/schemes/elliptic_curves/kodaira_symbol.py +344 -0
  244. sage/schemes/elliptic_curves/kraus.py +1014 -0
  245. sage/schemes/elliptic_curves/lseries_ell.py +943 -0
  246. sage/schemes/elliptic_curves/mod5family.py +105 -0
  247. sage/schemes/elliptic_curves/mod_poly.py +197 -0
  248. sage/schemes/elliptic_curves/mod_sym_num.cpython-314t-darwin.so +0 -0
  249. sage/schemes/elliptic_curves/mod_sym_num.pyx +3796 -0
  250. sage/schemes/elliptic_curves/modular_parametrization.py +305 -0
  251. sage/schemes/elliptic_curves/padic_lseries.py +1793 -0
  252. sage/schemes/elliptic_curves/padics.py +1816 -0
  253. sage/schemes/elliptic_curves/period_lattice.py +2234 -0
  254. sage/schemes/elliptic_curves/period_lattice_region.cpython-314t-darwin.so +0 -0
  255. sage/schemes/elliptic_curves/period_lattice_region.pyx +722 -0
  256. sage/schemes/elliptic_curves/saturation.py +715 -0
  257. sage/schemes/elliptic_curves/sha_tate.py +1158 -0
  258. sage/schemes/elliptic_curves/weierstrass_morphism.py +1117 -0
  259. sage/schemes/elliptic_curves/weierstrass_transform.py +200 -0
  260. sage/schemes/hyperelliptic_curves/all.py +6 -0
  261. sage/schemes/hyperelliptic_curves/constructor.py +291 -0
  262. sage/schemes/hyperelliptic_curves/hyperelliptic_finite_field.py +1914 -0
  263. sage/schemes/hyperelliptic_curves/hyperelliptic_g2.py +192 -0
  264. sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py +954 -0
  265. sage/schemes/hyperelliptic_curves/hyperelliptic_padic_field.py +1332 -0
  266. sage/schemes/hyperelliptic_curves/hyperelliptic_rational_field.py +84 -0
  267. sage/schemes/hyperelliptic_curves/invariants.py +410 -0
  268. sage/schemes/hyperelliptic_curves/jacobian_endomorphism_utils.py +315 -0
  269. sage/schemes/hyperelliptic_curves/jacobian_g2.py +32 -0
  270. sage/schemes/hyperelliptic_curves/jacobian_generic.py +419 -0
  271. sage/schemes/hyperelliptic_curves/jacobian_homset.py +186 -0
  272. sage/schemes/hyperelliptic_curves/jacobian_morphism.py +875 -0
  273. sage/schemes/hyperelliptic_curves/kummer_surface.py +99 -0
  274. sage/schemes/hyperelliptic_curves/mestre.py +302 -0
  275. sage/schemes/hyperelliptic_curves/monsky_washnitzer.py +3871 -0
  276. sage/schemes/jacobians/abstract_jacobian.py +277 -0
  277. sage/schemes/jacobians/all.py +2 -0
  278. sage/schemes/overview.py +161 -0
  279. sage/schemes/plane_conics/all.py +22 -0
  280. sage/schemes/plane_conics/con_field.py +1296 -0
  281. sage/schemes/plane_conics/con_finite_field.py +158 -0
  282. sage/schemes/plane_conics/con_number_field.py +456 -0
  283. sage/schemes/plane_conics/con_rational_field.py +406 -0
  284. sage/schemes/plane_conics/con_rational_function_field.py +580 -0
  285. sage/schemes/plane_conics/constructor.py +249 -0
  286. sage/schemes/plane_quartics/all.py +2 -0
  287. sage/schemes/plane_quartics/quartic_constructor.py +71 -0
  288. sage/schemes/plane_quartics/quartic_generic.py +73 -0
  289. sage/schemes/riemann_surfaces/all.py +1 -0
  290. sage/schemes/riemann_surfaces/riemann_surface.py +4117 -0
  291. sage_wheels/share/cremona/cremona_mini.db +0 -0
  292. sage_wheels/share/ellcurves/rank0 +30427 -0
  293. sage_wheels/share/ellcurves/rank1 +31871 -0
  294. sage_wheels/share/ellcurves/rank10 +6 -0
  295. sage_wheels/share/ellcurves/rank11 +6 -0
  296. sage_wheels/share/ellcurves/rank12 +1 -0
  297. sage_wheels/share/ellcurves/rank14 +1 -0
  298. sage_wheels/share/ellcurves/rank15 +1 -0
  299. sage_wheels/share/ellcurves/rank17 +1 -0
  300. sage_wheels/share/ellcurves/rank19 +1 -0
  301. sage_wheels/share/ellcurves/rank2 +2388 -0
  302. sage_wheels/share/ellcurves/rank20 +1 -0
  303. sage_wheels/share/ellcurves/rank21 +1 -0
  304. sage_wheels/share/ellcurves/rank22 +1 -0
  305. sage_wheels/share/ellcurves/rank23 +1 -0
  306. sage_wheels/share/ellcurves/rank24 +1 -0
  307. sage_wheels/share/ellcurves/rank28 +1 -0
  308. sage_wheels/share/ellcurves/rank3 +836 -0
  309. sage_wheels/share/ellcurves/rank4 +10 -0
  310. sage_wheels/share/ellcurves/rank5 +5 -0
  311. sage_wheels/share/ellcurves/rank6 +5 -0
  312. sage_wheels/share/ellcurves/rank7 +5 -0
  313. sage_wheels/share/ellcurves/rank8 +6 -0
  314. sage_wheels/share/ellcurves/rank9 +7 -0
@@ -0,0 +1,1019 @@
1
+ # sage_setup: distribution = sagemath-schemes
2
+ # sage.doctest: needs sage.libs.flint sage.libs.pari
3
+ """
4
+ Ambient Hecke modules
5
+ """
6
+ # ****************************************************************************
7
+ # Sage: Open Source Mathematical Software
8
+ #
9
+ # Copyright (C) 2005 William Stein <wstein@gmail.com>
10
+ #
11
+ # Distributed under the terms of the GNU General Public License (GPL)
12
+ #
13
+ # This code is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
+ # General Public License for more details.
17
+ #
18
+ # The full text of the GPL is available at:
19
+ #
20
+ # https://www.gnu.org/licenses/
21
+ # ****************************************************************************
22
+ from . import degenmap
23
+ from . import module
24
+ from . import submodule
25
+
26
+ from sage.modules.free_module import FreeModule, FreeModule_generic
27
+ from sage.rings.integer import Integer
28
+
29
+ import sage.arith.all as arith
30
+
31
+ import sage.matrix.matrix_space as matrix_space
32
+ from sage.matrix.constructor import matrix
33
+
34
+ from sage.modular.arithgroup.all import Gamma0 # for Sturm bound
35
+
36
+
37
+ def is_AmbientHeckeModule(x) -> bool:
38
+ r"""
39
+ Return ``True`` if ``x`` is of type ``AmbientHeckeModule``.
40
+
41
+ EXAMPLES::
42
+
43
+ sage: from sage.modular.hecke.ambient_module import is_AmbientHeckeModule
44
+ sage: is_AmbientHeckeModule(ModularSymbols(6))
45
+ doctest:warning...
46
+ DeprecationWarning: the function is_AmbientHeckeModule is deprecated;
47
+ use 'isinstance(..., AmbientHeckeModule)' instead
48
+ See https://github.com/sagemath/sage/issues/37895 for details.
49
+ True
50
+ sage: is_AmbientHeckeModule(ModularSymbols(6).cuspidal_subspace())
51
+ False
52
+ sage: is_AmbientHeckeModule(ModularForms(11))
53
+ True
54
+ sage: is_AmbientHeckeModule(BrandtModule(2, 3))
55
+ True
56
+ """
57
+ from sage.misc.superseded import deprecation
58
+ deprecation(37895, "the function is_AmbientHeckeModule is deprecated; use 'isinstance(..., AmbientHeckeModule)' instead")
59
+ return isinstance(x, AmbientHeckeModule)
60
+
61
+
62
+ class AmbientHeckeModule(module.HeckeModule_free_module):
63
+ """
64
+ An ambient Hecke module, i.e. a Hecke module that is isomorphic as a module
65
+ over its base ring `R` to the standard free module `R^k` for some `k`. This
66
+ is the base class for ambient spaces of modular forms and modular symbols,
67
+ and for Brandt modules.
68
+ """
69
+ def __init__(self, base_ring, rank, level, weight, category=None):
70
+ r"""
71
+ Create an ambient Hecke module.
72
+
73
+ EXAMPLES::
74
+
75
+ sage: ModularSymbols(6) # indirect doctest
76
+ Modular Symbols space of dimension 3 for Gamma_0(6) of weight 2 with sign 0 over Rational Field
77
+ sage: sage.modular.hecke.ambient_module.AmbientHeckeModule(QQ, 3, 2, 4)
78
+ Generic ambient Hecke module of rank 3, level 2 and weight 4 over Rational Field
79
+ """
80
+ rank = Integer(rank)
81
+ if rank < 0:
82
+ raise ValueError("rank (=%s) must be nonnegative" % rank)
83
+ self.__rank = rank
84
+ module.HeckeModule_free_module.__init__(self, base_ring, level,
85
+ weight, category=category)
86
+
87
+ def rank(self):
88
+ """
89
+ Return the rank of this ambient Hecke module.
90
+
91
+ OUTPUT: integer
92
+
93
+ EXAMPLES::
94
+
95
+ sage: M = sage.modular.hecke.ambient_module.AmbientHeckeModule(QQ, 3, 11, 2); M
96
+ Generic ambient Hecke module of rank 3, level 11 and weight 2 over Rational Field
97
+ sage: M.rank()
98
+ 3
99
+ """
100
+ return self.__rank
101
+
102
+ def __add__(self, other):
103
+ r"""
104
+ Return the sum of ``self`` and ``other``.
105
+
106
+ As ``self`` is an ambient space, this will only make sense if
107
+ ``other`` is a subspace of ``self``, in which case the answer
108
+ is ``self``.
109
+
110
+ EXAMPLES::
111
+
112
+ sage: M = ModularSymbols(23)
113
+ sage: M + M is M
114
+ True
115
+ sage: M + 3
116
+ Traceback (most recent call last):
117
+ ...
118
+ TypeError: other (=3) must be a Hecke module
119
+ """
120
+ if not isinstance(other, module.HeckeModule_free_module):
121
+ raise TypeError("other (=%s) must be a Hecke module" % other)
122
+ if other.ambient_hecke_module() == self:
123
+ return self
124
+ raise ArithmeticError("sum only defined for subspaces of a common ambient Hecke module")
125
+
126
+ def _repr_(self):
127
+ r"""
128
+ Return the string representation of ``self``.
129
+
130
+ This should be overridden by derived classes.
131
+
132
+ EXAMPLES::
133
+
134
+ sage: sage.modular.hecke.ambient_module.AmbientHeckeModule(QQ, 3, 2, 4)._repr_()
135
+ 'Generic ambient Hecke module of rank 3, level 2 and weight 4 over Rational Field'
136
+ """
137
+ return "Generic ambient Hecke module of rank %s, level %s and weight %s over %s" % (self.rank(), self.level(), self.weight(), self.base_ring())
138
+
139
+ def _degeneracy_raising_matrix(self, codomain):
140
+ """
141
+ Matrix of the degeneracy map (with t = 1) from ``self`` to ``codomain``,
142
+ whose level should be a multiple of the level of ``self``.
143
+
144
+ EXAMPLES::
145
+
146
+ sage: sage.modular.hecke.ambient_module.AmbientHeckeModule(QQ, 3, 2, 4)._degeneracy_raising_matrix(4)
147
+ Traceback (most recent call last):
148
+ ...
149
+ NotImplementedError
150
+ """
151
+ raise NotImplementedError
152
+
153
+ def _degeneracy_lowering_matrix(self, codomain, t):
154
+ """
155
+ Matrix of the degeneracy map of index t from ``self`` to ``codomain``,
156
+ whose level should be a divisor of the level of ``self``.
157
+
158
+ EXAMPLES::
159
+
160
+ sage: sage.modular.hecke.ambient_module.AmbientHeckeModule(QQ, 3, 2, 4)._degeneracy_lowering_matrix(2, 2)
161
+ Traceback (most recent call last):
162
+ ...
163
+ NotImplementedError
164
+ """
165
+ raise NotImplementedError
166
+
167
+ def _hecke_image_of_ith_basis_element(self, n, i):
168
+ """
169
+ Return the image under the Hecke operator `T_n` of the `i`-th basis
170
+ element.
171
+
172
+ EXAMPLES::
173
+
174
+ sage: sage.modular.hecke.ambient_module.AmbientHeckeModule(QQ, 3, 2, 4)._hecke_image_of_ith_basis_element(4, 2)
175
+ Traceback (most recent call last):
176
+ ...
177
+ NotImplementedError: All subclasses must implement _compute_hecke_matrix_prime
178
+ """
179
+ return self.hecke_operator(n)(self.gen(i))
180
+
181
+ def _set_dual_free_module(self, V):
182
+ r"""
183
+ Store the embedded dual module of this module.
184
+
185
+ Since this module is an ambient module, this is not necessary.
186
+
187
+ EXAMPLES::
188
+
189
+ sage: ModularForms(11, 2)._set_dual_free_module(None)
190
+ """
191
+ pass # setting dual free module of ambient space is not necessary
192
+
193
+ def ambient_hecke_module(self):
194
+ r"""
195
+ Return the ambient space that contains this ambient space.
196
+
197
+ This is, of course, just this space again.
198
+
199
+ EXAMPLES::
200
+
201
+ sage: M = ModularForms(11, 4); M.ambient_hecke_module() is M
202
+ True
203
+ """
204
+ return self
205
+
206
+ def complement(self):
207
+ """
208
+ Return the largest Hecke-stable complement of this space.
209
+
210
+ EXAMPLES::
211
+
212
+ sage: M = ModularSymbols(11,2,1); M
213
+ Modular Symbols space of dimension 2 for Gamma_0(11) of weight 2 with sign 1 over Rational Field
214
+ sage: M.complement()
215
+ Modular Symbols subspace of dimension 0 of Modular Symbols space of dimension 2 for Gamma_0(11) of weight 2 with sign 1 over Rational Field
216
+ sage: C = M.cuspidal_subspace(); C
217
+ Modular Symbols subspace of dimension 1 of Modular Symbols space of dimension 2 for Gamma_0(11) of weight 2 with sign 1 over Rational Field
218
+ sage: C.complement()
219
+ Modular Symbols subspace of dimension 1 of Modular Symbols space of dimension 2 for Gamma_0(11) of weight 2 with sign 1 over Rational Field
220
+ """
221
+ return self.zero_submodule()
222
+
223
+ def decomposition_matrix(self):
224
+ r"""
225
+ Return the matrix whose columns form a basis for the canonical
226
+ sorted decomposition of ``self`` coming from the Hecke operators.
227
+
228
+ If the simple factors are `D_0, \ldots, D_n`, then the
229
+ first few columns are an echelonized basis for `D_0`, the
230
+ next an echelonized basis for `D_1`, the next for
231
+ `D_2`, etc.
232
+
233
+ EXAMPLES::
234
+
235
+ sage: S = ModularSymbols(37, 2)
236
+ sage: S.decomposition_matrix()
237
+ [ 1 0 0 0 -1/3]
238
+ [ 0 1 -1 0 1/2]
239
+ [ 0 0 0 1 -1/2]
240
+ [ 0 1 1 1 0]
241
+ [ 0 0 0 0 1]
242
+ """
243
+ try:
244
+ return self.__decomposition_matrix_cache
245
+ except AttributeError:
246
+ rows = [x.list() for A in self.decomposition()
247
+ for x in A.basis()]
248
+ A = matrix_space.MatrixSpace(self.base_ring(), self.rank())(rows)
249
+ self.__decomposition_matrix_cache = A
250
+ return self.__decomposition_matrix_cache
251
+
252
+ def decomposition_matrix_inverse(self):
253
+ """
254
+ Return the inverse of the decomposition matrix.
255
+
256
+ This is the inverse of the matrix returned by
257
+ :meth:`decomposition_matrix`.
258
+
259
+ EXAMPLES::
260
+
261
+ sage: S = ModularSymbols(37, 2)
262
+ sage: t = S.decomposition_matrix_inverse(); t
263
+ [ 1 0 0 0 1/3]
264
+ [ 0 1/2 -1/2 1/2 -1/2]
265
+ [ 0 -1/2 -1/2 1/2 0]
266
+ [ 0 0 1 0 1/2]
267
+ [ 0 0 0 0 1]
268
+ sage: t * S.decomposition_matrix() == 1
269
+ True
270
+ """
271
+ try:
272
+ return self.__decomposition_matrix_inverse_cache
273
+ except AttributeError:
274
+ self.__decomposition_matrix_inverse_cache = ~self.decomposition_matrix()
275
+ return self.__decomposition_matrix_inverse_cache
276
+
277
+ def degeneracy_map(self, codomain, t=1):
278
+ """
279
+ The `t`-th degeneracy map from ``self`` to the module ``codomain``.
280
+
281
+ The level of the codomain must be a divisor or multiple of
282
+ level, and `t` must be a divisor of the quotient.
283
+
284
+ INPUT:
285
+
286
+ - ``codomain`` -- a Hecke module, which should be of the same type as
287
+ self, or a positive integer (in which case Sage will use
288
+ :meth:`~hecke_module_of_level` to find the "natural" module of the
289
+ corresponding level).
290
+ - ``t`` -- integer; the parameter of the degeneracy map, i.e., the map
291
+ is related to `f(q)` - `f(q^t)`
292
+
293
+ OUTPUT: a morphism from ``self`` to ``codomain``
294
+
295
+ EXAMPLES::
296
+
297
+ sage: M = ModularSymbols(11,sign=1)
298
+ sage: d1 = M.degeneracy_map(33); d1
299
+ Hecke module morphism degeneracy map corresponding to f(q) |--> f(q)
300
+ defined by the matrix
301
+ [ 1 0 0 0 -2 -1]
302
+ [ 0 -1 1 0 0 0]
303
+ Domain: Modular Symbols space of dimension 2 for Gamma_0(11) of weight ...
304
+ Codomain: Modular Symbols space of dimension 6 for Gamma_0(33) of weight ...
305
+ sage: M.degeneracy_map(33, 3).matrix()
306
+ [ 3 2 0 2 -2 1]
307
+ [ 0 0 -1 1 0 0]
308
+ sage: M = ModularSymbols(33, sign=1)
309
+ sage: d2 = M.degeneracy_map(11); d2.matrix()
310
+ [ 1 0]
311
+ [ 0 -2]
312
+ [ 0 2]
313
+ [ 0 1]
314
+ [-1 0]
315
+ [-1 0]
316
+ sage: (d2*d1).matrix()
317
+ [4 0]
318
+ [0 4]
319
+
320
+ ::
321
+
322
+ sage: M = ModularSymbols(3, 12, sign=1)
323
+ sage: M.degeneracy_map(1)
324
+ Hecke module morphism degeneracy map corresponding to f(q) |--> f(q)
325
+ defined by the matrix
326
+ [1 0]
327
+ [0 0]
328
+ [0 1]
329
+ [0 1]
330
+ [0 1]
331
+ Domain: Modular Symbols space of dimension 5 for Gamma_0(3) of weight ...
332
+ Codomain: Modular Symbols space of dimension 2 for Gamma_0(1) of weight ...
333
+
334
+ ::
335
+
336
+ sage: S = M.cuspidal_submodule()
337
+ sage: S.degeneracy_map(1)
338
+ Hecke module morphism defined by the matrix
339
+ [1 0]
340
+ [0 0]
341
+ [0 0]
342
+ Domain: Modular Symbols subspace of dimension 3 of Modular Symbols space ...
343
+ Codomain: Modular Symbols space of dimension 2 for Gamma_0(1) of weight ...
344
+
345
+ ::
346
+
347
+ sage: D = ModularSymbols(10,4).cuspidal_submodule().decomposition()
348
+ sage: D
349
+ [Modular Symbols subspace of dimension 2 of Modular Symbols space of dimension 10 for Gamma_0(10) of weight 4 with sign 0 over Rational Field,
350
+ Modular Symbols subspace of dimension 4 of Modular Symbols space of dimension 10 for Gamma_0(10) of weight 4 with sign 0 over Rational Field]
351
+ sage: D[1].degeneracy_map(5)
352
+ Hecke module morphism defined by the matrix
353
+ [ 0 0 -1 1]
354
+ [ 0 1/2 3/2 -2]
355
+ [ 0 -1 1 0]
356
+ [ 0 -3/4 -1/4 1]
357
+ Domain: Modular Symbols subspace of dimension 4 of Modular Symbols space ...
358
+ Codomain: Modular Symbols space of dimension 4 for Gamma_0(5) of weight ...
359
+
360
+ We check for a subtle caching bug that came up in work on :issue:`10453`::
361
+
362
+ sage: loads(dumps(J0(33).decomposition()[0].modular_symbols()))
363
+ Modular Symbols subspace of dimension 2 of
364
+ Modular Symbols space of dimension 9 for
365
+ Gamma_0(33) of weight 2 with sign 0 over Rational Field
366
+
367
+ We check that certain absurd inputs are correctly caught::
368
+
369
+ sage: chi = kronecker_character(7)
370
+ sage: ModularSymbols(Gamma0(7), 4).degeneracy_map(ModularSymbols(chi, 4))
371
+ Traceback (most recent call last):
372
+ ...
373
+ ValueError: the characters of the domain and codomain must match
374
+ """
375
+ if isinstance(codomain, AmbientHeckeModule):
376
+ M = codomain
377
+ level = int(M.level())
378
+ else:
379
+ level = int(codomain)
380
+ M = None
381
+
382
+ t = int(t)
383
+
384
+ err = False
385
+ if self.level() % level == 0:
386
+ quo = self.level() // level
387
+ if quo % t != 0:
388
+ err = True
389
+ elif level % self.level() == 0:
390
+ quo = level // self.level()
391
+ if quo % t != 0:
392
+ err = True
393
+ else:
394
+ err = True
395
+ if err:
396
+ raise ValueError(("the level of self (=%s) must be a divisor or multiple of "
397
+ "level (=%s) and t (=%s) must be a divisor of the quotient") % (self.level(), level, t))
398
+
399
+ eps = self.character()
400
+ if eps is not None and level % eps.conductor() != 0:
401
+ raise ArithmeticError("the conductor of the character of this space "
402
+ "(=%s) must be divisible by the level (=%s)" % (eps.conductor(), level))
403
+
404
+ if M is None:
405
+ M = self.hecke_module_of_level(level)
406
+
407
+ if eps is not None and M.character() is not None:
408
+ if eps.primitive_character() != M.character().primitive_character():
409
+ raise ValueError("the characters of the domain and codomain must match")
410
+
411
+ key = (M.group(), t)
412
+ # bad idea to use (M, t) as the key, because using complicated objects
413
+ # like modular forms spaces as dictionary keys causes weird behaviour;
414
+ # on the other hand, (M.level(), t) isn't enough information.
415
+ try:
416
+ self._degeneracy_maps
417
+ except AttributeError:
418
+ self._degeneracy_maps = {}
419
+
420
+ if key in self._degeneracy_maps:
421
+ return self._degeneracy_maps[key]
422
+
423
+ if M.rank() == 0:
424
+ A = matrix_space.MatrixSpace(self.base_ring(), self.rank(), 0)(0)
425
+
426
+ elif self.level() % level == 0: # lower the level
427
+ A = self._degeneracy_lowering_matrix(M, t)
428
+
429
+ elif level % self.level() == 0: # raise the level
430
+ A = self._degeneracy_raising_matrix(M, t)
431
+
432
+ d = degenmap.DegeneracyMap(A, self, M, t)
433
+ self._degeneracy_maps[key] = d
434
+ return d
435
+
436
+ def dual_free_module(self):
437
+ r"""
438
+ The free module dual to ``self``, as a submodule of the dual
439
+ module of the ambient space. As this space is ambient anyway,
440
+ this just returns ``self.free_module()``.
441
+
442
+ EXAMPLES::
443
+
444
+ sage: M = ModularForms(2,8); M.dual_free_module()
445
+ Vector space of dimension 3 over Rational Field
446
+ sage: M.dual_free_module() is M.free_module()
447
+ True
448
+ """
449
+ return self.free_module()
450
+
451
+ def fcp(self, n, var='x'):
452
+ """
453
+ Return the factorization of the characteristic polynomial of
454
+ the Hecke operator `T_n` of index `n` acting on this space.
455
+
456
+ INPUT:
457
+
458
+ - ``self`` -- Hecke module invariant under the Hecke operator of index
459
+ `n`
460
+
461
+ - ``n`` --- a positive integer.
462
+
463
+ - ``var`` --- variable of polynomial (default: ``'x'``)
464
+
465
+ OUTPUT:
466
+
467
+ - ``list`` -- list of the pairs `(g,e)`, where `g` is an
468
+ irreducible factor of the characteristic polynomial of `T_n`, and `e`
469
+ is its multiplicity.
470
+
471
+ EXAMPLES::
472
+
473
+ sage: m = ModularSymbols(23, 2, sign=1)
474
+ sage: m.fcp(2)
475
+ (x - 3) * (x^2 + x - 1)
476
+ sage: m.hecke_operator(2).charpoly('x').factor()
477
+ (x - 3) * (x^2 + x - 1)
478
+ """
479
+ n = int(n)
480
+ if n <= 0:
481
+ raise ArithmeticError("n (=%s) must be positive" % n)
482
+ return self.hecke_operator(n).fcp(var)
483
+
484
+ def free_module(self):
485
+ """
486
+ Return the free module underlying this ambient Hecke module (the
487
+ forgetful functor from Hecke modules to modules over the base ring)
488
+
489
+ EXAMPLES::
490
+
491
+ sage: ModularForms(59, 2).free_module()
492
+ Vector space of dimension 6 over Rational Field
493
+ """
494
+ try:
495
+ return self.__free_module
496
+ except AttributeError:
497
+ M = FreeModule(self.base_ring(), self.rank())
498
+ self.__free_module = M
499
+ return M
500
+
501
+ def hecke_bound(self):
502
+ r"""
503
+ Return an integer `B` such that the Hecke operators `T_n`, for `n\leq B`,
504
+ generate the full Hecke algebra as a module over the base ring. Note
505
+ that we include the `n` with `n` not coprime to the level.
506
+
507
+ At present this returns an unproven guess for non-cuspidal spaces which
508
+ appears to be valid for `M_k(\Gamma_0(N))`, where `k` and `N` are the
509
+ weight and level of ``self``. (It is clearly valid for *cuspidal* spaces
510
+ of any fixed character, as a consequence of the Sturm bound theorem.)
511
+ It returns a hopelessly wrong answer for spaces of full level
512
+ `\Gamma_1`.
513
+
514
+ TODO: Get rid of this dreadful bit of code.
515
+
516
+ EXAMPLES::
517
+
518
+ sage: ModularSymbols(17, 4).hecke_bound()
519
+ 15
520
+ sage: ModularSymbols(Gamma1(17), 4).hecke_bound() # wrong!
521
+ 15
522
+ """
523
+ from sage.misc.verbose import verbose
524
+ try:
525
+ if self.is_cuspidal():
526
+ return Gamma0(self.level()).sturm_bound(self.weight())
527
+ except AttributeError:
528
+ pass
529
+ verbose("WARNING: ambient.py -- hecke_bound; returning unproven guess.")
530
+ return Gamma0(self.level()).sturm_bound(self.weight()) + 2 * Gamma0(self.level()).dimension_eis(self.weight()) + 5
531
+
532
+ def hecke_module_of_level(self, level):
533
+ r"""
534
+ Return the Hecke module corresponding to ``self`` at the given level, which
535
+ should be either a divisor or a multiple of the level of ``self``.
536
+
537
+ This raises :exc:`NotImplementedError`, and should be overridden in
538
+ derived classes.
539
+
540
+ EXAMPLES::
541
+
542
+ sage: sage.modular.hecke.ambient_module.AmbientHeckeModule.hecke_module_of_level(ModularForms(2, 8),6)
543
+ Traceback (most recent call last):
544
+ ...
545
+ NotImplementedError
546
+ """
547
+ raise NotImplementedError
548
+
549
+ def hecke_images(self, i, v):
550
+ """
551
+ Return images of the `i`-th standard basis vector under the
552
+ Hecke operators `T_p` for all integers in `v`.
553
+
554
+ INPUT:
555
+
556
+ - ``i`` -- nonnegative integer
557
+
558
+ - ``v`` -- list of positive integer
559
+
560
+ OUTPUT: ``matrix`` -- whose rows are the Hecke images
561
+
562
+ EXAMPLES::
563
+
564
+ sage: M = ModularSymbols(DirichletGroup(13).0, 3)
565
+ sage: M.T(2)(M.0).element()
566
+ (zeta12 + 4, 0, -1, 1)
567
+ sage: M.hecke_images(0, [1,2])
568
+ [ 1 0 0 0]
569
+ [zeta12 + 4 0 -1 1]
570
+ """
571
+ try:
572
+ return self._hecke_images(i, v)
573
+ except (AttributeError, NotImplementedError):
574
+ pass
575
+ # Use slow generic algorithm
576
+ x = self.gen(i)
577
+ X = [self.hecke_operator(n).apply_sparse(x).element() for n in v]
578
+ return matrix(self.base_ring(), X)
579
+
580
+ def intersection(self, other):
581
+ """
582
+ Return the intersection of ``self`` and ``other``, which must both lie in
583
+ a common ambient space of modular symbols.
584
+
585
+ EXAMPLES::
586
+
587
+ sage: M = ModularSymbols(43, sign=1)
588
+ sage: A = M[0] + M[1]
589
+ sage: B = M[1] + M[2]
590
+ sage: A.rank(), B.rank()
591
+ (2, 3)
592
+ sage: C = A.intersection(B); C.rank() # TODO
593
+ 1
594
+ """
595
+ if not isinstance(other, module.HeckeModule_free_module):
596
+ raise TypeError("other (=%s) must be a Hecke module" % other)
597
+ if self.ambient_hecke_module() != other.ambient_hecke_module():
598
+ raise ArithmeticError("intersection only defined for subspaces of a common ambient Hecke module")
599
+ return other # since self is ambient, so the intersection must equal other.
600
+
601
+ def is_ambient(self) -> bool:
602
+ r"""
603
+ Return ``True`` if and only if ``self`` is an ambient Hecke module.
604
+
605
+ .. warning::
606
+
607
+ ``self`` can only be ambient by being of type
608
+ :class:`AmbientHeckeModule`.
609
+
610
+ For example, decomposing a simple ambient space yields a
611
+ single factor, and that factor is *not* considered an
612
+ ambient space.
613
+
614
+ EXAMPLES::
615
+
616
+ sage: m = ModularSymbols(10)
617
+ sage: m.is_ambient()
618
+ True
619
+
620
+ ::
621
+
622
+ sage: a = m[0] # the unique simple factor
623
+ sage: a == m
624
+ True
625
+ sage: a.is_ambient()
626
+ False
627
+ """
628
+ return True
629
+
630
+ def is_full_hecke_module(self, compute=True) -> bool:
631
+ """
632
+ Return ``True`` if this space is invariant under the action of
633
+ all Hecke operators, even those that divide the level. This is
634
+ always true for ambient Hecke modules, so return ``True``.
635
+
636
+ EXAMPLES::
637
+
638
+ sage: ModularSymbols(11, 4).is_full_hecke_module()
639
+ True
640
+ """
641
+ return True
642
+
643
+ def is_new(self, p=None) -> bool:
644
+ r"""
645
+ Return ``True`` if this module is entirely new.
646
+
647
+ EXAMPLES::
648
+
649
+ sage: ModularSymbols(11, 4).is_new()
650
+ False
651
+ sage: ModularSymbols(1, 12).is_new()
652
+ True
653
+ """
654
+ try:
655
+ if p in self.__is_new:
656
+ return self.__is_new[p]
657
+ except AttributeError:
658
+ pass
659
+ AmbientHeckeModule.new_submodule(self, p)
660
+ return self.__is_new[p]
661
+
662
+ def is_old(self, p=None) -> bool:
663
+ r"""
664
+ Return ``True`` if this module is entirely old.
665
+
666
+ EXAMPLES::
667
+
668
+ sage: ModularSymbols(22).is_old()
669
+ True
670
+ sage: ModularSymbols(3, 12).is_old()
671
+ False
672
+ """
673
+ try:
674
+ if p in self.__is_old:
675
+ return self.__is_old[p]
676
+ except AttributeError:
677
+ pass
678
+ self.old_submodule(p)
679
+ return self.__is_old[p]
680
+
681
+ def is_submodule(self, V) -> bool:
682
+ """
683
+ Return ``True`` if and only if ``self`` is a submodule of ``V``.
684
+
685
+ Since this is an ambient space, this returns ``True`` if and
686
+ only if ``V`` is equal to ``self``.
687
+
688
+ EXAMPLES::
689
+
690
+ sage: ModularSymbols(1, 4).is_submodule(ModularSymbols(11,4))
691
+ False
692
+ sage: ModularSymbols(11, 4).is_submodule(ModularSymbols(11,4))
693
+ True
694
+ """
695
+ if not isinstance(V, module.HeckeModule_free_module):
696
+ raise TypeError("V must be a Hecke module")
697
+ if not V.is_ambient():
698
+ return False
699
+ return V.ambient_hecke_module() == self
700
+
701
+ def linear_combination_of_basis(self, v):
702
+ r"""
703
+ Given a list or vector of length equal to the dimension of ``self``,
704
+ construct the appropriate linear combination of the basis vectors of
705
+ ``self``.
706
+
707
+ EXAMPLES::
708
+
709
+ sage: ModularForms(3, 12).linear_combination_of_basis([1,0,0,0,1])
710
+ 2*q + 2049*q^2 + 177147*q^3 + 4196177*q^4 + 48830556*q^5 + O(q^6)
711
+ """
712
+ return self(v)
713
+
714
+ def new_submodule(self, p=None):
715
+ """
716
+ Return the new or `p`-new submodule of ``self``.
717
+
718
+ INPUT:
719
+
720
+ - ``p`` -- (default: ``None``) if not ``None``, return only
721
+ the `p`-new submodule
722
+
723
+ OUTPUT: the new or `p`-new submodule of ``self``, i.e. the intersection of
724
+ the kernel of the degeneracy lowering maps to level `N/p` (for the
725
+ given prime `p`, or for all prime divisors of `N` if `p` is not given).
726
+
727
+ If ``self`` is cuspidal, this is a Hecke-invariant complement of the
728
+ corresponding old submodule, but this may break down on Eisenstein
729
+ subspaces (see the amusing example in William Stein's book of a form
730
+ which is new and old at the same time).
731
+
732
+ EXAMPLES::
733
+
734
+ sage: m = ModularSymbols(33); m.rank()
735
+ 9
736
+ sage: m.new_submodule().rank()
737
+ 3
738
+ sage: m.new_submodule(3).rank()
739
+ 4
740
+ sage: m.new_submodule(11).rank()
741
+ 8
742
+ """
743
+ try:
744
+ if self.__is_new[p]:
745
+ return self
746
+ except AttributeError:
747
+ self.__is_new = {}
748
+ except KeyError:
749
+ pass
750
+
751
+ if self.rank() == 0:
752
+ self.__is_new[p] = True
753
+ return self
754
+ try:
755
+ return self.__new_submodule[p]
756
+ except AttributeError:
757
+ self.__new_submodule = {}
758
+ except KeyError:
759
+ pass
760
+
761
+ # Construct the degeneracy map d.
762
+ N = self.level()
763
+ d = None
764
+ eps = self.character()
765
+ if eps is None:
766
+ f = 1
767
+ else:
768
+ f = eps.conductor()
769
+ if p is None:
770
+ D = arith.prime_divisors(N)
771
+ else:
772
+ if N % p != 0:
773
+ raise ValueError("p must divide the level")
774
+ D = [p]
775
+ for q in D:
776
+ # Here we are only using degeneracy *lowering* maps, so it is fine
777
+ # to be careless and pass an integer for the level. One needs to be
778
+ # a bit more careful with degeneracy *raising* maps for the Gamma1
779
+ # and GammaH cases.
780
+ if ((N // q) % f) == 0:
781
+ NN = N // q
782
+ d1 = self.degeneracy_map(NN, 1).matrix()
783
+ if d is None:
784
+ d = d1
785
+ else:
786
+ d = d.augment(d1)
787
+ d = d.augment(self.degeneracy_map(NN, q).matrix())
788
+
789
+ if d is None or d == 0:
790
+ self.__is_new[p] = True
791
+ return self
792
+ else:
793
+ self.__is_new[p] = False
794
+ ns = self.submodule(d.kernel(), check=False)
795
+ ns.__is_new = {p: True}
796
+ ns._is_full_hecke_module = True
797
+ self.__new_submodule[p] = ns
798
+ return ns
799
+
800
+ def nonembedded_free_module(self):
801
+ r"""
802
+ Return the free module corresponding to ``self`` as an abstract free module
803
+ (rather than as a submodule of an ambient free module).
804
+
805
+ As this module is ambient anyway, this just returns
806
+ ``self.free_module()``.
807
+
808
+ EXAMPLES::
809
+
810
+ sage: M = ModularSymbols(11, 2)
811
+ sage: M.nonembedded_free_module() is M.free_module()
812
+ True
813
+ """
814
+ return self.free_module()
815
+
816
+ def old_submodule(self, p=None):
817
+ """
818
+ Return the old or `p`-old submodule of ``self``, i.e. the sum of the images
819
+ of the degeneracy maps from level `N/p` (for the given prime `p`, or
820
+ for all primes `p` dividing `N` if `p` is not given).
821
+
822
+ INPUT:
823
+
824
+ - ``p`` -- (default: ``None``) if not ``None``, return only the `p`-old
825
+ submodule
826
+
827
+ OUTPUT: the old or `p`-old submodule of ``self``
828
+
829
+ EXAMPLES::
830
+
831
+ sage: m = ModularSymbols(33); m.rank()
832
+ 9
833
+ sage: m.old_submodule().rank()
834
+ 7
835
+ sage: m.old_submodule(3).rank()
836
+ 6
837
+ sage: m.new_submodule(11).rank()
838
+ 8
839
+
840
+ ::
841
+
842
+ sage: e = DirichletGroup(16)([-1, 1])
843
+ sage: M = ModularSymbols(e, 3, sign=1); M
844
+ Modular Symbols space of dimension 4 and level 16, weight 3,
845
+ character [-1, 1], sign 1, over Rational Field
846
+ sage: M.old_submodule()
847
+ Modular Symbols subspace of dimension 3 of
848
+ Modular Symbols space of dimension 4 and level 16, weight 3,
849
+ character [-1, 1], sign 1, over Rational Field
850
+
851
+ Illustrate that :issue:`10664` is fixed::
852
+
853
+ sage: ModularSymbols(DirichletGroup(42)[7], 6, sign=1).old_subspace(3)
854
+ Modular Symbols subspace of dimension 0 of
855
+ Modular Symbols space of dimension 40 and level 42, weight 6,
856
+ character [-1, -1], sign 1, over Rational Field
857
+ """
858
+ try:
859
+ if self.__is_old[p]:
860
+ return self
861
+ except AttributeError:
862
+ self.__is_old = {}
863
+ except KeyError:
864
+ pass
865
+
866
+ if self.rank() == 0:
867
+ self.__is_old[p] = True
868
+ return self
869
+ try:
870
+ return self.__old_submodule[p]
871
+ except AttributeError:
872
+ self.__old_submodule = {}
873
+ except KeyError:
874
+ pass
875
+
876
+ # Construct the degeneracy map d.
877
+ N = self.level()
878
+ d = None
879
+
880
+ eps = self.character()
881
+ if eps is None:
882
+ f = 1
883
+ else:
884
+ f = eps.conductor()
885
+
886
+ if p is None:
887
+ D = arith.prime_divisors(N)
888
+ else:
889
+ if N % p != 0:
890
+ raise ValueError("p must divide the level")
891
+ D = [p]
892
+
893
+ for q in D:
894
+ NN = N // q
895
+ if NN % f == 0:
896
+ M = self.hecke_module_of_level(NN)
897
+
898
+ # Here it is vital to pass self as an argument to
899
+ # degeneracy_map, because M and the level N don't uniquely
900
+ # determine self (e.g. the degeneracy map from level 1 to level
901
+ # N could go to Gamma0(N), Gamma1(N) or anything in between)
902
+ d1 = M.degeneracy_map(self, 1).matrix()
903
+
904
+ if d is None:
905
+ d = d1
906
+ else:
907
+ d = d.stack(d1)
908
+ d = d.stack(M.degeneracy_map(self, q).matrix())
909
+
910
+ if d is None:
911
+ os = self.zero_submodule()
912
+ else:
913
+ os = self.submodule(d.image(), check=False)
914
+
915
+ self.__is_old[p] = (os == self)
916
+
917
+ os.__is_old = {p: True}
918
+ os._is_full_hecke_module = True
919
+ self.__old_submodule[p] = os
920
+ return os
921
+
922
+ def submodule(self, M, Mdual=None, check=True):
923
+ """
924
+ Return the Hecke submodule of ``self`` generated by `M`, which may be a
925
+ submodule of the free module of ``self``, or a list of elements of ``self``.
926
+
927
+ EXAMPLES::
928
+
929
+ sage: M = ModularForms(37, 2)
930
+ sage: A = M.submodule([M.newforms()[0].element(), M.newforms()[1].element()]); A
931
+ Modular Forms subspace of dimension 2 of
932
+ Modular Forms space of dimension 3 for
933
+ Congruence Subgroup Gamma0(37) of weight 2 over Rational Field
934
+ """
935
+ if check:
936
+ if not isinstance(M, FreeModule_generic):
937
+ V = self.free_module()
938
+ if isinstance(M, (list, tuple)):
939
+ M = V.span([V(x.element()) for x in M])
940
+ else:
941
+ M = V.span(M)
942
+ if not M.is_submodule(self.free_module()):
943
+ raise TypeError("M must be a submodule of the free module associated to this module")
944
+ if M == self.free_module():
945
+ return self
946
+ return self._submodule_class()(self, M, Mdual, check=check)
947
+
948
+ def _submodule_class(self):
949
+ r"""
950
+ The class of submodules of this module. This is a separate method so it
951
+ can be overridden in derived classes.
952
+
953
+ EXAMPLES::
954
+
955
+ sage: sage.modular.hecke.ambient_module.AmbientHeckeModule._submodule_class(ModularForms(1, 24))
956
+ <class 'sage.modular.hecke.submodule.HeckeSubmodule'>
957
+ sage: ModularForms(1, 24)._submodule_class()
958
+ <class 'sage.modular.modform.submodule.ModularFormsSubmodule'>
959
+ """
960
+ return submodule.HeckeSubmodule
961
+
962
+ def submodule_from_nonembedded_module(self, V, Vdual=None, check=True):
963
+ """
964
+ Create a submodule of this module, from a submodule of an ambient free
965
+ module of the same rank as the rank of ``self``.
966
+
967
+ INPUT:
968
+
969
+ - ``V`` -- submodule of ambient free module of the same rank as the
970
+ rank of ``self``
971
+
972
+ - ``Vdual`` -- used to pass in dual submodule (may be ``None``)
973
+
974
+ - ``check`` -- whether to check that submodule is Hecke-equivariant
975
+
976
+ OUTPUT: Hecke submodule of ``self``
977
+
978
+ EXAMPLES::
979
+
980
+ sage: V = QQ^8
981
+ sage: ModularForms(24, 2).submodule_from_nonembedded_module(V.submodule([0]))
982
+ Modular Forms subspace of dimension 0 of
983
+ Modular Forms space of dimension 8 for
984
+ Congruence Subgroup Gamma0(24) of weight 2 over Rational Field
985
+ """
986
+ return self.submodule(V, Vdual, check=check)
987
+
988
+ def submodule_generated_by_images(self, M):
989
+ """
990
+ Return the submodule of this ambient modular symbols space
991
+ generated by the images under all degeneracy maps of `M`.
992
+
993
+ The space `M` must have the same weight, sign, and group or
994
+ character as this ambient space.
995
+
996
+ EXAMPLES::
997
+
998
+ sage: ModularSymbols(6, 12).submodule_generated_by_images(ModularSymbols(1,12))
999
+ Modular Symbols subspace of dimension 12 of
1000
+ Modular Symbols space of dimension 22 for
1001
+ Gamma_0(6) of weight 12 with sign 0 over Rational Field
1002
+ """
1003
+ S = self.zero_submodule()
1004
+ if self.level() % M.level() == 0:
1005
+ D = arith.divisors(self.level() // M.level())
1006
+ elif M.level() % self.level() == 0:
1007
+ D = arith.divisors(M.level() // self.level())
1008
+ else:
1009
+ D = []
1010
+ for t in D:
1011
+ d = M.degeneracy_map(self, t)
1012
+ if d.codomain() != self:
1013
+ raise ArithmeticError("incompatible spaces of modular symbols")
1014
+ S += d.image()
1015
+
1016
+ if self.is_full_hecke_module(compute=False):
1017
+ S._is_full_hecke_module = True
1018
+
1019
+ return S