passagemath-schemes 10.6.40__cp314-cp314-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.22.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.40.dist-info/METADATA +204 -0
  7. passagemath_schemes-10.6.40.dist-info/METADATA.bak +205 -0
  8. passagemath_schemes-10.6.40.dist-info/RECORD +314 -0
  9. passagemath_schemes-10.6.40.dist-info/WHEEL +6 -0
  10. passagemath_schemes-10.6.40.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-314-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-314-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-314-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-314-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-314-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-314-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-314-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-314-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-314-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-314-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-314-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-314-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,1207 @@
1
+ # sage_setup: distribution = sagemath-schemes
2
+ r"""
3
+ Local data for elliptic curves over number fields
4
+
5
+ Let `E` be an elliptic curve over a number field `K` (including `\QQ`).
6
+ There are several local invariants at a finite place `v` that
7
+ can be computed via Tate's algorithm (see [Sil1994]_ IV.9.4 or [Tate1975]_).
8
+
9
+ These include the type of reduction (good, additive, multiplicative),
10
+ a minimal equation of `E` over `K_v`,
11
+ the Tamagawa number `c_v`, defined to be the index `[E(K_v):E^0(K_v)]`
12
+ of the points with good reduction among the local points, and the
13
+ exponent of the conductor `f_v`.
14
+
15
+ The functions in this file will typically be called by using ``local_data``.
16
+
17
+ EXAMPLES::
18
+
19
+ sage: # needs sage.rings.number_field
20
+ sage: x = polygen(ZZ, 'x')
21
+ sage: K.<i> = NumberField(x^2 + 1)
22
+ sage: E = EllipticCurve([(2+i)^2, (2+i)^7])
23
+ sage: pp = K.fractional_ideal(2+i)
24
+ sage: da = E.local_data(pp)
25
+ sage: da.has_bad_reduction()
26
+ True
27
+ sage: da.has_multiplicative_reduction()
28
+ False
29
+ sage: da.kodaira_symbol()
30
+ I0*
31
+ sage: da.tamagawa_number()
32
+ 4
33
+ sage: da.minimal_model()
34
+ Elliptic Curve defined by y^2 = x^3 + (4*i+3)*x + (-29*i-278)
35
+ over Number Field in i with defining polynomial x^2 + 1
36
+
37
+ An example to show how the Neron model can change as one extends the field::
38
+
39
+ sage: E = EllipticCurve([0,-1])
40
+ sage: E.local_data(2)
41
+ Local data at Principal ideal (2) of Integer Ring:
42
+ Reduction type: bad additive
43
+ Local minimal model: Elliptic Curve defined by y^2 = x^3 - 1 over Rational Field
44
+ Minimal discriminant valuation: 4
45
+ Conductor exponent: 4
46
+ Kodaira Symbol: II
47
+ Tamagawa Number: 1
48
+
49
+ sage: # needs sage.rings.number_field
50
+ sage: EK = E.base_extend(K)
51
+ sage: EK.local_data(1+i)
52
+ Local data at Fractional ideal (i + 1):
53
+ Reduction type: bad additive
54
+ Local minimal model: Elliptic Curve defined by y^2 = x^3 + (-1)
55
+ over Number Field in i with defining polynomial x^2 + 1
56
+ Minimal discriminant valuation: 8
57
+ Conductor exponent: 2
58
+ Kodaira Symbol: IV*
59
+ Tamagawa Number: 3
60
+
61
+ Or how the minimal equation changes::
62
+
63
+ sage: E = EllipticCurve([0,8])
64
+ sage: E.is_minimal()
65
+ True
66
+
67
+ sage: # needs sage.rings.number_field
68
+ sage: EK = E.base_extend(K)
69
+ sage: da = EK.local_data(1+i)
70
+ sage: da.minimal_model()
71
+ Elliptic Curve defined by y^2 = x^3 + (-i)
72
+ over Number Field in i with defining polynomial x^2 + 1
73
+
74
+ AUTHORS:
75
+
76
+ - John Cremona: First version 2008-09-21 (refactoring code from
77
+ ``ell_number_field.py`` and ``ell_rational_field.py``)
78
+
79
+ - Chris Wuthrich: more documentation 2010-01
80
+ """
81
+ # ****************************************************************************
82
+ # Copyright (C) 2005 William Stein <wstein@gmail.com>
83
+ #
84
+ # Distributed under the terms of the GNU General Public License (GPL)
85
+ #
86
+ # This code is distributed in the hope that it will be useful,
87
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
88
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
89
+ # General Public License for more details.
90
+ #
91
+ # The full text of the GPL is available at:
92
+ #
93
+ # https://www.gnu.org/licenses/
94
+ # ****************************************************************************
95
+
96
+ from sage.structure.sage_object import SageObject
97
+ from sage.misc.verbose import verbose
98
+
99
+ from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
100
+ from sage.rings.rational_field import QQ
101
+ from sage.rings.integer_ring import ZZ
102
+ from sage.rings.integer import Integer
103
+ from sage.rings.number_field.number_field_ideal import NumberFieldFractionalIdeal
104
+
105
+ from sage.rings.number_field.number_field_base import NumberField
106
+ from sage.rings.ideal import Ideal_generic
107
+
108
+ from .constructor import EllipticCurve
109
+ from .kodaira_symbol import KodairaSymbol
110
+
111
+
112
+ class EllipticCurveLocalData(SageObject):
113
+ r"""
114
+ The class for the local reduction data of an elliptic curve.
115
+
116
+ Currently supported are elliptic curves defined over `\QQ`, and
117
+ elliptic curves defined over a number field, at an arbitrary prime
118
+ or prime ideal.
119
+
120
+ INPUT:
121
+
122
+ - ``E`` -- an elliptic curve defined over a number field, or `\QQ`
123
+
124
+ - ``P`` -- a prime ideal of the field, or a prime integer if the field is `\QQ`
125
+
126
+ - ``proof`` -- boolean; if ``True``, only use provably correct
127
+ methods (default: controlled by global proof module). Note
128
+ that the proof module is number_field, not elliptic_curves,
129
+ since the functions that actually need the flag are in
130
+ number fields.
131
+
132
+ - ``algorithm`` -- string (default: ``'pari'``); ignored unless the
133
+ base field is `\QQ`. If "pari", use the PARI C-library
134
+ ``ellglobalred`` implementation of Tate's algorithm over
135
+ `\QQ`. If "generic", use the general number field
136
+ implementation.
137
+
138
+ .. NOTE::
139
+
140
+ This function is not normally called directly by users, who
141
+ may access the data via methods of the EllipticCurve
142
+ classes.
143
+
144
+ EXAMPLES::
145
+
146
+ sage: from sage.schemes.elliptic_curves.ell_local_data import EllipticCurveLocalData
147
+ sage: E = EllipticCurve('14a1')
148
+ sage: EllipticCurveLocalData(E,2)
149
+ Local data at Principal ideal (2) of Integer Ring:
150
+ Reduction type: bad non-split multiplicative
151
+ Local minimal model: Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x - 6
152
+ over Rational Field
153
+ Minimal discriminant valuation: 6
154
+ Conductor exponent: 1
155
+ Kodaira Symbol: I6
156
+ Tamagawa Number: 2
157
+ """
158
+
159
+ def __init__(self, E, P, proof=None, algorithm='pari', globally=False):
160
+ r"""
161
+ Initialize the reduction data for the elliptic curve `E` at the prime `P`.
162
+
163
+ INPUT:
164
+
165
+ - ``E`` -- an elliptic curve defined over a number field, or `\QQ`
166
+
167
+ - ``P`` -- a prime ideal of the field, or a prime integer if the field is `\QQ`
168
+
169
+ - ``proof`` -- boolean; if ``True``, only use provably correct
170
+ methods (default: controlled by global proof module). Note
171
+ that the proof module is number_field, not elliptic_curves,
172
+ since the functions that actually need the flag are in
173
+ number fields.
174
+
175
+ - ``algorithm`` -- string (default: ``'pari'``); ignored unless the
176
+ base field is `\QQ`. If "pari", use the PARI C-library
177
+ ``ellglobalred`` implementation of Tate's algorithm over
178
+ `\QQ`. If "generic", use the general number field
179
+ implementation.
180
+
181
+ - ``globally`` -- boolean (default: ``False``); if ``True``, the algorithm
182
+ uses the generators of principal ideals rather than an arbitrary
183
+ uniformizer.
184
+
185
+ .. NOTE::
186
+
187
+ This function is not normally called directly by users, who
188
+ may access the data via methods of the EllipticCurve
189
+ classes.
190
+
191
+ EXAMPLES::
192
+
193
+ sage: from sage.schemes.elliptic_curves.ell_local_data import EllipticCurveLocalData
194
+ sage: E = EllipticCurve('14a1')
195
+ sage: EllipticCurveLocalData(E, 2)
196
+ Local data at Principal ideal (2) of Integer Ring:
197
+ Reduction type: bad non-split multiplicative
198
+ Local minimal model: Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x - 6
199
+ over Rational Field
200
+ Minimal discriminant valuation: 6
201
+ Conductor exponent: 1
202
+ Kodaira Symbol: I6
203
+ Tamagawa Number: 2
204
+
205
+ ::
206
+
207
+ sage: EllipticCurveLocalData(E, 2, algorithm='generic')
208
+ Local data at Principal ideal (2) of Integer Ring:
209
+ Reduction type: bad non-split multiplicative
210
+ Local minimal model: Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x - 6
211
+ over Rational Field
212
+ Minimal discriminant valuation: 6
213
+ Conductor exponent: 1
214
+ Kodaira Symbol: I6
215
+ Tamagawa Number: 2
216
+
217
+ ::
218
+
219
+ sage: EllipticCurveLocalData(E, 2, algorithm='pari')
220
+ Local data at Principal ideal (2) of Integer Ring:
221
+ Reduction type: bad non-split multiplicative
222
+ Local minimal model: Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x - 6
223
+ over Rational Field
224
+ Minimal discriminant valuation: 6
225
+ Conductor exponent: 1
226
+ Kodaira Symbol: I6
227
+ Tamagawa Number: 2
228
+
229
+ ::
230
+
231
+ sage: EllipticCurveLocalData(E, 2, algorithm='unknown')
232
+ Traceback (most recent call last):
233
+ ...
234
+ ValueError: algorithm must be one of 'pari', 'generic'
235
+
236
+ ::
237
+
238
+ sage: EllipticCurveLocalData(E, 3)
239
+ Local data at Principal ideal (3) of Integer Ring:
240
+ Reduction type: good
241
+ Local minimal model: Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x - 6
242
+ over Rational Field
243
+ Minimal discriminant valuation: 0
244
+ Conductor exponent: 0
245
+ Kodaira Symbol: I0
246
+ Tamagawa Number: 1
247
+
248
+ ::
249
+
250
+ sage: EllipticCurveLocalData(E, 7)
251
+ Local data at Principal ideal (7) of Integer Ring:
252
+ Reduction type: bad split multiplicative
253
+ Local minimal model: Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x - 6
254
+ over Rational Field
255
+ Minimal discriminant valuation: 3
256
+ Conductor exponent: 1
257
+ Kodaira Symbol: I3
258
+ Tamagawa Number: 3
259
+ """
260
+ self._curve = E
261
+ K = E.base_field()
262
+ p = check_prime(K,P) # error handling done in that function
263
+ if algorithm != "pari" and algorithm != "generic":
264
+ raise ValueError("algorithm must be one of 'pari', 'generic'")
265
+
266
+ self._reduction_type = None
267
+ if K is QQ:
268
+ self._prime = ZZ.ideal(p)
269
+ else:
270
+ self._prime = p
271
+
272
+ if algorithm == "pari" and K is QQ:
273
+ Eint = E.integral_model()
274
+ data = Eint.pari_curve().elllocalred(p)
275
+ self._fp = data[0].sage()
276
+ self._KS = KodairaSymbol(data[1].sage())
277
+ self._cp = data[3].sage()
278
+ # We use a global minimal model since we can:
279
+ self._Emin_reduced = Eint.minimal_model()
280
+ self._val_disc = self._Emin_reduced.discriminant().valuation(p)
281
+ if self._fp > 0:
282
+ self._reduction_type = Eint.ap(p) # = 0,-1 or +1
283
+ else:
284
+ self._Emin, _, self._val_disc, self._fp, self._KS, self._cp, self._split = self._tate(proof, globally)
285
+ if self._fp > 0:
286
+ if self._Emin.c4().valuation(p) > 0:
287
+ self._reduction_type = 0
288
+ elif self._split:
289
+ self._reduction_type = +1
290
+ else:
291
+ self._reduction_type = -1
292
+
293
+ def __repr__(self):
294
+ r"""
295
+ Return the string representation of this reduction data.
296
+
297
+ EXAMPLES::
298
+
299
+ sage: from sage.schemes.elliptic_curves.ell_local_data import EllipticCurveLocalData
300
+ sage: E = EllipticCurve('14a1')
301
+ sage: EllipticCurveLocalData(E,2).__repr__()
302
+ 'Local data at Principal ideal (2) of Integer Ring:\nReduction type: bad non-split multiplicative\nLocal minimal model: Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x - 6 over Rational Field\nMinimal discriminant valuation: 6\nConductor exponent: 1\nKodaira Symbol: I6\nTamagawa Number: 2'
303
+ sage: EllipticCurveLocalData(E,3).__repr__()
304
+ 'Local data at Principal ideal (3) of Integer Ring:\nReduction type: good\nLocal minimal model: Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x - 6 over Rational Field\nMinimal discriminant valuation: 0\nConductor exponent: 0\nKodaira Symbol: I0\nTamagawa Number: 1'
305
+ sage: EllipticCurveLocalData(E,7).__repr__()
306
+ 'Local data at Principal ideal (7) of Integer Ring:\nReduction type: bad split multiplicative\nLocal minimal model: Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x - 6 over Rational Field\nMinimal discriminant valuation: 3\nConductor exponent: 1\nKodaira Symbol: I3\nTamagawa Number: 3'
307
+ """
308
+ red_type = "good"
309
+ if self._reduction_type is not None:
310
+ red_type = ["bad non-split multiplicative","bad additive","bad split multiplicative"][1+self._reduction_type]
311
+ return "Local data at %s:\nReduction type: %s\nLocal minimal model: %s\nMinimal discriminant valuation: %s\nConductor exponent: %s\nKodaira Symbol: %s\nTamagawa Number: %s" % (self._prime,red_type,self.minimal_model(),self._val_disc,self._fp,self._KS,self._cp)
312
+
313
+ def minimal_model(self, reduce=True):
314
+ """
315
+ Return the (local) minimal model from this local reduction data.
316
+
317
+ INPUT:
318
+
319
+ - ``reduce`` -- boolean (default: ``True``); if set to ``True`` and if
320
+ the initial elliptic curve had globally integral
321
+ coefficients, then the elliptic curve returned by Tate's
322
+ algorithm will be "reduced" as specified in _reduce_model()
323
+ for curves over number fields.
324
+
325
+ EXAMPLES::
326
+
327
+ sage: from sage.schemes.elliptic_curves.ell_local_data import EllipticCurveLocalData
328
+ sage: E = EllipticCurve([0,0,0,0,64]); E
329
+ Elliptic Curve defined by y^2 = x^3 + 64 over Rational Field
330
+ sage: data = EllipticCurveLocalData(E, 2)
331
+ sage: data.minimal_model()
332
+ Elliptic Curve defined by y^2 = x^3 + 1 over Rational Field
333
+ sage: data.minimal_model() == E.local_minimal_model(2)
334
+ True
335
+
336
+ To demonstrate the behaviour of the parameter ``reduce``::
337
+
338
+ sage: # needs sage.rings.number_field
339
+ sage: x = polygen(ZZ, 'x')
340
+ sage: K.<a> = NumberField(x^3 + x + 1)
341
+ sage: E = EllipticCurve(K, [0, 0, a, 0, 1])
342
+ sage: E.local_data(K.ideal(a-1)).minimal_model()
343
+ Elliptic Curve defined by y^2 + a*y = x^3 + 1
344
+ over Number Field in a with defining polynomial x^3 + x + 1
345
+ sage: E.local_data(K.ideal(a-1)).minimal_model(reduce=False)
346
+ Elliptic Curve defined by y^2 + (a+2)*y = x^3 + 3*x^2 + 3*x + (-a+1)
347
+ over Number Field in a with defining polynomial x^3 + x + 1
348
+
349
+ sage: E = EllipticCurve([2, 1, 0, -2, -1])
350
+ sage: E.local_data(ZZ.ideal(2), algorithm='generic').minimal_model(reduce=False)
351
+ Elliptic Curve defined by y^2 + 2*x*y + 2*y = x^3 + x^2 - 4*x - 2 over Rational Field
352
+ sage: E.local_data(ZZ.ideal(2), algorithm='pari').minimal_model(reduce=False)
353
+ Traceback (most recent call last):
354
+ ...
355
+ ValueError: the argument reduce must not be False if algorithm=pari is used
356
+ sage: E.local_data(ZZ.ideal(2), algorithm='generic').minimal_model()
357
+ Elliptic Curve defined by y^2 = x^3 - x^2 - 3*x + 2 over Rational Field
358
+ sage: E.local_data(ZZ.ideal(2), algorithm='pari').minimal_model()
359
+ Elliptic Curve defined by y^2 = x^3 - x^2 - 3*x + 2 over Rational Field
360
+
361
+ :issue:`14476`::
362
+
363
+ sage: # needs sage.rings.number_field
364
+ sage: t = QQ['t'].0
365
+ sage: K.<g> = NumberField(t^4 - t^3-3*t^2 - t +1)
366
+ sage: E = EllipticCurve([-2*g^3 + 10/3*g^2 + 3*g - 2/3,
367
+ ....: -11/9*g^3 + 34/9*g^2 - 7/3*g + 4/9,
368
+ ....: -11/9*g^3 + 34/9*g^2 - 7/3*g + 4/9, 0, 0])
369
+ sage: vv = K.fractional_ideal(g^2 - g - 2)
370
+ sage: E.local_data(vv).minimal_model()
371
+ Elliptic Curve defined by
372
+ y^2 + (-2*g^3+10/3*g^2+3*g-2/3)*x*y + (-11/9*g^3+34/9*g^2-7/3*g+4/9)*y
373
+ = x^3 + (-11/9*g^3+34/9*g^2-7/3*g+4/9)*x^2
374
+ over Number Field in g with defining polynomial t^4 - t^3 - 3*t^2 - t + 1
375
+ """
376
+ if reduce:
377
+ try:
378
+ return self._Emin_reduced
379
+ except AttributeError:
380
+ pass
381
+ # trac 14476 we only reduce if the coefficients are globally integral
382
+ if all(a.is_integral() for a in self._Emin.a_invariants()):
383
+ self._Emin_reduced = self._Emin._reduce_model()
384
+ return self._Emin_reduced
385
+ else:
386
+ return self._Emin
387
+ else:
388
+ try:
389
+ return self._Emin
390
+ except AttributeError:
391
+ raise ValueError("the argument reduce must not be False if algorithm=pari is used")
392
+
393
+ def prime(self):
394
+ """
395
+ Return the prime ideal associated with this local reduction data.
396
+
397
+ EXAMPLES::
398
+
399
+ sage: from sage.schemes.elliptic_curves.ell_local_data import EllipticCurveLocalData
400
+ sage: E = EllipticCurve([0,0,0,0,64]); E
401
+ Elliptic Curve defined by y^2 = x^3 + 64 over Rational Field
402
+ sage: data = EllipticCurveLocalData(E,2)
403
+ sage: data.prime()
404
+ Principal ideal (2) of Integer Ring
405
+ """
406
+ return self._prime
407
+
408
+ def conductor_valuation(self):
409
+ """
410
+ Return the valuation of the conductor from this local reduction data.
411
+
412
+ EXAMPLES::
413
+
414
+ sage: from sage.schemes.elliptic_curves.ell_local_data import EllipticCurveLocalData
415
+ sage: E = EllipticCurve([0,0,0,0,64]); E
416
+ Elliptic Curve defined by y^2 = x^3 + 64 over Rational Field
417
+ sage: data = EllipticCurveLocalData(E,2)
418
+ sage: data.conductor_valuation()
419
+ 2
420
+ """
421
+ return self._fp
422
+
423
+ def discriminant_valuation(self):
424
+ """
425
+ Return the valuation of the minimal discriminant from this local reduction data.
426
+
427
+ EXAMPLES::
428
+
429
+ sage: from sage.schemes.elliptic_curves.ell_local_data import EllipticCurveLocalData
430
+ sage: E = EllipticCurve([0,0,0,0,64]); E
431
+ Elliptic Curve defined by y^2 = x^3 + 64 over Rational Field
432
+ sage: data = EllipticCurveLocalData(E,2)
433
+ sage: data.discriminant_valuation()
434
+ 4
435
+ """
436
+ return self._val_disc
437
+
438
+ def kodaira_symbol(self):
439
+ r"""
440
+ Return the Kodaira symbol from this local reduction data.
441
+
442
+ EXAMPLES::
443
+
444
+ sage: from sage.schemes.elliptic_curves.ell_local_data import EllipticCurveLocalData
445
+ sage: E = EllipticCurve([0,0,0,0,64]); E
446
+ Elliptic Curve defined by y^2 = x^3 + 64 over Rational Field
447
+ sage: data = EllipticCurveLocalData(E,2)
448
+ sage: data.kodaira_symbol()
449
+ IV
450
+ """
451
+ return self._KS
452
+
453
+ def tamagawa_number(self):
454
+ r"""
455
+ Return the Tamagawa number from this local reduction data.
456
+
457
+ This is the index `[E(K_v):E^0(K_v)]`.
458
+
459
+ EXAMPLES::
460
+
461
+ sage: from sage.schemes.elliptic_curves.ell_local_data import EllipticCurveLocalData
462
+ sage: E = EllipticCurve([0,0,0,0,64]); E
463
+ Elliptic Curve defined by y^2 = x^3 + 64 over Rational Field
464
+ sage: data = EllipticCurveLocalData(E,2)
465
+ sage: data.tamagawa_number()
466
+ 3
467
+ """
468
+ return self._cp
469
+
470
+ def tamagawa_exponent(self):
471
+ r"""
472
+ Return the Tamagawa index from this local reduction data.
473
+
474
+ This is the exponent of `E(K_v)/E^0(K_v)`; in most cases it is
475
+ the same as the Tamagawa index.
476
+
477
+ EXAMPLES::
478
+
479
+ sage: from sage.schemes.elliptic_curves.ell_local_data import EllipticCurveLocalData
480
+ sage: E = EllipticCurve('816a1')
481
+ sage: data = EllipticCurveLocalData(E, 2)
482
+ sage: data.kodaira_symbol()
483
+ I2*
484
+ sage: data.tamagawa_number()
485
+ 4
486
+ sage: data.tamagawa_exponent()
487
+ 2
488
+
489
+ sage: E = EllipticCurve('200c4')
490
+ sage: data = EllipticCurveLocalData(E, 5)
491
+ sage: data.kodaira_symbol()
492
+ I4*
493
+ sage: data.tamagawa_number()
494
+ 4
495
+ sage: data.tamagawa_exponent()
496
+ 2
497
+ """
498
+ cp = self._cp
499
+ if cp != 4:
500
+ return cp
501
+ ks = self._KS
502
+ if ks._roman == 1 and ks._n % 2 == 0 and ks._starred:
503
+ return ZZ(2)
504
+ return ZZ(4)
505
+
506
+ def bad_reduction_type(self):
507
+ r"""
508
+ Return the type of bad reduction of this reduction data.
509
+
510
+ OUTPUT:
511
+
512
+ integer or ``None``:
513
+
514
+ - +1 for split multiplicative reduction
515
+ - -1 for non-split multiplicative reduction
516
+ - 0 for additive reduction
517
+ - ``None`` for good reduction
518
+
519
+ EXAMPLES::
520
+
521
+ sage: E = EllipticCurve('14a1')
522
+ sage: [(p,E.local_data(p).bad_reduction_type()) for p in prime_range(15)]
523
+ [(2, -1), (3, None), (5, None), (7, 1), (11, None), (13, None)]
524
+
525
+ sage: # needs sage.rings.number_field
526
+ sage: x = polygen(ZZ, 'x')
527
+ sage: K.<a> = NumberField(x^3 - 2)
528
+ sage: P17a, P17b = [P for P,e in K.factor(17)]
529
+ sage: E = EllipticCurve([0, 0, 0, 0, 2*a+1])
530
+ sage: [(p,E.local_data(p).bad_reduction_type()) for p in [P17a,P17b]]
531
+ [(Fractional ideal (4*a^2 - 2*a + 1), None), (Fractional ideal (2*a + 1), 0)]
532
+ """
533
+ return self._reduction_type
534
+
535
+ def has_good_reduction(self) -> bool:
536
+ r"""
537
+ Return ``True`` if there is good reduction.
538
+
539
+ EXAMPLES::
540
+
541
+ sage: E = EllipticCurve('14a1')
542
+ sage: [(p,E.local_data(p).has_good_reduction()) for p in prime_range(15)]
543
+ [(2, False), (3, True), (5, True), (7, False), (11, True), (13, True)]
544
+
545
+ sage: # needs sage.rings.number_field
546
+ sage: x = polygen(ZZ, 'x')
547
+ sage: K.<a> = NumberField(x^3 - 2)
548
+ sage: P17a, P17b = [P for P,e in K.factor(17)]
549
+ sage: E = EllipticCurve([0, 0, 0, 0, 2*a+1])
550
+ sage: [(p,E.local_data(p).has_good_reduction()) for p in [P17a,P17b]]
551
+ [(Fractional ideal (4*a^2 - 2*a + 1), True),
552
+ (Fractional ideal (2*a + 1), False)]
553
+ """
554
+ return self._reduction_type is None
555
+
556
+ def has_bad_reduction(self) -> bool:
557
+ r"""
558
+ Return ``True`` if there is bad reduction.
559
+
560
+ EXAMPLES::
561
+
562
+ sage: E = EllipticCurve('14a1')
563
+ sage: [(p,E.local_data(p).has_bad_reduction()) for p in prime_range(15)]
564
+ [(2, True), (3, False), (5, False), (7, True), (11, False), (13, False)]
565
+
566
+ ::
567
+
568
+ sage: # needs sage.rings.number_field
569
+ sage: x = polygen(ZZ, 'x')
570
+ sage: K.<a> = NumberField(x^3 - 2)
571
+ sage: P17a, P17b = [P for P,e in K.factor(17)]
572
+ sage: E = EllipticCurve([0, 0, 0, 0, 2*a+1])
573
+ sage: [(p,E.local_data(p).has_bad_reduction()) for p in [P17a,P17b]]
574
+ [(Fractional ideal (4*a^2 - 2*a + 1), False),
575
+ (Fractional ideal (2*a + 1), True)]
576
+ """
577
+ return self._reduction_type is not None
578
+
579
+ def has_multiplicative_reduction(self) -> bool:
580
+ r"""
581
+ Return ``True`` if there is multiplicative reduction.
582
+
583
+ .. NOTE::
584
+
585
+ See also ``has_split_multiplicative_reduction()`` and
586
+ ``has_nonsplit_multiplicative_reduction()``.
587
+
588
+ EXAMPLES::
589
+
590
+ sage: E = EllipticCurve('14a1')
591
+ sage: [(p, E.local_data(p).has_multiplicative_reduction()) for p in prime_range(15)]
592
+ [(2, True), (3, False), (5, False), (7, True), (11, False), (13, False)]
593
+
594
+ ::
595
+
596
+ sage: # needs sage.rings.number_field
597
+ sage: x = polygen(ZZ, 'x')
598
+ sage: K.<a> = NumberField(x^3 - 2)
599
+ sage: P17a, P17b = [P for P,e in K.factor(17)]
600
+ sage: E = EllipticCurve([0, 0, 0, 0, 2*a+1])
601
+ sage: [(p,E.local_data(p).has_multiplicative_reduction()) for p in [P17a,P17b]]
602
+ [(Fractional ideal (4*a^2 - 2*a + 1), False), (Fractional ideal (2*a + 1), False)]
603
+ """
604
+ return self._reduction_type in (-1, 1)
605
+
606
+ def has_split_multiplicative_reduction(self) -> bool:
607
+ r"""
608
+ Return ``True`` if there is split multiplicative reduction.
609
+
610
+ EXAMPLES::
611
+
612
+ sage: E = EllipticCurve('14a1')
613
+ sage: [(p, E.local_data(p).has_split_multiplicative_reduction())
614
+ ....: for p in prime_range(15)]
615
+ [(2, False), (3, False), (5, False), (7, True), (11, False), (13, False)]
616
+
617
+ ::
618
+
619
+ sage: # needs sage.rings.number_field
620
+ sage: x = polygen(ZZ, 'x')
621
+ sage: K.<a> = NumberField(x^3 - 2)
622
+ sage: P17a, P17b = [P for P,e in K.factor(17)]
623
+ sage: E = EllipticCurve([0, 0, 0, 0, 2*a+1])
624
+ sage: [(p,E .local_data(p).has_split_multiplicative_reduction())
625
+ ....: for p in [P17a,P17b]]
626
+ [(Fractional ideal (4*a^2 - 2*a + 1), False),
627
+ (Fractional ideal (2*a + 1), False)]
628
+ """
629
+ return self._reduction_type == 1
630
+
631
+ def has_nonsplit_multiplicative_reduction(self) -> bool:
632
+ r"""
633
+ Return ``True`` if there is non-split multiplicative reduction.
634
+
635
+ EXAMPLES::
636
+
637
+ sage: E = EllipticCurve('14a1')
638
+ sage: [(p, E.local_data(p).has_nonsplit_multiplicative_reduction())
639
+ ....: for p in prime_range(15)]
640
+ [(2, True), (3, False), (5, False), (7, False), (11, False), (13, False)]
641
+
642
+ ::
643
+
644
+ sage: # needs sage.rings.number_field
645
+ sage: x = polygen(ZZ, 'x')
646
+ sage: K.<a> = NumberField(x^3 - 2)
647
+ sage: P17a, P17b = [P for P,e in K.factor(17)]
648
+ sage: E = EllipticCurve([0, 0, 0, 0, 2*a+1])
649
+ sage: [(p, E.local_data(p).has_nonsplit_multiplicative_reduction())
650
+ ....: for p in [P17a,P17b]]
651
+ [(Fractional ideal (4*a^2 - 2*a + 1), False), (Fractional ideal (2*a + 1), False)]
652
+ """
653
+ return self._reduction_type == -1
654
+
655
+ def has_additive_reduction(self) -> bool:
656
+ r"""
657
+ Return ``True`` if there is additive reduction.
658
+
659
+ EXAMPLES::
660
+
661
+ sage: E = EllipticCurve('27a1')
662
+ sage: [(p, E.local_data(p).has_additive_reduction()) for p in prime_range(15)]
663
+ [(2, False), (3, True), (5, False), (7, False), (11, False), (13, False)]
664
+
665
+ ::
666
+
667
+ sage: # needs sage.rings.number_field
668
+ sage: x = polygen(ZZ, 'x')
669
+ sage: K.<a> = NumberField(x^3 - 2)
670
+ sage: P17a, P17b = [P for P,e in K.factor(17)]
671
+ sage: E = EllipticCurve([0, 0, 0, 0, 2*a+1])
672
+ sage: [(p, E.local_data(p).has_additive_reduction()) for p in [P17a,P17b]]
673
+ [(Fractional ideal (4*a^2 - 2*a + 1), False),
674
+ (Fractional ideal (2*a + 1), True)]
675
+ """
676
+ return self._reduction_type == 0
677
+
678
+ def _tate(self, proof=None, globally=False):
679
+ r"""
680
+ Tate's algorithm for an elliptic curve over a number field.
681
+
682
+ This computes both local reduction data at a prime ideal and a
683
+ local minimal model.
684
+
685
+ The model is not required to be integral on input. If `P` is
686
+ principal, uses a generator as uniformizer, so it will not
687
+ affect integrality or minimality at other primes. If `P` is not
688
+ principal, the minimal model returned will preserve
689
+ integrality at other primes, but not minimality.
690
+
691
+ The optional argument globally, when set to True, tells the algorithm to use the generator of the prime ideal if it is principal. Otherwise just any uniformizer will be used.
692
+
693
+ .. NOTE::
694
+
695
+ Called only by ``EllipticCurveLocalData.__init__()``.
696
+
697
+ OUTPUT:
698
+
699
+ (tuple) ``(Emin, p, val_disc, fp, KS, cp)`` where:
700
+
701
+ - ``Emin`` -- :class:`EllipticCurve`; a model (integral and) minimal at P
702
+ - ``p`` -- integer; the residue characteristic
703
+ - ``val_disc`` -- integer; the valuation of the local minimal discriminant
704
+ - ``fp`` -- integer; the valuation of the conductor
705
+ - ``KS`` -- string; the Kodaira symbol
706
+ - ``cp`` -- integer; the Tamagawa number
707
+
708
+ EXAMPLES (this raised a type error in sage prior to 4.4.4, see :issue:`7930`) ::
709
+
710
+ sage: # needs sage.rings.number_field
711
+ sage: E = EllipticCurve('99d1')
712
+ sage: R.<X> = QQ[]
713
+ sage: K.<t> = NumberField(X^3 + X^2 - 2*X - 1)
714
+ sage: L.<s> = NumberField(X^3 + X^2 - 36*X - 4)
715
+ sage: EK = E.base_extend(K)
716
+ sage: toK = EK.torsion_order()
717
+ sage: da = EK.local_data() # indirect doctest
718
+ sage: EL = E.base_extend(L)
719
+ sage: da = EL.local_data() # indirect doctest
720
+
721
+ EXAMPLES:
722
+
723
+ The following example shows that the bug at :issue:`9324` is fixed::
724
+
725
+ sage: # needs sage.rings.number_field
726
+ sage: x = polygen(ZZ, 'x')
727
+ sage: K.<a> = NumberField(x^2 - x + 6)
728
+ sage: E = EllipticCurve([0,0,0,-53160*a-43995,-5067640*a+19402006])
729
+ sage: E.conductor() # indirect doctest
730
+ Fractional ideal (18, 6*a)
731
+
732
+ The following example shows that the bug at :issue:`9417` is fixed::
733
+
734
+ sage: # needs sage.rings.number_field
735
+ sage: K.<a> = NumberField(x^2 + 18*x + 1)
736
+ sage: E = EllipticCurve(K, [0, -36, 0, 320, 0])
737
+ sage: E.tamagawa_number(K.ideal(2))
738
+ 4
739
+
740
+ This is to show that the bug :issue:`11630` is fixed. (The computation of the class group would produce a warning)::
741
+
742
+ sage: # needs sage.rings.number_field
743
+ sage: K.<t> = NumberField(x^7 - 2*x + 177)
744
+ sage: E = EllipticCurve([0,1,0,t,t])
745
+ sage: P = K.ideal(2, t^3 + t + 1)
746
+ sage: E.local_data(P).kodaira_symbol()
747
+ II
748
+ """
749
+ E = self._curve
750
+ P = self._prime
751
+ K = E.base_ring()
752
+ OK = K.maximal_order()
753
+ t = verbose("Running Tate's algorithm with P = %s" % P, level=1)
754
+ F = OK.residue_field(P)
755
+ p = F.characteristic()
756
+
757
+ # In case P is not principal we mostly use a uniformiser which
758
+ # is globally integral (with positive valuation at some other
759
+ # primes); for this to work, it is essential that we can
760
+ # reduce (mod P) elements of K which are not integral (but are
761
+ # P-integral). However, if the model is non-minimal and we
762
+ # end up dividing a_i by pi^i then at that point we use a
763
+ # uniformiser pi which has nonpositive valuation at all other
764
+ # primes, so that we can divide by it without losing
765
+ # integrality at other primes.
766
+
767
+ if globally:
768
+ principal_flag = P.is_principal()
769
+ else:
770
+ principal_flag = False
771
+
772
+ if (K is QQ) or principal_flag:
773
+ pi = P.gens_reduced()[0]
774
+ verbose("P is principal, generator pi = %s" % pi, t, 1)
775
+ else:
776
+ pi = K.uniformizer(P, 'positive')
777
+ verbose("uniformizer pi = %s" % pi, t, 1)
778
+ pi2 = pi * pi
779
+ pi3 = pi * pi2
780
+ pi4 = pi * pi3
781
+ pi_neg = None
782
+ prime = pi if K is QQ else P
783
+
784
+ pval = lambda x: x.valuation(prime)
785
+ pdiv = lambda x: x.is_zero() or pval(x) > 0
786
+ # Since ResidueField is cached in a way that
787
+ # does not care much about embeddings of number
788
+ # fields, it can happen that F.p.ring() is different
789
+ # from K. This is a problem: If F.p.ring() has no
790
+ # embedding but K has, then there is no coercion
791
+ # from F.p.ring().maximal_order() to K. But it is
792
+ # no problem to do an explicit conversion in that
793
+ # case (Simon King, github issue #8800).
794
+
795
+ from sage.categories.pushout import pushout, CoercionException
796
+ try:
797
+ if hasattr(F.p.ring(), 'maximal_order'): # it is not ZZ
798
+ pushout(F.p.ring().maximal_order(), K)
799
+ pinv = lambda x: F.lift(~F(x))
800
+ proot = lambda x,e: F.lift(F(x).nth_root(e, extend=False, all=True)[0])
801
+ preduce = lambda x: F.lift(F(x))
802
+ except CoercionException: # the pushout does not exist, we need conversion
803
+ pinv = lambda x: K(F.lift(~F(x)))
804
+ proot = lambda x,e: K(F.lift(F(x).nth_root(e, extend=False, all=True)[0]))
805
+ preduce = lambda x: K(F.lift(F(x)))
806
+
807
+ def _pquadroots(a, b, c):
808
+ r"""
809
+ Local function returning ``True`` iff `ax^2 + bx + c` has roots
810
+ modulo `P`.
811
+ """
812
+ (a, b, c) = (F(a), F(b), F(c))
813
+ if a == 0:
814
+ return (b != 0) or (c == 0)
815
+ elif p == 2:
816
+ return len(PolynomialRing(F, "x")([c,b,a]).roots()) > 0
817
+ else:
818
+ return (b**2 - 4*a*c).is_square()
819
+
820
+ def _pcubicroots(b, c, d):
821
+ r"""
822
+ Local function returning the number of roots of `x^3 +
823
+ b*x^2 + c*x + d` modulo `P`, counting multiplicities
824
+ """
825
+
826
+ return sum([rr[1] for rr in PolynomialRing(F, 'x')([F(d), F(c), F(b), F(1)]).roots()],0)
827
+
828
+ if p == 2:
829
+ halfmodp = OK(Integer(0))
830
+ else:
831
+ halfmodp = pinv(Integer(2))
832
+
833
+ A = E.a_invariants()
834
+ A = [0, A[0], A[1], A[2], A[3], 0, A[4]]
835
+ indices = [1,2,3,4,6]
836
+ if min([pval(a) for a in A if a != 0]) < 0:
837
+ verbose("Non-integral model at P: valuations are %s; making integral" % ([pval(a) for a in A if a != 0]), t, 1)
838
+ e = 0
839
+ for i in range(7):
840
+ if A[i] != 0:
841
+ e = max(e, (-pval(A[i])/i).ceil())
842
+ pie = pi**e
843
+ for i in range(7):
844
+ if A[i] != 0:
845
+ A[i] *= pie**i
846
+ verbose("P-integral model is %s, with valuations %s" % ([A[i] for i in indices], [pval(A[i]) for i in indices]), t, 1)
847
+
848
+ split = None # only relevant for multiplicative reduction
849
+
850
+ (a1, a2, a3, a4, a6) = (A[1], A[2], A[3], A[4], A[6])
851
+ while True:
852
+ C = EllipticCurve([a1, a2, a3, a4, a6])
853
+ (b2, b4, b6, b8) = C.b_invariants()
854
+ (c4, c6) = C.c_invariants()
855
+ delta = C.discriminant()
856
+ val_disc = pval(delta)
857
+
858
+ if val_disc == 0:
859
+ ## Good reduction already
860
+ cp = 1
861
+ fp = 0
862
+ KS = KodairaSymbol("I0")
863
+ break #return
864
+
865
+ # Otherwise, we change coordinates so that p | a3, a4, a6
866
+ if p == 2:
867
+ if pdiv(b2):
868
+ r = proot(a4, 2)
869
+ t = proot(((r + a2)*r + a4)*r + a6, 2)
870
+ else:
871
+ temp = pinv(a1)
872
+ r = temp * a3
873
+ t = temp * (a4 + r*r)
874
+ elif p == 3:
875
+ if pdiv(b2):
876
+ r = proot(-b6, 3)
877
+ else:
878
+ r = -pinv(b2) * b4
879
+ t = a1 * r + a3
880
+ else:
881
+ if pdiv(c4):
882
+ r = -pinv(12) * b2
883
+ else:
884
+ r = -pinv(12*c4) * (c6 + b2 * c4)
885
+ t = -halfmodp * (a1 * r + a3)
886
+ r = preduce(r)
887
+ t = preduce(t)
888
+ verbose("Before first transform C = %s" % C)
889
+ verbose("[a1,a2,a3,a4,a6] = %s" % ([a1, a2, a3, a4, a6]))
890
+ C = C.rst_transform(r, 0, t)
891
+ (a1, a2, a3, a4, a6) = C.a_invariants()
892
+ (b2, b4, b6, b8) = C.b_invariants()
893
+ if min([pval(a) for a in (a1, a2, a3, a4, a6) if a != 0]) < 0:
894
+ raise RuntimeError("Non-integral model after first transform!")
895
+ verbose("After first transform %s\n, [a1,a2,a3,a4,a6] = %s\n, valuations = %s" % ([r, 0, t], [a1, a2, a3, a4, a6], [pval(a1), pval(a2), pval(a3), pval(a4), pval(a6)]), t, 2)
896
+ if pval(a3) == 0:
897
+ raise RuntimeError("p does not divide a3 after first transform!")
898
+ if pval(a4) == 0:
899
+ raise RuntimeError("p does not divide a4 after first transform!")
900
+ if pval(a6) == 0:
901
+ raise RuntimeError("p does not divide a6 after first transform!")
902
+
903
+ # Now we test for Types In, II, III, IV
904
+ # NB the c invariants never change.
905
+
906
+ if not pdiv(c4):
907
+ # Multiplicative reduction: Type In (n = val_disc)
908
+ split = False
909
+ if _pquadroots(1, a1, -a2):
910
+ cp = val_disc
911
+ split = True
912
+ elif Integer(2).divides(val_disc):
913
+ cp = 2
914
+ else:
915
+ cp = 1
916
+ KS = KodairaSymbol("I%s" % val_disc)
917
+ fp = 1
918
+ break #return
919
+
920
+ # Additive reduction
921
+
922
+ if pval(a6) < 2:
923
+ ## Type II
924
+ KS = KodairaSymbol("II")
925
+ fp = val_disc
926
+ cp = 1
927
+ break #return
928
+ if pval(b8) < 3:
929
+ ## Type III
930
+ KS = KodairaSymbol("III")
931
+ fp = val_disc - 1
932
+ cp = 2
933
+ break #return
934
+ if pval(b6) < 3:
935
+ ## Type IV
936
+ cp = 1
937
+ a3t = preduce(a3/pi)
938
+ a6t = preduce(a6/pi2)
939
+ if _pquadroots(1, a3t, -a6t):
940
+ cp = 3
941
+ KS = KodairaSymbol("IV")
942
+ fp = val_disc - 2
943
+ break #return
944
+
945
+ # If our curve is none of these types, we change coords so that
946
+ # p | a1, a2; p^2 | a3, a4; p^3 | a6
947
+ if p == 2:
948
+ s = proot(a2, 2) # so s^2=a2 (mod pi)
949
+ t = pi*proot(a6/pi2, 2) # so t^2=a6 (mod pi^3)
950
+ elif p == 3:
951
+ s = a1 # so a1'=2s+a1=3a1=0 (mod pi)
952
+ t = a3 # so a3'=2t+a3=3a3=0 (mod pi^2)
953
+ else:
954
+ s = -a1*halfmodp # so a1'=2s+a1=0 (mod pi)
955
+ t = -a3*halfmodp # so a3'=2t+a3=0 (mod pi^2)
956
+ C = C.rst_transform(0, s, t)
957
+ (a1, a2, a3, a4, a6) = C.a_invariants()
958
+
959
+ verbose("After second transform %s\n[a1, a2, a3, a4, a6] = %s\nValuations: %s" % ([0, s, t], [a1,a2,a3,a4,a6],[pval(a1),pval(a2),pval(a3),pval(a4),pval(a6)]), t, 2)
960
+ if pval(a1) == 0:
961
+ raise RuntimeError("p does not divide a1 after second transform!")
962
+ if pval(a2) == 0:
963
+ raise RuntimeError("p does not divide a2 after second transform!")
964
+ if pval(a3) < 2:
965
+ raise RuntimeError("p^2 does not divide a3 after second transform!")
966
+ if pval(a4) < 2:
967
+ raise RuntimeError("p^2 does not divide a4 after second transform!")
968
+ if pval(a6) < 3:
969
+ raise RuntimeError("p^3 does not divide a6 after second transform!")
970
+ if min(pval(a1), pval(a2), pval(a3), pval(a4), pval(a6)) < 0:
971
+ raise RuntimeError("Non-integral model after second transform!")
972
+
973
+ # Analyze roots of the cubic T^3 + bT^2 + cT + d = 0 mod P, where
974
+ # b = a2/p, c = a4/p^2, d = a6/p^3
975
+ b = preduce(a2/pi)
976
+ c = preduce(a4/pi2)
977
+ d = preduce(a6/pi3)
978
+ bb = b*b
979
+ cc = c*c
980
+ bc = b*c
981
+ w = 27*d*d - bb*cc + 4*b*bb*d - 18*bc*d + 4*c*cc
982
+ x = 3*c - bb
983
+ if pdiv(w):
984
+ if pdiv(x):
985
+ sw = 3
986
+ else:
987
+ sw = 2
988
+ else:
989
+ sw = 1
990
+ verbose("Analyzing roots of cubic T^3 + %s*T^2 + %s*T + %s, case %s" % (b, c, d, sw), t, 1)
991
+ if sw == 1:
992
+ ## Three distinct roots - Type I*0
993
+ verbose("Distinct roots", t, 1)
994
+ KS = KodairaSymbol("I0*")
995
+ cp = 1 + _pcubicroots(b, c, d)
996
+ fp = val_disc - 4
997
+ break #return
998
+ elif sw == 2:
999
+ ## One double root - Type I*m for some m
1000
+ verbose("One double root", t, 1)
1001
+ ## Change coords so that the double root is T = 0 mod p
1002
+ if p == 2:
1003
+ r = proot(c, 2)
1004
+ elif p == 3:
1005
+ r = c * pinv(b)
1006
+ else:
1007
+ r = (bc - 9*d)*pinv(2*x)
1008
+ r = pi * preduce(r)
1009
+ C = C.rst_transform(r, 0, 0)
1010
+ (a1, a2, a3, a4, a6) = C.a_invariants()
1011
+
1012
+ # The rest of this branch is just to compute cp, fp, KS.
1013
+ # We use pi to keep transforms integral.
1014
+ ix = 3
1015
+ iy = 3
1016
+ mx = pi2
1017
+ my = mx
1018
+ while True:
1019
+ a2t = preduce(a2 / pi)
1020
+ a3t = preduce(a3 / my)
1021
+ a4t = preduce(a4 / (pi*mx))
1022
+ a6t = preduce(a6 / (mx*my))
1023
+ if pdiv(a3t*a3t + 4*a6t):
1024
+ if p == 2:
1025
+ t = my*proot(a6t, 2)
1026
+ else:
1027
+ t = my*preduce(-a3t*halfmodp)
1028
+ C = C.rst_transform(0, 0, t)
1029
+ (a1, a2, a3, a4, a6) = C.a_invariants()
1030
+
1031
+ my *= pi
1032
+ iy += 1
1033
+ a2t = preduce(a2 / pi)
1034
+ a3t = preduce(a3/my)
1035
+ a4t = preduce(a4/(pi*mx))
1036
+ a6t = preduce(a6/(mx*my))
1037
+ if pdiv(a4t*a4t - 4*a6t*a2t):
1038
+ if p == 2:
1039
+ r = mx*proot(a6t*pinv(a2t), 2)
1040
+ else:
1041
+ r = mx*preduce(-a4t*pinv(2*a2t))
1042
+ C = C.rst_transform(r, 0, 0)
1043
+ (a1, a2, a3, a4, a6) = C.a_invariants()
1044
+
1045
+ mx *= pi
1046
+ ix += 1 # and stay in loop
1047
+ else:
1048
+ if _pquadroots(a2t, a4t, a6t):
1049
+ cp = 4
1050
+ else:
1051
+ cp = 2
1052
+ break # exit loop
1053
+ else:
1054
+ if _pquadroots(1, a3t, -a6t):
1055
+ cp = 4
1056
+ else:
1057
+ cp = 2
1058
+ break
1059
+ KS = KodairaSymbol("I%s*" % (ix+iy-5))
1060
+ fp = val_disc - ix - iy + 1
1061
+ break #return
1062
+ else: # sw == 3
1063
+ ## The cubic has a triple root
1064
+ verbose("Triple root", t, 1)
1065
+ ## First we change coordinates so that T = 0 mod p
1066
+ if p == 2:
1067
+ r = b
1068
+ elif p == 3:
1069
+ r = proot(-d, 3)
1070
+ else:
1071
+ r = -b * pinv(3)
1072
+ r = pi*preduce(r)
1073
+ C = C.rst_transform(r, 0, 0)
1074
+ (a1, a2, a3, a4, a6) = C.a_invariants()
1075
+
1076
+ verbose("After third transform %s\n[a1,a2,a3,a4,a6] = %s\nValuations: %s" % ([r,0,0],[a1,a2,a3,a4,a6],[pval(ai) for ai in [a1,a2,a3,a4,a6]]), t, 2)
1077
+ if min(pval(ai) for ai in [a1,a2,a3,a4,a6]) < 0:
1078
+ raise RuntimeError("Non-integral model after third transform!")
1079
+ if pval(a2) < 2 or pval(a4) < 3 or pval(a6) < 4:
1080
+ raise RuntimeError("Cubic after transform does not have a triple root at 0")
1081
+ a3t = preduce(a3/pi2)
1082
+ a6t = preduce(a6/pi4)
1083
+ # We test for Type IV*
1084
+ if not pdiv(a3t*a3t + 4*a6t):
1085
+ cp = 3 if _pquadroots(1, a3t, -a6t) else 1
1086
+ KS = KodairaSymbol("IV*")
1087
+ fp = val_disc - 6
1088
+ break #return
1089
+ # Now change coordinates so that p^3|a3, p^5|a6
1090
+ if p == 2:
1091
+ t = -pi2*proot(a6t, 2)
1092
+ else:
1093
+ t = pi2*preduce(-a3t*halfmodp)
1094
+ C = C.rst_transform(0, 0, t)
1095
+ (a1, a2, a3, a4, a6) = C.a_invariants()
1096
+
1097
+ # We test for types III* and II*
1098
+ if pval(a4) < 4:
1099
+ ## Type III*
1100
+ KS = KodairaSymbol("III*")
1101
+ fp = val_disc - 7
1102
+ cp = 2
1103
+ break #return
1104
+ if pval(a6) < 6:
1105
+ ## Type II*
1106
+ KS = KodairaSymbol("II*")
1107
+ fp = val_disc - 8
1108
+ cp = 1
1109
+ break #return
1110
+ if pi_neg is None:
1111
+ if principal_flag:
1112
+ pi_neg = pi
1113
+ else:
1114
+ pi_neg = K.uniformizer(P, 'negative')
1115
+ pi_neg2 = pi_neg*pi_neg
1116
+ pi_neg3 = pi_neg*pi_neg2
1117
+ pi_neg4 = pi_neg*pi_neg3
1118
+ pi_neg6 = pi_neg4*pi_neg2
1119
+ a1 /= pi_neg
1120
+ a2 /= pi_neg2
1121
+ a3 /= pi_neg3
1122
+ a4 /= pi_neg4
1123
+ a6 /= pi_neg6
1124
+ verbose("Non-minimal equation, dividing out...\nNew model is %s" % ([a1, a2, a3, a4, a6]), t, 1)
1125
+ return (C, p, val_disc, fp, KS, cp, split)
1126
+
1127
+
1128
+ def check_prime(K, P):
1129
+ r"""
1130
+ Function to check that `P` determines a prime of `K`, and return that ideal.
1131
+
1132
+ INPUT:
1133
+
1134
+ - ``K`` -- a number field (including `\QQ`)
1135
+
1136
+ - ``P`` -- an element of ``K`` or a (fractional) ideal of ``K``
1137
+
1138
+ OUTPUT: if ``K`` is `\QQ`: the prime integer equal to or which generates `P`
1139
+
1140
+ - If ``K`` is not `\QQ`: the prime ideal equal to or generated by `P`.
1141
+
1142
+ .. NOTE::
1143
+
1144
+ If `P` is not a prime and does not generate a prime, a :exc:`TypeError`
1145
+ is raised.
1146
+
1147
+ EXAMPLES::
1148
+
1149
+ sage: from sage.schemes.elliptic_curves.ell_local_data import check_prime
1150
+ sage: check_prime(QQ, 3)
1151
+ 3
1152
+ sage: check_prime(QQ, QQ(3))
1153
+ 3
1154
+ sage: check_prime(QQ, ZZ.ideal(31))
1155
+ 31
1156
+
1157
+ sage: # needs sage.rings.number_field
1158
+ sage: x = polygen(ZZ, 'x')
1159
+ sage: K.<a> = NumberField(x^2 - 5)
1160
+ sage: check_prime(K, a)
1161
+ Fractional ideal (a)
1162
+ sage: check_prime(K, a + 1)
1163
+ Fractional ideal (a + 1)
1164
+ sage: [check_prime(K, P) for P in K.primes_above(31)]
1165
+ [Fractional ideal (-5/2*a - 1/2), Fractional ideal (-5/2*a + 1/2)]
1166
+ sage: L.<b> = NumberField(x^2 + 3)
1167
+ sage: check_prime(K, L.ideal(5))
1168
+ Traceback (most recent call last):
1169
+ ...
1170
+ TypeError: The ideal Fractional ideal (5) is not a prime ideal of
1171
+ Number Field in a with defining polynomial x^2 - 5
1172
+ sage: check_prime(K, L.ideal(b))
1173
+ Traceback (most recent call last):
1174
+ ...
1175
+ TypeError: No compatible natural embeddings found for
1176
+ Number Field in a with defining polynomial x^2 - 5 and
1177
+ Number Field in b with defining polynomial x^2 + 3
1178
+ """
1179
+ if K is QQ:
1180
+ if P in ZZ or isinstance(P, (Integer, int)):
1181
+ P = Integer(P)
1182
+ if P.is_prime():
1183
+ return P
1184
+ else:
1185
+ raise TypeError("The element %s is not prime" % (P,))
1186
+ elif P in QQ:
1187
+ raise TypeError("The element %s is not prime" % (P,))
1188
+ elif isinstance(P, Ideal_generic) and P.base_ring() is ZZ:
1189
+ if P.is_prime():
1190
+ return P.gen()
1191
+ else:
1192
+ raise TypeError("The ideal %s is not a prime ideal of %s" % (P, ZZ))
1193
+ else:
1194
+ raise TypeError("%s is neither an element of QQ or an ideal of %s" % (P, ZZ))
1195
+
1196
+ if not isinstance(K, NumberField):
1197
+ raise TypeError("%s is not a number field" % (K,))
1198
+
1199
+ if isinstance(P, NumberFieldFractionalIdeal) or P in K:
1200
+ # if P is an ideal, making sure it is a fractional ideal of K
1201
+ P = K.fractional_ideal(P)
1202
+ if P.is_prime():
1203
+ return P
1204
+ else:
1205
+ raise TypeError("The ideal %s is not a prime ideal of %s" % (P, K))
1206
+
1207
+ raise TypeError("%s is not a valid prime of %s" % (P, K))