passagemath-flint 10.6.1rc10__cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.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 (360) hide show
  1. passagemath_flint-10.6.1rc10.dist-info/METADATA +122 -0
  2. passagemath_flint-10.6.1rc10.dist-info/RECORD +360 -0
  3. passagemath_flint-10.6.1rc10.dist-info/WHEEL +6 -0
  4. passagemath_flint-10.6.1rc10.dist-info/top_level.txt +2 -0
  5. passagemath_flint.libs/libflint-3701249d.so.21.0.0 +0 -0
  6. passagemath_flint.libs/libgf2x-fbd36f80.so.3.0.0 +0 -0
  7. passagemath_flint.libs/libgfortran-8a9a71bc.so.5.0.0 +0 -0
  8. passagemath_flint.libs/libgmp-93ebf16a.so.10.5.0 +0 -0
  9. passagemath_flint.libs/libgsl-e3525837.so.28.0.0 +0 -0
  10. passagemath_flint.libs/libmpfi-ad12a86d.so.0.0.0 +0 -0
  11. passagemath_flint.libs/libmpfr-e0f11cf3.so.6.2.1 +0 -0
  12. passagemath_flint.libs/libntl-1004113e.so.44.0.1 +0 -0
  13. passagemath_flint.libs/libopenblasp-r0-4c5b64b1.3.29.so +0 -0
  14. sage/all__sagemath_flint.py +29 -0
  15. sage/combinat/all__sagemath_flint.py +1 -0
  16. sage/combinat/posets/all__sagemath_flint.py +1 -0
  17. sage/combinat/posets/hasse_cython_flint.cpython-313-aarch64-linux-gnu.so +0 -0
  18. sage/combinat/posets/hasse_cython_flint.pyx +194 -0
  19. sage/data_structures/all__sagemath_flint.py +1 -0
  20. sage/data_structures/bounded_integer_sequences.cpython-313-aarch64-linux-gnu.so +0 -0
  21. sage/data_structures/bounded_integer_sequences.pxd +62 -0
  22. sage/data_structures/bounded_integer_sequences.pyx +1418 -0
  23. sage/graphs/all__sagemath_flint.py +1 -0
  24. sage/graphs/chrompoly.cpython-313-aarch64-linux-gnu.so +0 -0
  25. sage/graphs/chrompoly.pyx +555 -0
  26. sage/graphs/matchpoly.cpython-313-aarch64-linux-gnu.so +0 -0
  27. sage/graphs/matchpoly.pyx +412 -0
  28. sage/libs/all__sagemath_flint.py +17 -0
  29. sage/libs/arb/__init__.py +1 -0
  30. sage/libs/arb/acb.pxd +154 -0
  31. sage/libs/arb/acb_calc.pxd +9 -0
  32. sage/libs/arb/acb_elliptic.pxd +25 -0
  33. sage/libs/arb/acb_hypgeom.pxd +74 -0
  34. sage/libs/arb/acb_mat.pxd +62 -0
  35. sage/libs/arb/acb_modular.pxd +17 -0
  36. sage/libs/arb/acb_poly.pxd +216 -0
  37. sage/libs/arb/arb.pxd +240 -0
  38. sage/libs/arb/arb_fmpz_poly.pxd +21 -0
  39. sage/libs/arb/arb_hypgeom.pxd +83 -0
  40. sage/libs/arb/arb_wrap.h +34 -0
  41. sage/libs/arb/arf.pxd +131 -0
  42. sage/libs/arb/arith.cpython-313-aarch64-linux-gnu.so +0 -0
  43. sage/libs/arb/arith.pyx +87 -0
  44. sage/libs/arb/bernoulli.pxd +6 -0
  45. sage/libs/arb/mag.pxd +77 -0
  46. sage/libs/arb/types.pxd +37 -0
  47. sage/libs/flint/__init__.py +1 -0
  48. sage/libs/flint/acb.pxd +270 -0
  49. sage/libs/flint/acb_calc.pxd +22 -0
  50. sage/libs/flint/acb_dft.pxd +51 -0
  51. sage/libs/flint/acb_dirichlet.pxd +112 -0
  52. sage/libs/flint/acb_elliptic.pxd +42 -0
  53. sage/libs/flint/acb_hypgeom.pxd +169 -0
  54. sage/libs/flint/acb_macros.pxd +9 -0
  55. sage/libs/flint/acb_mat.pxd +136 -0
  56. sage/libs/flint/acb_mat_macros.pxd +10 -0
  57. sage/libs/flint/acb_modular.pxd +62 -0
  58. sage/libs/flint/acb_poly.pxd +251 -0
  59. sage/libs/flint/acb_poly_macros.pxd +8 -0
  60. sage/libs/flint/acb_theta.pxd +124 -0
  61. sage/libs/flint/acf.pxd +32 -0
  62. sage/libs/flint/aprcl.pxd +84 -0
  63. sage/libs/flint/arb.pxd +382 -0
  64. sage/libs/flint/arb_calc.pxd +31 -0
  65. sage/libs/flint/arb_fmpz_poly.pxd +34 -0
  66. sage/libs/flint/arb_fpwrap.pxd +215 -0
  67. sage/libs/flint/arb_hypgeom.pxd +147 -0
  68. sage/libs/flint/arb_macros.pxd +9 -0
  69. sage/libs/flint/arb_mat.pxd +140 -0
  70. sage/libs/flint/arb_mat_macros.pxd +10 -0
  71. sage/libs/flint/arb_poly.pxd +237 -0
  72. sage/libs/flint/arf.pxd +167 -0
  73. sage/libs/flint/arith.cpython-313-aarch64-linux-gnu.so +0 -0
  74. sage/libs/flint/arith.pxd +76 -0
  75. sage/libs/flint/arith.pyx +77 -0
  76. sage/libs/flint/arith_sage.cpython-313-aarch64-linux-gnu.so +0 -0
  77. sage/libs/flint/arith_sage.pyx +308 -0
  78. sage/libs/flint/bernoulli.pxd +28 -0
  79. sage/libs/flint/bool_mat.pxd +52 -0
  80. sage/libs/flint/ca.pxd +203 -0
  81. sage/libs/flint/ca_ext.pxd +34 -0
  82. sage/libs/flint/ca_field.pxd +32 -0
  83. sage/libs/flint/ca_mat.pxd +117 -0
  84. sage/libs/flint/ca_poly.pxd +104 -0
  85. sage/libs/flint/ca_vec.pxd +46 -0
  86. sage/libs/flint/calcium.pxd +27 -0
  87. sage/libs/flint/d_mat.pxd +39 -0
  88. sage/libs/flint/d_vec.pxd +32 -0
  89. sage/libs/flint/dirichlet.pxd +57 -0
  90. sage/libs/flint/dlog.pxd +53 -0
  91. sage/libs/flint/double_extras.pxd +24 -0
  92. sage/libs/flint/double_interval.pxd +36 -0
  93. sage/libs/flint/fexpr.pxd +104 -0
  94. sage/libs/flint/fexpr_builtin.pxd +20 -0
  95. sage/libs/flint/fft.pxd +66 -0
  96. sage/libs/flint/flint.pxd +36 -0
  97. sage/libs/flint/flint_ntl_wrap.h +35 -0
  98. sage/libs/flint/flint_sage.cpython-313-aarch64-linux-gnu.so +0 -0
  99. sage/libs/flint/flint_sage.pyx +163 -0
  100. sage/libs/flint/flint_wrap.h +190 -0
  101. sage/libs/flint/fmpq.pxd +137 -0
  102. sage/libs/flint/fmpq_mat.pxd +105 -0
  103. sage/libs/flint/fmpq_mat_macros.pxd +10 -0
  104. sage/libs/flint/fmpq_mpoly.pxd +165 -0
  105. sage/libs/flint/fmpq_mpoly_factor.pxd +30 -0
  106. sage/libs/flint/fmpq_poly.pxd +241 -0
  107. sage/libs/flint/fmpq_poly_macros.pxd +9 -0
  108. sage/libs/flint/fmpq_poly_sage.cpython-313-aarch64-linux-gnu.so +0 -0
  109. sage/libs/flint/fmpq_poly_sage.pxd +31 -0
  110. sage/libs/flint/fmpq_poly_sage.pyx +48 -0
  111. sage/libs/flint/fmpq_vec.pxd +27 -0
  112. sage/libs/flint/fmpz.pxd +256 -0
  113. sage/libs/flint/fmpz_extras.pxd +32 -0
  114. sage/libs/flint/fmpz_factor.pxd +42 -0
  115. sage/libs/flint/fmpz_factor_sage.cpython-313-aarch64-linux-gnu.so +0 -0
  116. sage/libs/flint/fmpz_factor_sage.pxd +4 -0
  117. sage/libs/flint/fmpz_factor_sage.pyx +29 -0
  118. sage/libs/flint/fmpz_lll.pxd +49 -0
  119. sage/libs/flint/fmpz_macros.pxd +8 -0
  120. sage/libs/flint/fmpz_mat.pxd +184 -0
  121. sage/libs/flint/fmpz_mat_macros.pxd +10 -0
  122. sage/libs/flint/fmpz_mod.pxd +46 -0
  123. sage/libs/flint/fmpz_mod_mat.pxd +71 -0
  124. sage/libs/flint/fmpz_mod_mpoly.pxd +161 -0
  125. sage/libs/flint/fmpz_mod_mpoly_factor.pxd +28 -0
  126. sage/libs/flint/fmpz_mod_poly.pxd +249 -0
  127. sage/libs/flint/fmpz_mod_poly_factor.pxd +46 -0
  128. sage/libs/flint/fmpz_mod_vec.pxd +27 -0
  129. sage/libs/flint/fmpz_mpoly.pxd +224 -0
  130. sage/libs/flint/fmpz_mpoly_factor.pxd +29 -0
  131. sage/libs/flint/fmpz_mpoly_q.pxd +57 -0
  132. sage/libs/flint/fmpz_poly.cpython-313-aarch64-linux-gnu.so +0 -0
  133. sage/libs/flint/fmpz_poly.pxd +407 -0
  134. sage/libs/flint/fmpz_poly.pyx +19 -0
  135. sage/libs/flint/fmpz_poly_factor.pxd +33 -0
  136. sage/libs/flint/fmpz_poly_macros.pxd +8 -0
  137. sage/libs/flint/fmpz_poly_mat.pxd +71 -0
  138. sage/libs/flint/fmpz_poly_q.pxd +55 -0
  139. sage/libs/flint/fmpz_poly_sage.cpython-313-aarch64-linux-gnu.so +0 -0
  140. sage/libs/flint/fmpz_poly_sage.pxd +20 -0
  141. sage/libs/flint/fmpz_poly_sage.pyx +500 -0
  142. sage/libs/flint/fmpz_vec.pxd +80 -0
  143. sage/libs/flint/fmpzi.pxd +52 -0
  144. sage/libs/flint/fq.pxd +97 -0
  145. sage/libs/flint/fq_default.pxd +84 -0
  146. sage/libs/flint/fq_default_mat.pxd +70 -0
  147. sage/libs/flint/fq_default_poly.pxd +97 -0
  148. sage/libs/flint/fq_default_poly_factor.pxd +39 -0
  149. sage/libs/flint/fq_embed.pxd +28 -0
  150. sage/libs/flint/fq_mat.pxd +83 -0
  151. sage/libs/flint/fq_nmod.pxd +95 -0
  152. sage/libs/flint/fq_nmod_embed.pxd +28 -0
  153. sage/libs/flint/fq_nmod_mat.pxd +83 -0
  154. sage/libs/flint/fq_nmod_mpoly.pxd +130 -0
  155. sage/libs/flint/fq_nmod_mpoly_factor.pxd +28 -0
  156. sage/libs/flint/fq_nmod_poly.pxd +202 -0
  157. sage/libs/flint/fq_nmod_poly_factor.pxd +47 -0
  158. sage/libs/flint/fq_nmod_vec.pxd +33 -0
  159. sage/libs/flint/fq_poly.pxd +204 -0
  160. sage/libs/flint/fq_poly_factor.pxd +47 -0
  161. sage/libs/flint/fq_vec.pxd +33 -0
  162. sage/libs/flint/fq_zech.pxd +99 -0
  163. sage/libs/flint/fq_zech_embed.pxd +28 -0
  164. sage/libs/flint/fq_zech_mat.pxd +78 -0
  165. sage/libs/flint/fq_zech_poly.pxd +198 -0
  166. sage/libs/flint/fq_zech_poly_factor.pxd +47 -0
  167. sage/libs/flint/fq_zech_vec.pxd +33 -0
  168. sage/libs/flint/gr.pxd +174 -0
  169. sage/libs/flint/gr_generic.pxd +215 -0
  170. sage/libs/flint/gr_mat.pxd +161 -0
  171. sage/libs/flint/gr_mpoly.pxd +68 -0
  172. sage/libs/flint/gr_poly.pxd +276 -0
  173. sage/libs/flint/gr_special.pxd +237 -0
  174. sage/libs/flint/gr_vec.pxd +120 -0
  175. sage/libs/flint/hypgeom.pxd +24 -0
  176. sage/libs/flint/long_extras.pxd +23 -0
  177. sage/libs/flint/mag.pxd +131 -0
  178. sage/libs/flint/mag_macros.pxd +8 -0
  179. sage/libs/flint/mpf_mat.pxd +36 -0
  180. sage/libs/flint/mpf_vec.pxd +34 -0
  181. sage/libs/flint/mpfr_mat.pxd +27 -0
  182. sage/libs/flint/mpfr_vec.pxd +25 -0
  183. sage/libs/flint/mpn_extras.pxd +41 -0
  184. sage/libs/flint/mpoly.pxd +72 -0
  185. sage/libs/flint/nf.pxd +19 -0
  186. sage/libs/flint/nf_elem.pxd +74 -0
  187. sage/libs/flint/nmod.pxd +35 -0
  188. sage/libs/flint/nmod_mat.pxd +104 -0
  189. sage/libs/flint/nmod_mpoly.pxd +144 -0
  190. sage/libs/flint/nmod_mpoly_factor.pxd +28 -0
  191. sage/libs/flint/nmod_poly.pxd +339 -0
  192. sage/libs/flint/nmod_poly_factor.pxd +44 -0
  193. sage/libs/flint/nmod_poly_linkage.pxi +710 -0
  194. sage/libs/flint/nmod_poly_mat.pxd +76 -0
  195. sage/libs/flint/nmod_vec.pxd +40 -0
  196. sage/libs/flint/ntl_interface.pxd +17 -0
  197. sage/libs/flint/padic.pxd +93 -0
  198. sage/libs/flint/padic_mat.pxd +64 -0
  199. sage/libs/flint/padic_poly.pxd +88 -0
  200. sage/libs/flint/partitions.pxd +23 -0
  201. sage/libs/flint/perm.pxd +26 -0
  202. sage/libs/flint/profiler.pxd +24 -0
  203. sage/libs/flint/qadic.pxd +77 -0
  204. sage/libs/flint/qfb.pxd +44 -0
  205. sage/libs/flint/qqbar.pxd +172 -0
  206. sage/libs/flint/qsieve.cpython-313-aarch64-linux-gnu.so +0 -0
  207. sage/libs/flint/qsieve.pxd +41 -0
  208. sage/libs/flint/qsieve.pyx +21 -0
  209. sage/libs/flint/qsieve_sage.cpython-313-aarch64-linux-gnu.so +0 -0
  210. sage/libs/flint/qsieve_sage.pyx +67 -0
  211. sage/libs/flint/thread_pool.pxd +25 -0
  212. sage/libs/flint/types.pxd +2076 -0
  213. sage/libs/flint/ulong_extras.cpython-313-aarch64-linux-gnu.so +0 -0
  214. sage/libs/flint/ulong_extras.pxd +141 -0
  215. sage/libs/flint/ulong_extras.pyx +21 -0
  216. sage/libs/flint/ulong_extras_sage.cpython-313-aarch64-linux-gnu.so +0 -0
  217. sage/libs/flint/ulong_extras_sage.pyx +21 -0
  218. sage/matrix/all__sagemath_flint.py +1 -0
  219. sage/matrix/change_ring.cpython-313-aarch64-linux-gnu.so +0 -0
  220. sage/matrix/change_ring.pyx +43 -0
  221. sage/matrix/matrix_complex_ball_dense.cpython-313-aarch64-linux-gnu.so +0 -0
  222. sage/matrix/matrix_complex_ball_dense.pxd +14 -0
  223. sage/matrix/matrix_complex_ball_dense.pyx +973 -0
  224. sage/matrix/matrix_cyclo_dense.cpython-313-aarch64-linux-gnu.so +0 -0
  225. sage/matrix/matrix_cyclo_dense.pxd +16 -0
  226. sage/matrix/matrix_cyclo_dense.pyx +1761 -0
  227. sage/matrix/matrix_integer_dense.cpython-313-aarch64-linux-gnu.so +0 -0
  228. sage/matrix/matrix_integer_dense.pxd +32 -0
  229. sage/matrix/matrix_integer_dense.pyx +5801 -0
  230. sage/matrix/matrix_integer_dense_hnf.py +1294 -0
  231. sage/matrix/matrix_integer_dense_saturation.py +346 -0
  232. sage/matrix/matrix_integer_sparse.cpython-313-aarch64-linux-gnu.so +0 -0
  233. sage/matrix/matrix_integer_sparse.pxd +9 -0
  234. sage/matrix/matrix_integer_sparse.pyx +1090 -0
  235. sage/matrix/matrix_rational_dense.cpython-313-aarch64-linux-gnu.so +0 -0
  236. sage/matrix/matrix_rational_dense.pxd +23 -0
  237. sage/matrix/matrix_rational_dense.pyx +2995 -0
  238. sage/matrix/matrix_rational_sparse.cpython-313-aarch64-linux-gnu.so +0 -0
  239. sage/matrix/matrix_rational_sparse.pxd +11 -0
  240. sage/matrix/matrix_rational_sparse.pyx +789 -0
  241. sage/matrix/misc_flint.cpython-313-aarch64-linux-gnu.so +0 -0
  242. sage/matrix/misc_flint.pyx +109 -0
  243. sage/modular/all__sagemath_flint.py +1 -0
  244. sage/modular/modform/all__sagemath_flint.py +1 -0
  245. sage/modular/modform/eis_series_cython.cpython-313-aarch64-linux-gnu.so +0 -0
  246. sage/modular/modform/eis_series_cython.pyx +226 -0
  247. sage/modular/modsym/all__sagemath_flint.py +1 -0
  248. sage/modular/modsym/apply.cpython-313-aarch64-linux-gnu.so +0 -0
  249. sage/modular/modsym/apply.pxd +6 -0
  250. sage/modular/modsym/apply.pyx +113 -0
  251. sage/modular/modsym/heilbronn.cpython-313-aarch64-linux-gnu.so +0 -0
  252. sage/modular/modsym/heilbronn.pyx +966 -0
  253. sage/modular/pollack_stevens/all__sagemath_flint.py +1 -0
  254. sage/modular/pollack_stevens/dist.cpython-313-aarch64-linux-gnu.so +0 -0
  255. sage/modular/pollack_stevens/dist.pxd +38 -0
  256. sage/modular/pollack_stevens/dist.pyx +1439 -0
  257. sage/quivers/algebra.py +691 -0
  258. sage/quivers/algebra_elements.cpython-313-aarch64-linux-gnu.so +0 -0
  259. sage/quivers/algebra_elements.pxd +97 -0
  260. sage/quivers/algebra_elements.pxi +1324 -0
  261. sage/quivers/algebra_elements.pyx +1424 -0
  262. sage/quivers/all.py +1 -0
  263. sage/quivers/ar_quiver.py +917 -0
  264. sage/quivers/homspace.py +640 -0
  265. sage/quivers/morphism.py +1282 -0
  266. sage/quivers/path_semigroup.py +1155 -0
  267. sage/quivers/paths.cpython-313-aarch64-linux-gnu.so +0 -0
  268. sage/quivers/paths.pxd +13 -0
  269. sage/quivers/paths.pyx +809 -0
  270. sage/quivers/representation.py +2975 -0
  271. sage/rings/all__sagemath_flint.py +37 -0
  272. sage/rings/cif.py +4 -0
  273. sage/rings/complex_arb.cpython-313-aarch64-linux-gnu.so +0 -0
  274. sage/rings/complex_arb.pxd +29 -0
  275. sage/rings/complex_arb.pyx +5176 -0
  276. sage/rings/complex_interval.cpython-313-aarch64-linux-gnu.so +0 -0
  277. sage/rings/complex_interval.pxd +30 -0
  278. sage/rings/complex_interval.pyx +2475 -0
  279. sage/rings/complex_interval_field.py +711 -0
  280. sage/rings/convert/all.py +1 -0
  281. sage/rings/convert/mpfi.cpython-313-aarch64-linux-gnu.so +0 -0
  282. sage/rings/convert/mpfi.pxd +6 -0
  283. sage/rings/convert/mpfi.pyx +576 -0
  284. sage/rings/factorint_flint.cpython-313-aarch64-linux-gnu.so +0 -0
  285. sage/rings/factorint_flint.pyx +99 -0
  286. sage/rings/fraction_field_FpT.cpython-313-aarch64-linux-gnu.so +0 -0
  287. sage/rings/fraction_field_FpT.pxd +28 -0
  288. sage/rings/fraction_field_FpT.pyx +2043 -0
  289. sage/rings/imaginary_unit.py +5 -0
  290. sage/rings/monomials.py +73 -0
  291. sage/rings/number_field/S_unit_solver.py +2870 -0
  292. sage/rings/number_field/all__sagemath_flint.py +7 -0
  293. sage/rings/number_field/bdd_height.py +664 -0
  294. sage/rings/number_field/class_group.py +762 -0
  295. sage/rings/number_field/galois_group.py +1307 -0
  296. sage/rings/number_field/homset.py +612 -0
  297. sage/rings/number_field/maps.py +687 -0
  298. sage/rings/number_field/morphism.py +272 -0
  299. sage/rings/number_field/number_field.py +12820 -0
  300. sage/rings/number_field/number_field_element.cpython-313-aarch64-linux-gnu.so +0 -0
  301. sage/rings/number_field/number_field_element.pxd +59 -0
  302. sage/rings/number_field/number_field_element.pyx +5735 -0
  303. sage/rings/number_field/number_field_element_quadratic.cpython-313-aarch64-linux-gnu.so +0 -0
  304. sage/rings/number_field/number_field_element_quadratic.pxd +34 -0
  305. sage/rings/number_field/number_field_element_quadratic.pyx +3185 -0
  306. sage/rings/number_field/number_field_ideal_rel.py +925 -0
  307. sage/rings/number_field/number_field_morphisms.cpython-313-aarch64-linux-gnu.so +0 -0
  308. sage/rings/number_field/number_field_morphisms.pyx +781 -0
  309. sage/rings/number_field/number_field_rel.py +2734 -0
  310. sage/rings/number_field/order.py +2981 -0
  311. sage/rings/number_field/order_ideal.py +804 -0
  312. sage/rings/number_field/selmer_group.py +715 -0
  313. sage/rings/number_field/small_primes_of_degree_one.py +242 -0
  314. sage/rings/number_field/splitting_field.py +606 -0
  315. sage/rings/number_field/structure.py +380 -0
  316. sage/rings/number_field/unit_group.py +721 -0
  317. sage/rings/padics/all__sagemath_flint.py +3 -0
  318. sage/rings/polynomial/all__sagemath_flint.py +1 -0
  319. sage/rings/polynomial/complex_roots.py +312 -0
  320. sage/rings/polynomial/evaluation_flint.cpython-313-aarch64-linux-gnu.so +0 -0
  321. sage/rings/polynomial/evaluation_flint.pxd +7 -0
  322. sage/rings/polynomial/evaluation_flint.pyx +68 -0
  323. sage/rings/polynomial/hilbert.cpython-313-aarch64-linux-gnu.so +0 -0
  324. sage/rings/polynomial/hilbert.pyx +602 -0
  325. sage/rings/polynomial/polynomial_complex_arb.cpython-313-aarch64-linux-gnu.so +0 -0
  326. sage/rings/polynomial/polynomial_complex_arb.pxd +7 -0
  327. sage/rings/polynomial/polynomial_complex_arb.pyx +963 -0
  328. sage/rings/polynomial/polynomial_integer_dense_flint.cpython-313-aarch64-linux-gnu.so +0 -0
  329. sage/rings/polynomial/polynomial_integer_dense_flint.pxd +13 -0
  330. sage/rings/polynomial/polynomial_integer_dense_flint.pyx +1881 -0
  331. sage/rings/polynomial/polynomial_number_field.cpython-313-aarch64-linux-gnu.so +0 -0
  332. sage/rings/polynomial/polynomial_number_field.pyx +345 -0
  333. sage/rings/polynomial/polynomial_rational_flint.cpython-313-aarch64-linux-gnu.so +0 -0
  334. sage/rings/polynomial/polynomial_rational_flint.pxd +20 -0
  335. sage/rings/polynomial/polynomial_rational_flint.pyx +2598 -0
  336. sage/rings/polynomial/polynomial_zmod_flint.cpython-313-aarch64-linux-gnu.so +0 -0
  337. sage/rings/polynomial/polynomial_zmod_flint.pxd +20 -0
  338. sage/rings/polynomial/polynomial_zmod_flint.pyx +1063 -0
  339. sage/rings/polynomial/real_roots.cpython-313-aarch64-linux-gnu.so +0 -0
  340. sage/rings/polynomial/real_roots.pxd +81 -0
  341. sage/rings/polynomial/real_roots.pyx +4704 -0
  342. sage/rings/polynomial/refine_root.cpython-313-aarch64-linux-gnu.so +0 -0
  343. sage/rings/polynomial/refine_root.pyx +142 -0
  344. sage/rings/polynomial/weil/all.py +4 -0
  345. sage/rings/polynomial/weil/power_sums.h +46 -0
  346. sage/rings/polynomial/weil/weil_polynomials.cpython-313-aarch64-linux-gnu.so +0 -0
  347. sage/rings/polynomial/weil/weil_polynomials.pyx +596 -0
  348. sage/rings/qqbar.py +9025 -0
  349. sage/rings/real_arb.cpython-313-aarch64-linux-gnu.so +0 -0
  350. sage/rings/real_arb.pxd +21 -0
  351. sage/rings/real_arb.pyx +4065 -0
  352. sage/rings/real_interval_absolute.cpython-313-aarch64-linux-gnu.so +0 -0
  353. sage/rings/real_interval_absolute.pyx +1073 -0
  354. sage/rings/real_mpfi.cpython-313-aarch64-linux-gnu.so +0 -0
  355. sage/rings/real_mpfi.pyx +5428 -0
  356. sage/schemes/all__sagemath_flint.py +1 -0
  357. sage/schemes/elliptic_curves/all__sagemath_flint.py +1 -0
  358. sage/schemes/elliptic_curves/descent_two_isogeny.cpython-313-aarch64-linux-gnu.so +0 -0
  359. sage/schemes/elliptic_curves/descent_two_isogeny.pyx +1387 -0
  360. sage/schemes/elliptic_curves/descent_two_isogeny_pari.pxd +5 -0
