passagemath-schemes 10.8.1a4__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.
Files changed (312) 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.8.1a4.dist-info/METADATA +203 -0
  7. passagemath_schemes-10.8.1a4.dist-info/METADATA.bak +204 -0
  8. passagemath_schemes-10.8.1a4.dist-info/RECORD +312 -0
  9. passagemath_schemes-10.8.1a4.dist-info/WHEEL +6 -0
  10. passagemath_schemes-10.8.1a4.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 +9556 -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 +2578 -0
  27. sage/lfunctions/all.py +18 -0
  28. sage/lfunctions/dokchitser.py +727 -0
  29. sage/lfunctions/pari.py +971 -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 +5132 -0
  33. sage/modular/abvar/abvar_ambient_jacobian.py +414 -0
  34. sage/modular/abvar/abvar_newform.py +246 -0
  35. sage/modular/abvar/all.py +8 -0
  36. sage/modular/abvar/constructor.py +187 -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 +721 -0
  40. sage/modular/abvar/homspace.py +989 -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 +741 -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 +1406 -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 +361 -0
  54. sage/modular/arithgroup/congroup_gamma0.py +692 -0
  55. sage/modular/arithgroup/congroup_gamma1.py +659 -0
  56. sage/modular/arithgroup/congroup_gammaH.py +1491 -0
  57. sage/modular/arithgroup/congroup_generic.py +630 -0
  58. sage/modular/arithgroup/congroup_sl2z.py +266 -0
  59. sage/modular/arithgroup/farey_symbol.cpython-314t-darwin.so +0 -0
  60. sage/modular/arithgroup/farey_symbol.pyx +1067 -0
  61. sage/modular/arithgroup/tests.py +425 -0
  62. sage/modular/btquotients/all.py +4 -0
  63. sage/modular/btquotients/btquotient.py +3736 -0
  64. sage/modular/btquotients/pautomorphicform.py +2564 -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 +1107 -0
  69. sage/modular/cusps_nf.py +1270 -0
  70. sage/modular/dims.py +571 -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 +1076 -0
  77. sage/modular/hecke/algebra.py +725 -0
  78. sage/modular/hecke/all.py +19 -0
  79. sage/modular/hecke/ambient_module.py +994 -0
  80. sage/modular/hecke/degenmap.py +119 -0
  81. sage/modular/hecke/element.py +302 -0
  82. sage/modular/hecke/hecke_operator.py +736 -0
  83. sage/modular/hecke/homspace.py +185 -0
  84. sage/modular/hecke/module.py +1744 -0
  85. sage/modular/hecke/morphism.py +139 -0
  86. sage/modular/hecke/submodule.py +970 -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 +2020 -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 +1070 -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 +817 -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 +120 -0
  101. sage/modular/modform/ambient_g1.py +199 -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 +487 -0
  106. sage/modular/modform/eisenstein_submodule.py +663 -0
  107. sage/modular/modform/element.py +4105 -0
  108. sage/modular/modform/half_integral.py +154 -0
  109. sage/modular/modform/hecke_operator_on_qexp.py +247 -0
  110. sage/modular/modform/j_invariant.py +47 -0
  111. sage/modular/modform/l_series_gross_zagier.py +127 -0
  112. sage/modular/modform/l_series_gross_zagier_coeffs.cpython-314t-darwin.so +0 -0
  113. sage/modular/modform/l_series_gross_zagier_coeffs.pyx +177 -0
  114. sage/modular/modform/notes.py +45 -0
  115. sage/modular/modform/numerical.py +514 -0
  116. sage/modular/modform/periods.py +14 -0
  117. sage/modular/modform/ring.py +1257 -0
  118. sage/modular/modform/space.py +1859 -0
  119. sage/modular/modform/submodule.py +118 -0
  120. sage/modular/modform/tests.py +64 -0
  121. sage/modular/modform/theta.py +110 -0
  122. sage/modular/modform/vm_basis.py +380 -0
  123. sage/modular/modform/weight1.py +221 -0
  124. sage/modular/modform_hecketriangle/abstract_ring.py +1932 -0
  125. sage/modular/modform_hecketriangle/abstract_space.py +2527 -0
  126. sage/modular/modform_hecketriangle/all.py +30 -0
  127. sage/modular/modform_hecketriangle/analytic_type.py +590 -0
  128. sage/modular/modform_hecketriangle/constructor.py +416 -0
  129. sage/modular/modform_hecketriangle/element.py +351 -0
  130. sage/modular/modform_hecketriangle/functors.py +752 -0
  131. sage/modular/modform_hecketriangle/graded_ring.py +541 -0
  132. sage/modular/modform_hecketriangle/graded_ring_element.py +2225 -0
  133. sage/modular/modform_hecketriangle/hecke_triangle_group_element.py +3349 -0
  134. sage/modular/modform_hecketriangle/hecke_triangle_groups.py +1426 -0
  135. sage/modular/modform_hecketriangle/readme.py +1214 -0
  136. sage/modular/modform_hecketriangle/series_constructor.py +580 -0
  137. sage/modular/modform_hecketriangle/space.py +1037 -0
  138. sage/modular/modform_hecketriangle/subspace.py +423 -0
  139. sage/modular/modsym/all.py +17 -0
  140. sage/modular/modsym/ambient.py +3844 -0
  141. sage/modular/modsym/boundary.py +1420 -0
  142. sage/modular/modsym/element.py +336 -0
  143. sage/modular/modsym/g1list.py +178 -0
  144. sage/modular/modsym/ghlist.py +182 -0
  145. sage/modular/modsym/hecke_operator.py +73 -0
  146. sage/modular/modsym/manin_symbol.cpython-314t-darwin.so +0 -0
  147. sage/modular/modsym/manin_symbol.pxd +5 -0
  148. sage/modular/modsym/manin_symbol.pyx +497 -0
  149. sage/modular/modsym/manin_symbol_list.py +1291 -0
  150. sage/modular/modsym/modsym.py +400 -0
  151. sage/modular/modsym/modular_symbols.py +384 -0
  152. sage/modular/modsym/p1list_nf.py +1241 -0
  153. sage/modular/modsym/relation_matrix.py +591 -0
  154. sage/modular/modsym/relation_matrix_pyx.cpython-314t-darwin.so +0 -0
  155. sage/modular/modsym/relation_matrix_pyx.pyx +108 -0
  156. sage/modular/modsym/space.py +2468 -0
  157. sage/modular/modsym/subspace.py +455 -0
  158. sage/modular/modsym/tests.py +376 -0
  159. sage/modular/multiple_zeta.py +2635 -0
  160. sage/modular/multiple_zeta_F_algebra.py +789 -0
  161. sage/modular/overconvergent/all.py +6 -0
  162. sage/modular/overconvergent/genus0.py +1879 -0
  163. sage/modular/overconvergent/hecke_series.py +1187 -0
  164. sage/modular/overconvergent/weightspace.py +776 -0
  165. sage/modular/pollack_stevens/all.py +4 -0
  166. sage/modular/pollack_stevens/distributions.py +874 -0
  167. sage/modular/pollack_stevens/fund_domain.py +1572 -0
  168. sage/modular/pollack_stevens/manin_map.py +856 -0
  169. sage/modular/pollack_stevens/modsym.py +1590 -0
  170. sage/modular/pollack_stevens/padic_lseries.py +417 -0
  171. sage/modular/pollack_stevens/sigma0.py +534 -0
  172. sage/modular/pollack_stevens/space.py +1078 -0
  173. sage/modular/quasimodform/all.py +3 -0
  174. sage/modular/quasimodform/element.py +846 -0
  175. sage/modular/quasimodform/ring.py +826 -0
  176. sage/modular/quatalg/all.py +3 -0
  177. sage/modular/quatalg/brandt.py +1642 -0
  178. sage/modular/ssmod/all.py +8 -0
  179. sage/modular/ssmod/ssmod.py +827 -0
  180. sage/rings/all__sagemath_schemes.py +1 -0
  181. sage/rings/polynomial/all__sagemath_schemes.py +1 -0
  182. sage/rings/polynomial/binary_form_reduce.py +585 -0
  183. sage/schemes/all.py +41 -0
  184. sage/schemes/berkovich/all.py +6 -0
  185. sage/schemes/berkovich/berkovich_cp_element.py +2582 -0
  186. sage/schemes/berkovich/berkovich_space.py +700 -0
  187. sage/schemes/curves/affine_curve.py +2924 -0
  188. sage/schemes/curves/all.py +33 -0
  189. sage/schemes/curves/closed_point.py +434 -0
  190. sage/schemes/curves/constructor.py +397 -0
  191. sage/schemes/curves/curve.py +542 -0
  192. sage/schemes/curves/plane_curve_arrangement.py +1283 -0
  193. sage/schemes/curves/point.py +463 -0
  194. sage/schemes/curves/projective_curve.py +3203 -0
  195. sage/schemes/curves/weighted_projective_curve.py +106 -0
  196. sage/schemes/curves/zariski_vankampen.py +1931 -0
  197. sage/schemes/cyclic_covers/all.py +2 -0
  198. sage/schemes/cyclic_covers/charpoly_frobenius.py +320 -0
  199. sage/schemes/cyclic_covers/constructor.py +137 -0
  200. sage/schemes/cyclic_covers/cycliccover_finite_field.py +1309 -0
  201. sage/schemes/cyclic_covers/cycliccover_generic.py +310 -0
  202. sage/schemes/elliptic_curves/BSD.py +991 -0
  203. sage/schemes/elliptic_curves/Qcurves.py +592 -0
  204. sage/schemes/elliptic_curves/addition_formulas_ring.py +94 -0
  205. sage/schemes/elliptic_curves/all.py +49 -0
  206. sage/schemes/elliptic_curves/cardinality.py +609 -0
  207. sage/schemes/elliptic_curves/cm.py +1103 -0
  208. sage/schemes/elliptic_curves/constructor.py +1530 -0
  209. sage/schemes/elliptic_curves/ec_database.py +175 -0
  210. sage/schemes/elliptic_curves/ell_curve_isogeny.py +3971 -0
  211. sage/schemes/elliptic_curves/ell_egros.py +457 -0
  212. sage/schemes/elliptic_curves/ell_field.py +2837 -0
  213. sage/schemes/elliptic_curves/ell_finite_field.py +3249 -0
  214. sage/schemes/elliptic_curves/ell_generic.py +3760 -0
  215. sage/schemes/elliptic_curves/ell_local_data.py +1207 -0
  216. sage/schemes/elliptic_curves/ell_modular_symbols.py +775 -0
  217. sage/schemes/elliptic_curves/ell_number_field.py +4220 -0
  218. sage/schemes/elliptic_curves/ell_padic_field.py +107 -0
  219. sage/schemes/elliptic_curves/ell_point.py +4944 -0
  220. sage/schemes/elliptic_curves/ell_rational_field.py +7184 -0
  221. sage/schemes/elliptic_curves/ell_tate_curve.py +671 -0
  222. sage/schemes/elliptic_curves/ell_torsion.py +436 -0
  223. sage/schemes/elliptic_curves/ell_wp.py +352 -0
  224. sage/schemes/elliptic_curves/formal_group.py +760 -0
  225. sage/schemes/elliptic_curves/gal_reps.py +1459 -0
  226. sage/schemes/elliptic_curves/gal_reps_number_field.py +1663 -0
  227. sage/schemes/elliptic_curves/gp_simon.py +152 -0
  228. sage/schemes/elliptic_curves/heegner.py +7328 -0
  229. sage/schemes/elliptic_curves/height.py +2108 -0
  230. sage/schemes/elliptic_curves/hom.py +1788 -0
  231. sage/schemes/elliptic_curves/hom_composite.py +1084 -0
  232. sage/schemes/elliptic_curves/hom_fractional.py +544 -0
  233. sage/schemes/elliptic_curves/hom_frobenius.py +522 -0
  234. sage/schemes/elliptic_curves/hom_scalar.py +531 -0
  235. sage/schemes/elliptic_curves/hom_sum.py +681 -0
  236. sage/schemes/elliptic_curves/hom_velusqrt.py +1290 -0
  237. sage/schemes/elliptic_curves/homset.py +271 -0
  238. sage/schemes/elliptic_curves/isogeny_class.py +1523 -0
  239. sage/schemes/elliptic_curves/isogeny_small_degree.py +2797 -0
  240. sage/schemes/elliptic_curves/jacobian.py +247 -0
  241. sage/schemes/elliptic_curves/kodaira_symbol.py +344 -0
  242. sage/schemes/elliptic_curves/kraus.py +1014 -0
  243. sage/schemes/elliptic_curves/lseries_ell.py +915 -0
  244. sage/schemes/elliptic_curves/mod5family.py +105 -0
  245. sage/schemes/elliptic_curves/mod_poly.py +197 -0
  246. sage/schemes/elliptic_curves/mod_sym_num.cpython-314t-darwin.so +0 -0
  247. sage/schemes/elliptic_curves/mod_sym_num.pyx +3796 -0
  248. sage/schemes/elliptic_curves/modular_parametrization.py +305 -0
  249. sage/schemes/elliptic_curves/padic_lseries.py +1793 -0
  250. sage/schemes/elliptic_curves/padics.py +1816 -0
  251. sage/schemes/elliptic_curves/period_lattice.py +2234 -0
  252. sage/schemes/elliptic_curves/period_lattice_region.cpython-314t-darwin.so +0 -0
  253. sage/schemes/elliptic_curves/period_lattice_region.pyx +722 -0
  254. sage/schemes/elliptic_curves/saturation.py +716 -0
  255. sage/schemes/elliptic_curves/sha_tate.py +1158 -0
  256. sage/schemes/elliptic_curves/weierstrass_morphism.py +1117 -0
  257. sage/schemes/elliptic_curves/weierstrass_transform.py +200 -0
  258. sage/schemes/hyperelliptic_curves/all.py +6 -0
  259. sage/schemes/hyperelliptic_curves/constructor.py +369 -0
  260. sage/schemes/hyperelliptic_curves/hyperelliptic_finite_field.py +1948 -0
  261. sage/schemes/hyperelliptic_curves/hyperelliptic_g2.py +192 -0
  262. sage/schemes/hyperelliptic_curves/hyperelliptic_generic.py +936 -0
  263. sage/schemes/hyperelliptic_curves/hyperelliptic_padic_field.py +1332 -0
  264. sage/schemes/hyperelliptic_curves/hyperelliptic_rational_field.py +84 -0
  265. sage/schemes/hyperelliptic_curves/invariants.py +410 -0
  266. sage/schemes/hyperelliptic_curves/jacobian_endomorphism_utils.py +312 -0
  267. sage/schemes/hyperelliptic_curves/jacobian_g2.py +32 -0
  268. sage/schemes/hyperelliptic_curves/jacobian_generic.py +437 -0
  269. sage/schemes/hyperelliptic_curves/jacobian_homset.py +186 -0
  270. sage/schemes/hyperelliptic_curves/jacobian_morphism.py +878 -0
  271. sage/schemes/hyperelliptic_curves/kummer_surface.py +99 -0
  272. sage/schemes/hyperelliptic_curves/mestre.py +302 -0
  273. sage/schemes/hyperelliptic_curves/monsky_washnitzer.py +3863 -0
  274. sage/schemes/jacobians/abstract_jacobian.py +277 -0
  275. sage/schemes/jacobians/all.py +2 -0
  276. sage/schemes/overview.py +161 -0
  277. sage/schemes/plane_conics/all.py +22 -0
  278. sage/schemes/plane_conics/con_field.py +1296 -0
  279. sage/schemes/plane_conics/con_finite_field.py +158 -0
  280. sage/schemes/plane_conics/con_number_field.py +456 -0
  281. sage/schemes/plane_conics/con_rational_field.py +406 -0
  282. sage/schemes/plane_conics/con_rational_function_field.py +581 -0
  283. sage/schemes/plane_conics/constructor.py +249 -0
  284. sage/schemes/plane_quartics/all.py +2 -0
  285. sage/schemes/plane_quartics/quartic_constructor.py +71 -0
  286. sage/schemes/plane_quartics/quartic_generic.py +53 -0
  287. sage/schemes/riemann_surfaces/all.py +1 -0
  288. sage/schemes/riemann_surfaces/riemann_surface.py +4177 -0
  289. sage_wheels/share/cremona/cremona_mini.db +0 -0
  290. sage_wheels/share/ellcurves/rank0 +30427 -0
  291. sage_wheels/share/ellcurves/rank1 +31871 -0
  292. sage_wheels/share/ellcurves/rank10 +6 -0
  293. sage_wheels/share/ellcurves/rank11 +6 -0
  294. sage_wheels/share/ellcurves/rank12 +1 -0
  295. sage_wheels/share/ellcurves/rank14 +1 -0
  296. sage_wheels/share/ellcurves/rank15 +1 -0
  297. sage_wheels/share/ellcurves/rank17 +1 -0
  298. sage_wheels/share/ellcurves/rank19 +1 -0
  299. sage_wheels/share/ellcurves/rank2 +2388 -0
  300. sage_wheels/share/ellcurves/rank20 +1 -0
  301. sage_wheels/share/ellcurves/rank21 +1 -0
  302. sage_wheels/share/ellcurves/rank22 +1 -0
  303. sage_wheels/share/ellcurves/rank23 +1 -0
  304. sage_wheels/share/ellcurves/rank24 +1 -0
  305. sage_wheels/share/ellcurves/rank28 +1 -0
  306. sage_wheels/share/ellcurves/rank3 +836 -0
  307. sage_wheels/share/ellcurves/rank4 +10 -0
  308. sage_wheels/share/ellcurves/rank5 +5 -0
  309. sage_wheels/share/ellcurves/rank6 +5 -0
  310. sage_wheels/share/ellcurves/rank7 +5 -0
  311. sage_wheels/share/ellcurves/rank8 +6 -0
  312. sage_wheels/share/ellcurves/rank9 +7 -0
