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,1530 @@
1
+ # sage_setup: distribution = sagemath-schemes
2
+ """
3
+ Elliptic curve constructor
4
+
5
+ AUTHORS:
6
+
7
+ - William Stein (2005): Initial version
8
+
9
+ - John Cremona (2008-01): EllipticCurve(j) fixed for all cases
10
+ """
11
+
12
+ #*****************************************************************************
13
+ # Copyright (C) 2005 William Stein <wstein@gmail.com>
14
+ #
15
+ # Distributed under the terms of the GNU General Public License (GPL)
16
+ #
17
+ # This code is distributed in the hope that it will be useful,
18
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20
+ # General Public License for more details.
21
+ #
22
+ # The full text of the GPL is available at:
23
+ #
24
+ # http://www.gnu.org/licenses/
25
+ #*****************************************************************************
26
+
27
+ from sage.rings.integer_ring import ZZ
28
+ from sage.rings.rational_field import QQ
29
+ from sage.rings.rational_field import RationalField
30
+
31
+ import sage.rings.abc
32
+ from sage.rings.polynomial.multi_polynomial_ring import MPolynomialRing_base
33
+ from sage.rings.number_field.number_field_base import NumberField
34
+ from sage.rings.finite_rings.finite_field_base import FiniteField
35
+ from sage.rings.polynomial.multi_polynomial import MPolynomial
36
+
37
+ from sage.categories.rings import Rings
38
+ from sage.categories.fields import Fields
39
+ _Fields = Fields()
40
+
41
+ from sage.structure.sequence import Sequence
42
+ from sage.structure.element import parent, Expression
43
+ from sage.structure.factory import UniqueFactory
44
+
45
+
46
+ class EllipticCurveFactory(UniqueFactory):
47
+ r"""
48
+ Construct an elliptic curve.
49
+
50
+ In Sage, an elliptic curve is always specified by
51
+ (the coefficients of) a long Weierstrass equation
52
+
53
+ .. MATH::
54
+
55
+ y^2 + a_1 xy + a_3 y = x^3 + a_2 x^2 + a_4 x + a_6.
56
+
57
+ INPUT:
58
+
59
+ There are several ways to construct an elliptic curve:
60
+
61
+ - ``EllipticCurve([a1,a2,a3,a4,a6])``: Elliptic curve with given
62
+ `a`-invariants. The invariants are coerced into a common parent.
63
+ If all are integers, they are coerced into the rational numbers.
64
+
65
+ - ``EllipticCurve([a4,a6])``: Same as above, but `a_1=a_2=a_3=0`.
66
+
67
+ - ``EllipticCurve(label)``: Returns the elliptic curve over `\QQ`
68
+ from the Cremona database with the given label. The label is a
69
+ string, such as ``'11a'`` or ``'37b2'``. The letters in the
70
+ label *must* be lower case (Cremona's new labeling).
71
+
72
+ - ``EllipticCurve(R, [a1,a2,a3,a4,a6])``: Create the elliptic
73
+ curve over `R` with given `a`-invariants. Here `R` can be an
74
+ arbitrary commutative ring, although most functionality is only
75
+ implemented over fields.
76
+
77
+ - ``EllipticCurve(j=j0)`` or ``EllipticCurve_from_j(j0)``: Return
78
+ an elliptic curve with `j`-invariant ``j0``.
79
+
80
+ - ``EllipticCurve(polynomial)``: Read off the `a`-invariants from
81
+ the polynomial coefficients, see
82
+ :func:`EllipticCurve_from_Weierstrass_polynomial`.
83
+
84
+ - ``EllipticCurve(cubic, point)``: The elliptic curve defined by a
85
+ plane cubic (homogeneous polynomial in three variables), with a
86
+ rational point.
87
+
88
+ Instead of giving the coefficients as a *list* of length 2 or 5,
89
+ one can also give a *tuple*.
90
+
91
+ EXAMPLES:
92
+
93
+ We illustrate creating elliptic curves::
94
+
95
+ sage: EllipticCurve([0,0,1,-1,0])
96
+ Elliptic Curve defined by y^2 + y = x^3 - x over Rational Field
97
+
98
+ We create a curve from a Cremona label::
99
+
100
+ sage: EllipticCurve('37b2')
101
+ Elliptic Curve defined by y^2 + y = x^3 + x^2 - 1873*x - 31833 over Rational Field
102
+ sage: EllipticCurve('5077a')
103
+ Elliptic Curve defined by y^2 + y = x^3 - 7*x + 6 over Rational Field
104
+ sage: EllipticCurve('389a')
105
+ Elliptic Curve defined by y^2 + y = x^3 + x^2 - 2*x over Rational Field
106
+
107
+ Old Cremona labels are allowed::
108
+
109
+ sage: EllipticCurve('2400FF')
110
+ Elliptic Curve defined by y^2 = x^3 + x^2 + 2*x + 8 over Rational Field
111
+
112
+ Unicode labels are allowed::
113
+
114
+ sage: EllipticCurve(u'389a')
115
+ Elliptic Curve defined by y^2 + y = x^3 + x^2 - 2*x over Rational Field
116
+
117
+ We create curves over a finite field as follows::
118
+
119
+ sage: EllipticCurve([GF(5)(0),0,1,-1,0])
120
+ Elliptic Curve defined by y^2 + y = x^3 + 4*x over Finite Field of size 5
121
+ sage: EllipticCurve(GF(5), [0, 0,1,-1,0])
122
+ Elliptic Curve defined by y^2 + y = x^3 + 4*x over Finite Field of size 5
123
+
124
+ Elliptic curves over `\ZZ/N\ZZ` with `N` prime are of type
125
+ "elliptic curve over a finite field"::
126
+
127
+ sage: F = Zmod(101)
128
+ sage: EllipticCurve(F, [2, 3])
129
+ Elliptic Curve defined by y^2 = x^3 + 2*x + 3 over Ring of integers modulo 101
130
+ sage: E = EllipticCurve([F(2), F(3)])
131
+ sage: type(E)
132
+ <class 'sage.schemes.elliptic_curves.ell_finite_field.EllipticCurve_finite_field_with_category'>
133
+ sage: E.category()
134
+ Category of abelian varieties over Ring of integers modulo 101
135
+
136
+ In contrast, elliptic curves over `\ZZ/N\ZZ` with `N` composite
137
+ are of type "generic elliptic curve"::
138
+
139
+ sage: F = Zmod(95)
140
+ sage: EllipticCurve(F, [2, 3])
141
+ Elliptic Curve defined by y^2 = x^3 + 2*x + 3 over Ring of integers modulo 95
142
+ sage: E = EllipticCurve([F(2), F(3)])
143
+ sage: type(E)
144
+ <class 'sage.schemes.elliptic_curves.ell_generic.EllipticCurve_generic_with_category'>
145
+ sage: E.category()
146
+ Category of schemes over Ring of integers modulo 95
147
+
148
+ The following is a curve over the complex numbers::
149
+
150
+ sage: E = EllipticCurve(CC, [0,0,1,-1,0])
151
+ sage: E
152
+ Elliptic Curve defined by y^2 + 1.00000000000000*y = x^3 + (-1.00000000000000)*x
153
+ over Complex Field with 53 bits of precision
154
+ sage: E.j_invariant()
155
+ 2988.97297297297
156
+
157
+ We can also create elliptic curves by giving the Weierstrass equation::
158
+
159
+ sage: R2.<x,y> = PolynomialRing(QQ,2)
160
+ sage: EllipticCurve(y^2 + y - ( x^3 + x - 9 ))
161
+ Elliptic Curve defined by y^2 + y = x^3 + x - 9 over Rational Field
162
+
163
+ sage: R.<x,y> = GF(5)[]
164
+ sage: EllipticCurve(x^3 + x^2 + 2 - y^2 - y*x)
165
+ Elliptic Curve defined by y^2 + x*y = x^3 + x^2 + 2 over Finite Field of size 5
166
+
167
+ We can also create elliptic curves by giving a smooth plane cubic with a rational point::
168
+
169
+ sage: R3.<x,y,z> = PolynomialRing(QQ,3)
170
+ sage: F = x^3 + y^3 + 30*z^3
171
+ sage: P = [1,-1,0]
172
+ sage: EllipticCurve(F,P)
173
+ Elliptic Curve defined by y^2 - 270*y = x^3 - 24300 over Rational Field
174
+
175
+ We can explicitly specify the `j`-invariant::
176
+
177
+ sage: E = EllipticCurve(j=1728); E; E.j_invariant(); E.label()
178
+ Elliptic Curve defined by y^2 = x^3 - x over Rational Field
179
+ 1728
180
+ '32a2'
181
+
182
+ sage: E = EllipticCurve(j=GF(5)(2)); E; E.j_invariant()
183
+ Elliptic Curve defined by y^2 = x^3 + x + 1 over Finite Field of size 5
184
+ 2
185
+
186
+ See :issue:`6657` ::
187
+
188
+ sage: EllipticCurve(GF(144169), j=1728) # needs sage.rings.finite_rings
189
+ Elliptic Curve defined by y^2 = x^3 + x over Finite Field of size 144169
190
+
191
+ Elliptic curves over the same ring with the same Weierstrass
192
+ coefficients are identical, even when they are constructed in
193
+ different ways (see :issue:`11474`)::
194
+
195
+ sage: EllipticCurve('11a3') is EllipticCurve(QQ, [0, -1, 1, 0, 0])
196
+ True
197
+
198
+ By default, when a rational value of `j` is given, the constructed
199
+ curve is a minimal twist (minimal conductor for curves with that
200
+ `j`-invariant). This can be changed by setting the optional
201
+ parameter ``minimal_twist``, which is ``True`` by default, to ``False``::
202
+
203
+ sage: EllipticCurve(j=100)
204
+ Elliptic Curve defined by y^2 = x^3 + x^2 + 3392*x + 307888 over Rational Field
205
+ sage: E =EllipticCurve(j=100); E
206
+ Elliptic Curve defined by y^2 = x^3 + x^2 + 3392*x + 307888 over Rational Field
207
+ sage: E.conductor()
208
+ 33129800
209
+ sage: E.j_invariant()
210
+ 100
211
+ sage: E =EllipticCurve(j=100, minimal_twist=False); E
212
+ Elliptic Curve defined by y^2 = x^3 + 488400*x - 530076800 over Rational Field
213
+ sage: E.conductor()
214
+ 298168200
215
+ sage: E.j_invariant()
216
+ 100
217
+
218
+ Without this option, constructing the curve could take a long time
219
+ since both `j` and `j-1728` have to be factored to compute the
220
+ minimal twist (see :issue:`13100`)::
221
+
222
+ sage: E = EllipticCurve_from_j(2^256+1, minimal_twist=False)
223
+ sage: E.j_invariant() == 2^256+1
224
+ True
225
+
226
+ TESTS::
227
+
228
+ sage: R = ZZ['u', 'v']
229
+ sage: EllipticCurve(R, [1,1])
230
+ Elliptic Curve defined by y^2 = x^3 + x + 1 over Multivariate Polynomial Ring in u, v
231
+ over Integer Ring
232
+
233
+ We create a curve and a point over ``QQbar`` (see :issue:`6879`)::
234
+
235
+ sage: E = EllipticCurve(QQbar, [0,1]) # needs sage.rings.number_field
236
+ sage: E(0) # needs sage.rings.number_field
237
+ (0 : 1 : 0)
238
+ sage: E.base_field() # needs sage.rings.number_field
239
+ Algebraic Field
240
+
241
+ sage: E = EllipticCurve(RR, [1,2]); E; E.base_field()
242
+ Elliptic Curve defined by y^2 = x^3 + 1.00000000000000*x + 2.00000000000000
243
+ over Real Field with 53 bits of precision
244
+ Real Field with 53 bits of precision
245
+ sage: E = EllipticCurve(CC,[3,4]); E; E.base_field()
246
+ Elliptic Curve defined by y^2 = x^3 + 3.00000000000000*x + 4.00000000000000
247
+ over Complex Field with 53 bits of precision
248
+ Complex Field with 53 bits of precision
249
+ sage: E = EllipticCurve(QQbar, [5,6]); E; E.base_field() # needs sage.rings.number_field
250
+ Elliptic Curve defined by y^2 = x^3 + 5*x + 6 over Algebraic Field
251
+ Algebraic Field
252
+
253
+ See :issue:`6657` ::
254
+
255
+ sage: EllipticCurve(3, j=1728)
256
+ Traceback (most recent call last):
257
+ ...
258
+ ValueError: First parameter (if present) must be a ring when j is specified
259
+
260
+ sage: EllipticCurve(GF(5), j=3/5)
261
+ Traceback (most recent call last):
262
+ ...
263
+ ValueError: First parameter must be a ring containing 3/5
264
+
265
+ If the universe of the coefficients is a general field, the object
266
+ constructed has type :class:`EllipticCurve_field`. Otherwise it is
267
+ :class:`EllipticCurve_generic`. See :issue:`9816` ::
268
+
269
+ sage: E = EllipticCurve([QQbar(1), 3]); E # needs sage.rings.number_field
270
+ Elliptic Curve defined by y^2 = x^3 + x + 3 over Algebraic Field
271
+ sage: type(E) # needs sage.rings.number_field
272
+ <class 'sage.schemes.elliptic_curves.ell_field.EllipticCurve_field_with_category'>
273
+
274
+ sage: E = EllipticCurve([RR(1), 3]); E
275
+ Elliptic Curve defined by y^2 = x^3 + 1.00000000000000*x + 3.00000000000000
276
+ over Real Field with 53 bits of precision
277
+ sage: type(E)
278
+ <class 'sage.schemes.elliptic_curves.ell_field.EllipticCurve_field_with_category'>
279
+
280
+ sage: # needs sage.symbolic
281
+ sage: E = EllipticCurve([SR(i),i]); E
282
+ Elliptic Curve defined by y^2 = x^3 + I*x + I over Symbolic Ring
283
+ sage: type(E)
284
+ <class 'sage.schemes.elliptic_curves.ell_field.EllipticCurve_field_with_category'>
285
+ sage: E.category()
286
+ Category of abelian varieties over Symbolic Ring
287
+ sage: SR in Fields()
288
+ True
289
+
290
+ sage: F = FractionField(PolynomialRing(QQ,'t'))
291
+ sage: t = F.gen()
292
+ sage: E = EllipticCurve([t,0]); E
293
+ Elliptic Curve defined by y^2 = x^3 + t*x
294
+ over Fraction Field of Univariate Polynomial Ring in t over Rational Field
295
+ sage: type(E)
296
+ <class 'sage.schemes.elliptic_curves.ell_field.EllipticCurve_field_with_category'>
297
+ sage: E.category()
298
+ Category of abelian varieties over
299
+ Fraction Field of Univariate Polynomial Ring in t over Rational Field
300
+
301
+ See :issue:`12517`::
302
+
303
+ sage: E = EllipticCurve([1..5])
304
+ sage: EllipticCurve(E.a_invariants())
305
+ Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 4*x + 5 over Rational Field
306
+
307
+ See :issue:`11773`::
308
+
309
+ sage: E = EllipticCurve()
310
+ Traceback (most recent call last):
311
+ ...
312
+ TypeError: invalid input to EllipticCurve constructor
313
+ """
314
+ def create_key_and_extra_args(self, x=None, y=None, j=None, minimal_twist=True, **kwds):
315
+ r"""
316
+ Return a ``UniqueFactory`` key and possibly extra parameters.
317
+
318
+ INPUT: See the documentation for :class:`EllipticCurveFactory`.
319
+
320
+ OUTPUT:
321
+
322
+ A pair ``(key, extra_args)``:
323
+
324
+ - ``key`` has the form `(R, (a_1, a_2, a_3, a_4, a_6))`,
325
+ representing a ring and the Weierstrass coefficients of an
326
+ elliptic curve over that ring;
327
+
328
+ - ``extra_args`` is a dictionary containing additional data to
329
+ be inserted into the elliptic curve structure.
330
+
331
+ EXAMPLES::
332
+
333
+ sage: EllipticCurve.create_key_and_extra_args(j=8000)
334
+ ((Rational Field, (0, 1, 0, -3, 1)), {})
335
+
336
+ When constructing a curve over `\QQ` from a Cremona or LMFDB
337
+ label, the invariants from the database are returned as
338
+ ``extra_args``::
339
+
340
+ sage: key, data = EllipticCurve.create_key_and_extra_args('389.a1')
341
+ sage: key
342
+ (Rational Field, (0, 1, 1, -2, 0))
343
+ sage: data['conductor']
344
+ 389
345
+ sage: data['cremona_label']
346
+ '389a1'
347
+ sage: data['lmfdb_label']
348
+ '389.a1'
349
+ sage: data['rank']
350
+ 2
351
+ sage: data['torsion_order']
352
+ 1
353
+
354
+ User-specified keywords are also included in ``extra_args``::
355
+
356
+ sage: key, data = EllipticCurve.create_key_and_extra_args((0, 0, 1, -23737, 960366), rank=4)
357
+ sage: data['rank']
358
+ 4
359
+
360
+ Furthermore, keywords takes precedence over data from the
361
+ database, which can be used to specify an alternative set of
362
+ generators for the Mordell-Weil group::
363
+
364
+ sage: key, data = EllipticCurve.create_key_and_extra_args('5077a1', gens=[[1, -1], [-2, 3], [4, -7]])
365
+ sage: data['gens']
366
+ [[1, -1], [-2, 3], [4, -7]]
367
+ sage: E = EllipticCurve.create_object(0, key, **data)
368
+ sage: E.gens()
369
+ [(-2 : 3 : 1), (1 : -1 : 1), (4 : -7 : 1)]
370
+
371
+ Note that elliptic curves are equal if and only they have the
372
+ same base ring and Weierstrass equation; the data in
373
+ ``extra_args`` do not influence comparison of elliptic curves.
374
+ A consequence of this is that passing keyword arguments only
375
+ works when constructing an elliptic curve the first time::
376
+
377
+ sage: E = EllipticCurve('433a1', gens=[[-1, 1], [3, 4]])
378
+ sage: E.gens()
379
+ [(-1 : 1 : 1), (3 : 4 : 1)]
380
+ sage: E = EllipticCurve('433a1', gens=[[-1, 0], [0, 1]])
381
+ sage: E.gens()
382
+ [(-1 : 1 : 1), (3 : 4 : 1)]
383
+
384
+ .. WARNING::
385
+
386
+ Manually specifying extra data is almost never necessary
387
+ and is not guaranteed to have any effect, as the above
388
+ example shows. Almost no checking is done, so specifying
389
+ incorrect data may lead to wrong results of computations
390
+ instead of errors or warnings.
391
+
392
+ TESTS::
393
+
394
+ sage: # needs sage.symbolic
395
+ sage: var('x', 'y', 'v', 'w')
396
+ (x, y, v, w)
397
+ sage: EllipticCurve(y^2 + y > x^3 + x - 9)
398
+ Traceback (most recent call last):
399
+ ...
400
+ ValueError: no symbolic relations other than equalities are allowed
401
+ sage: E = EllipticCurve(y^2 + y == x^3 + x - 9)
402
+ sage: E is EllipticCurve(y^2 + y - ( x^3 + x - 9 ))
403
+ True
404
+ sage: R.<x,y> = QQ[]
405
+ sage: E is EllipticCurve(y^2 + y - ( x^3 + x - 9 ))
406
+ True
407
+ """
408
+ R = None
409
+ if x in Rings():
410
+ R, x = (x, y)
411
+
412
+ if j is not None:
413
+ if R is not None:
414
+ try:
415
+ j = R(j)
416
+ except (ZeroDivisionError, ValueError, TypeError):
417
+ raise ValueError("First parameter must be a ring containing %s" % j)
418
+ elif x is not None:
419
+ raise ValueError("First parameter (if present) must be a ring when j is specified")
420
+ x = coefficients_from_j(j, minimal_twist)
421
+
422
+ if isinstance(x, Expression) and x.is_relational():
423
+ import operator
424
+ if x.operator() != operator.eq:
425
+ raise ValueError("no symbolic relations other than equalities are allowed")
426
+ x = x.lhs() - x.rhs()
427
+
428
+ if isinstance(parent(x), sage.rings.abc.SymbolicRing):
429
+ x = x._polynomial_(QQ['x', 'y'])
430
+
431
+ if isinstance(x, MPolynomial):
432
+ if y is None:
433
+ x = coefficients_from_Weierstrass_polynomial(x)
434
+ else:
435
+ # x is a cubic, y a rational point
436
+ x = EllipticCurve_from_cubic(x, y, morphism=False).ainvs()
437
+
438
+ if isinstance(x, str):
439
+ # Interpret x as a Cremona or LMFDB label.
440
+ from sage.databases.cremona import CremonaDatabase
441
+ x, data = CremonaDatabase().coefficients_and_data(x)
442
+ # data is only valid for elliptic curves over QQ.
443
+ if R not in (None, QQ):
444
+ data = {}
445
+ # User-provided keywords may override database entries.
446
+ data.update(kwds)
447
+ kwds = data
448
+
449
+ if not isinstance(x, (list, tuple)):
450
+ raise TypeError("invalid input to EllipticCurve constructor")
451
+
452
+ if len(x) == 2:
453
+ x = (0, 0, 0, x[0], x[1])
454
+ elif len(x) != 5:
455
+ raise ValueError("sequence of coefficients must have length 2 or 5")
456
+
457
+ if R is None:
458
+ R = Sequence(x).universe()
459
+ if R in (ZZ, int):
460
+ R = QQ
461
+
462
+ return (R, tuple(R(a) for a in x)), kwds
463
+
464
+ def create_object(self, version, key, *, names=None, **kwds):
465
+ r"""
466
+ Create an object from a ``UniqueFactory`` key.
467
+
468
+ EXAMPLES::
469
+
470
+ sage: E = EllipticCurve.create_object(0, (GF(3), (1, 2, 0, 1, 2)))
471
+ sage: type(E)
472
+ <class 'sage.schemes.elliptic_curves.ell_finite_field.EllipticCurve_finite_field_with_category'>
473
+
474
+ ``names`` is ignored at the moment, however it is used to support a convenient way to get a generator::
475
+
476
+ sage: # needs eclib
477
+ sage: E.<P> = EllipticCurve(QQ, [1, 3])
478
+ sage: P
479
+ (-1 : 1 : 1)
480
+ sage: E.<P> = EllipticCurve(GF(5), [1, 3])
481
+ sage: P
482
+ (4 : 1 : 1)
483
+
484
+ .. NOTE::
485
+
486
+ Keyword arguments are currently only passed to the
487
+ constructor for elliptic curves over `\QQ`; elliptic
488
+ curves over other fields do not support them.
489
+
490
+ TESTS::
491
+
492
+ sage: E = EllipticCurve.create_object(0, (QQ, (1, 2, 0, 1, 2)), rank=2)
493
+ sage: E = EllipticCurve.create_object(0, (GF(3), (1, 2, 0, 1, 2)), rank=2)
494
+ Traceback (most recent call last):
495
+ ...
496
+ TypeError: unexpected keyword arguments: {'rank': 2}
497
+
498
+ Coverage tests::
499
+
500
+ sage: E = EllipticCurve(QQ, [2, 5], modular_degree=944, regulator=1)
501
+ sage: E.modular_degree()
502
+ 944
503
+ sage: E.regulator()
504
+ 1.00000000000000
505
+ """
506
+ R, x = key
507
+
508
+ if R is QQ:
509
+ from .ell_rational_field import EllipticCurve_rational_field
510
+ return EllipticCurve_rational_field(x, **kwds)
511
+ elif kwds:
512
+ raise TypeError(f"unexpected keyword arguments: {kwds}")
513
+
514
+ if isinstance(R, NumberField):
515
+ from .ell_number_field import EllipticCurve_number_field
516
+ return EllipticCurve_number_field(R, x)
517
+ elif isinstance(R, sage.rings.abc.pAdicField):
518
+ from .ell_padic_field import EllipticCurve_padic_field
519
+ return EllipticCurve_padic_field(R, x)
520
+ elif isinstance(R, FiniteField) or (isinstance(R, sage.rings.abc.IntegerModRing) and R.characteristic().is_prime()):
521
+ from .ell_finite_field import EllipticCurve_finite_field
522
+ return EllipticCurve_finite_field(R, x)
523
+ elif R in _Fields:
524
+ from .ell_field import EllipticCurve_field
525
+ return EllipticCurve_field(R, x)
526
+ from .ell_generic import EllipticCurve_generic
527
+ return EllipticCurve_generic(R, x)
528
+
529
+
530
+ EllipticCurve = EllipticCurveFactory('sage.schemes.elliptic_curves.constructor.EllipticCurve')
531
+
532
+
533
+ def EllipticCurve_from_Weierstrass_polynomial(f):
534
+ r"""
535
+ Return the elliptic curve defined by a cubic in (long) Weierstrass
536
+ form.
537
+
538
+ INPUT:
539
+
540
+ - ``f`` -- a inhomogeneous cubic polynomial in long Weierstrass form
541
+
542
+ OUTPUT: the elliptic curve defined by it
543
+
544
+ EXAMPLES::
545
+
546
+ sage: R.<x,y> = QQ[]
547
+ sage: f = y^2 + 1*x*y + 3*y - (x^3 + 2*x^2 + 4*x + 6)
548
+ sage: EllipticCurve(f)
549
+ Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 4*x + 6 over Rational Field
550
+ sage: EllipticCurve(f).a_invariants()
551
+ (1, 2, 3, 4, 6)
552
+
553
+ The polynomial ring may have extra variables as long as they
554
+ do not occur in the polynomial itself::
555
+
556
+ sage: R.<x,y,z,w> = QQ[]
557
+ sage: EllipticCurve(-y^2 + x^3 + 1)
558
+ Elliptic Curve defined by y^2 = x^3 + 1 over Rational Field
559
+ sage: EllipticCurve(-x^2 + y^3 + 1)
560
+ Elliptic Curve defined by y^2 = x^3 + 1 over Rational Field
561
+ sage: EllipticCurve(-w^2 + z^3 + 1)
562
+ Elliptic Curve defined by y^2 = x^3 + 1 over Rational Field
563
+
564
+ TESTS::
565
+
566
+ sage: from sage.schemes.elliptic_curves.constructor import EllipticCurve_from_Weierstrass_polynomial
567
+ sage: EllipticCurve_from_Weierstrass_polynomial(-w^2 + z^3 + 1)
568
+ Elliptic Curve defined by y^2 = x^3 + 1 over Rational Field
569
+ """
570
+ return EllipticCurve(coefficients_from_Weierstrass_polynomial(f))
571
+
572
+
573
+ def coefficients_from_Weierstrass_polynomial(f):
574
+ r"""
575
+ Return the coefficients `[a_1, a_2, a_3, a_4, a_6]` of a cubic in
576
+ Weierstrass form.
577
+
578
+ EXAMPLES::
579
+
580
+ sage: from sage.schemes.elliptic_curves.constructor import coefficients_from_Weierstrass_polynomial
581
+ sage: R.<w,z> = QQ[]
582
+ sage: coefficients_from_Weierstrass_polynomial(-w^2 + z^3 + 1)
583
+ [0, 0, 0, 0, 1]
584
+ sage: R.<u,v> = GF(13)[]
585
+ sage: EllipticCurve(u^2 + 2*v*u + 3*u - (v^3 + 4*v^2 + 5*v + 6)) # indirect doctest
586
+ Elliptic Curve defined by y^2 + 2*x*y + 3*y = x^3 + 4*x^2 + 5*x + 6 over Finite Field of size 13
587
+ """
588
+ from sage.schemes.hyperelliptic_curves.constructor import _parse_multivariate_defining_equation
589
+ f, h = _parse_multivariate_defining_equation(f)
590
+ # OUTPUT: tuple (f, h), each of them given as a list of coefficients.
591
+ if len(f) != 4 or len(h) > 2:
592
+ raise ValueError('polynomial is not in long Weierstrass form')
593
+ if not f[3].is_one():
594
+ raise ValueError('the coefficient of x^3 and -y^2 must be the same')
595
+ h += [0] * (2 - len(h))
596
+ return [h[1], f[2], h[0], f[1], f[0]]
597
+
598
+
599
+ def EllipticCurve_from_c4c6(c4, c6):
600
+ r"""
601
+ Return an elliptic curve with given `c_4` and
602
+ `c_6` invariants.
603
+
604
+ EXAMPLES::
605
+
606
+ sage: E = EllipticCurve_from_c4c6(17, -2005)
607
+ sage: E
608
+ Elliptic Curve defined by y^2 = x^3 - 17/48*x + 2005/864 over Rational Field
609
+ sage: E.c_invariants()
610
+ (17, -2005)
611
+ """
612
+ try:
613
+ K = c4.parent()
614
+ except AttributeError:
615
+ K = RationalField()
616
+ if K not in _Fields:
617
+ K = K.fraction_field()
618
+ return EllipticCurve([-K(c4)/K(48), -K(c6)/K(864)])
619
+
620
+
621
+ def EllipticCurve_from_j(j, minimal_twist=True):
622
+ r"""
623
+ Return an elliptic curve with given `j`-invariant.
624
+
625
+ INPUT:
626
+
627
+ - ``j`` -- an element of some field
628
+
629
+ - ``minimal_twist``-- boolean (default: ``True``); if ``True`` and ``j``
630
+ is in `\QQ`, the curve returned is a minimal twist, i.e. has
631
+ minimal conductor; when there is more than one curve with
632
+ minimal conductor, the curve returned is the one whose label
633
+ comes first if the curves are in the CremonaDatabase, otherwise
634
+ the one whose minimal a-invariants are first lexicographically.
635
+ If `j` is not in `\QQ` this parameter is ignored.
636
+
637
+ OUTPUT: an elliptic curve with `j`-invariant `j`
638
+
639
+ EXAMPLES::
640
+
641
+ sage: E = EllipticCurve_from_j(0); E; E.j_invariant(); E.label()
642
+ Elliptic Curve defined by y^2 + y = x^3 over Rational Field
643
+ 0
644
+ '27a3'
645
+
646
+ sage: E = EllipticCurve_from_j(1728); E; E.j_invariant(); E.label()
647
+ Elliptic Curve defined by y^2 = x^3 - x over Rational Field
648
+ 1728
649
+ '32a2'
650
+
651
+ sage: E = EllipticCurve_from_j(1); E; E.j_invariant()
652
+ Elliptic Curve defined by y^2 + x*y = x^3 + 36*x + 3455 over Rational Field
653
+ 1
654
+
655
+ The ``minimal_twist`` parameter (ignored except over `\QQ` and
656
+ ``True`` by default) controls whether or not a minimal twist is
657
+ computed::
658
+
659
+ sage: EllipticCurve_from_j(100)
660
+ Elliptic Curve defined by y^2 = x^3 + x^2 + 3392*x + 307888 over Rational Field
661
+ sage: _.conductor()
662
+ 33129800
663
+ sage: EllipticCurve_from_j(100, minimal_twist=False)
664
+ Elliptic Curve defined by y^2 = x^3 + 488400*x - 530076800 over Rational Field
665
+ sage: _.conductor()
666
+ 298168200
667
+
668
+ Since computing the minimal twist requires factoring both `j` and
669
+ `j-1728` the following example would take a long time without
670
+ setting ``minimal_twist`` to False::
671
+
672
+ sage: E = EllipticCurve_from_j(2^256+1, minimal_twist=False)
673
+ sage: E.j_invariant() == 2^256+1
674
+ True
675
+ """
676
+ return EllipticCurve(coefficients_from_j(j, minimal_twist))
677
+
678
+
679
+ def coefficients_from_j(j, minimal_twist=True):
680
+ r"""
681
+ Return Weierstrass coefficients `(a_1, a_2, a_3, a_4, a_6)` for an
682
+ elliptic curve with given `j`-invariant.
683
+
684
+ INPUT: See :func:`EllipticCurve_from_j`.
685
+
686
+ EXAMPLES::
687
+
688
+ sage: from sage.schemes.elliptic_curves.constructor import coefficients_from_j
689
+ sage: coefficients_from_j(0)
690
+ [0, 0, 1, 0, 0]
691
+ sage: coefficients_from_j(1728)
692
+ [0, 0, 0, -1, 0]
693
+ sage: coefficients_from_j(1)
694
+ [1, 0, 0, 36, 3455]
695
+
696
+ The ``minimal_twist`` parameter (ignored except over `\QQ` and
697
+ ``True`` by default) controls whether or not a minimal twist is
698
+ computed::
699
+
700
+ sage: coefficients_from_j(100)
701
+ [0, 1, 0, 3392, 307888]
702
+ sage: coefficients_from_j(100, minimal_twist=False)
703
+ [0, 0, 0, 488400, -530076800]
704
+ """
705
+ try:
706
+ K = j.parent()
707
+ except AttributeError:
708
+ K = RationalField()
709
+ if K not in _Fields:
710
+ K = K.fraction_field()
711
+
712
+ char = K.characteristic()
713
+ if char == 2:
714
+ if j == 0:
715
+ return Sequence([0, 0, 1, 0, 0], universe=K)
716
+ else:
717
+ return Sequence([1, 0, 0, 0, 1/j], universe=K)
718
+ if char == 3:
719
+ if j == 0:
720
+ return Sequence([0, 0, 0, 1, 0], universe=K)
721
+ else:
722
+ return Sequence([0, j, 0, 0, -j**2], universe=K)
723
+
724
+ if K is RationalField():
725
+ # we construct the minimal twist, i.e. the curve with minimal
726
+ # conductor with this j_invariant:
727
+ if j == 0:
728
+ return Sequence([0, 0, 1, 0, 0], universe=K) # 27a3
729
+ if j == 1728:
730
+ return Sequence([0, 0, 0, -1, 0], universe=K) # 32a2
731
+
732
+ if not minimal_twist:
733
+ k = j-1728
734
+ return Sequence([0, 0, 0, -3*j*k, -2*j*k**2], universe=K)
735
+
736
+ n = j.numerator()
737
+ m = n-1728*j.denominator()
738
+ a4 = -3*n*m
739
+ a6 = -2*n*m**2
740
+
741
+ # Now E=[0,0,0,a4,a6] has j-invariant j=n/d
742
+ from sage.sets.set import Set
743
+ for p in Set(n.prime_divisors()+m.prime_divisors()):
744
+ e = min(a4.valuation(p)//2,a6.valuation(p)//3)
745
+ if e > 0:
746
+ p = p**e
747
+ a4 /= p**2
748
+ a6 /= p**3
749
+
750
+ # Now E=[0,0,0,a4,a6] is minimal at all p != 2,3
751
+ tw = [-1,2,-2,3,-3,6,-6]
752
+ E1 = EllipticCurve([0,0,0,a4,a6])
753
+ Elist = [E1] + [E1.quadratic_twist(t) for t in tw]
754
+ min_cond = min(E.conductor() for E in Elist)
755
+ Elist = [E for E in Elist if E.conductor() == min_cond]
756
+ if len(Elist) > 1:
757
+ from sage.databases.cremona import CremonaDatabase, parse_cremona_label
758
+ if min_cond <= CremonaDatabase().largest_conductor():
759
+ sorter = lambda E: parse_cremona_label(E.label(), numerical_class_code=True)
760
+ else:
761
+ sorter = lambda E: E.ainvs()
762
+ Elist.sort(key=sorter)
763
+ return Sequence(Elist[0].ainvs())
764
+
765
+ # defaults for all other fields:
766
+ if j == 0:
767
+ return Sequence([0, 0, 0, 0, 1], universe=K)
768
+ if j == 1728:
769
+ return Sequence([0, 0, 0, 1, 0], universe=K)
770
+ k = j-1728
771
+ return Sequence([0, 0, 0, -3*j*k, -2*j*k**2], universe=K)
772
+
773
+
774
+ def EllipticCurve_from_cubic(F, P=None, morphism=True):
775
+ r"""
776
+ Construct an elliptic curve from a ternary cubic with a rational point.
777
+
778
+ If you just want the Weierstrass form and are not interested in
779
+ the morphism then it is easier to use the function
780
+ :func:`~sage.schemes.elliptic_curves.jacobian.Jacobian`
781
+ instead. If there is a rational point on the given cubic, this
782
+ function will construct the same elliptic curve but you do not have to
783
+ supply the point ``P``.
784
+
785
+ INPUT:
786
+
787
+ - ``F`` -- a homogeneous cubic in three variables with rational
788
+ coefficients, as a polynomial ring element, defining a smooth
789
+ plane cubic curve `C`
790
+
791
+ - ``P`` -- a 3-tuple `(x,y,z)` defining a projective point on `C`,
792
+ or ``None``. If ``None`` then a rational flex will be used as a
793
+ base point if one exists, otherwise an error will be raised.
794
+
795
+ - ``morphism`` -- boolean (default: ``True``); if ``True``
796
+ returns a birational isomorphism from `C` to a Weierstrass
797
+ elliptic curve `E`, otherwise just returns `E`
798
+
799
+ OUTPUT:
800
+
801
+ Either (when ``morphism``=``False``) an elliptic curve `E` in long
802
+ Weierstrass form isomorphic to the plane cubic curve `C` defined
803
+ by the equation `F=0`.
804
+
805
+ Or (when ``morphism=True``), a birational isomorphism from `C` to
806
+ the elliptic curve `E`. If the given point is a flex, this is a
807
+ linear isomorphism.
808
+
809
+ .. NOTE::
810
+
811
+ The function
812
+ :func:`~sage.schemes.elliptic_curves.jacobian.Jacobian` may be
813
+ used instead. It constructs the same elliptic curve (which is in
814
+ all cases the Jacobian of `(F=0)`) and needs no base point to be
815
+ provided, but also returns no isomorphism since in general there
816
+ is none: the plane cubic is only isomorphic to its Jacobian when
817
+ it has a rational point.
818
+
819
+ .. NOTE::
820
+
821
+ When ``morphism=True``, a birational isomorphism between the
822
+ curve `F=0` and the Weierstrass curve is returned. If the point
823
+ happens to be a flex, then this is a linear isomorphism. The
824
+ morphism does not necessarily take the given point `P` to the
825
+ point at infinity on `E`, since we always use a rational flex
826
+ on `C` as base-point when one exists.
827
+
828
+ EXAMPLES:
829
+
830
+ First we find that the Fermat cubic is isomorphic to the curve
831
+ with Cremona label 27a1::
832
+
833
+ sage: R.<x,y,z> = QQ[]
834
+ sage: cubic = x^3 + y^3 + z^3
835
+ sage: P = [1,-1,0]
836
+ sage: E = EllipticCurve_from_cubic(cubic, P, morphism=False); E
837
+ Elliptic Curve defined by y^2 - 9*y = x^3 - 27 over Rational Field
838
+ sage: E.cremona_label()
839
+ '27a1'
840
+ sage: EllipticCurve_from_cubic(cubic, [0,1,-1], morphism=False).cremona_label()
841
+ '27a1'
842
+ sage: EllipticCurve_from_cubic(cubic, [1,0,-1], morphism=False).cremona_label()
843
+ '27a1'
844
+
845
+ Next we find the minimal model and conductor of the Jacobian of the
846
+ Selmer curve::
847
+
848
+ sage: R.<a,b,c> = QQ[]
849
+ sage: cubic = a^3 + b^3 + 60*c^3
850
+ sage: P = [1,-1,0]
851
+ sage: E = EllipticCurve_from_cubic(cubic, P, morphism=False); E
852
+ Elliptic Curve defined by y^2 - 540*y = x^3 - 97200 over Rational Field
853
+ sage: E.minimal_model()
854
+ Elliptic Curve defined by y^2 = x^3 - 24300 over Rational Field
855
+ sage: E.conductor()
856
+ 24300
857
+
858
+ We can also get the birational isomorphism to and from the
859
+ Weierstrass form. We start with an example where ``P`` is a flex
860
+ and the equivalence is a linear isomorphism::
861
+
862
+ sage: f = EllipticCurve_from_cubic(cubic, P, morphism=True)
863
+ sage: f
864
+ Scheme morphism:
865
+ From: Projective Plane Curve over Rational Field defined by a^3 + b^3 + 60*c^3
866
+ To: Elliptic Curve defined by y^2 - 540*y = x^3 - 97200 over Rational Field
867
+ Defn: Defined on coordinates by sending (a : b : c) to
868
+ (-c : 3*a : 1/180*a + 1/180*b)
869
+
870
+ sage: finv = f.inverse(); finv
871
+ Scheme morphism:
872
+ From: Elliptic Curve defined by y^2 - 540*y = x^3 - 97200 over Rational Field
873
+ To: Projective Plane Curve over Rational Field defined by a^3 + b^3 + 60*c^3
874
+ Defn: Defined on coordinates by sending (x : y : z) to
875
+ (1/3*y : -1/3*y + 180*z : -x)
876
+
877
+ Scheme morphism:
878
+ From: Elliptic Curve defined by y^2 + 2*x*y + 20*y = x^3 - x^2 - 20*x - 400/3
879
+ over Rational Field
880
+ To: Closed subscheme of Projective Space of dimension 2 over Rational Field
881
+ defined by: a^3 + b^3 + 60*c^3
882
+ Defn: Defined on coordinates by sending (x : y : z) to
883
+ (x + y + 20*z : -x - y : -x)
884
+
885
+ We verify that `f` maps the chosen point `P=(1,-1,0)` on the cubic
886
+ to the origin of the elliptic curve::
887
+
888
+ sage: f([1,-1,0])
889
+ (0 : 1 : 0)
890
+ sage: finv([0,1,0])
891
+ (-1 : 1 : 0)
892
+
893
+ To verify the output, we plug in the polynomials to check that
894
+ this indeed transforms the cubic into Weierstrass form::
895
+
896
+ sage: cubic(finv.defining_polynomials()) * finv.post_rescaling()
897
+ -x^3 + y^2*z - 540*y*z^2 + 97200*z^3
898
+
899
+ sage: E.defining_polynomial()(f.defining_polynomials()) * f.post_rescaling()
900
+ a^3 + b^3 + 60*c^3
901
+
902
+ If the given point is not a flex and the cubic has no rational
903
+ flexes, then the cubic can not be transformed to a Weierstrass
904
+ equation by a linear transformation. The general birational
905
+ transformation is still a birational isomorphism, but is
906
+ quadratic::
907
+
908
+ sage: R.<x,y,z> = QQ[]
909
+ sage: cubic = x^2*y + 4*x*y^2 + x^2*z + 8*x*y*z + 4*y^2*z + 9*x*z^2 + 9*y*z^2
910
+ sage: f = EllipticCurve_from_cubic(cubic, [1,-1,1], morphism=True); f
911
+ Scheme morphism:
912
+ From: Projective Plane Curve over Rational Field defined
913
+ by x^2*y + 4*x*y^2 + x^2*z + 8*x*y*z + 4*y^2*z + 9*x*z^2 + 9*y*z^2
914
+ To: Elliptic Curve defined
915
+ by y^2 + 7560/19*x*y + 552960000000/2352637*y = x^3 - 3445200/133*x^2
916
+ over Rational Field
917
+ Defn: Defined on coordinates by sending (x : y : z) to
918
+ (2527/17280*x^2 + 133/2160*x*y + 133/108000*y^2 + 133/2880*x*z
919
+ + 931/18000*y*z - 3857/48000*z^2
920
+ : -6859/288*x^2 + 323/36*x*y + 359/1800*y^2 + 551/48*x*z
921
+ + 2813/300*y*z + 24389/800*z^2
922
+ : -2352637/99532800000*x^2 - 2352637/124416000000*x*y
923
+ - 2352637/622080000000*y^2 + 2352637/82944000000*x*z
924
+ + 2352637/207360000000*y*z - 2352637/276480000000*z^2)
925
+
926
+ Note that the morphism returned cannot be evaluated directly at
927
+ the given point ``P=(1:-1:1)`` since the polynomials defining it
928
+ all vanish there::
929
+
930
+ sage: f([1,-1,1])
931
+ Traceback (most recent call last):
932
+ ...
933
+ ValueError: [0, 0, 0] does not define a valid projective point since all entries are zero
934
+
935
+ Using the group law on the codomain elliptic curve, which has rank
936
+ 1 and full 2-torsion, and the inverse morphism, we can find many
937
+ points on the cubic. First we find the preimages of multiples of
938
+ the generator::
939
+
940
+ sage: # needs eclib
941
+ sage: E = f.codomain()
942
+ sage: E.label()
943
+ '720e2'
944
+ sage: E.rank()
945
+ 1
946
+ sage: R = E.gens()[0]; R
947
+ (-17280000/2527 : 9331200000/6859 : 1)
948
+ sage: finv = f.inverse()
949
+ sage: [finv(k*R) for k in range(1,10)]
950
+ [(-4 : 1 : 0),
951
+ (-1 : 4 : 1),
952
+ (-20 : -55/76 : 1),
953
+ (319/399 : -11339/7539 : 1),
954
+ (159919/14360 : -4078139/1327840 : 1),
955
+ (-27809119/63578639 : 1856146436/3425378659 : 1),
956
+ (-510646582340/56909753439 : 424000923715/30153806197284 : 1),
957
+ (-56686114363679/4050436059492161 : -2433034816977728281/1072927821085503881 : 1),
958
+ (650589589099815846721/72056273157352822480 : -347376189546061993109881/194127383495944026752320 : 1)]
959
+
960
+ The elliptic curve also has torsion, which we can map back::
961
+
962
+ sage: # needs eclib
963
+ sage: E.torsion_points()
964
+ [(0 : 1 : 0),
965
+ (-144000000/17689 : 3533760000000/2352637 : 1),
966
+ (-92160000/17689 : 2162073600000/2352637 : 1),
967
+ (-5760000/17689 : -124070400000/2352637 : 1)]
968
+ sage: [finv(Q) for Q in E.torsion_points() if Q]
969
+ [(9 : -9/4 : 1), (-9 : 0 : 1), (0 : 1 : 0)]
970
+
971
+ In this example, the given point ``P`` is not a flex but the cubic
972
+ does have a rational flex, ``(-4:0:1)``. We return a linear
973
+ isomorphism which maps this flex to the point at infinity on the
974
+ Weierstrass model::
975
+
976
+ sage: R.<a,b,c> = QQ[]
977
+ sage: cubic = a^3 + 7*b^3 + 64*c^3
978
+ sage: P = [2,2,-1]
979
+ sage: f = EllipticCurve_from_cubic(cubic, P, morphism=True)
980
+ sage: E = f.codomain(); E
981
+ Elliptic Curve defined by y^2 - 258048*y = x^3 - 22196256768 over Rational Field
982
+ sage: E.minimal_model()
983
+ Elliptic Curve defined by y^2 + y = x^3 - 331 over Rational Field
984
+
985
+ sage: f
986
+ Scheme morphism:
987
+ From: Projective Plane Curve over Rational Field defined by a^3 + 7*b^3 + 64*c^3
988
+ To: Elliptic Curve defined by y^2 - 258048*y = x^3 - 22196256768 over Rational Field
989
+ Defn: Defined on coordinates by sending (a : b : c) to
990
+ (b : -48*a : -1/5376*a - 1/1344*c)
991
+
992
+ sage: finv = f.inverse(); finv
993
+ Scheme morphism:
994
+ From: Elliptic Curve defined by y^2 - 258048*y = x^3 - 22196256768 over Rational Field
995
+ To: Projective Plane Curve over Rational Field defined by a^3 + 7*b^3 + 64*c^3
996
+ Defn: Defined on coordinates by sending (x : y : z) to
997
+ (-1/48*y : x : 1/192*y - 1344*z)
998
+
999
+ sage: cubic(finv.defining_polynomials()) * finv.post_rescaling()
1000
+ -x^3 + y^2*z - 258048*y*z^2 + 22196256768*z^3
1001
+
1002
+ sage: E.defining_polynomial()(f.defining_polynomials()) * f.post_rescaling()
1003
+ a^3 + 7*b^3 + 64*c^3
1004
+
1005
+ sage: f(P)
1006
+ (5376 : -258048 : 1)
1007
+ sage: f([-4,0,1])
1008
+ (0 : 1 : 0)
1009
+
1010
+ It is possible to not provide a base point ``P`` provided that the
1011
+ cubic has a rational flex. In this case the flexes will be found
1012
+ and one will be used as a base point::
1013
+
1014
+ sage: R.<x,y,z> = QQ[]
1015
+ sage: cubic = x^3 + y^3 + z^3
1016
+ sage: f = EllipticCurve_from_cubic(cubic, morphism=True)
1017
+ sage: f
1018
+ Scheme morphism:
1019
+ From: Projective Plane Curve over Rational Field defined by x^3 + y^3 + z^3
1020
+ To: Elliptic Curve defined by y^2 - 9*y = x^3 - 27 over Rational Field
1021
+ Defn: Defined on coordinates by sending (x : y : z) to
1022
+ (y : -3*x : -1/3*x - 1/3*z)
1023
+
1024
+ An error will be raised if no point is given and there are no rational flexes::
1025
+
1026
+ sage: R.<x,y,z> = QQ[]
1027
+ sage: cubic = 3*x^3 + 4*y^3 + 5*z^3
1028
+ sage: EllipticCurve_from_cubic(cubic)
1029
+ Traceback (most recent call last):
1030
+ ...
1031
+ ValueError: A point must be given when the cubic has no rational flexes
1032
+
1033
+ An example over a finite field, using a flex::
1034
+
1035
+ sage: K = GF(17)
1036
+ sage: R.<x,y,z> = K[]
1037
+ sage: cubic = 2*x^3 + 3*y^3 + 4*z^3
1038
+ sage: EllipticCurve_from_cubic(cubic, [0,3,1])
1039
+ Scheme morphism:
1040
+ From: Projective Plane Curve over Finite Field of size 17
1041
+ defined by 2*x^3 + 3*y^3 + 4*z^3
1042
+ To: Elliptic Curve defined by y^2 + 16*y = x^3 + 11 over Finite Field of size 17
1043
+ Defn: Defined on coordinates by sending (x : y : z) to
1044
+ (-x : 4*y : 4*y + 5*z)
1045
+
1046
+ An example in characteristic 3::
1047
+
1048
+ sage: K = GF(3)
1049
+ sage: R.<x,y,z> = K[]
1050
+ sage: cubic = x^3 + y^3 + z^3 + x*y*z
1051
+ sage: EllipticCurve_from_cubic(cubic, [0,1,-1])
1052
+ Scheme morphism:
1053
+ From: Projective Plane Curve over Finite Field of size 3
1054
+ defined by x^3 + y^3 + x*y*z + z^3
1055
+ To: Elliptic Curve defined by y^2 + x*y = x^3 + 1 over Finite Field of size 3
1056
+ Defn: Defined on coordinates by sending (x : y : z) to
1057
+ (y + z : -y : x)
1058
+
1059
+ An example over a number field, using a non-flex and where there are no rational flexes::
1060
+
1061
+ sage: # needs sage.rings.number_field
1062
+ sage: K.<a> = QuadraticField(-3)
1063
+ sage: R.<x,y,z> = K[]
1064
+ sage: cubic = 2*x^3 + 3*y^3 + 5*z^3
1065
+ sage: EllipticCurve_from_cubic(cubic, [1,1,-1])
1066
+ Scheme morphism:
1067
+ From: Projective Plane Curve over Number Field in a
1068
+ with defining polynomial x^2 + 3 with a = 1.732050807568878?*I
1069
+ defined by 2*x^3 + 3*y^3 + 5*z^3
1070
+ To: Elliptic Curve defined by
1071
+ y^2 + 1754460/2053*x*y + 5226454388736000/8653002877*y
1072
+ = x^3 + (-652253285700/4214809)*x^2
1073
+ over Number Field in a with defining polynomial x^2 + 3
1074
+ with a = 1.732050807568878?*I
1075
+ Defn: Defined on coordinates by sending (x : y : z) to
1076
+ (-16424/127575*x^2 - 231989/680400*x*y - 14371/64800*y^2 - 26689/81648*x*z - 10265/27216*y*z - 2053/163296*z^2
1077
+ : 24496/315*x^2 + 119243/840*x*y + 4837/80*y^2 + 67259/504*x*z + 25507/168*y*z + 5135/1008*z^2
1078
+ : 8653002877/2099914709760000*x^2 + 8653002877/699971569920000*x*y + 8653002877/933295426560000*y^2 + 8653002877/419982941952000*x*z + 8653002877/279988627968000*y*z + 8653002877/335986353561600*z^2)
1079
+
1080
+ An example over a function field, using a non-flex::
1081
+
1082
+ sage: K.<t> = FunctionField(QQ)
1083
+ sage: R.<x,y,z> = K[]
1084
+ sage: cubic = x^3 + t*y^3 + (1+t)*z^3
1085
+ sage: EllipticCurve_from_cubic(cubic, [1,1,-1], morphism=False) # needs sage.libs.singular
1086
+ Elliptic Curve defined by y^2 + ((162*t^6+486*t^5+810*t^4+810*t^3+486*t^2+162*t)/(t^6+12*t^5-3*t^4-20*t^3-3*t^2+12*t+1))*x*y + ((314928*t^14+4094064*t^13+23462136*t^12+78102144*t^11+167561379*t^10+243026001*t^9+243026001*t^8+167561379*t^7+78102144*t^6+23462136*t^5+4094064*t^4+314928*t^3)/(t^14+40*t^13+577*t^12+3524*t^11+8075*t^10+5288*t^9-8661*t^8-17688*t^7-8661*t^6+5288*t^5+8075*t^4+3524*t^3+577*t^2+40*t+1))*y = x^3 + ((2187*t^12+13122*t^11-17496*t^10-207765*t^9-516132*t^8-673596*t^7-516132*t^6-207765*t^5-17496*t^4+13122*t^3+2187*t^2)/(t^12+24*t^11+138*t^10-112*t^9-477*t^8+72*t^7+708*t^6+72*t^5-477*t^4-112*t^3+138*t^2+24*t+1))*x^2
1087
+ over Rational function field in t over Rational Field
1088
+
1089
+ TESTS:
1090
+
1091
+ Here is a test for :issue:`21092`::
1092
+
1093
+ sage: R.<x,y,z> = QQ[]
1094
+ sage: cubic = -3*x^2*y + 3*x*y^2 + 4*x^2*z + 4*y^2*z - 3*x*z^2 + 3*y*z^2 - 8*z^3
1095
+ sage: EllipticCurve_from_cubic(cubic, (-4/5, 4/5, 3/5) )
1096
+ Scheme morphism:
1097
+ From: Projective Plane Curve over Rational Field defined
1098
+ by -3*x^2*y + 3*x*y^2 + 4*x^2*z + 4*y^2*z - 3*x*z^2 + 3*y*z^2 - 8*z^3
1099
+ To: Elliptic Curve defined by y^2 + 24*x*y + 3024*y = x^3 + 495*x^2 + 36288*x
1100
+ over Rational Field
1101
+ Defn: Defined on coordinates by sending (x : y : z) to
1102
+ (-1/3*z : 3*x : -1/1008*x + 1/1008*y + 1/378*z)
1103
+ """
1104
+ from sage.schemes.curves.constructor import Curve
1105
+ from sage.matrix.constructor import Matrix
1106
+ from sage.schemes.elliptic_curves.weierstrass_transform import \
1107
+ WeierstrassTransformationWithInverse
1108
+
1109
+ # check the input
1110
+ R = F.parent()
1111
+ K = R.base_ring()
1112
+ if not isinstance(R, MPolynomialRing_base):
1113
+ raise TypeError('equation must be a polynomial')
1114
+ if R.ngens() != 3 or F.nvariables() != 3:
1115
+ raise TypeError('equation must be a polynomial in three variables')
1116
+ if not F.is_homogeneous():
1117
+ raise TypeError('equation must be a homogeneous polynomial')
1118
+
1119
+ C = Curve(F)
1120
+ if P:
1121
+ try:
1122
+ CP = C(P)
1123
+ except (TypeError, ValueError):
1124
+ raise TypeError('{} does not define a point on a projective curve over {} defined by {}'.format(P,K,F))
1125
+
1126
+ x, y, z = R.gens()
1127
+
1128
+ # Test whether P is a flex; if not test whether there are any rational flexes:
1129
+
1130
+ hessian = Matrix([[F.derivative(v1, v2) for v1 in R.gens()] for v2 in R.gens()]).det()
1131
+ if P and hessian(P) == 0:
1132
+ flex_point = P
1133
+ else:
1134
+ flexes = C.intersection(Curve(hessian)).rational_points()
1135
+ if flexes:
1136
+ flex_point = list(flexes[0])
1137
+ if not P:
1138
+ P = flex_point
1139
+ CP = C(P)
1140
+ else:
1141
+ flex_point = None
1142
+
1143
+ if flex_point is not None: # first case: base point is a flex
1144
+ P = flex_point
1145
+ L = tangent_at_smooth_point(C,P)
1146
+ dx, dy, dz = (L.coefficient(v) for v in R.gens())
1147
+
1148
+ # find an invertible matrix M such that (0,1,0)M=P and
1149
+ # ML'=(0,0,1)' where L=[dx,dy,dx]. Then the linear transform
1150
+ # by M takes P to [0,1,0] and L to Z=0:
1151
+
1152
+ if P[0]:
1153
+ Q1 = [0,-dz,dy]
1154
+ Q2 = [0,1,0] if dy else [0,0,1]
1155
+ elif P[1]:
1156
+ Q1 = [dz,0,-dx]
1157
+ Q2 = [1,0,0] if dx else [0,0,1]
1158
+ else:
1159
+ Q1 = [-dy,dx,0]
1160
+ Q2 = [1,0,0] if dx else [0,1,0]
1161
+
1162
+ M = Matrix(K,[Q1,P,Q2])
1163
+ # assert M.is_invertible()
1164
+ # assert list(vector([0,1,0])*M) == P
1165
+ # assert list(M*vector([dx,dy,dz]))[:2] == [0,0]
1166
+
1167
+ M = M.transpose()
1168
+ F2 = R(M.act_on_polynomial(F))
1169
+
1170
+ # scale and dehomogenise
1171
+ a = K(F2.coefficient(x**3))
1172
+ b = K(F2.coefficient(y*y*z))
1173
+
1174
+ F3 = F2([-x, y/b, z*a*b]) / a
1175
+ # assert F3.coefficient(x**3) == -1
1176
+ # assert F3.coefficient(y*y*z) == 1
1177
+ E = EllipticCurve(F3([x,y,1]))
1178
+ if not morphism:
1179
+ return E
1180
+
1181
+ # Construct the (linear) morphism
1182
+ M = M * Matrix(K,[[-1,0,0],[0,1/b,0],[0,0,a*b]])
1183
+ inv_defining_poly = [ M[i,0]*x + M[i,1]*y + M[i,2]*z for i in range(3) ]
1184
+ inv_post = 1/a
1185
+ M = M.inverse()
1186
+ fwd_defining_poly = [ M[i,0]*x + M[i,1]*y + M[i,2]*z for i in range(3) ]
1187
+ fwd_post = a
1188
+
1189
+ else: # Second case: no flexes
1190
+ if not P:
1191
+ raise ValueError('A point must be given when the cubic has no rational flexes')
1192
+ L = tangent_at_smooth_point(C,P)
1193
+ Qlist = [Q for Q in C.intersection(Curve(L)).rational_points() if C(Q) != CP]
1194
+ # assert Qlist
1195
+ P2 = C(Qlist[0])
1196
+ L2 = tangent_at_smooth_point(C,P2)
1197
+ Qlist = [Q for Q in C.intersection(Curve(L2)).rational_points() if C(Q) != P2]
1198
+ # assert Qlist
1199
+ P3 = C(Qlist[0])
1200
+
1201
+ # NB This construction of P3 relies on P2 not being a flex.
1202
+ # If we want to use a non-flex as P when there are rational
1203
+ # flexes this would be a problem. However, the only condition
1204
+ # which P3 must satisfy is that it is on the tangent at P2, it
1205
+ # need not lie on the cubic.
1206
+
1207
+ # send P, P2, P3 to (1:0:0), (0:1:0), (0:0:1) respectively
1208
+ M = Matrix(K, [P, list(P2), list(P3)]).transpose()
1209
+ F2 = M.act_on_polynomial(F)
1210
+ xyzM = [ M[i,0]*x + M[i,1]*y + M[i,2]*z for i in range(3) ]
1211
+ # assert F(xyzM)==F2
1212
+
1213
+ # substitute x = U^2, y = V*W, z = U*W, and rename (x,y,z)=(U,V,W)
1214
+ T1 = [x*x,y*z,x*z]
1215
+ S1 = x**2*z
1216
+ F3 = F2(T1) // S1
1217
+ xyzC = [ t(T1) for t in xyzM ]
1218
+ # assert F3 == F(xyzC) // S1
1219
+
1220
+ # scale and dehomogenise
1221
+ a = K(F3.coefficient(x**3))
1222
+ b = K(F3.coefficient(y*y*z))
1223
+ ab = a*b
1224
+
1225
+ T2 = [-x, y/b, ab*z]
1226
+ F4 = F3(T2) / a
1227
+ # assert F4.coefficient(x**3) == -1
1228
+ # assert F4.coefficient(y*y*z) == 1
1229
+ xyzW = [ t(T2) for t in xyzC ]
1230
+ S2 = a*S1(T2)
1231
+ # assert F4 == F(xyzW) // S2
1232
+
1233
+ E = EllipticCurve(F4([x,y,1]))
1234
+ if not morphism:
1235
+ return E
1236
+
1237
+ inv_defining_poly = xyzW
1238
+ inv_post = 1/S2
1239
+ # assert F4==F(inv_defining_poly)*inv_post
1240
+ MI = M.inverse()
1241
+ xyzI = [ (MI[i,0]*x + MI[i,1]*y + MI[i,2]*z) for i in range(3) ]
1242
+ T1I = [x*z,x*y,z*z] # inverse of T1
1243
+ xyzIC = [ t(xyzI) for t in T1I ]
1244
+ T2I = [-x, b*y, z/ab] # inverse of T2
1245
+ xyzIW = [ t(xyzIC) for t in T2I ]
1246
+ fwd_defining_poly = xyzIW
1247
+ fwd_post = a/(x*z*z)(xyzI)
1248
+ # assert F4(fwd_defining_poly)*fwd_post == F
1249
+
1250
+ # Construct the morphism
1251
+
1252
+ return WeierstrassTransformationWithInverse(
1253
+ C, E, fwd_defining_poly, fwd_post, inv_defining_poly, inv_post)
1254
+
1255
+
1256
+ def tangent_at_smooth_point(C, P):
1257
+ r"""Return the tangent at the smooth point `P` of projective curve `C`.
1258
+
1259
+ INPUT:
1260
+
1261
+ - ``C`` -- a projective plane curve
1262
+
1263
+ - ``P`` -- a 3-tuple `(x,y,z)` defining a projective point on `C`
1264
+
1265
+ OUTPUT: the linear form defining the tangent at `P` to `C`
1266
+
1267
+ EXAMPLES::
1268
+
1269
+ sage: R.<x,y,z> = QQ[]
1270
+ sage: from sage.schemes.elliptic_curves.constructor import tangent_at_smooth_point
1271
+ sage: C = Curve(x^3 + y^3 + 60*z^3)
1272
+ sage: tangent_at_smooth_point(C, [1,-1,0])
1273
+ x + y
1274
+
1275
+ sage: K.<t> = FunctionField(QQ)
1276
+ sage: R.<x,y,z> = K[]
1277
+ sage: C = Curve(x^3 + 2*y^3 + 3*z^3)
1278
+ sage: from sage.schemes.elliptic_curves.constructor import tangent_at_smooth_point
1279
+ sage: tangent_at_smooth_point(C,[1,1,-1])
1280
+ 3*x + 6*y + 9*z
1281
+ """
1282
+ # Over function fields such as QQ(t) an error is raised with the
1283
+ # default (factor=True). Note that factor=False returns the
1284
+ # product of the tangents in case of a multiple point, while here
1285
+ # `P` is assumed smooth so factorization is unnecessary, but over
1286
+ # QQ (for example) including the factorization gives better
1287
+ # results, for example returning x+y instead of 3x+3y in the
1288
+ # doctest.
1289
+ try:
1290
+ return C.tangents(P)[0]
1291
+ except NotImplementedError:
1292
+ return C.tangents(P,factor=False)[0]
1293
+
1294
+
1295
+ def chord_and_tangent(F, P):
1296
+ r"""Return the third point of intersection of a cubic with the tangent at one point.
1297
+
1298
+ INPUT:
1299
+
1300
+ - ``F`` -- a homogeneous cubic in three variables with rational
1301
+ coefficients, as a polynomial ring element, defining a smooth
1302
+ plane cubic curve.
1303
+
1304
+ - ``P`` -- a 3-tuple `(x,y,z)` defining a projective point on the
1305
+ curve `F=0`
1306
+
1307
+ OUTPUT:
1308
+
1309
+ A point ``Q`` such that ``F(Q)=0``, namely the third point of
1310
+ intersection of the tangent at ``P`` with the curve ``F=0``, so
1311
+ ``Q=P`` if and only if ``P`` is a flex.
1312
+
1313
+ EXAMPLES::
1314
+
1315
+ sage: R.<x,y,z> = QQ[]
1316
+ sage: from sage.schemes.elliptic_curves.constructor import chord_and_tangent
1317
+ sage: F = x^3 + y^3 + 60*z^3
1318
+ sage: chord_and_tangent(F, [1,-1,0])
1319
+ (-1 : 1 : 0)
1320
+
1321
+ sage: F = x^3 + 7*y^3 + 64*z^3
1322
+ sage: p0 = [2,2,-1]
1323
+ sage: p1 = chord_and_tangent(F, p0); p1
1324
+ (5 : -3 : 1)
1325
+ sage: p2 = chord_and_tangent(F, p1); p2
1326
+ (-1265/314 : 183/314 : 1)
1327
+
1328
+ TESTS::
1329
+
1330
+ sage: F(list(p2))
1331
+ 0
1332
+ sage: list(map(type, p2))
1333
+ [<... 'sage.rings.rational.Rational'>,
1334
+ <... 'sage.rings.rational.Rational'>,
1335
+ <... 'sage.rings.rational.Rational'>]
1336
+
1337
+ See :issue:`16068`::
1338
+
1339
+ sage: F = x**3 - 4*x**2*y - 65*x*y**2 + 3*x*y*z - 76*y*z**2
1340
+ sage: chord_and_tangent(F, [0, 1, 0])
1341
+ (0 : 0 : 1)
1342
+ """
1343
+ from sage.schemes.curves.constructor import Curve
1344
+ # check the input
1345
+ R = F.parent()
1346
+ if not isinstance(R, MPolynomialRing_base):
1347
+ raise TypeError('equation must be a polynomial')
1348
+ if R.ngens() != 3:
1349
+ raise TypeError('{} is not a polynomial in three variables'.format(F))
1350
+ if not F.is_homogeneous():
1351
+ raise TypeError('{} is not a homogeneous polynomial'.format(F))
1352
+ x, y, z = R.gens()
1353
+ if len(P) != 3:
1354
+ raise TypeError('{} is not a projective point'.format(P))
1355
+ K = R.base_ring()
1356
+ try:
1357
+ C = Curve(F)
1358
+ P = C(P)
1359
+ except (TypeError, ValueError):
1360
+ raise TypeError('{} does not define a point on a projective curve over {} defined by {}'.format(P,K,F))
1361
+
1362
+ L = Curve(tangent_at_smooth_point(C,P))
1363
+ Qlist = [Q for Q in C.intersection(L).rational_points() if Q != P]
1364
+ if Qlist:
1365
+ return Qlist[0]
1366
+ return P
1367
+
1368
+
1369
+ def projective_point(p):
1370
+ r"""
1371
+ Return equivalent point with denominators removed.
1372
+
1373
+ INPUT:
1374
+
1375
+ - ``P``, ``Q`` -- list/tuple of projective coordinates
1376
+
1377
+ OUTPUT: list of projective coordinates
1378
+
1379
+ EXAMPLES::
1380
+
1381
+ sage: from sage.schemes.elliptic_curves.constructor import projective_point
1382
+ sage: projective_point([4/5, 6/5, 8/5])
1383
+ [2, 3, 4]
1384
+ sage: F = GF(11)
1385
+ sage: projective_point([F(4), F(8), F(2)])
1386
+ [4, 8, 2]
1387
+ """
1388
+ from sage.rings.integer import GCD_list
1389
+ from sage.arith.functions import LCM_list
1390
+ try:
1391
+ p_gcd = GCD_list([x.numerator() for x in p])
1392
+ p_lcm = LCM_list(x.denominator() for x in p)
1393
+ except AttributeError:
1394
+ return p
1395
+ scale = p_lcm / p_gcd
1396
+ return [scale * x for x in p]
1397
+
1398
+
1399
+ def are_projectively_equivalent(P, Q, base_ring):
1400
+ r"""
1401
+ Test whether ``P`` and ``Q`` are projectively equivalent.
1402
+
1403
+ INPUT:
1404
+
1405
+ - ``P``, ``Q`` -- list/tuple of projective coordinates
1406
+
1407
+ - ``base_ring`` -- the base ring
1408
+
1409
+ OUTPUT: boolean
1410
+
1411
+ EXAMPLES::
1412
+
1413
+ sage: from sage.schemes.elliptic_curves.constructor import are_projectively_equivalent
1414
+ sage: are_projectively_equivalent([0,1,2,3], [0,1,2,2], base_ring=QQ)
1415
+ False
1416
+ sage: are_projectively_equivalent([0,1,2,3], [0,2,4,6], base_ring=QQ)
1417
+ True
1418
+ """
1419
+ from sage.matrix.constructor import matrix
1420
+ return matrix(base_ring, [P, Q]).rank() < 2
1421
+
1422
+
1423
+ def EllipticCurves_with_good_reduction_outside_S(S=[], proof=None, verbose=False):
1424
+ r"""
1425
+ Return a sorted list of all elliptic curves defined over `\QQ`
1426
+ with good reduction outside the set `S` of primes.
1427
+
1428
+ INPUT:
1429
+
1430
+ - ``S`` -- list of primes (default: empty list)
1431
+
1432
+ - ``proof`` -- boolean (default: ``True``); the MW basis for
1433
+ auxiliary curves will be computed with this proof flag
1434
+
1435
+ - ``verbose`` -- boolean (default: ``False``); if ``True``, some details
1436
+ of the computation will be output
1437
+
1438
+ .. NOTE::
1439
+
1440
+ Proof flag: The algorithm used requires determining all
1441
+ S-integral points on several auxiliary curves, which in turn
1442
+ requires the computation of their generators. This is not
1443
+ always possible (even in theory) using current knowledge.
1444
+
1445
+ The value of this flag is passed to the function which
1446
+ computes generators of various auxiliary elliptic curves, in
1447
+ order to find their S-integral points. Set to ``False`` if the
1448
+ default (``True``) causes warning messages, but note that you can
1449
+ then not rely on the set of curves returned being
1450
+ complete.
1451
+
1452
+ EXAMPLES::
1453
+
1454
+ sage: # needs eclib sage.symbolic
1455
+ sage: EllipticCurves_with_good_reduction_outside_S([])
1456
+ []
1457
+ sage: elist = EllipticCurves_with_good_reduction_outside_S([2])
1458
+ sage: elist
1459
+ [Elliptic Curve defined by y^2 = x^3 + 4*x over Rational Field,
1460
+ Elliptic Curve defined by y^2 = x^3 - x over Rational Field,
1461
+ ...
1462
+ Elliptic Curve defined by y^2 = x^3 - x^2 - 13*x + 21 over Rational Field]
1463
+ sage: len(elist)
1464
+ 24
1465
+ sage: ', '.join(e.label() for e in elist)
1466
+ '32a1, 32a2, 32a3, 32a4, 64a1, 64a2, 64a3, 64a4, 128a1, 128a2, 128b1, 128b2, 128c1, 128c2, 128d1, 128d2, 256a1, 256a2, 256b1, 256b2, 256c1, 256c2, 256d1, 256d2'
1467
+
1468
+ Without ``Proof=False``, this example gives two warnings::
1469
+
1470
+ sage: # needs eclib sage.symbolic
1471
+ sage: elist = EllipticCurves_with_good_reduction_outside_S([11], proof=False) # long time (14s on sage.math, 2011)
1472
+ sage: len(elist) # long time
1473
+ 12
1474
+ sage: ', '.join(e.label() for e in elist) # long time
1475
+ '11a1, 11a2, 11a3, 121a1, 121a2, 121b1, 121b2, 121c1, 121c2, 121d1, 121d2, 121d3'
1476
+
1477
+ sage: # long time, needs eclib sage.symbolic
1478
+ sage: elist = EllipticCurves_with_good_reduction_outside_S([2,3]) # long time (26s on sage.math, 2011)
1479
+ sage: len(elist)
1480
+ 752
1481
+ sage: conds = sorted(set([e.conductor() for e in elist]))
1482
+ sage: max(conds)
1483
+ 62208
1484
+ sage: [N.factor() for N in conds]
1485
+ [2^3 * 3,
1486
+ 3^3,
1487
+ 2^5,
1488
+ 2^2 * 3^2,
1489
+ 2^4 * 3,
1490
+ 2 * 3^3,
1491
+ 2^6,
1492
+ 2^3 * 3^2,
1493
+ 2^5 * 3,
1494
+ 2^2 * 3^3,
1495
+ 2^7,
1496
+ 2^4 * 3^2,
1497
+ 2 * 3^4,
1498
+ 2^6 * 3,
1499
+ 2^3 * 3^3,
1500
+ 3^5,
1501
+ 2^8,
1502
+ 2^5 * 3^2,
1503
+ 2^2 * 3^4,
1504
+ 2^7 * 3,
1505
+ 2^4 * 3^3,
1506
+ 2 * 3^5,
1507
+ 2^6 * 3^2,
1508
+ 2^3 * 3^4,
1509
+ 2^8 * 3,
1510
+ 2^5 * 3^3,
1511
+ 2^2 * 3^5,
1512
+ 2^7 * 3^2,
1513
+ 2^4 * 3^4,
1514
+ 2^6 * 3^3,
1515
+ 2^3 * 3^5,
1516
+ 2^8 * 3^2,
1517
+ 2^5 * 3^4,
1518
+ 2^7 * 3^3,
1519
+ 2^4 * 3^5,
1520
+ 2^6 * 3^4,
1521
+ 2^8 * 3^3,
1522
+ 2^5 * 3^5,
1523
+ 2^7 * 3^4,
1524
+ 2^6 * 3^5,
1525
+ 2^8 * 3^4,
1526
+ 2^7 * 3^5,
1527
+ 2^8 * 3^5]
1528
+ """
1529
+ from .ell_egros import egros_from_jlist, egros_get_j
1530
+ return egros_from_jlist(egros_get_j(S, proof=proof, verbose=verbose), S)