@@ -0,0 +1,781 @@
1
+ # sage_setup: distribution = sagemath-flint
2
+ # sage.doctest: needs sage.rings.number_field
3
+ r"""
4
+ Embeddings into ambient fields
5
+
6
+ This module provides classes to handle embeddings of number fields into ambient
7
+ fields (generally `\RR` or `\CC`).
8
+ """
9
+ # ****************************************************************************
10
+ # Copyright (C) 2008 Robert Bradshaw <robertwb@math.washington.edu>
11
+ #
12
+ # Distributed under the terms of the GNU General Public License (GPL)
13
+ #
14
+ # This code is distributed in the hope that it will be useful,
15
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
+ # General Public License for more details.
18
+ #
19
+ # The full text of the GPL is available at:
20
+ #
21
+ # https://www.gnu.org/licenses/
22
+ # ****************************************************************************
23
+
24
+ from sage.structure.element cimport Element
25
+ from sage.categories.morphism cimport Morphism
26
+ from sage.categories.map cimport Map
27
+ from sage.categories.pushout import pushout
28
+
29
+ from sage.rings.complex_double import CDF
30
+ from sage.rings.real_lazy import RLF, CLF, LazyField, LazyAlgebraic
31
+
32
+ cdef class NumberFieldEmbedding(Morphism):
33
+
34
+ cdef _gen_image
35
+
36
+ def __init__(self, K, R, gen_embedding):
37
+ """
38
+ If R is a lazy field, the closest root to gen_embedding will be chosen.
39
+
40
+ EXAMPLES::
41
+
42
+ sage: x = polygen(QQ)
43
+ sage: from sage.rings.number_field.number_field_morphisms import NumberFieldEmbedding
44
+ sage: K.<a> = NumberField(x^3-2)
45
+ sage: f = NumberFieldEmbedding(K, RLF, 1)
46
+ sage: f(a)^3
47
+ 2.00000000000000?
48
+ sage: RealField(200)(f(a)^3)
49
+ 2.0000000000000000000000000000000000000000000000000000000000
50
+
51
+ sage: sigma_a = K.polynomial().change_ring(CC).roots()[1][0]; sigma_a
52
+ -0.62996052494743... - 1.09112363597172*I
53
+ sage: g = NumberFieldEmbedding(K, CC, sigma_a)
54
+ sage: g(a+1)
55
+ 0.37003947505256... - 1.09112363597172*I
56
+ """
57
+ from sage.categories.homset import Hom
58
+ Morphism.__init__(self, Hom(K, R))
59
+ if isinstance(R, LazyField) and not isinstance(gen_embedding.parent(), LazyField):
60
+ self._gen_image = LazyAlgebraic(R, K.polynomial(), gen_embedding, prec=0)
61
+ else:
62
+ self._gen_image = R(gen_embedding)
63
+
64
+ cdef dict _extra_slots(self):
65
+ """
66
+ A helper for pickling and copying.
67
+
68
+ INPUT:
69
+
70
+ - ``_slots`` -- dictionary
71
+
72
+ OUTPUT: the given dictionary, with the generator image added
73
+
74
+ EXAMPLES::
75
+
76
+ sage: x = polygen(QQ)
77
+ sage: from sage.rings.number_field.number_field_morphisms import NumberFieldEmbedding
78
+ sage: K.<a> = NumberField(x^3-2)
79
+ sage: f = NumberFieldEmbedding(K, RLF, 1)
80
+ sage: g = copy(f) # indirect doctest
81
+ sage: g
82
+ Generic morphism:
83
+ From: Number Field in a with defining polynomial x^3 - 2
84
+ To: Real Lazy Field
85
+ Defn: a -> 1.259921049894873?
86
+ sage: g(a)^3
87
+ 2.00000000000000?
88
+ """
89
+ slots = Morphism._extra_slots(self)
90
+ slots['_gen_image'] = self._gen_image
91
+ return slots
92
+
93
+ cdef _update_slots(self, dict _slots):
94
+ """
95
+ A helper for unpickling and copying.
96
+
97
+ INPUT:
98
+
99
+ - ``_slots`` -- dictionary providing values for the c(p)def slots of ``self``
100
+
101
+ EXAMPLES::
102
+
103
+ sage: x = polygen(QQ)
104
+ sage: from sage.rings.number_field.number_field_morphisms import NumberFieldEmbedding
105
+ sage: K.<a> = NumberField(x^3-2)
106
+ sage: f = NumberFieldEmbedding(K, RLF, 1)
107
+ sage: g = copy(f) # indirect doctest
108
+ sage: g
109
+ Generic morphism:
110
+ From: Number Field in a with defining polynomial x^3 - 2
111
+ To: Real Lazy Field
112
+ Defn: a -> 1.259921049894873?
113
+ sage: g(a)^3
114
+ 2.00000000000000?
115
+ """
116
+ Morphism._update_slots(self, _slots)
117
+ self._gen_image = _slots['_gen_image']
118
+
119
+ cpdef Element _call_(self, x):
120
+ """
121
+ EXAMPLES::
122
+
123
+ sage: x = polygen(QQ)
124
+ sage: from sage.rings.number_field.number_field_morphisms import NumberFieldEmbedding
125
+ sage: K.<a> = NumberField(x^2-2)
126
+ sage: f = NumberFieldEmbedding(K, RLF, 1.4)
127
+ sage: f(a) # indirect doctest
128
+ 1.414213562373095?
129
+ """
130
+ return x.polynomial()(self._gen_image)
131
+
132
+ def _repr_defn(self):
133
+ """
134
+ EXAMPLES::
135
+
136
+ sage: from sage.rings.number_field.number_field_morphisms import NumberFieldEmbedding
137
+ sage: x = polygen(ZZ, 'x')
138
+ sage: K.<a> = NumberField(x^2 - 2)
139
+ sage: f = NumberFieldEmbedding(K, RLF, 1.4)
140
+ sage: f # indirect doctest
141
+ Generic morphism:
142
+ From: Number Field in a with defining polynomial x^2 - 2
143
+ To: Real Lazy Field
144
+ Defn: a -> 1.414213562373095?
145
+ """
146
+ return "{} -> {}".format(self.domain().variable_name(), self._gen_image)
147
+
148
+ def gen_image(self):
149
+ """
150
+ Return the image of the generator under this embedding.
151
+
152
+ EXAMPLES::
153
+
154
+ sage: f = QuadraticField(7, 'a', embedding=2).coerce_embedding()
155
+ sage: f.gen_image()
156
+ 2.645751311064591?
157
+ """
158
+ return self._gen_image
159
+
160
+
161
+ cdef class EmbeddedNumberFieldMorphism(NumberFieldEmbedding):
162
+ r"""
163
+ This allows one to go from one number field in another consistently,
164
+ assuming they both have specified embeddings into an ambient field.
165
+
166
+ If no ambient field is supplied, then the following ambient fields are
167
+ tried:
168
+
169
+ * the pushout of the fields where the number fields are embedded;
170
+
171
+ * the algebraic closure of the previous pushout;
172
+
173
+ * `\CC`.
174
+
175
+ EXAMPLES::
176
+
177
+ sage: x = polygen(ZZ, 'x')
178
+ sage: K.<i> = NumberField(x^2 + 1, embedding=QQbar(I))
179
+ sage: L.<i> = NumberField(x^2 + 1, embedding=-QQbar(I))
180
+ sage: from sage.rings.number_field.number_field_morphisms import EmbeddedNumberFieldMorphism
181
+ sage: EmbeddedNumberFieldMorphism(K, L, CDF)
182
+ Generic morphism:
183
+ From: Number Field in i with defining polynomial x^2 + 1 with i = I
184
+ To: Number Field in i with defining polynomial x^2 + 1 with i = -I
185
+ Defn: i -> -i
186
+ sage: EmbeddedNumberFieldMorphism(K, L, QQbar)
187
+ Generic morphism:
188
+ From: Number Field in i with defining polynomial x^2 + 1 with i = I
189
+ To: Number Field in i with defining polynomial x^2 + 1 with i = -I
190
+ Defn: i -> -i
191
+ """
192
+ cdef readonly ambient_field
193
+
194
+ def __init__(self, K, L, ambient_field=None):
195
+ """
196
+ EXAMPLES::
197
+
198
+ sage: from sage.rings.number_field.number_field_morphisms import EmbeddedNumberFieldMorphism
199
+ sage: x = polygen(ZZ, 'x')
200
+ sage: K.<a> = NumberField(x^2 - 17, embedding=4.1)
201
+ sage: L.<b> = NumberField(x^4 - 17, embedding=2.0)
202
+ sage: f = EmbeddedNumberFieldMorphism(K, L)
203
+ sage: f(a)
204
+ b^2
205
+
206
+ sage: K.<zeta12> = CyclotomicField(12)
207
+ sage: L.<zeta36> = CyclotomicField(36)
208
+ sage: f = EmbeddedNumberFieldMorphism(K, L)
209
+ sage: f(zeta12)
210
+ zeta36^3
211
+ sage: f(zeta12^5-zeta12+1)
212
+ zeta36^9 - 2*zeta36^3 + 1
213
+ sage: f
214
+ Generic morphism:
215
+ From: Cyclotomic Field of order 12 and degree 4
216
+ To: Cyclotomic Field of order 36 and degree 12
217
+ Defn: zeta12 -> zeta36^3
218
+
219
+ The embeddings must be compatible::
220
+
221
+ sage: F1 = NumberField(x^3 + 2, 'a', embedding=2)
222
+ sage: F2 = NumberField(x^3 + 2, 'a', embedding=CC.0)
223
+ sage: F1.gen() + F2.gen()
224
+ Traceback (most recent call last):
225
+ ...
226
+ TypeError: unsupported operand parent(s) for +:
227
+ 'Number Field in a with defining polynomial x^3 + 2 with a = -1.259921049894873?' and
228
+ 'Number Field in a with defining polynomial x^3 + 2 with a = 0.6299605249474365? + 1.091123635971722?*I'
229
+
230
+ The following was fixed to raise a :exc:`TypeError` in :issue:`15331`::
231
+
232
+ sage: L.<i> = NumberField(x^2 + 1)
233
+ sage: K = NumberField(L(i/2+3).minpoly(), names=('i0',), embedding=L(i/2+3))
234
+ sage: EmbeddedNumberFieldMorphism(K, L)
235
+ Traceback (most recent call last):
236
+ ...
237
+ TypeError: No embedding available for Number Field in i with defining polynomial x^2 + 1
238
+ """
239
+ if ambient_field is None:
240
+ if K.coerce_embedding() is None:
241
+ raise TypeError("No embedding available for %s" % K)
242
+ Kemb = K
243
+ while Kemb.coerce_embedding() is not None:
244
+ Kemb = Kemb.coerce_embedding().codomain()
245
+ if L.coerce_embedding() is None:
246
+ raise TypeError("No embedding available for %s" % L)
247
+ Lemb = L
248
+ while Lemb.coerce_embedding() is not None:
249
+ Lemb = Lemb.coerce_embedding().codomain()
250
+ ambient_field = pushout(Kemb, Lemb)
251
+ candidate_ambient_fields = [ambient_field]
252
+ try:
253
+ candidate_ambient_fields.append(ambient_field.algebraic_closure())
254
+ except NotImplementedError:
255
+ pass
256
+ candidate_ambient_fields.append(CDF)
257
+ else:
258
+ candidate_ambient_fields = [ambient_field]
259
+
260
+ for ambient_field in candidate_ambient_fields:
261
+ gen_image = matching_root(K.polynomial().change_ring(L), K.gen(), ambient_field=ambient_field, margin=2)
262
+ if gen_image is not None:
263
+ NumberFieldEmbedding.__init__(self, K, L, gen_image)
264
+ self.ambient_field = ambient_field
265
+ return
266
+ else:
267
+ raise ValueError("No consistent embedding of all of %s into %s." % (K, L))
268
+
269
+ def section(self):
270
+ """
271
+ EXAMPLES::
272
+
273
+ sage: from sage.rings.number_field.number_field_morphisms import EmbeddedNumberFieldMorphism
274
+ sage: x = polygen(ZZ, 'x')
275
+ sage: K.<a> = NumberField(x^2 - 700, embedding=25)
276
+ sage: L.<b> = NumberField(x^6 - 700, embedding=3)
277
+ sage: f = EmbeddedNumberFieldMorphism(K, L)
278
+ sage: f(2*a - 1)
279
+ 2*b^3 - 1
280
+ sage: g = f.section()
281
+ sage: g(2*b^3 - 1)
282
+ 2*a - 1
283
+ """
284
+ return EmbeddedNumberFieldConversion(self.codomain(), self.domain(), self.ambient_field)
285
+
286
+
287
+ cdef class EmbeddedNumberFieldConversion(Map):
288
+ r"""
289
+ This allows one to cast one number field in another consistently,
290
+ assuming they both have specified embeddings into an ambient field
291
+ (by default it looks for an embedding into `\CC`).
292
+
293
+ This is done by factoring the minimal polynomial of the input
294
+ in the number field of the codomain. This may fail if the element is
295
+ not actually in the given field.
296
+ """
297
+ cdef _gen_image
298
+ cdef readonly ambient_field
299
+
300
+ def __init__(self, K, L, ambient_field=None):
301
+ """
302
+ EXAMPLES::
303
+
304
+ sage: from sage.rings.number_field.number_field_morphisms import EmbeddedNumberFieldConversion
305
+ sage: x = polygen(ZZ, 'x')
306
+ sage: K.<a> = NumberField(x^2 - 17, embedding=4.1)
307
+ sage: L.<b> = NumberField(x^4 - 17, embedding=2.0)
308
+ sage: f = EmbeddedNumberFieldConversion(K, L)
309
+ sage: f(a)
310
+ b^2
311
+ sage: f(K(b^2/2-11))
312
+ 1/2*b^2 - 11
313
+ """
314
+ if ambient_field is None:
315
+ from sage.rings.complex_double import CDF
316
+ ambient_field = CDF
317
+ self.ambient_field = ambient_field
318
+ Map.__init__(self, K, L)
319
+
320
+ cpdef Element _call_(self, x):
321
+ """
322
+ EXAMPLES::
323
+
324
+ sage: from sage.rings.number_field.number_field_morphisms import EmbeddedNumberFieldConversion
325
+ sage: K.<zeta12> = CyclotomicField(12)
326
+ sage: L.<zeta15> = CyclotomicField(15)
327
+ sage: f = EmbeddedNumberFieldConversion(K, L)
328
+ sage: f(zeta12^4) # indirect doctest
329
+ zeta15^5
330
+ sage: f(zeta12)
331
+ Traceback (most recent call last):
332
+ ...
333
+ ValueError: No consistent embedding of Cyclotomic Field of order 12 and degree 4 into Cyclotomic Field of order 15 and degree 8.
334
+ """
335
+ minpoly = x.minpoly()
336
+ gen_image = matching_root(minpoly.change_ring(self.codomain()), x, self.ambient_field, 4)
337
+ if gen_image is None:
338
+ raise ValueError("No consistent embedding of {} into {}.".format(self.domain(), self.codomain()))
339
+ return gen_image
340
+
341
+
342
+ cpdef matching_root(poly, target, ambient_field=None, margin=1, max_prec=None):
343
+ """
344
+ Given a polynomial and a ``target``, choose the root that
345
+ ``target`` best approximates as compared in ``ambient_field``.
346
+
347
+ If the parent of ``target`` is exact, the equality is required, otherwise
348
+ find closest root (with respect to the ``abs`` function) in the
349
+ ambient field to the ``target``, and return the root of ``poly`` (if any) that
350
+ approximates it best.
351
+
352
+ EXAMPLES::
353
+
354
+ sage: from sage.rings.number_field.number_field_morphisms import matching_root
355
+ sage: R.<x> = CC[]
356
+ sage: matching_root(x^2-2, 1.5)
357
+ 1.41421356237310
358
+ sage: matching_root(x^2-2, -100.0)
359
+ -1.41421356237310
360
+ sage: matching_root(x^2-2, .00000001)
361
+ 1.41421356237310
362
+ sage: matching_root(x^3-1, CDF.0)
363
+ -0.50000000000000... + 0.86602540378443...*I
364
+ sage: matching_root(x^3-x, 2, ambient_field=RR)
365
+ 1.00000000000000
366
+ """
367
+ if isinstance(poly, list):
368
+ roots = poly
369
+ else:
370
+ roots = poly.roots()
371
+ if len(roots) == 0:
372
+ return None
373
+ elif isinstance(roots[0], tuple): # as returned from the roots method
374
+ roots = [r for r, e in roots]
375
+
376
+ if ambient_field is None:
377
+ ambient_field = target.parent()
378
+
379
+ if ambient_field.is_exact():
380
+ target_approx = ambient_field(target)
381
+ for r in roots:
382
+ if ambient_field(r) == target_approx:
383
+ return r
384
+ else:
385
+ # since things are inexact, try and pick the closest one
386
+ # -- unless the ambient field is inexact and has no prec(),
387
+ # which holds, e.g., for the symbolic ring
388
+ if not hasattr(ambient_field,'prec'):
389
+ return None
390
+ if max_prec is None:
391
+ max_prec = ambient_field.prec() * 32
392
+ while ambient_field.prec() < max_prec:
393
+ if isinstance(poly, list):
394
+ ambient_roots = [ambient_field(r) for r in poly]
395
+ else:
396
+ ambient_roots = [r for r, e in poly.change_ring(ambient_field).roots()]
397
+ target_root = closest(ambient_field(target), ambient_roots, margin)
398
+ if target_root is not None:
399
+ for r in roots:
400
+ if closest(ambient_field(r), ambient_roots, margin) is target_root:
401
+ return r
402
+ ambient_field = ambient_field.to_prec(ambient_field.prec() * 2)
403
+
404
+
405
+ cpdef closest(target, values, margin=1):
406
+ """
407
+ This is a utility function that returns the item in ``values`` closest to
408
+ target (with respect to the ``abs`` function). If ``margin`` is greater
409
+ than 1, and `x` and `y` are the first and second closest elements to ``target``,
410
+ then only return `x` if `x` is ``margin`` times closer to ``target`` than `y`, i.e.
411
+ ``margin * abs(target-x) < abs(target-y)``.
412
+
413
+ TESTS::
414
+
415
+ sage: from sage.rings.number_field.number_field_morphisms import closest
416
+ sage: closest(1.2, [0,1,2,3,4])
417
+ 1
418
+ sage: closest(1.7, [0,1,2,3,4])
419
+ 2
420
+ sage: closest(1.7, [0,1,2,3,4], margin=5)
421
+ sage: closest(1.9, [0,1,2,3,4], margin=5)
422
+ 2
423
+ sage: closest(.2, [-1, 1, CDF.0, -CDF.0])
424
+ 1
425
+ """
426
+ cdef int i
427
+ if len(values) == 0:
428
+ raise ValueError
429
+ elif len(values) == 1:
430
+ return values[0]
431
+ else:
432
+ dists = [abs(target - r) for r in values]
433
+ sdists = sorted(dists)
434
+ min_dist = sdists[0]
435
+ if margin*min_dist < sdists[1]:
436
+ for i in range(len(values)):
437
+ if dists[i] is min_dist:
438
+ return values[i]
439
+ else:
440
+ return None
441
+
442
+
443
+ def root_from_approx(f, a):
444
+ """
445
+ Return an exact root of the polynomial `f` closest to `a`.
446
+
447
+ INPUT:
448
+
449
+ - ``f`` -- polynomial with rational coefficients
450
+
451
+ - ``a`` -- element of a ring
452
+
453
+ OUTPUT:
454
+
455
+ A root of ``f`` in the parent of ``a`` or, if ``a`` is not already
456
+ an exact root of ``f``, in the corresponding lazy field. The root
457
+ is taken to be closest to ``a`` among all roots of ``f``.
458
+
459
+ EXAMPLES::
460
+
461
+ sage: from sage.rings.number_field.number_field_morphisms import root_from_approx
462
+ sage: R.<x> = QQ[]
463
+
464
+ sage: root_from_approx(x^2 - 1, -1)
465
+ -1
466
+ sage: root_from_approx(x^2 - 2, 1)
467
+ 1.414213562373095?
468
+ sage: root_from_approx(x^3 - x - 1, RR(1))
469
+ 1.324717957244746?
470
+ sage: root_from_approx(x^3 - x - 1, CC.gen())
471
+ -0.6623589786223730? + 0.5622795120623013?*I
472
+
473
+ sage: root_from_approx(x^2 + 1, 0)
474
+ Traceback (most recent call last):
475
+ ...
476
+ ValueError: x^2 + 1 has no real roots
477
+ sage: root_from_approx(x^2 + 1, CC(0))
478
+ -1*I
479
+
480
+ sage: root_from_approx(x^2 - 2, sqrt(2)) # needs sage.symbolic
481
+ sqrt(2)
482
+ sage: root_from_approx(x^2 - 2, sqrt(3)) # needs sage.symbolic
483
+ Traceback (most recent call last):
484
+ ...
485
+ ValueError: sqrt(3) is not a root of x^2 - 2
486
+ """
487
+ P = a.parent()
488
+ if P.is_exact() and not f(a):
489
+ return a
490
+ elif P._is_real_numerical():
491
+ return LazyAlgebraic(RLF, f, a, prec=0)
492
+ elif P._is_numerical():
493
+ return LazyAlgebraic(CLF, f, a, prec=0)
494
+ # p-adic lazy, when implemented, would go here
495
+ else:
496
+ rel = (f(a) != 0)
497
+ if rel is False:
498
+ return a
499
+ if rel is True:
500
+ raise ValueError("{} is not a root of {}".format(a, f))
501
+ from sage.symbolic.relation import test_relation_maxima
502
+ if test_relation_maxima(rel):
503
+ raise ValueError("{} is not a root of {}".format(a, f))
504
+ return a
505
+
506
+
507
+ def create_embedding_from_approx(K, gen_image):
508
+ """
509
+ Return an embedding of ``K`` determined by ``gen_image``.
510
+
511
+ The codomain of the embedding is the parent of ``gen_image`` or,
512
+ if ``gen_image`` is not already an exact root of the defining
513
+ polynomial of ``K``, the corresponding lazy field. The embedding
514
+ maps the generator of ``K`` to a root of the defining polynomial
515
+ of ``K`` closest to ``gen_image``.
516
+
517
+ EXAMPLES::
518
+
519
+ sage: from sage.rings.number_field.number_field_morphisms import create_embedding_from_approx
520
+ sage: x = polygen(ZZ, 'x')
521
+ sage: K.<a> = NumberField(x^3 - x + 1/10)
522
+ sage: create_embedding_from_approx(K, 1)
523
+ Generic morphism:
524
+ From: Number Field in a with defining polynomial x^3 - x + 1/10
525
+ To: Real Lazy Field
526
+ Defn: a -> 0.9456492739235915?
527
+ sage: create_embedding_from_approx(K, 0)
528
+ Generic morphism:
529
+ From: Number Field in a with defining polynomial x^3 - x + 1/10
530
+ To: Real Lazy Field
531
+ Defn: a -> 0.10103125788101081?
532
+ sage: create_embedding_from_approx(K, -1)
533
+ Generic morphism:
534
+ From: Number Field in a with defining polynomial x^3 - x + 1/10
535
+ To: Real Lazy Field
536
+ Defn: a -> -1.046680531804603?
537
+
538
+ We can define embeddings from one number field to another::
539
+
540
+ sage: L.<b> = NumberField(x^6-x^2+1/10)
541
+ sage: create_embedding_from_approx(K, b^2)
542
+ Generic morphism:
543
+ From: Number Field in a with defining polynomial x^3 - x + 1/10
544
+ To: Number Field in b with defining polynomial x^6 - x^2 + 1/10
545
+ Defn: a -> b^2
546
+
547
+ If the embedding is exact, it must be valid::
548
+
549
+ sage: create_embedding_from_approx(K, b)
550
+ Traceback (most recent call last):
551
+ ...
552
+ ValueError: b is not a root of x^3 - x + 1/10
553
+ """
554
+ if gen_image is None:
555
+ return None
556
+ elif isinstance(gen_image, Map):
557
+ return gen_image
558
+ elif isinstance(gen_image, Element):
559
+ x = root_from_approx(K.defining_polynomial(), gen_image)
560
+ return NumberFieldEmbedding(K, x.parent(), x)
561
+ else:
562
+ raise TypeError("Embedding (type %s) must be a morphism or element." % type(gen_image))
563
+
564
+
565
+ cdef class CyclotomicFieldEmbedding(NumberFieldEmbedding):
566
+ """
567
+ Specialized class for converting cyclotomic field elements into a
568
+ cyclotomic field of higher order. All the real work is done by
569
+ :meth:`_lift_cyclotomic_element`.
570
+ """
571
+
572
+ cdef ratio
573
+
574
+ def __init__(self, K, L):
575
+ """
576
+ Check and cache the parameters.
577
+
578
+ EXAMPLES::
579
+
580
+ sage: from sage.rings.number_field.number_field_morphisms import CyclotomicFieldEmbedding
581
+ sage: CyclotomicFieldEmbedding(CyclotomicField(7), CyclotomicField(21))
582
+ Generic morphism:
583
+ From: Cyclotomic Field of order 7 and degree 6
584
+ To: Cyclotomic Field of order 21 and degree 12
585
+ Defn: zeta7 -> zeta21^3
586
+
587
+ Note that this only handles the easy case of cyclotomic fields where
588
+ the order of the smaller dividing the order of the larger, regardless
589
+ of whether or not there is an actual coercion::
590
+
591
+ sage: CyclotomicFieldEmbedding(CyclotomicField(3), QuadraticField(-3, 'a'))
592
+ Traceback (most recent call last):
593
+ ...
594
+ TypeError: CyclotomicFieldEmbedding only valid for cyclotomic fields.
595
+ sage: CyclotomicFieldEmbedding(CyclotomicField(14), CyclotomicField(21))
596
+ Traceback (most recent call last):
597
+ ...
598
+ TypeError: The zeta_order of the new field must be a multiple of the zeta_order of the original.
599
+
600
+ Check that :issue:`13765` is fixed::
601
+
602
+ sage: z3=(CC(-1)^(1/3))^2
603
+ sage: Ka.<a>=CyclotomicField(3,embedding=z3)
604
+ sage: Kb.<b>=CyclotomicField(3,embedding=z3^2)
605
+ sage: CyclotomicFieldEmbedding(Ka, Kb)
606
+ Generic morphism:
607
+ From: Cyclotomic Field of order 3 and degree 2
608
+ To: Cyclotomic Field of order 3 and degree 2
609
+ Defn: a -> -b - 1
610
+ sage: Ka(b)
611
+ -a - 1
612
+ sage: a + b
613
+ -1
614
+ sage: b + a
615
+ -1
616
+ """
617
+ Morphism.__init__(self, K, L)
618
+ from sage.rings.number_field.number_field import NumberField_cyclotomic
619
+ if not isinstance(K, NumberField_cyclotomic) or not isinstance(L, NumberField_cyclotomic):
620
+ raise TypeError("CyclotomicFieldEmbedding only valid for cyclotomic fields.")
621
+ Kn = K._n()
622
+ Ln = L._n()
623
+ if not Kn.divides(Ln):
624
+ raise TypeError("The zeta_order of the new field must be a multiple of the zeta_order of the original.")
625
+ self.ratio = L._log_gen(K.coerce_embedding()(K.gen()))
626
+ self._gen_image = L.gen() ** self.ratio
627
+
628
+ cdef dict _extra_slots(self):
629
+ """
630
+ A helper for pickling and copying.
631
+
632
+ INPUT:
633
+
634
+ - ``_slots`` -- dictionary
635
+
636
+ OUTPUT: the given dictionary, with _gen_image and ratio added
637
+
638
+ EXAMPLES::
639
+
640
+ sage: from sage.rings.number_field.number_field_morphisms import CyclotomicFieldEmbedding
641
+ sage: cf6 = CyclotomicField(6)
642
+ sage: cf12 = CyclotomicField(12)
643
+ sage: f = CyclotomicFieldEmbedding(cf6, cf12)
644
+ sage: g = copy(f) # indirect doctest
645
+ sage: g
646
+ Generic morphism:
647
+ From: Cyclotomic Field of order 6 and degree 2
648
+ To: Cyclotomic Field of order 12 and degree 4
649
+ Defn: zeta6 -> zeta12^2
650
+ sage: g(cf6.0)
651
+ zeta12^2
652
+ """
653
+ slots = NumberFieldEmbedding._extra_slots(self)
654
+ slots['ratio'] = self.ratio
655
+ return slots
656
+
657
+ cdef _update_slots(self, dict _slots):
658
+ """
659
+ A helper for unpickling and copying.
660
+
661
+ INPUT:
662
+
663
+ - ``_slots`` -- dictionary providing values for the c(p)def slots of ``self``
664
+
665
+ EXAMPLES::
666
+
667
+ sage: from sage.rings.number_field.number_field_morphisms import CyclotomicFieldEmbedding
668
+ sage: cf6 = CyclotomicField(6)
669
+ sage: cf12 = CyclotomicField(12)
670
+ sage: f = CyclotomicFieldEmbedding(cf6, cf12)
671
+ sage: g = copy(f) # indirect doctest
672
+ sage: g
673
+ Generic morphism:
674
+ From: Cyclotomic Field of order 6 and degree 2
675
+ To: Cyclotomic Field of order 12 and degree 4
676
+ Defn: zeta6 -> zeta12^2
677
+ sage: g(cf6.0)
678
+ zeta12^2
679
+ """
680
+ Morphism._update_slots(self, _slots)
681
+ self._gen_image = _slots['_gen_image']
682
+ self.ratio = _slots['ratio']
683
+
684
+ cpdef Element _call_(self, x):
685
+ """
686
+ EXAMPLES::
687
+
688
+ sage: from sage.rings.number_field.number_field_morphisms import CyclotomicFieldEmbedding
689
+ sage: K = CyclotomicField(7)
690
+ sage: L = CyclotomicField(21)
691
+ sage: f = CyclotomicFieldEmbedding(K, L)
692
+ sage: f(K.gen()) # indirect doctest
693
+ zeta21^3
694
+ sage: f(K.gen()^2 + 3) # indirect doctest
695
+ zeta21^6 + 3
696
+ """
697
+ return x._lift_cyclotomic_element(self.codomain(), False, self.ratio)
698
+
699
+ def section(self):
700
+ """
701
+ Return the section of ``self``.
702
+
703
+ EXAMPLES::
704
+
705
+ sage: from sage.rings.number_field.number_field_morphisms import CyclotomicFieldEmbedding
706
+ sage: K = CyclotomicField(7)
707
+ sage: L = CyclotomicField(21)
708
+ sage: f = CyclotomicFieldEmbedding(K, L)
709
+ sage: h = f.section()
710
+ sage: h(f(K.gen())) # indirect doctest
711
+ zeta7
712
+ """
713
+ return CyclotomicFieldConversion(self.codomain(), self.domain())
714
+
715
+ cdef class CyclotomicFieldConversion(Map):
716
+ r"""
717
+ This allows one to cast one cyclotomic field in another consistently.
718
+
719
+ EXAMPLES::
720
+
721
+ sage: from sage.rings.number_field.number_field_morphisms import CyclotomicFieldConversion
722
+ sage: K1.<z1> = CyclotomicField(12)
723
+ sage: K2.<z2> = CyclotomicField(18)
724
+ sage: f = CyclotomicFieldConversion(K1, K2)
725
+ sage: f(z1^2)
726
+ z2^3
727
+ sage: f(z1)
728
+ Traceback (most recent call last):
729
+ ...
730
+ ValueError: Element z1 has no image in the codomain
731
+
732
+ Tests from :issue:`29511`::
733
+
734
+ sage: K.<z> = CyclotomicField(12)
735
+ sage: K1.<z1> = CyclotomicField(3)
736
+ sage: K(2) in K1 # indirect doctest
737
+ True
738
+ sage: K1(K(2)) # indirect doctest
739
+ 2
740
+ """
741
+ cdef ambient_field
742
+ cdef phi
743
+
744
+ def __init__(self, K, L):
745
+ """
746
+ Construct a conversion map between cyclotomic fields.
747
+
748
+ EXAMPLES::
749
+
750
+ sage: from sage.rings.number_field.number_field_morphisms import CyclotomicFieldEmbedding
751
+ sage: K.<a> = CyclotomicField(7)
752
+ sage: L.<b> = CyclotomicField(21)
753
+ sage: K(b^3) # indirect doctest
754
+ a
755
+ """
756
+ from sage.rings.number_field.number_field import CyclotomicField
757
+ n1 = K._n()
758
+ n2 = L._n()
759
+ n3 = n1.lcm(n2)
760
+ M = CyclotomicField(n3)
761
+ self.ambient_field = M
762
+ self.phi = L.hom([M.gen()**(n3//n2)])
763
+ Map.__init__(self, K, L)
764
+
765
+ cpdef Element _call_(self, x):
766
+ """
767
+ Call a conversion map between cyclotomic fields.
768
+
769
+ EXAMPLES::
770
+
771
+ sage: from sage.rings.number_field.number_field_morphisms import CyclotomicFieldEmbedding
772
+ sage: K.<a> = CyclotomicField(7)
773
+ sage: L.<b> = CyclotomicField(21)
774
+ sage: K(b^3) # indirect doctest
775
+ a
776
+ """
777
+ M = self.ambient_field
778
+ try:
779
+ return self.phi.preimage(M(x))
780
+ except ValueError:
781
+ raise ValueError('Element {} has no image in the codomain'.format(x))