@@ -0,0 +1,936 @@
1
+ # sage_setup: distribution = sagemath-schemes
2
+ """
3
+ Hyperelliptic curves over a general ring
4
+
5
+ EXAMPLES::
6
+
7
+ sage: P.<x> = GF(5)[]
8
+ sage: f = x^5 - 3*x^4 - 2*x^3 + 6*x^2 + 3*x - 1
9
+ sage: C = HyperellipticCurve(f); C
10
+ Hyperelliptic Curve over Finite Field of size 5
11
+ defined by y^2 = x^5 + 2*x^4 + 3*x^3 + x^2 + 3*x + 4
12
+
13
+ ::
14
+
15
+ sage: P.<x> = QQ[]
16
+ sage: f = 4*x^5 - 30*x^3 + 45*x - 22
17
+ sage: C = HyperellipticCurve(f); C
18
+ Hyperelliptic Curve over Rational Field defined by y^2 = 4*x^5 - 30*x^3 + 45*x - 22
19
+ sage: C.genus()
20
+ 2
21
+
22
+ sage: D = C.affine_patch(0)
23
+ sage: D.defining_polynomials()[0].parent()
24
+ Multivariate Polynomial Ring in x1, x2 over Rational Field
25
+ """
26
+
27
+ #*****************************************************************************
28
+ # Copyright (C) 2006 David Kohel <kohel@maths.usyd.edu>
29
+ #
30
+ # This program is free software: you can redistribute it and/or modify
31
+ # it under the terms of the GNU General Public License as published by
32
+ # the Free Software Foundation, either version 2 of the License, or
33
+ # (at your option) any later version.
34
+ # http://www.gnu.org/licenses/
35
+ #*****************************************************************************
36
+
37
+ import sage.schemes.curves.projective_curve as plane_curve
38
+
39
+ from sage.misc.lazy_import import lazy_import
40
+ from sage.rings.big_oh import O
41
+ from sage.rings.laurent_series_ring import LaurentSeriesRing
42
+ from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
43
+ from sage.rings.power_series_ring import PowerSeriesRing
44
+ from sage.rings.real_mpfr import RR
45
+ from sage.structure.category_object import normalize_names
46
+
47
+ lazy_import("sage.functions.all", "log")
48
+
49
+
50
+ class HyperellipticCurve_generic(plane_curve.ProjectivePlaneCurve):
51
+ """
52
+ TESTS::
53
+
54
+ sage: P.<x> = QQ[]
55
+ sage: f0 = 4*x^5 - 30*x^3 + 45*x - 22
56
+ sage: C0 = HyperellipticCurve(f0)
57
+ sage: f1 = x^5 - x^3 + x - 22
58
+ sage: C1 = HyperellipticCurve(f1)
59
+ sage: C0 == C1
60
+ False
61
+ sage: C0 == C0
62
+ True
63
+
64
+ sage: P.<x> = QQ[]
65
+ sage: f0 = 4*x^5 - 30*x^3 + 45*x - 22
66
+ sage: C0 = HyperellipticCurve(f0)
67
+ sage: f1 = x^5 - x^3 + x - 22
68
+ sage: C1 = HyperellipticCurve(f1)
69
+ sage: C0 != C1
70
+ True
71
+ sage: C0 != C0
72
+ False
73
+
74
+ sage: P.<x> = QQ[]
75
+ sage: f0 = 4*x^5 - 30*x^3 + 45*x - 22
76
+ sage: C0 = HyperellipticCurve(f0)
77
+ sage: f1 = x^5 - x^3 + x - 22
78
+ sage: C1 = HyperellipticCurve(f1)
79
+ sage: Q.<y> = GF(5)[]
80
+ sage: f2 = y^5 - y^3 + y - 22
81
+ sage: C2 = HyperellipticCurve(f2)
82
+ sage: hash(C0) == hash(C0)
83
+ True
84
+ sage: hash(C0) == hash(C1)
85
+ False
86
+ sage: hash(C1) == hash(C2)
87
+ False
88
+ """
89
+ def __init__(self, PP, f, h=None, names=None, genus=None) -> None:
90
+ x, y, z = PP.gens()
91
+ df = f.degree()
92
+ F1 = sum([ f[i]*x**i*z**(df-i) for i in range(df+1) ])
93
+ if h is None:
94
+ F = y**2*z**(df-2) - F1
95
+ else:
96
+ dh = h.degree()
97
+ deg = max(df,dh+1)
98
+ F0 = sum([ h[i]*x**i*z**(dh-i) for i in range(dh+1) ])
99
+ F = y**2*z**(deg-2) + F0*y*z**(deg-dh-1) - F1*z**(deg-df)
100
+ plane_curve.ProjectivePlaneCurve.__init__(self,PP,F)
101
+ R = PP.base_ring()
102
+ if names is None:
103
+ names = ("x", "y")
104
+ else:
105
+ names = normalize_names(2, names)
106
+ self._names = names
107
+ P1 = PolynomialRing(R, name=names[0])
108
+ P2 = PolynomialRing(P1, name=names[1])
109
+ self._PP = PP
110
+ self._printing_ring = P2
111
+ self._hyperelliptic_polynomials = (f,h)
112
+ self._genus = genus
113
+
114
+ def change_ring(self, R):
115
+ """
116
+ Return this HyperellipticCurve over a new base ring ``R``.
117
+
118
+ EXAMPLES::
119
+
120
+ sage: # needs sage.rings.padics
121
+ sage: R.<x> = QQ[]
122
+ sage: H = HyperellipticCurve(x^5 - 10*x + 9)
123
+ sage: K = Qp(3, 5)
124
+ sage: L.<a> = K.extension(x^30 - 3)
125
+ sage: HK = H.change_ring(K)
126
+ sage: HL = HK.change_ring(L); HL
127
+ Hyperelliptic Curve
128
+ over 3-adic Eisenstein Extension Field in a defined by x^30 - 3
129
+ defined by (1 + O(a^150))*y^2 = (1 + O(a^150))*x^5
130
+ + (2 + 2*a^30 + a^60 + 2*a^90 + 2*a^120 + O(a^150))*x + a^60 + O(a^210)
131
+
132
+ sage: R.<x> = FiniteField(7)[]
133
+ sage: H = HyperellipticCurve(x^8 + x + 5)
134
+ sage: H.base_extend(FiniteField(7^2, 'a')) # needs sage.rings.finite_rings
135
+ Hyperelliptic Curve over Finite Field in a of size 7^2
136
+ defined by y^2 = x^8 + x + 5
137
+ """
138
+ from .constructor import HyperellipticCurve
139
+ f, h = self._hyperelliptic_polynomials
140
+ y = self._printing_ring.variable_name()
141
+ x = self._printing_ring.base_ring().variable_name()
142
+ return HyperellipticCurve(f.change_ring(R), h.change_ring(R), "%s,%s" % (x,y))
143
+
144
+ base_extend = change_ring
145
+
146
+ def _repr_(self):
147
+ """
148
+ String representation of hyperelliptic curves.
149
+
150
+ EXAMPLES::
151
+
152
+ sage: P.<x> = QQ[]
153
+ sage: f = 4*x^5 - 30*x^3 + 45*x - 22
154
+ sage: C = HyperellipticCurve(f); C
155
+ Hyperelliptic Curve over Rational Field defined by y^2 = 4*x^5 - 30*x^3 + 45*x - 22
156
+ sage: C = HyperellipticCurve(f,names='u,v'); C
157
+ Hyperelliptic Curve over Rational Field defined by v^2 = 4*u^5 - 30*u^3 + 45*u - 22
158
+ sage: C = HyperellipticCurve(x^5 + 1, x^3 + 2); C
159
+ Hyperelliptic Curve over Rational Field defined by y^2 + (x^3 + 2)*y = x^5 + 1
160
+ """
161
+
162
+ f, h = self._hyperelliptic_polynomials
163
+ R = self.base_ring()
164
+ y = self._printing_ring.gen()
165
+ x = self._printing_ring.base_ring().gen()
166
+ if h.is_zero():
167
+ return "Hyperelliptic Curve over %s defined by %s = %s" % (R, y**2, f(x))
168
+ return "Hyperelliptic Curve over %s defined by %s + %s = %s" % (R, y**2, h(x)*y, f(x))
169
+
170
+ def _latex_(self):
171
+ r"""
172
+ LaTeX representation of hyperelliptic curves.
173
+
174
+ EXAMPLES::
175
+
176
+ sage: P.<x> = QQ[]
177
+ sage: f = 4*x^5 - 30*x^3 + 45*x - 22
178
+ sage: C = HyperellipticCurve(f); latex(C)
179
+ \text{Hyperelliptic Curve over $\Bold{Q}$ defined by $y^{2} = 4 x^{5} - 30 x^{3} + 45 x - 22$}
180
+ sage: C = HyperellipticCurve(f,names='u,v'); latex(C)
181
+ \text{Hyperelliptic Curve over $\Bold{Q}$ defined by $v^{2} = 4 u^{5} - 30 u^{3} + 45 u - 22$}
182
+ sage: C = HyperellipticCurve(x^5 + 1, x^2 + 3); latex(C)
183
+ \text{Hyperelliptic Curve over $\Bold{Q}$ defined by $y^{2} + \left(x^{2} + 3\right) y = x^{5} + 1$}
184
+ """
185
+
186
+ f, h = self._hyperelliptic_polynomials
187
+ R = self.base_ring()
188
+ y = self._printing_ring.gen()
189
+ x = self._printing_ring.base_ring().gen()
190
+ if h.is_zero():
191
+ return (fr'\text{{Hyperelliptic Curve over ${R._latex_()}$ '
192
+ f'defined by ${(y**2)._latex_()} = {(f(x))._latex_()}$}}')
193
+ return (fr'\text{{Hyperelliptic Curve over ${R._latex_()}$ '
194
+ f'defined by ${(y**2)._latex_()} + {(h(x)*y)._latex_()} = '
195
+ f'{(f(x))._latex_()}$}}')
196
+
197
+ def hyperelliptic_polynomials(self, K=None, var='x'):
198
+ """
199
+ EXAMPLES::
200
+
201
+ sage: R.<x> = QQ[]; C = HyperellipticCurve(x^3 + x - 1, x^3/5); C
202
+ Hyperelliptic Curve over Rational Field defined by y^2 + 1/5*x^3*y = x^3 + x - 1
203
+ sage: C.hyperelliptic_polynomials()
204
+ (x^3 + x - 1, 1/5*x^3)
205
+ """
206
+ if K is None:
207
+ return self._hyperelliptic_polynomials
208
+ else:
209
+ f, h = self._hyperelliptic_polynomials
210
+ P = PolynomialRing(K, var)
211
+ return (P(f), P(h))
212
+
213
+ def is_singular(self) -> bool:
214
+ r"""
215
+ Return ``False``, because hyperelliptic curves are smooth projective
216
+ curves, as checked on construction.
217
+
218
+ EXAMPLES::
219
+
220
+ sage: R.<x> = QQ[]
221
+ sage: H = HyperellipticCurve(x^5 + 1)
222
+ sage: H.is_singular()
223
+ False
224
+
225
+ A hyperelliptic curve with genus at least 2 always has a singularity at
226
+ infinity when viewed as a *plane* projective curve. This can be seen in
227
+ the following example.::
228
+
229
+ sage: R.<x> = QQ[]
230
+ sage: H = HyperellipticCurve(x^5 + 2)
231
+ sage: from sage.misc.verbose import set_verbose
232
+ sage: set_verbose(-1)
233
+ sage: H.is_singular()
234
+ False
235
+ sage: from sage.schemes.curves.projective_curve import ProjectivePlaneCurve
236
+ sage: ProjectivePlaneCurve.is_singular(H)
237
+ True
238
+ """
239
+ return False
240
+
241
+ def is_smooth(self) -> bool:
242
+ r"""
243
+ Return ``True``, because hyperelliptic curves are smooth projective
244
+ curves, as checked on construction.
245
+
246
+ EXAMPLES::
247
+
248
+ sage: R.<x> = GF(13)[]
249
+ sage: H = HyperellipticCurve(x^8 + 1)
250
+ sage: H.is_smooth()
251
+ True
252
+
253
+ A hyperelliptic curve with genus at least 2 always has a singularity at
254
+ infinity when viewed as a *plane* projective curve. This can be seen in
255
+ the following example.::
256
+
257
+ sage: # needs sage.rings.finite_rings
258
+ sage: R.<x> = GF(27, 'a')[]
259
+ sage: H = HyperellipticCurve(x^10 + 2)
260
+ sage: from sage.misc.verbose import set_verbose
261
+ sage: set_verbose(-1)
262
+ sage: H.is_smooth()
263
+ True
264
+ sage: from sage.schemes.curves.projective_curve import ProjectivePlaneCurve
265
+ sage: ProjectivePlaneCurve.is_smooth(H)
266
+ False
267
+ """
268
+ return True
269
+
270
+ def is_x_coord(self, x):
271
+ """
272
+ Return ``True`` if ``x`` is the `x`-coordinate of a point on this curve.
273
+
274
+ .. SEEALSO::
275
+
276
+ See also :meth:`lift_x` to find the point(s) with a given
277
+ `x`-coordinate. This function may be useful in cases where
278
+ testing an element of the base field for being a square is
279
+ faster than finding its square root.
280
+
281
+ INPUT:
282
+
283
+ - ``x`` -- an element of the base ring of the curve
284
+
285
+ OUTPUT: boolean stating whether or not `x` is a x-coordinate of a point
286
+ on the curve
287
+
288
+ EXAMPLES:
289
+
290
+ When `x` is the `x`-coordinate of a rational point on the
291
+ curve, we can request these::
292
+
293
+ sage: R.<x> = PolynomialRing(QQ)
294
+ sage: f = x^5 + x^3 + 1
295
+ sage: H = HyperellipticCurve(f)
296
+ sage: H.is_x_coord(0)
297
+ True
298
+
299
+ There are no rational points with `x`-coordinate 3::
300
+
301
+ sage: H.is_x_coord(3)
302
+ False
303
+
304
+ The function also handles the case when `h(x)` is not zero::
305
+
306
+ sage: R.<x> = PolynomialRing(QQ)
307
+ sage: f = x^5 + x^3 + 1
308
+ sage: h = x + 1
309
+ sage: H = HyperellipticCurve(f, h)
310
+ sage: H.is_x_coord(1)
311
+ True
312
+
313
+ We can perform these operations over finite fields too::
314
+
315
+ sage: # needs sage.rings.finite_rings
316
+ sage: R.<x> = PolynomialRing(GF(163))
317
+ sage: f = x^7 + x + 1
318
+ sage: H = HyperellipticCurve(f)
319
+ sage: H.is_x_coord(13)
320
+ True
321
+
322
+ Including the case of characteristic two::
323
+
324
+ sage: # needs sage.rings.finite_rings
325
+ sage: F.<z4> = GF(2^4)
326
+ sage: R.<x> = PolynomialRing(F)
327
+ sage: f = x^7 + x^3 + 1
328
+ sage: h = x + 1
329
+ sage: H = HyperellipticCurve(f, h)
330
+ sage: H.is_x_coord(z4^3 + z4^2 + z4)
331
+ True
332
+
333
+ AUTHORS:
334
+
335
+ - Giacomo Pope (2024): adapted from :meth:`lift_x`
336
+
337
+ TESTS:
338
+
339
+ The `x`-coordinate must be defined over the base field of the curve::
340
+
341
+ sage: p = 11
342
+ sage: F = GF(11)
343
+ sage: F_ext = GF(11^2)
344
+ sage: R.<x> = PolynomialRing(F)
345
+ sage: f = x^7 + x^3 + 1
346
+ sage: H = HyperellipticCurve(f)
347
+ sage: H.is_x_coord(F_ext.gen())
348
+ Traceback (most recent call last):
349
+ ...
350
+ TypeError: x must be coercible into the base ring of the curve
351
+ """
352
+ f, h = self.hyperelliptic_polynomials()
353
+ K = self.base_ring()
354
+ try:
355
+ x = K(x)
356
+ except (ValueError, TypeError):
357
+ raise TypeError('x must be coercible into the base ring of the curve')
358
+
359
+ # When h is zero then x is a valid coordinate if y2 is square
360
+ if not h:
361
+ y2 = f(x)
362
+ return y2.is_square()
363
+ # Generic case for h != 0
364
+ a = f(x)
365
+ b = h(x)
366
+ # Special case for char 2
367
+ if K.characteristic() == 2:
368
+ R = f.parent() # Polynomial ring K[x]
369
+ F = R([-a, b, 1])
370
+ return bool(F.roots())
371
+ # Otherwise x is a point on the curve if the discriminant is a square
372
+ D = b*b + 4*a
373
+ return D.is_square()
374
+
375
+ def lift_x(self, x, all=False):
376
+ """
377
+ Return one or all points with given `x`-coordinate.
378
+
379
+ This method is deterministic: It returns the same data each
380
+ time when called again with the same `x`.
381
+
382
+ INPUT:
383
+
384
+ - ``x`` -- an element of the base ring of the curve
385
+
386
+ - ``all`` -- boolean (default: ``False``); if ``True``, return a
387
+ (possibly empty) list of all points. If ``False``, return
388
+ just one point, or raise a :exc:`ValueError` if there are none.
389
+
390
+ OUTPUT: a point or list of up to two points on this curve
391
+
392
+ .. SEEALSO::
393
+
394
+ :meth:`is_x_coord`
395
+
396
+ AUTHORS:
397
+
398
+ - Giacomo Pope (2024): Allowed for the case of characteristic two
399
+
400
+ EXAMPLES:
401
+
402
+ When `x` is the `x`-coordinate of a rational point on the
403
+ curve, we can request these::
404
+
405
+ sage: R.<x> = PolynomialRing(QQ)
406
+ sage: f = x^5 + x^3 + 1
407
+ sage: H = HyperellipticCurve(f)
408
+ sage: H.lift_x(0)
409
+ (0 : -1 : 1)
410
+ sage: H.lift_x(4, all=True)
411
+ [(4 : -33 : 1), (4 : 33 : 1)]
412
+
413
+ There are no rational points with `x`-coordinate 3::
414
+
415
+ sage: H.lift_x(3)
416
+ Traceback (most recent call last):
417
+ ...
418
+ ValueError: No point with x-coordinate 3 on Hyperelliptic Curve over Rational Field defined by y^2 = x^5 + x^3 + 1
419
+
420
+ An empty list is returned when there are no points and ``all=True``::
421
+
422
+ sage: H.lift_x(3, all=True)
423
+ []
424
+
425
+ The function also handles the case when `h(x)` is not zero::
426
+
427
+ sage: R.<x> = PolynomialRing(QQ)
428
+ sage: f = x^5 + x^3 + 1
429
+ sage: h = x + 1
430
+ sage: H = HyperellipticCurve(f, h)
431
+ sage: H.lift_x(1)
432
+ (1 : -3 : 1)
433
+
434
+ We can perform these operations over finite fields too::
435
+
436
+ sage: # needs sage.rings.finite_rings
437
+ sage: R.<x> = PolynomialRing(GF(163))
438
+ sage: f = x^7 + x + 1
439
+ sage: H = HyperellipticCurve(f)
440
+ sage: H.lift_x(13)
441
+ (13 : 41 : 1)
442
+
443
+ Including the case of characteristic two::
444
+
445
+ sage: # needs sage.rings.finite_rings
446
+ sage: F.<z4> = GF(2^4)
447
+ sage: R.<x> = PolynomialRing(F)
448
+ sage: f = x^7 + x^3 + 1
449
+ sage: h = x + 1
450
+ sage: H = HyperellipticCurve(f, h)
451
+ sage: H.lift_x(z4^3 + z4^2 + z4, all=True)
452
+ [(z4^3 + z4^2 + z4 : z4^2 + z4 + 1 : 1), (z4^3 + z4^2 + z4 : z4^3 : 1)]
453
+
454
+ TESTS::
455
+
456
+ sage: # needs sage.rings.finite_rings
457
+ sage: F1 = GF(11)
458
+ sage: F2 = GF(13)
459
+ sage: R.<x> = PolynomialRing(F1)
460
+ sage: f = x^7 + x^3 + 1
461
+ sage: H = HyperellipticCurve(f)
462
+ sage: H.lift_x(F2.random_element())
463
+ Traceback (most recent call last):
464
+ ...
465
+ ValueError: x must have a common parent with the base ring
466
+
467
+ Ensure that :issue:`37097` is fixed::
468
+
469
+ sage: # needs sage.rings.finite_rings
470
+ sage: F.<z4> = GF(2^4)
471
+ sage: R.<x> = PolynomialRing(F)
472
+ sage: f = x^7 + x^3 + 1
473
+ sage: h = x + 1
474
+ sage: H = HyperellipticCurve(f, h)
475
+ sage: H.lift_x(z4^3 + z4^2 + z4, all=True)
476
+ [(z4^3 + z4^2 + z4 : z4^2 + z4 + 1 : 1), (z4^3 + z4^2 + z4 : z4^3 : 1)]
477
+ """
478
+ from sage.structure.element import get_coercion_model
479
+ cm = get_coercion_model()
480
+
481
+ f, h = self.hyperelliptic_polynomials()
482
+ K = self.base_ring()
483
+
484
+ # Compute the common parent between the base ring of the curve and
485
+ # the parent of the input x-coordinate.
486
+ try:
487
+ L = cm.common_parent(x.parent(), K)
488
+ x = L(x)
489
+ except (TypeError, ValueError):
490
+ raise ValueError('x must have a common parent with the base ring')
491
+
492
+ # First we compute the y-coordinates the given x-coordinate
493
+ ys = []
494
+ one = L.one()
495
+
496
+ # When h is zero we find all y-coordinates with a single sqrt
497
+ if not h:
498
+ y2 = f(x)
499
+ # When y2 is not a square, ys will be an empty list
500
+ ys = y2.sqrt(all=True, extend=False)
501
+ # Otherwise we need roots of the discriminant
502
+ else:
503
+ a = f(x)
504
+ b = h(x)
505
+ # Special case for char 2
506
+ if K.characteristic() == 2:
507
+ R = f.parent()
508
+ F = R([-a, b, 1])
509
+ ys = F.roots(L, multiplicities=False)
510
+ else:
511
+ D = b*b + 4*a
512
+ # When D is not a square, ys will be an empty list
513
+ ys = [(-b+d)/2 for d in D.sqrt(all=True, extend=False)]
514
+
515
+ if ys:
516
+ ys.sort() # Make lifting deterministic
517
+ if all:
518
+ return [self.point([x, y, one], check=False) for y in ys]
519
+ else:
520
+ return self.point([x, ys[0], one], check=False)
521
+
522
+ if all:
523
+ return []
524
+ else:
525
+ raise ValueError(f"No point with x-coordinate {x} on {self}")
526
+
527
+ def genus(self):
528
+ return self._genus
529
+
530
+ def jacobian(self):
531
+ from . import jacobian_generic
532
+ return jacobian_generic.HyperellipticJacobian_generic(self)
533
+
534
+ def odd_degree_model(self):
535
+ r"""
536
+ Return an odd degree model of ``self``, or raise :exc:`ValueError` if
537
+ one does not exist over the field of definition.
538
+
539
+ EXAMPLES::
540
+
541
+ sage: x = QQ['x'].gen()
542
+ sage: H = HyperellipticCurve((x^2 + 2)*(x^2 + 3)*(x^2 + 5)); H
543
+ Hyperelliptic Curve over Rational Field defined by y^2 = x^6 + 10*x^4 + 31*x^2 + 30
544
+ sage: H.odd_degree_model()
545
+ Traceback (most recent call last):
546
+ ...
547
+ ValueError: No odd degree model exists over field of definition
548
+
549
+ sage: K2 = QuadraticField(-2, 'a') # needs sage.rings.number_field
550
+ sage: Hp2 = H.change_ring(K2).odd_degree_model(); Hp2 # needs sage.rings.number_field
551
+ Hyperelliptic Curve over Number Field in a
552
+ with defining polynomial x^2 + 2 with a = 1.414213562373095?*I
553
+ defined by y^2 = 6*a*x^5 - 29*x^4 - 20*x^2 + 6*a*x + 1
554
+
555
+ sage: K3 = QuadraticField(-3, 'b') # needs sage.rings.number_field
556
+ sage: Hp3 = H.change_ring(QuadraticField(-3, 'b')).odd_degree_model(); Hp3 # needs sage.rings.number_field
557
+ Hyperelliptic Curve over Number Field in b
558
+ with defining polynomial x^2 + 3 with b = 1.732050807568878?*I
559
+ defined by y^2 = -4*b*x^5 - 14*x^4 - 20*b*x^3 - 35*x^2 + 6*b*x + 1
560
+
561
+ Of course, ``Hp2`` and ``Hp3`` are isomorphic over the composite
562
+ extension. One consequence of this is that odd degree models
563
+ reduced over "different" fields should have the same number of
564
+ points on their reductions. 43 and 67 split completely in the
565
+ compositum, so when we reduce we find:
566
+
567
+ sage: # needs sage.rings.number_field
568
+ sage: P2 = K2.factor(43)[0][0]
569
+ sage: P3 = K3.factor(43)[0][0]
570
+ sage: Hp2.change_ring(K2.residue_field(P2)).frobenius_polynomial()
571
+ x^4 - 16*x^3 + 134*x^2 - 688*x + 1849
572
+ sage: Hp3.change_ring(K3.residue_field(P3)).frobenius_polynomial()
573
+ x^4 - 16*x^3 + 134*x^2 - 688*x + 1849
574
+
575
+ sage: H.change_ring(GF(43)).odd_degree_model().frobenius_polynomial() # needs sage.rings.finite_rings
576
+ x^4 - 16*x^3 + 134*x^2 - 688*x + 1849
577
+
578
+ sage: # needs sage.rings.number_field
579
+ sage: P2 = K2.factor(67)[0][0]
580
+ sage: P3 = K3.factor(67)[0][0]
581
+ sage: Hp2.change_ring(K2.residue_field(P2)).frobenius_polynomial()
582
+ x^4 - 8*x^3 + 150*x^2 - 536*x + 4489
583
+ sage: Hp3.change_ring(K3.residue_field(P3)).frobenius_polynomial()
584
+ x^4 - 8*x^3 + 150*x^2 - 536*x + 4489
585
+
586
+ sage: H.change_ring(GF(67)).odd_degree_model().frobenius_polynomial() # needs sage.rings.finite_rings
587
+ x^4 - 8*x^3 + 150*x^2 - 536*x + 4489
588
+
589
+ TESTS::
590
+
591
+ sage: HyperellipticCurve(x^5 + 1, 1).odd_degree_model()
592
+ Traceback (most recent call last):
593
+ ...
594
+ NotImplementedError: odd_degree_model only implemented for curves in Weierstrass form
595
+
596
+ sage: HyperellipticCurve(x^5 + 1, names="U, V").odd_degree_model()
597
+ Hyperelliptic Curve over Rational Field defined by V^2 = U^5 + 1
598
+ """
599
+ f, h = self._hyperelliptic_polynomials
600
+ if h:
601
+ raise NotImplementedError("odd_degree_model only implemented for curves in Weierstrass form")
602
+ if f.degree() % 2:
603
+ # already odd, so just yield self
604
+ return self
605
+
606
+ rts = f.roots(multiplicities=False)
607
+ if not rts:
608
+ raise ValueError("No odd degree model exists over field of definition")
609
+ rt = rts[0]
610
+ x = f.parent().gen()
611
+ fnew = f((x * rt + 1) / x).numerator() # move rt to "infinity"
612
+
613
+ from .constructor import HyperellipticCurve
614
+ return HyperellipticCurve(fnew, 0, names=self._names, PP=self._PP)
615
+
616
+ def has_odd_degree_model(self) -> bool:
617
+ r"""
618
+ Return ``True`` if an odd degree model of ``self`` exists over the
619
+ field of definition; ``False`` otherwise.
620
+
621
+ Use ``odd_degree_model`` to calculate an odd degree model.
622
+
623
+ EXAMPLES::
624
+
625
+ sage: x = QQ['x'].0
626
+ sage: HyperellipticCurve(x^5 + x).has_odd_degree_model()
627
+ True
628
+ sage: HyperellipticCurve(x^6 + x).has_odd_degree_model()
629
+ True
630
+ sage: HyperellipticCurve(x^6 + x + 1).has_odd_degree_model()
631
+ False
632
+ """
633
+ try:
634
+ return bool(self.odd_degree_model())
635
+ except ValueError:
636
+ return False
637
+
638
+ def _magma_init_(self, magma):
639
+ """
640
+ Internal function. Returns a string to initialize this elliptic
641
+ curve in the Magma subsystem.
642
+
643
+ EXAMPLES::
644
+
645
+ sage: # optional - magma
646
+ sage: R.<x> = QQ[]; C = HyperellipticCurve(x^3 + x - 1, x); C
647
+ Hyperelliptic Curve over Rational Field
648
+ defined by y^2 + x*y = x^3 + x - 1
649
+ sage: magma(C)
650
+ Hyperelliptic Curve defined by y^2 + x*y = x^3 + x - 1 over Rational Field
651
+ sage: R.<x> = GF(9,'a')[]; C = HyperellipticCurve(x^3 + x - 1, x^10); C # needs sage.rings.finite_rings
652
+ Hyperelliptic Curve over Finite Field in a of size 3^2
653
+ defined by y^2 + x^10*y = x^3 + x + 2
654
+ sage: D = magma(C); D # needs sage.rings.finite_rings
655
+ Hyperelliptic Curve defined by y^2 + x^10*y = x^3 + x + 2 over GF(3^2)
656
+ sage: D.sage() # needs sage.rings.finite_rings
657
+ Hyperelliptic Curve over Finite Field in a of size 3^2
658
+ defined by y^2 + x^10*y = x^3 + x + 2
659
+ """
660
+ f, h = self._hyperelliptic_polynomials
661
+ return 'HyperellipticCurve(%s, %s)' % (f._magma_init_(magma), h._magma_init_(magma))
662
+
663
+ def monsky_washnitzer_gens(self):
664
+ import sage.schemes.hyperelliptic_curves.monsky_washnitzer as monsky_washnitzer
665
+ S = monsky_washnitzer.SpecialHyperellipticQuotientRing(self)
666
+ return S.gens()
667
+
668
+ def invariant_differential(self):
669
+ """
670
+ Return `dx/2y`, as an element of the Monsky-Washnitzer cohomology
671
+ of ``self``.
672
+
673
+ EXAMPLES::
674
+
675
+ sage: R.<x> = QQ['x']
676
+ sage: C = HyperellipticCurve(x^5 - 4*x + 4)
677
+ sage: C.invariant_differential()
678
+ 1 dx/2y
679
+ """
680
+ import sage.schemes.hyperelliptic_curves.monsky_washnitzer as m_w
681
+ S = m_w.SpecialHyperellipticQuotientRing(self)
682
+ MW = m_w.MonskyWashnitzerDifferentialRing(S)
683
+ return MW.invariant_differential()
684
+
685
+ def local_coordinates_at_nonweierstrass(self, P, prec=20, name='t'):
686
+ """
687
+ For a non-Weierstrass point `P = (a,b)` on the hyperelliptic
688
+ curve `y^2 = f(x)`, return `(x(t), y(t))` such that `(y(t))^2 = f(x(t))`,
689
+ where `t = x - a` is the local parameter.
690
+
691
+ INPUT:
692
+
693
+ - ``P = (a, b)`` -- a non-Weierstrass point on ``self``
694
+ - ``prec`` -- desired precision of the local coordinates
695
+ - ``name`` -- gen of the power series ring (default: ``t``)
696
+
697
+ OUTPUT:
698
+
699
+ `(x(t),y(t))` such that `y(t)^2 = f(x(t))` and `t = x - a`
700
+ is the local parameter at `P`
701
+
702
+ EXAMPLES::
703
+
704
+ sage: R.<x> = QQ['x']
705
+ sage: H = HyperellipticCurve(x^5 - 23*x^3 + 18*x^2 + 40*x)
706
+ sage: P = H(1, 6)
707
+ sage: x, y = H.local_coordinates_at_nonweierstrass(P, prec=5)
708
+ sage: x
709
+ 1 + t + O(t^5)
710
+ sage: y
711
+ 6 + t - 7/2*t^2 - 1/2*t^3 - 25/48*t^4 + O(t^5)
712
+ sage: Q = H(-2, 12)
713
+ sage: x, y = H.local_coordinates_at_nonweierstrass(Q, prec=5)
714
+ sage: x
715
+ -2 + t + O(t^5)
716
+ sage: y
717
+ 12 - 19/2*t - 19/32*t^2 + 61/256*t^3 - 5965/24576*t^4 + O(t^5)
718
+
719
+ AUTHOR:
720
+
721
+ - Jennifer Balakrishnan (2007-12)
722
+ """
723
+ d = P[1]
724
+ if d == 0:
725
+ raise TypeError("P = %s is a Weierstrass point. Use local_coordinates_at_weierstrass instead!" % P)
726
+ pol = self.hyperelliptic_polynomials()[0]
727
+ L = PowerSeriesRing(self.base_ring(), name, default_prec=prec)
728
+ t = L.gen()
729
+ K = PowerSeriesRing(L, 'x')
730
+ pol = K(pol)
731
+ b = P[0]
732
+ f = pol(t+b)
733
+ for i in range((RR(log(prec)/log(2))).ceil()):
734
+ d = (d + f/d)/2
735
+ return t+b+O(t**(prec)), d + O(t**(prec))
736
+
737
+ def local_coordinates_at_weierstrass(self, P, prec=20, name='t'):
738
+ """
739
+ For a finite Weierstrass point on the hyperelliptic
740
+ curve `y^2 = f(x)`, returns `(x(t), y(t))` such that
741
+ `(y(t))^2 = f(x(t))`, where `t = y` is the local parameter.
742
+
743
+ INPUT:
744
+
745
+ - ``P`` -- a finite Weierstrass point on ``self``
746
+ - ``prec`` -- desired precision of the local coordinates
747
+ - ``name`` -- gen of the power series ring (default: `t`)
748
+
749
+ OUTPUT:
750
+
751
+ `(x(t),y(t))` such that `y(t)^2 = f(x(t))` and `t = y`
752
+ is the local parameter at `P`
753
+
754
+ EXAMPLES::
755
+
756
+ sage: R.<x> = QQ['x']
757
+ sage: H = HyperellipticCurve(x^5 - 23*x^3 + 18*x^2 + 40*x)
758
+ sage: A = H(4, 0)
759
+ sage: x, y = H.local_coordinates_at_weierstrass(A, prec=7)
760
+ sage: x
761
+ 4 + 1/360*t^2 - 191/23328000*t^4 + 7579/188956800000*t^6 + O(t^7)
762
+ sage: y
763
+ t + O(t^7)
764
+ sage: B = H(-5, 0)
765
+ sage: x, y = H.local_coordinates_at_weierstrass(B, prec=5)
766
+ sage: x
767
+ -5 + 1/1260*t^2 + 887/2000376000*t^4 + O(t^5)
768
+ sage: y
769
+ t + O(t^5)
770
+
771
+ AUTHOR:
772
+ - Jennifer Balakrishnan (2007-12)
773
+
774
+ - Francis Clarke (2012-08-26)
775
+ """
776
+ if P[1] != 0:
777
+ raise TypeError("P = %s is not a finite Weierstrass point. Use local_coordinates_at_nonweierstrass instead!" % P)
778
+ L = PowerSeriesRing(self.base_ring(), name)
779
+ t = L.gen()
780
+ pol = self.hyperelliptic_polynomials()[0]
781
+ pol_prime = pol.derivative()
782
+ b = P[0]
783
+ t2 = t**2
784
+ c = b + t2/pol_prime(b)
785
+ c = c.add_bigoh(prec)
786
+ for _ in range(int(1 + log(prec, 2))):
787
+ c -= (pol(c) - t2)/pol_prime(c)
788
+ return (c, t.add_bigoh(prec))
789
+
790
+ def local_coordinates_at_infinity(self, prec=20, name='t'):
791
+ """
792
+ For the genus `g` hyperelliptic curve `y^2 = f(x)`, return
793
+ `(x(t), y(t))` such that `(y(t))^2 = f(x(t))`, where `t = x^g/y` is
794
+ the local parameter at infinity
795
+
796
+ INPUT:
797
+
798
+ - ``prec`` -- desired precision of the local coordinates
799
+ - ``name`` -- generator of the power series ring (default: ``t``)
800
+
801
+ OUTPUT:
802
+
803
+ `(x(t),y(t))` such that `y(t)^2 = f(x(t))` and `t = x^g/y`
804
+ is the local parameter at infinity
805
+
806
+ EXAMPLES::
807
+
808
+ sage: R.<x> = QQ['x']
809
+ sage: H = HyperellipticCurve(x^5 - 5*x^2 + 1)
810
+ sage: x, y = H.local_coordinates_at_infinity(10)
811
+ sage: x
812
+ t^-2 + 5*t^4 - t^8 - 50*t^10 + O(t^12)
813
+ sage: y
814
+ t^-5 + 10*t - 2*t^5 - 75*t^7 + 50*t^11 + O(t^12)
815
+
816
+ ::
817
+
818
+ sage: R.<x> = QQ['x']
819
+ sage: H = HyperellipticCurve(x^3 - x + 1)
820
+ sage: x, y = H.local_coordinates_at_infinity(10)
821
+ sage: x
822
+ t^-2 + t^2 - t^4 - t^6 + 3*t^8 + O(t^12)
823
+ sage: y
824
+ t^-3 + t - t^3 - t^5 + 3*t^7 - 10*t^11 + O(t^12)
825
+
826
+ AUTHOR:
827
+
828
+ - Jennifer Balakrishnan (2007-12)
829
+ """
830
+ g = self.genus()
831
+ pol = self.hyperelliptic_polynomials()[0]
832
+ K = LaurentSeriesRing(self.base_ring(), name, default_prec=prec+2)
833
+ t = K.gen()
834
+ L = PolynomialRing(K,'x')
835
+ x = L.gen()
836
+ i = 0
837
+ w = (x**g/t)**2-pol
838
+ wprime = w.derivative(x)
839
+ x = t**-2
840
+ for i in range((RR(log(prec+2)/log(2))).ceil()):
841
+ x = x - w(x)/wprime(x)
842
+ y = x**g/t
843
+ return x+O(t**(prec+2)) , y+O(t**(prec+2))
844
+
845
+ def local_coord(self, P, prec=20, name='t'):
846
+ """
847
+ Call the appropriate local_coordinates function.
848
+
849
+ INPUT:
850
+
851
+ - ``P`` -- a point on ``self``
852
+ - ``prec`` -- desired precision of the local coordinates
853
+ - ``name`` -- generator of the power series ring (default: ``t``)
854
+
855
+ OUTPUT:
856
+
857
+ `(x(t),y(t))` such that `y(t)^2 = f(x(t))`, where `t`
858
+ is the local parameter at `P`
859
+
860
+ EXAMPLES::
861
+
862
+ sage: R.<x> = QQ['x']
863
+ sage: H = HyperellipticCurve(x^5 - 23*x^3 + 18*x^2 + 40*x)
864
+ sage: H.local_coord(H(1 ,6), prec=5)
865
+ (1 + t + O(t^5), 6 + t - 7/2*t^2 - 1/2*t^3 - 25/48*t^4 + O(t^5))
866
+ sage: H.local_coord(H(4, 0), prec=7)
867
+ (4 + 1/360*t^2 - 191/23328000*t^4 + 7579/188956800000*t^6 + O(t^7), t + O(t^7))
868
+ sage: H.local_coord(H(0, 1, 0), prec=5)
869
+ (t^-2 + 23*t^2 - 18*t^4 - 569*t^6 + O(t^7),
870
+ t^-5 + 46*t^-1 - 36*t - 609*t^3 + 1656*t^5 + O(t^6))
871
+
872
+ AUTHOR:
873
+
874
+ - Jennifer Balakrishnan (2007-12)
875
+ """
876
+ if P[1] == 0:
877
+ return self.local_coordinates_at_weierstrass(P, prec, name)
878
+ elif P[2] == 0:
879
+ return self.local_coordinates_at_infinity(prec, name)
880
+ else:
881
+ return self.local_coordinates_at_nonweierstrass(P, prec, name)
882
+
883
+ def rational_points(self, **kwds):
884
+ r"""
885
+ Find rational points on the hyperelliptic curve, all arguments are passed
886
+ on to :meth:`sage.schemes.generic.algebraic_scheme.rational_points`.
887
+
888
+ EXAMPLES:
889
+
890
+ For the LMFDB genus 2 curve `932.a.3728.1 <https://www.lmfdb.org/Genus2Curve/Q/932/a/3728/1>`_::
891
+
892
+ sage: R.<x> = PolynomialRing(QQ)
893
+ sage: C = HyperellipticCurve(R([0, -1, 1, 0, 1, -2, 1]), R([1]))
894
+ sage: C.rational_points(bound=8)
895
+ [(-1 : -3 : 1),
896
+ (-1 : 2 : 1),
897
+ (0 : -1 : 1),
898
+ (0 : 0 : 1),
899
+ (0 : 1 : 0),
900
+ (1/2 : -5/8 : 1),
901
+ (1/2 : -3/8 : 1),
902
+ (1 : -1 : 1),
903
+ (1 : 0 : 1)]
904
+
905
+ Check that :issue:`29509` is fixed for the LMFDB genus 2 curve
906
+ `169.a.169.1 <https://www.lmfdb.org/Genus2Curve/Q/169/a/169/1>`_::
907
+
908
+ sage: C = HyperellipticCurve(R([0, 0, 0, 0, 1, 1]), R([1, 1, 0, 1]))
909
+ sage: C.rational_points(bound=10)
910
+ [(-1 : 0 : 1),
911
+ (-1 : 1 : 1),
912
+ (0 : -1 : 1),
913
+ (0 : 0 : 1),
914
+ (0 : 1 : 0)]
915
+
916
+ An example over a number field::
917
+
918
+ sage: R.<x> = PolynomialRing(QuadraticField(2)) # needs sage.rings.number_field
919
+ sage: C = HyperellipticCurve(R([1, 0, 0, 0, 0, 1])) # needs sage.rings.number_field
920
+ sage: C.rational_points(bound=2) # needs sage.rings.number_field
921
+ [(-1 : 0 : 1),
922
+ (0 : -1 : 1),
923
+ (0 : 1 : 0),
924
+ (0 : 1 : 1),
925
+ (1 : -a : 1),
926
+ (1 : a : 1)]
927
+ """
928
+ from sage.schemes.curves.constructor import Curve
929
+ # we change C to be a plane curve to allow the generic rational
930
+ # points code to reduce mod any prime, whereas a HyperellipticCurve
931
+ # can only be base changed to good primes.
932
+ C = self
933
+ if 'F' in kwds:
934
+ C = C.change_ring(kwds['F'])
935
+
936
+ return [C(pt) for pt in Curve(self).rational_points(**kwds)]