passagemath-pari 10.6.32__cp314-cp314-musllinux_1_2_x86_64.whl

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

Potentially problematic release.


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

Files changed (331) hide show
  1. PARIKernel/__init__.py +2 -0
  2. PARIKernel/__main__.py +5 -0
  3. PARIKernel/io.cpython-314-x86_64-linux-musl.so +0 -0
  4. PARIKernel/io.pxd +7 -0
  5. PARIKernel/io.pyx +84 -0
  6. PARIKernel/kernel.cpython-314-x86_64-linux-musl.so +0 -0
  7. PARIKernel/kernel.pyx +260 -0
  8. PARIKernel/paridecl.pxd +95 -0
  9. PARIKernel/svg.cpython-314-x86_64-linux-musl.so +0 -0
  10. PARIKernel/svg.pyx +52 -0
  11. cypari2/__init__.py +8 -0
  12. cypari2/auto_paridecl.pxd +1070 -0
  13. cypari2/closure.cpython-314-x86_64-linux-musl.so +0 -0
  14. cypari2/closure.pxd +5 -0
  15. cypari2/closure.pyx +246 -0
  16. cypari2/convert.cpython-314-x86_64-linux-musl.so +0 -0
  17. cypari2/convert.pxd +80 -0
  18. cypari2/convert.pyx +613 -0
  19. cypari2/custom_block.cpython-314-x86_64-linux-musl.so +0 -0
  20. cypari2/custom_block.pyx +30 -0
  21. cypari2/cypari.h +13 -0
  22. cypari2/gen.cpython-314-x86_64-linux-musl.so +0 -0
  23. cypari2/gen.pxd +69 -0
  24. cypari2/gen.pyx +4819 -0
  25. cypari2/handle_error.cpython-314-x86_64-linux-musl.so +0 -0
  26. cypari2/handle_error.pxd +7 -0
  27. cypari2/handle_error.pyx +232 -0
  28. cypari2/pari_instance.cpython-314-x86_64-linux-musl.so +0 -0
  29. cypari2/pari_instance.pxd +27 -0
  30. cypari2/pari_instance.pyx +1438 -0
  31. cypari2/paridecl.pxd +5353 -0
  32. cypari2/paripriv.pxd +34 -0
  33. cypari2/pycore_long.h +98 -0
  34. cypari2/pycore_long.pxd +9 -0
  35. cypari2/stack.cpython-314-x86_64-linux-musl.so +0 -0
  36. cypari2/stack.pxd +27 -0
  37. cypari2/stack.pyx +278 -0
  38. cypari2/string_utils.cpython-314-x86_64-linux-musl.so +0 -0
  39. cypari2/string_utils.pxd +29 -0
  40. cypari2/string_utils.pyx +65 -0
  41. cypari2/types.pxd +147 -0
  42. passagemath_pari-10.6.32.data/data/etc/jupyter/nbconfig/notebook.d/gp-mode.json +5 -0
  43. passagemath_pari-10.6.32.data/data/share/jupyter/kernels/pari_jupyter/kernel.js +28 -0
  44. passagemath_pari-10.6.32.data/data/share/jupyter/kernels/pari_jupyter/kernel.json +6 -0
  45. passagemath_pari-10.6.32.data/data/share/jupyter/kernels/pari_jupyter/logo-64x64.png +0 -0
  46. passagemath_pari-10.6.32.data/data/share/jupyter/kernels/xeus-gp/kernel.json +13 -0
  47. passagemath_pari-10.6.32.data/data/share/jupyter/kernels/xeus-gp/logo-32x32.png +0 -0
  48. passagemath_pari-10.6.32.data/data/share/jupyter/kernels/xeus-gp/logo-64x64.png +0 -0
  49. passagemath_pari-10.6.32.data/data/share/jupyter/kernels/xeus-gp/logo-svg.svg +75 -0
  50. passagemath_pari-10.6.32.data/data/share/jupyter/nbextensions/gp-mode/gp.js +284 -0
  51. passagemath_pari-10.6.32.data/data/share/jupyter/nbextensions/gp-mode/main.js +15 -0
  52. passagemath_pari-10.6.32.dist-info/METADATA +209 -0
  53. passagemath_pari-10.6.32.dist-info/RECORD +331 -0
  54. passagemath_pari-10.6.32.dist-info/WHEEL +5 -0
  55. passagemath_pari-10.6.32.dist-info/top_level.txt +4 -0
  56. passagemath_pari.libs/libcrypto-f04afe95.so.3 +0 -0
  57. passagemath_pari.libs/libflint-fd6f12fc.so.21.0.0 +0 -0
  58. passagemath_pari.libs/libgcc_s-0cd532bd.so.1 +0 -0
  59. passagemath_pari.libs/libgf2x-9e30c3e3.so.3.0.0 +0 -0
  60. passagemath_pari.libs/libgfortran-2c33b284.so.5.0.0 +0 -0
  61. passagemath_pari.libs/libgivaro-9a94c711.so.9.2.1 +0 -0
  62. passagemath_pari.libs/libgmp-0e7fc84e.so.10.5.0 +0 -0
  63. passagemath_pari.libs/libgmpxx-9e08595c.so.4.7.0 +0 -0
  64. passagemath_pari.libs/libgsl-42cda06f.so.28.0.0 +0 -0
  65. passagemath_pari.libs/libmpfr-aaecbfc0.so.6.2.1 +0 -0
  66. passagemath_pari.libs/libncursesw-9c9e32c3.so.6.5 +0 -0
  67. passagemath_pari.libs/libntl-26885ca2.so.44.0.1 +0 -0
  68. passagemath_pari.libs/libopenblasp-r0-905cb27d.3.29.so +0 -0
  69. passagemath_pari.libs/libpari-gmp-tls-f31f908f.so.2.17.2 +0 -0
  70. passagemath_pari.libs/libquadmath-bb76a5fc.so.0.0.0 +0 -0
  71. passagemath_pari.libs/libreadline-06542304.so.8.2 +0 -0
  72. passagemath_pari.libs/libstdc++-5d72f927.so.6.0.33 +0 -0
  73. passagemath_pari.libs/libuuid-f3770415.so.1.3.0 +0 -0
  74. passagemath_pari.libs/libxeus-735780ff.so.13.1.0 +0 -0
  75. passagemath_pari.libs/libxeus-zmq-c68577b4.so.6.0.1 +0 -0
  76. passagemath_pari.libs/libzmq-1ba9a3da.so.5.2.5 +0 -0
  77. sage/all__sagemath_pari.py +26 -0
  78. sage/databases/all__sagemath_pari.py +7 -0
  79. sage/databases/conway.py +274 -0
  80. sage/ext/all__sagemath_pari.py +1 -0
  81. sage/ext/memory.cpython-314-x86_64-linux-musl.so +0 -0
  82. sage/ext/memory.pyx +98 -0
  83. sage/ext_data/pari/buzzard/DimensionSk.g +286 -0
  84. sage/ext_data/pari/buzzard/Tpprog.g +179 -0
  85. sage/ext_data/pari/buzzard/genusn.g +129 -0
  86. sage/ext_data/pari/dokchitser/computel.gp +740 -0
  87. sage/ext_data/pari/dokchitser/computel.gp.template +740 -0
  88. sage/ext_data/pari/dokchitser/ex-bsw +43 -0
  89. sage/ext_data/pari/dokchitser/ex-chgen +48 -0
  90. sage/ext_data/pari/dokchitser/ex-chqua +37 -0
  91. sage/ext_data/pari/dokchitser/ex-delta +35 -0
  92. sage/ext_data/pari/dokchitser/ex-eisen +30 -0
  93. sage/ext_data/pari/dokchitser/ex-gen2 +38 -0
  94. sage/ext_data/pari/dokchitser/ex-gen3 +49 -0
  95. sage/ext_data/pari/dokchitser/ex-gen4 +54 -0
  96. sage/ext_data/pari/dokchitser/ex-nf +48 -0
  97. sage/ext_data/pari/dokchitser/ex-shin +50 -0
  98. sage/ext_data/pari/dokchitser/ex-tau2 +30 -0
  99. sage/ext_data/pari/dokchitser/ex-zeta +27 -0
  100. sage/ext_data/pari/dokchitser/ex-zeta2 +47 -0
  101. sage/ext_data/pari/dokchitser/testall +13 -0
  102. sage/ext_data/pari/simon/ell.gp +2129 -0
  103. sage/ext_data/pari/simon/ellQ.gp +2151 -0
  104. sage/ext_data/pari/simon/ellcommon.gp +126 -0
  105. sage/ext_data/pari/simon/qfsolve.gp +722 -0
  106. sage/ext_data/pari/simon/resultant3.gp +306 -0
  107. sage/groups/all__sagemath_pari.py +3 -0
  108. sage/groups/pari_group.py +175 -0
  109. sage/interfaces/all__sagemath_pari.py +1 -0
  110. sage/interfaces/genus2reduction.py +464 -0
  111. sage/interfaces/gp.py +1114 -0
  112. sage/libs/all__sagemath_pari.py +2 -0
  113. sage/libs/linkages/__init__.py +1 -0
  114. sage/libs/linkages/padics/API.pxi +617 -0
  115. sage/libs/linkages/padics/Polynomial_ram.pxi +388 -0
  116. sage/libs/linkages/padics/Polynomial_shared.pxi +554 -0
  117. sage/libs/linkages/padics/__init__.py +1 -0
  118. sage/libs/linkages/padics/fmpz_poly_unram.pxi +869 -0
  119. sage/libs/linkages/padics/mpz.pxi +691 -0
  120. sage/libs/linkages/padics/relaxed/API.pxi +518 -0
  121. sage/libs/linkages/padics/relaxed/__init__.py +1 -0
  122. sage/libs/linkages/padics/relaxed/flint.pxi +543 -0
  123. sage/libs/linkages/padics/unram_shared.pxi +247 -0
  124. sage/libs/pari/__init__.py +210 -0
  125. sage/libs/pari/all.py +5 -0
  126. sage/libs/pari/convert_flint.cpython-314-x86_64-linux-musl.so +0 -0
  127. sage/libs/pari/convert_flint.pxd +14 -0
  128. sage/libs/pari/convert_flint.pyx +159 -0
  129. sage/libs/pari/convert_gmp.cpython-314-x86_64-linux-musl.so +0 -0
  130. sage/libs/pari/convert_gmp.pxd +14 -0
  131. sage/libs/pari/convert_gmp.pyx +210 -0
  132. sage/libs/pari/convert_sage.cpython-314-x86_64-linux-musl.so +0 -0
  133. sage/libs/pari/convert_sage.pxd +16 -0
  134. sage/libs/pari/convert_sage.pyx +588 -0
  135. sage/libs/pari/convert_sage_complex_double.cpython-314-x86_64-linux-musl.so +0 -0
  136. sage/libs/pari/convert_sage_complex_double.pxd +14 -0
  137. sage/libs/pari/convert_sage_complex_double.pyx +132 -0
  138. sage/libs/pari/convert_sage_matrix.cpython-314-x86_64-linux-musl.so +0 -0
  139. sage/libs/pari/convert_sage_matrix.pyx +106 -0
  140. sage/libs/pari/convert_sage_real_double.cpython-314-x86_64-linux-musl.so +0 -0
  141. sage/libs/pari/convert_sage_real_double.pxd +5 -0
  142. sage/libs/pari/convert_sage_real_double.pyx +14 -0
  143. sage/libs/pari/convert_sage_real_mpfr.cpython-314-x86_64-linux-musl.so +0 -0
  144. sage/libs/pari/convert_sage_real_mpfr.pxd +7 -0
  145. sage/libs/pari/convert_sage_real_mpfr.pyx +108 -0
  146. sage/libs/pari/misc.cpython-314-x86_64-linux-musl.so +0 -0
  147. sage/libs/pari/misc.pxd +4 -0
  148. sage/libs/pari/misc.pyx +26 -0
  149. sage/libs/pari/tests.py +1848 -0
  150. sage/matrix/all__sagemath_pari.py +1 -0
  151. sage/matrix/matrix_integer_pari.cpython-314-x86_64-linux-musl.so +0 -0
  152. sage/matrix/matrix_integer_pari.pyx +187 -0
  153. sage/matrix/matrix_rational_pari.cpython-314-x86_64-linux-musl.so +0 -0
  154. sage/matrix/matrix_rational_pari.pyx +160 -0
  155. sage/quadratic_forms/all__sagemath_pari.py +10 -0
  156. sage/quadratic_forms/genera/all.py +9 -0
  157. sage/quadratic_forms/genera/genus.py +3506 -0
  158. sage/quadratic_forms/genera/normal_form.py +1519 -0
  159. sage/quadratic_forms/genera/spinor_genus.py +243 -0
  160. sage/quadratic_forms/qfsolve.py +255 -0
  161. sage/quadratic_forms/quadratic_form__automorphisms.py +427 -0
  162. sage/quadratic_forms/quadratic_form__genus.py +141 -0
  163. sage/quadratic_forms/quadratic_form__local_density_interfaces.py +140 -0
  164. sage/quadratic_forms/quadratic_form__local_normal_form.py +421 -0
  165. sage/quadratic_forms/quadratic_form__local_representation_conditions.py +889 -0
  166. sage/quadratic_forms/quadratic_form__mass.py +69 -0
  167. sage/quadratic_forms/quadratic_form__mass__Conway_Sloane_masses.py +663 -0
  168. sage/quadratic_forms/quadratic_form__mass__Siegel_densities.py +373 -0
  169. sage/quadratic_forms/quadratic_form__siegel_product.py +198 -0
  170. sage/quadratic_forms/special_values.py +323 -0
  171. sage/rings/all__sagemath_pari.py +15 -0
  172. sage/rings/factorint_pari.cpython-314-x86_64-linux-musl.so +0 -0
  173. sage/rings/factorint_pari.pyx +80 -0
  174. sage/rings/finite_rings/all__sagemath_pari.py +1 -0
  175. sage/rings/finite_rings/element_givaro.cpython-314-x86_64-linux-musl.so +0 -0
  176. sage/rings/finite_rings/element_givaro.pxd +91 -0
  177. sage/rings/finite_rings/element_givaro.pyx +1769 -0
  178. sage/rings/finite_rings/element_ntl_gf2e.cpython-314-x86_64-linux-musl.so +0 -0
  179. sage/rings/finite_rings/element_ntl_gf2e.pxd +22 -0
  180. sage/rings/finite_rings/element_ntl_gf2e.pyx +1333 -0
  181. sage/rings/finite_rings/element_pari_ffelt.cpython-314-x86_64-linux-musl.so +0 -0
  182. sage/rings/finite_rings/element_pari_ffelt.pxd +13 -0
  183. sage/rings/finite_rings/element_pari_ffelt.pyx +1441 -0
  184. sage/rings/finite_rings/finite_field_givaro.py +612 -0
  185. sage/rings/finite_rings/finite_field_pari_ffelt.py +238 -0
  186. sage/rings/finite_rings/hom_finite_field_givaro.cpython-314-x86_64-linux-musl.so +0 -0
  187. sage/rings/finite_rings/hom_finite_field_givaro.pxd +28 -0
  188. sage/rings/finite_rings/hom_finite_field_givaro.pyx +280 -0
  189. sage/rings/finite_rings/residue_field_givaro.cpython-314-x86_64-linux-musl.so +0 -0
  190. sage/rings/finite_rings/residue_field_givaro.pyx +133 -0
  191. sage/rings/finite_rings/residue_field_pari_ffelt.cpython-314-x86_64-linux-musl.so +0 -0
  192. sage/rings/finite_rings/residue_field_pari_ffelt.pyx +128 -0
  193. sage/rings/function_field/all__sagemath_pari.py +1 -0
  194. sage/rings/function_field/valuation.py +1450 -0
  195. sage/rings/function_field/valuation_ring.py +212 -0
  196. sage/rings/number_field/all__sagemath_pari.py +14 -0
  197. sage/rings/number_field/totallyreal.cpython-314-x86_64-linux-musl.so +0 -0
  198. sage/rings/number_field/totallyreal.pyx +509 -0
  199. sage/rings/number_field/totallyreal_data.cpython-314-x86_64-linux-musl.so +0 -0
  200. sage/rings/number_field/totallyreal_data.pxd +26 -0
  201. sage/rings/number_field/totallyreal_data.pyx +928 -0
  202. sage/rings/number_field/totallyreal_phc.py +144 -0
  203. sage/rings/number_field/totallyreal_rel.py +1018 -0
  204. sage/rings/padics/CA_template.pxi +1847 -0
  205. sage/rings/padics/CA_template_header.pxi +50 -0
  206. sage/rings/padics/CR_template.pxi +2563 -0
  207. sage/rings/padics/CR_template_header.pxi +57 -0
  208. sage/rings/padics/FM_template.pxi +1575 -0
  209. sage/rings/padics/FM_template_header.pxi +50 -0
  210. sage/rings/padics/FP_template.pxi +2176 -0
  211. sage/rings/padics/FP_template_header.pxi +57 -0
  212. sage/rings/padics/all.py +3 -0
  213. sage/rings/padics/all__sagemath_pari.py +11 -0
  214. sage/rings/padics/common_conversion.cpython-314-x86_64-linux-musl.so +0 -0
  215. sage/rings/padics/common_conversion.pxd +15 -0
  216. sage/rings/padics/common_conversion.pyx +508 -0
  217. sage/rings/padics/eisenstein_extension_generic.py +232 -0
  218. sage/rings/padics/factory.py +3623 -0
  219. sage/rings/padics/generic_nodes.py +1615 -0
  220. sage/rings/padics/lattice_precision.py +2889 -0
  221. sage/rings/padics/morphism.cpython-314-x86_64-linux-musl.so +0 -0
  222. sage/rings/padics/morphism.pxd +11 -0
  223. sage/rings/padics/morphism.pyx +366 -0
  224. sage/rings/padics/padic_base_generic.py +467 -0
  225. sage/rings/padics/padic_base_leaves.py +1235 -0
  226. sage/rings/padics/padic_capped_absolute_element.cpython-314-x86_64-linux-musl.so +0 -0
  227. sage/rings/padics/padic_capped_absolute_element.pxd +15 -0
  228. sage/rings/padics/padic_capped_absolute_element.pyx +520 -0
  229. sage/rings/padics/padic_capped_relative_element.cpython-314-x86_64-linux-musl.so +0 -0
  230. sage/rings/padics/padic_capped_relative_element.pxd +14 -0
  231. sage/rings/padics/padic_capped_relative_element.pyx +614 -0
  232. sage/rings/padics/padic_extension_generic.py +990 -0
  233. sage/rings/padics/padic_extension_leaves.py +738 -0
  234. sage/rings/padics/padic_fixed_mod_element.cpython-314-x86_64-linux-musl.so +0 -0
  235. sage/rings/padics/padic_fixed_mod_element.pxd +15 -0
  236. sage/rings/padics/padic_fixed_mod_element.pyx +584 -0
  237. sage/rings/padics/padic_floating_point_element.cpython-314-x86_64-linux-musl.so +0 -0
  238. sage/rings/padics/padic_floating_point_element.pxd +14 -0
  239. sage/rings/padics/padic_floating_point_element.pyx +447 -0
  240. sage/rings/padics/padic_generic_element.cpython-314-x86_64-linux-musl.so +0 -0
  241. sage/rings/padics/padic_generic_element.pxd +48 -0
  242. sage/rings/padics/padic_generic_element.pyx +4642 -0
  243. sage/rings/padics/padic_lattice_element.py +1342 -0
  244. sage/rings/padics/padic_printing.cpython-314-x86_64-linux-musl.so +0 -0
  245. sage/rings/padics/padic_printing.pxd +38 -0
  246. sage/rings/padics/padic_printing.pyx +1505 -0
  247. sage/rings/padics/padic_relaxed_element.cpython-314-x86_64-linux-musl.so +0 -0
  248. sage/rings/padics/padic_relaxed_element.pxd +56 -0
  249. sage/rings/padics/padic_relaxed_element.pyx +18 -0
  250. sage/rings/padics/padic_relaxed_errors.cpython-314-x86_64-linux-musl.so +0 -0
  251. sage/rings/padics/padic_relaxed_errors.pxd +11 -0
  252. sage/rings/padics/padic_relaxed_errors.pyx +71 -0
  253. sage/rings/padics/padic_template_element.pxi +1212 -0
  254. sage/rings/padics/padic_template_element_header.pxi +50 -0
  255. sage/rings/padics/padic_valuation.py +1423 -0
  256. sage/rings/padics/pow_computer_flint.cpython-314-x86_64-linux-musl.so +0 -0
  257. sage/rings/padics/pow_computer_flint.pxd +38 -0
  258. sage/rings/padics/pow_computer_flint.pyx +641 -0
  259. sage/rings/padics/pow_computer_relative.cpython-314-x86_64-linux-musl.so +0 -0
  260. sage/rings/padics/pow_computer_relative.pxd +29 -0
  261. sage/rings/padics/pow_computer_relative.pyx +415 -0
  262. sage/rings/padics/qadic_flint_CA.cpython-314-x86_64-linux-musl.so +0 -0
  263. sage/rings/padics/qadic_flint_CA.pxd +21 -0
  264. sage/rings/padics/qadic_flint_CA.pyx +130 -0
  265. sage/rings/padics/qadic_flint_CR.cpython-314-x86_64-linux-musl.so +0 -0
  266. sage/rings/padics/qadic_flint_CR.pxd +13 -0
  267. sage/rings/padics/qadic_flint_CR.pyx +172 -0
  268. sage/rings/padics/qadic_flint_FM.cpython-314-x86_64-linux-musl.so +0 -0
  269. sage/rings/padics/qadic_flint_FM.pxd +14 -0
  270. sage/rings/padics/qadic_flint_FM.pyx +111 -0
  271. sage/rings/padics/qadic_flint_FP.cpython-314-x86_64-linux-musl.so +0 -0
  272. sage/rings/padics/qadic_flint_FP.pxd +12 -0
  273. sage/rings/padics/qadic_flint_FP.pyx +165 -0
  274. sage/rings/padics/relative_extension_leaves.py +429 -0
  275. sage/rings/padics/relative_ramified_CA.cpython-314-x86_64-linux-musl.so +0 -0
  276. sage/rings/padics/relative_ramified_CA.pxd +9 -0
  277. sage/rings/padics/relative_ramified_CA.pyx +33 -0
  278. sage/rings/padics/relative_ramified_CR.cpython-314-x86_64-linux-musl.so +0 -0
  279. sage/rings/padics/relative_ramified_CR.pxd +8 -0
  280. sage/rings/padics/relative_ramified_CR.pyx +33 -0
  281. sage/rings/padics/relative_ramified_FM.cpython-314-x86_64-linux-musl.so +0 -0
  282. sage/rings/padics/relative_ramified_FM.pxd +9 -0
  283. sage/rings/padics/relative_ramified_FM.pyx +33 -0
  284. sage/rings/padics/relative_ramified_FP.cpython-314-x86_64-linux-musl.so +0 -0
  285. sage/rings/padics/relative_ramified_FP.pxd +8 -0
  286. sage/rings/padics/relative_ramified_FP.pyx +33 -0
  287. sage/rings/padics/relaxed_template.pxi +4229 -0
  288. sage/rings/padics/relaxed_template_header.pxi +160 -0
  289. sage/rings/padics/tests.py +35 -0
  290. sage/rings/padics/tutorial.py +341 -0
  291. sage/rings/padics/unramified_extension_generic.py +335 -0
  292. sage/rings/padics/witt_vector.py +917 -0
  293. sage/rings/padics/witt_vector_ring.py +934 -0
  294. sage/rings/pari_ring.py +235 -0
  295. sage/rings/polynomial/all__sagemath_pari.py +1 -0
  296. sage/rings/polynomial/padics/all.py +1 -0
  297. sage/rings/polynomial/padics/polynomial_padic.py +360 -0
  298. sage/rings/polynomial/padics/polynomial_padic_capped_relative_dense.py +1324 -0
  299. sage/rings/polynomial/padics/polynomial_padic_flat.py +72 -0
  300. sage/rings/power_series_pari.cpython-314-x86_64-linux-musl.so +0 -0
  301. sage/rings/power_series_pari.pxd +6 -0
  302. sage/rings/power_series_pari.pyx +934 -0
  303. sage/rings/tate_algebra.py +1282 -0
  304. sage/rings/tate_algebra_element.cpython-314-x86_64-linux-musl.so +0 -0
  305. sage/rings/tate_algebra_element.pxd +49 -0
  306. sage/rings/tate_algebra_element.pyx +3464 -0
  307. sage/rings/tate_algebra_ideal.cpython-314-x86_64-linux-musl.so +0 -0
  308. sage/rings/tate_algebra_ideal.pxd +7 -0
  309. sage/rings/tate_algebra_ideal.pyx +1307 -0
  310. sage/rings/valuation/all.py +7 -0
  311. sage/rings/valuation/augmented_valuation.py +2118 -0
  312. sage/rings/valuation/developing_valuation.py +362 -0
  313. sage/rings/valuation/gauss_valuation.py +812 -0
  314. sage/rings/valuation/inductive_valuation.py +1686 -0
  315. sage/rings/valuation/limit_valuation.py +946 -0
  316. sage/rings/valuation/mapped_valuation.py +656 -0
  317. sage/rings/valuation/scaled_valuation.py +322 -0
  318. sage/rings/valuation/trivial_valuation.py +382 -0
  319. sage/rings/valuation/valuation.py +1119 -0
  320. sage/rings/valuation/valuation_space.py +1615 -0
  321. sage/rings/valuation/valuations_catalog.py +10 -0
  322. sage/rings/valuation/value_group.py +697 -0
  323. sage/schemes/all__sagemath_pari.py +1 -0
  324. sage/schemes/elliptic_curves/all__sagemath_pari.py +1 -0
  325. sage/schemes/elliptic_curves/descent_two_isogeny_pari.cpython-314-x86_64-linux-musl.so +0 -0
  326. sage/schemes/elliptic_curves/descent_two_isogeny_pari.pyx +46 -0
  327. sage_wheels/bin/gp +0 -0
  328. sage_wheels/bin/gp2c +0 -0
  329. sage_wheels/bin/gp2c-run +57 -0
  330. sage_wheels/bin/xeus-gp +0 -0
  331. sage_wheels/share/gp2c/func.dsc +18414 -0
@@ -0,0 +1,934 @@
1
+ # sage_setup: distribution = sagemath-pari
2
+ r"""
3
+ Power series implemented using PARI
4
+
5
+ EXAMPLES:
6
+
7
+ This implementation can be selected for any base ring supported by
8
+ PARI by passing the keyword ``implementation='pari'`` to the
9
+ :func:`~sage.rings.power_series_ring.PowerSeriesRing` constructor::
10
+
11
+ sage: R.<q> = PowerSeriesRing(ZZ, implementation='pari'); R
12
+ Power Series Ring in q over Integer Ring
13
+ sage: S.<t> = PowerSeriesRing(CC, implementation='pari'); S # needs sage.rings.real_mpfr
14
+ Power Series Ring in t over Complex Field with 53 bits of precision
15
+
16
+ Note that only the type of the elements depends on the implementation,
17
+ not the type of the parents::
18
+
19
+ sage: type(R)
20
+ <class 'sage.rings.power_series_ring.PowerSeriesRing_domain_with_category'>
21
+ sage: type(q)
22
+ <class 'sage.rings.power_series_pari.PowerSeries_pari'>
23
+ sage: type(S) # needs sage.rings.real_mpfr
24
+ <class 'sage.rings.power_series_ring.PowerSeriesRing_over_field_with_category'>
25
+ sage: type(t) # needs sage.rings.real_mpfr
26
+ <class 'sage.rings.power_series_pari.PowerSeries_pari'>
27
+
28
+ If `k` is a finite field implemented using PARI, this is the default
29
+ implementation for power series over `k`::
30
+
31
+ sage: k.<c> = GF(5^12)
32
+ sage: type(c)
33
+ <class 'sage.rings.finite_rings.element_pari_ffelt.FiniteFieldElement_pari_ffelt'>
34
+ sage: A.<x> = k[[]]
35
+ sage: type(x)
36
+ <class 'sage.rings.power_series_pari.PowerSeries_pari'>
37
+
38
+ .. WARNING::
39
+
40
+ Because this implementation uses the PARI interface, the PARI variable
41
+ ordering must be respected in the sense that the variable name of the
42
+ power series ring must have higher priority than any variable names
43
+ occurring in the base ring::
44
+
45
+ sage: R.<y> = QQ[]
46
+ sage: S.<x> = PowerSeriesRing(R, implementation='pari'); S
47
+ Power Series Ring in x over Univariate Polynomial Ring in y over Rational Field
48
+
49
+ Reversing the variable ordering leads to errors::
50
+
51
+ sage: R.<x> = QQ[]
52
+ sage: S.<y> = PowerSeriesRing(R, implementation='pari')
53
+ Traceback (most recent call last):
54
+ ...
55
+ PariError: incorrect priority in gtopoly: variable x <= y
56
+
57
+ AUTHORS:
58
+
59
+ - Peter Bruin (December 2013): initial version
60
+ """
61
+
62
+ # ****************************************************************************
63
+ # Copyright (C) 2013-2017 Peter Bruin <P.J.Bruin@math.leidenuniv.nl>
64
+ #
65
+ # This program is free software: you can redistribute it and/or modify
66
+ # it under the terms of the GNU General Public License as published by
67
+ # the Free Software Foundation, either version 2 of the License, or
68
+ # (at your option) any later version.
69
+ # https://www.gnu.org/licenses/
70
+ # ****************************************************************************
71
+
72
+ from cypari2.gen cimport Gen as pari_gen
73
+ from cypari2.pari_instance cimport get_var
74
+ from cypari2.paridecl cimport gel, typ, lg, valp, varn, t_POL, t_SER, t_RFRAC, t_VEC
75
+ from sage.libs.pari import pari
76
+
77
+ from sage.rings.polynomial.polynomial_element cimport Polynomial
78
+ from sage.rings.power_series_ring_element cimport PowerSeries
79
+ from sage.structure.element cimport Element
80
+ from sage.structure.parent cimport Parent
81
+ from sage.rings.infinity import infinity
82
+
83
+
84
+ cdef PowerSeries_pari construct_from_pari(parent, pari_gen g):
85
+ r"""
86
+ Fast construction of power series from PARI objects of suitable
87
+ type (series, polynomials, scalars and rational functions).
88
+
89
+ The resulting series has the same precision as `g`, unless `g` is
90
+ a rational function, in which case the default precision of
91
+ ``parent`` is used.
92
+
93
+ TESTS:
94
+
95
+ Check for :issue:`33224`::
96
+
97
+ sage: R.<z> = LaurentSeriesRing(QQ, implementation='pari')
98
+ sage: (z^-2).prec()
99
+ +Infinity
100
+ """
101
+ cdef long t = typ(g.g)
102
+ v = parent.variable_name()
103
+ if t == t_SER and varn(g.g) == get_var(v):
104
+ prec = lg(g.g) - 2 + valp(g.g)
105
+ elif t == t_RFRAC and pari.denominator(g) != 1:
106
+ prec = parent.default_prec()
107
+ g = g.Ser(v, prec - g.valuation(v))
108
+ else:
109
+ prec = infinity
110
+ cdef PowerSeries_pari x = PowerSeries_pari.__new__(PowerSeries_pari)
111
+ x._parent = parent
112
+ x._prec = prec
113
+ x.g = g
114
+ return x
115
+
116
+
117
+ cdef class PowerSeries_pari(PowerSeries):
118
+ r"""
119
+ A power series implemented using PARI.
120
+
121
+ INPUT:
122
+
123
+ - ``parent`` -- the power series ring to use as the parent
124
+
125
+ - ``f`` -- object from which to construct a power series
126
+
127
+ - ``prec`` -- (default: infinity) precision of the element
128
+ to be constructed
129
+
130
+ - ``check`` -- ignored, but accepted for compatibility with
131
+ :class:`~sage.rings.power_series_poly.PowerSeries_poly`
132
+ """
133
+ def __init__(self, parent, f=0, prec=infinity, check=None):
134
+ """
135
+ Initialize ``self``.
136
+
137
+ TESTS::
138
+
139
+ sage: # needs sage.rings.real_mpfr
140
+ sage: R.<q> = PowerSeriesRing(CC, implementation='pari')
141
+ sage: TestSuite(q).run()
142
+ sage: f = q - q^3 + O(q^10)
143
+ sage: TestSuite(f).run()
144
+ """
145
+ cdef Parent f_parent
146
+ cdef pari_gen g
147
+ cdef long t
148
+ v = parent.variable_name()
149
+ R = parent.base_ring()
150
+ P = parent._poly_ring()
151
+
152
+ if isinstance(f, PowerSeries): # not only PowerSeries_pari
153
+ f_parent = (<PowerSeries>f)._parent
154
+ if f_parent is parent:
155
+ if prec is infinity:
156
+ prec = (<PowerSeries>f)._prec
157
+ g = f.__pari__()
158
+ elif R.has_coerce_map_from(f_parent):
159
+ g = R.coerce(f).__pari__()
160
+ else:
161
+ if prec is infinity:
162
+ prec = f.prec()
163
+ g = f.polynomial().change_ring(R).__pari__()
164
+ elif isinstance(f, Polynomial):
165
+ f_parent = (<Polynomial>f)._parent
166
+ if f_parent is P:
167
+ g = f.__pari__()
168
+ elif R.has_coerce_map_from(f_parent):
169
+ g = R.coerce(f).__pari__()
170
+ else:
171
+ g = P.coerce(f).__pari__()
172
+ elif isinstance(f, pari_gen):
173
+ g = f
174
+ t = typ(g.g)
175
+ if t == t_POL:
176
+ g = P(g).__pari__()
177
+ elif t == t_SER and varn(g.g) == get_var(v):
178
+ if valp(g.g) < 0:
179
+ raise ValueError('series has negative valuation')
180
+ if prec is infinity:
181
+ prec = lg(g.g) - 2 + valp(g.g)
182
+ g = P(g.Pol(v)).__pari__()
183
+ elif t == t_RFRAC:
184
+ if prec is infinity:
185
+ prec = parent.default_prec()
186
+ g = P.fraction_field()(g).__pari__()
187
+ g = g.Ser(v, prec - g.valuation(v))
188
+ elif t == t_VEC:
189
+ g = P(g.Polrev(v)).__pari__()
190
+ else:
191
+ g = R(g).__pari__()
192
+ elif isinstance(f, (list, tuple)):
193
+ g = pari([R.coerce(x) for x in f]).Polrev(v)
194
+ else:
195
+ g = R.coerce(f).__pari__()
196
+
197
+ if prec is infinity:
198
+ self.g = g
199
+ else:
200
+ if not g:
201
+ self.g = g.Ser(v, prec)
202
+ else:
203
+ self.g = g.Ser(v, prec - g.valuation(v))
204
+
205
+ PowerSeries.__init__(self, parent, prec)
206
+
207
+ def __hash__(self):
208
+ """
209
+ Return a hash of ``self``.
210
+
211
+ TESTS::
212
+
213
+ sage: R.<t> = PowerSeriesRing(ZZ, implementation='pari')
214
+ sage: hash(t^2 + 1) == hash(pari(t^2 + 1))
215
+ True
216
+ """
217
+ return hash(self.g)
218
+
219
+ def __reduce__(self):
220
+ """
221
+ Used for pickling.
222
+
223
+ EXAMPLES::
224
+
225
+ sage: A.<z> = PowerSeriesRing(RR, implementation='pari')
226
+ sage: f = z - z^3 + O(z^10)
227
+ sage: z == loads(dumps(z))
228
+ True
229
+ sage: f == loads(dumps(f))
230
+ True
231
+ """
232
+ return PowerSeries_pari, (self._parent, self.g, self._prec, False)
233
+
234
+ def __pari__(self):
235
+ """
236
+ Convert ``self`` to a PARI object.
237
+
238
+ TESTS::
239
+
240
+ sage: R.<t> = PowerSeriesRing(GF(7), implementation='pari')
241
+ sage: (3 - t^3 + O(t^5)).__pari__()
242
+ Mod(3, 7) + Mod(6, 7)*t^3 + O(t^5)
243
+ """
244
+ return self.g
245
+
246
+ def polynomial(self):
247
+ """
248
+ Convert ``self`` to a polynomial.
249
+
250
+ EXAMPLES::
251
+
252
+ sage: R.<t> = PowerSeriesRing(GF(7), implementation='pari')
253
+ sage: f = 3 - t^3 + O(t^5)
254
+ sage: f.polynomial()
255
+ 6*t^3 + 3
256
+ """
257
+ return self._parent._poly_ring()(self.list())
258
+
259
+ def valuation(self):
260
+ """
261
+ Return the valuation of ``self``.
262
+
263
+ EXAMPLES::
264
+
265
+ sage: R.<t> = PowerSeriesRing(QQ, implementation='pari')
266
+ sage: (5 - t^8 + O(t^11)).valuation()
267
+ 0
268
+ sage: (-t^8 + O(t^11)).valuation()
269
+ 8
270
+ sage: O(t^7).valuation()
271
+ 7
272
+ sage: R(0).valuation()
273
+ +Infinity
274
+ """
275
+ if not self.g:
276
+ return self._prec
277
+ return self.g.valuation(self._parent.variable_name())
278
+
279
+ def __bool__(self):
280
+ """
281
+ Return ``True`` if ``self`` is nonzero, and ``False`` otherwise.
282
+
283
+ EXAMPLES::
284
+
285
+ sage: R.<t> = PowerSeriesRing(GF(11), implementation='pari')
286
+ sage: bool(1 + t + O(t^18))
287
+ True
288
+ sage: bool(R(0))
289
+ False
290
+ sage: bool(O(t^18))
291
+ False
292
+ """
293
+ return bool(self.g)
294
+
295
+ def __call__(self, *x, **kwds):
296
+ """
297
+ Evaluate ``self`` at `x = a`.
298
+
299
+ EXAMPLES::
300
+
301
+ sage: R.<t> = PowerSeriesRing(ZZ, implementation='pari')
302
+ sage: f = t^2 + t^3 + O(t^6)
303
+ sage: f(t^3)
304
+ t^6 + t^9 + O(t^18)
305
+ sage: f(t=t^3)
306
+ t^6 + t^9 + O(t^18)
307
+ sage: f(f)
308
+ t^4 + 2*t^5 + 2*t^6 + 3*t^7 + O(t^8)
309
+ sage: f(f)(f) == f(f(f))
310
+ True
311
+
312
+ The following demonstrates that the problems raised in
313
+ :issue:`3979` and :issue:`5367` are solved::
314
+
315
+ sage: [f(t^2 + O(t^n)) for n in [9, 10, 11]]
316
+ [t^4 + t^6 + O(t^11), t^4 + t^6 + O(t^12), t^4 + t^6 + O(t^12)]
317
+ sage: f(t^2)
318
+ t^4 + t^6 + O(t^12)
319
+
320
+ It is possible to substitute a series for which only
321
+ the precision is defined::
322
+
323
+ sage: f(O(t^5))
324
+ O(t^10)
325
+
326
+ or to substitute a polynomial (the result belonging to the power
327
+ series ring over the same base ring)::
328
+
329
+ sage: P.<z> = ZZ[]
330
+ sage: g = f(z + z^3); g
331
+ z^2 + z^3 + 2*z^4 + 3*z^5 + O(z^6)
332
+ sage: g.parent()
333
+ Power Series Ring in z over Integer Ring
334
+
335
+ A series defined over another ring can be substituted::
336
+
337
+ sage: S.<u> = PowerSeriesRing(GF(7), implementation='pari')
338
+ sage: f(2*u + u^3 + O(u^5))
339
+ 4*u^2 + u^3 + 4*u^4 + 5*u^5 + O(u^6)
340
+
341
+ Substituting `p`-adic numbers::
342
+
343
+ sage: # needs sage.rings.padics
344
+ sage: f(100 + O(5^7))
345
+ 5^4 + 3*5^5 + 4*5^6 + 2*5^7 + 2*5^8 + O(5^9)
346
+ sage: ff = PowerSeriesRing(pAdicRing(5), 't', implementation='pari')(f)
347
+ sage: ff
348
+ (1 + O(5^20))*t^2 + (1 + O(5^20))*t^3 + O(t^6)
349
+ sage: ff(100 + O(5^7))
350
+ 5^4 + 3*5^5 + 4*5^6 + 2*5^7 + 2*5^8 + O(5^9)
351
+ sage: ff(100 + O(2^7))
352
+ Traceback (most recent call last):
353
+ ...
354
+ TypeError: no common canonical parent for objects with parents:
355
+ '5-adic Ring with capped relative precision 20' and
356
+ '2-adic Ring with capped relative precision 20'
357
+
358
+ The argument must have valuation at least 1, unless the series
359
+ is actually a polynomial::
360
+
361
+ sage: f(0)
362
+ 0
363
+ sage: f(1 + t)
364
+ Traceback (most recent call last):
365
+ ...
366
+ ValueError: can only substitute elements of positive valuation
367
+ sage: f(t^-2)
368
+ Traceback (most recent call last):
369
+ ...
370
+ ValueError: can only substitute elements of positive valuation
371
+ sage: f(2 + O(5^3)) # needs sage.rings.padics
372
+ Traceback (most recent call last):
373
+ ...
374
+ ValueError: can only substitute elements of positive valuation
375
+ sage: g = t^2 + t^3
376
+ sage: g(1 + t + O(t^2))
377
+ 2 + 5*t + O(t^2)
378
+ sage: g(3)
379
+ 36
380
+
381
+ Substitution of variables belonging to the base ring can be
382
+ done using keywords::
383
+
384
+ sage: P.<a> = GF(5)[]
385
+ sage: Q.<x> = PowerSeriesRing(P, implementation='pari')
386
+ sage: h = (1 - a*x)^-1 + O(x^7); h
387
+ 1 + a*x + a^2*x^2 + a^3*x^3 + a^4*x^4 + a^5*x^5 + a^6*x^6 + O(x^7)
388
+ sage: h(x^2, a=3)
389
+ 1 + 3*x^2 + 4*x^4 + 2*x^6 + x^8 + 3*x^10 + 4*x^12 + O(x^14)
390
+ """
391
+ if len(kwds) >= 1:
392
+ name = self._parent.variable_name()
393
+ if name in kwds: # the series variable is specified by a keyword
394
+ if len(x):
395
+ raise ValueError("must not specify %s keyword and positional argument" % name)
396
+ x = [kwds[name]]
397
+ del kwds[name]
398
+
399
+ if len(x) != 1:
400
+ raise ValueError("must specify exactly one positional argument")
401
+
402
+ a = x[0]
403
+
404
+ s = self._prec
405
+ if s is infinity:
406
+ return self.polynomial()(a)
407
+
408
+ # Determine the parent of the result.
409
+ P = self._parent
410
+ Q = a.parent()
411
+ if not Q.has_coerce_map_from(P.base_ring()):
412
+ from sage.structure.element import canonical_coercion
413
+ a = canonical_coercion(P.base_ring()(0), a)[1]
414
+ Q = a.parent()
415
+
416
+ # The result is defined if the ring Q is complete with respect
417
+ # to an ideal I, and the element a lies in I. Here we only
418
+ # implement a few special cases.
419
+ from sage.rings.padics.padic_generic import pAdicGeneric
420
+ from sage.rings.polynomial.polynomial_ring import PolynomialRing_generic
421
+ from sage.rings.power_series_ring import PowerSeriesRing_generic
422
+ from sage.rings.laurent_series_ring import LaurentSeriesRing
423
+ if isinstance(Q, pAdicGeneric):
424
+ # Substitution of p-adic numbers in power series is
425
+ # currently not implemented in PARI (2.8.0-development).
426
+ t = a.valuation()
427
+ if t <= 0:
428
+ raise ValueError("can only substitute elements of positive valuation")
429
+ return Q(self.polynomial()(a)).add_bigoh(t * self._prec)
430
+ elif isinstance(Q, (PowerSeriesRing_generic, LaurentSeriesRing)):
431
+ # In Sage, we want an error to be raised when trying to
432
+ # substitute a series of nonpositive valuation, but PARI
433
+ # (2.8.0-development) does not do this. For example,
434
+ # subst(1 + O(x), x, 1/y) yields O(y^-1).
435
+ if a.valuation() <= 0:
436
+ raise ValueError("can only substitute elements of positive valuation")
437
+ elif isinstance(Q, PolynomialRing_generic):
438
+ Q = Q.completion(Q.gen())
439
+ elif Q.is_exact() and not a:
440
+ pass
441
+ else:
442
+ raise ValueError('cannot substitute %s in %s' % (a, self))
443
+
444
+ if not kwds:
445
+ return Q(self.g(a))
446
+ else:
447
+ kwds[P.variable_name()] = a
448
+ return Q(self.g(**kwds))
449
+
450
+ def __getitem__(self, n):
451
+ r"""
452
+ Return the ``n``-th coefficient of ``self``.
453
+
454
+ If ``n`` is a slice object, this returns a power series of the
455
+ same precision, whose coefficients are the same as ``self``
456
+ for those indices in the slice, and 0 otherwise.
457
+
458
+ Returns 0 for negative coefficients. Raises an :exc:`IndexError`
459
+ if trying to access beyond known coefficients.
460
+
461
+ EXAMPLES::
462
+
463
+ sage: R.<t> = PowerSeriesRing(QQ, implementation='pari')
464
+ sage: f = 3/2 - 17/5*t^3 + O(t^5)
465
+ sage: f[3]
466
+ -17/5
467
+ sage: f[-2]
468
+ 0
469
+ sage: f[4]
470
+ 0
471
+ sage: f[5]
472
+ Traceback (most recent call last):
473
+ ...
474
+ IndexError: index out of range
475
+
476
+ sage: R.<t> = PowerSeriesRing(ZZ, implementation='pari')
477
+ sage: f = (2-t)^5; f
478
+ 32 - 80*t + 80*t^2 - 40*t^3 + 10*t^4 - t^5
479
+ sage: f[:4]
480
+ 32 - 80*t + 80*t^2 - 40*t^3
481
+
482
+ sage: f = 1 + t^3 - 4*t^4 + O(t^7); f
483
+ 1 + t^3 - 4*t^4 + O(t^7)
484
+ sage: f[:4]
485
+ 1 + t^3 + O(t^7)
486
+ """
487
+ cdef long t
488
+ if isinstance(n, slice):
489
+ return PowerSeries_pari(self._parent, self.polynomial()[n],
490
+ prec=self._prec)
491
+ if n < 0:
492
+ return self.base_ring().zero()
493
+
494
+ t = typ(self.g.g)
495
+ if t == t_POL or t == t_SER:
496
+ h = self.g[n]
497
+ else:
498
+ h = self.g
499
+ return self.base_ring()(h)
500
+
501
+ def __invert__(self):
502
+ """
503
+ Return the multiplicative inverse of ``self``.
504
+
505
+ TESTS::
506
+
507
+ sage: R.<t> = PowerSeriesRing(QQ, default_prec=6, implementation='pari')
508
+ sage: ~(R(1-t))
509
+ 1 + t + t^2 + t^3 + t^4 + t^5 + O(t^6)
510
+ """
511
+ h = ~self.g
512
+ if h.valuation(self._parent.variable_name()) < 0:
513
+ return self._parent.laurent_series_ring()(h)
514
+ return construct_from_pari(self._parent, h)
515
+
516
+ def __neg__(self):
517
+ """
518
+ Return the negative of ``self``.
519
+
520
+ TESTS::
521
+
522
+ sage: R.<t> = PowerSeriesRing(QQ, implementation='pari')
523
+ sage: f = t + 17/5*t^3 + 2*t^4 + O(t^5)
524
+ sage: -f
525
+ -t - 17/5*t^3 - 2*t^4 + O(t^5)
526
+ """
527
+ return construct_from_pari(self._parent, -self.g)
528
+
529
+ def __pow__(PowerSeries_pari self, n, m):
530
+ """
531
+ Exponentiation of power series.
532
+
533
+ TESTS::
534
+
535
+ sage: R.<t> = PowerSeriesRing(QQ, implementation='pari')
536
+ sage: f = 3 - t^3 + O(t^5)
537
+ sage: a = f^3; a
538
+ 27 - 27*t^3 + O(t^5)
539
+ sage: b = f^-3; b
540
+ 1/27 + 1/27*t^3 + O(t^5)
541
+ """
542
+ h = self.g ** n
543
+ if h.valuation(self._parent.variable_name()) < 0:
544
+ return self._parent.laurent_series_ring()(h)
545
+ return construct_from_pari(self._parent, h)
546
+
547
+ cpdef _add_(self, right):
548
+ """
549
+ Addition of power series.
550
+
551
+ TESTS::
552
+
553
+ sage: R.<x> = PowerSeriesRing(ZZ, implementation='pari')
554
+ sage: f = x^4 + O(x^5); f
555
+ x^4 + O(x^5)
556
+ sage: g = x^2 + O(x^3); g
557
+ x^2 + O(x^3)
558
+ sage: f+g
559
+ x^2 + O(x^3)
560
+ """
561
+ return construct_from_pari(self._parent, self.g + (<PowerSeries_pari>right).g)
562
+
563
+ cpdef _sub_(self, right):
564
+ """
565
+ Subtraction of power series.
566
+
567
+ TESTS::
568
+
569
+ sage: k.<w> = ZZ[]
570
+ sage: R.<t> = PowerSeriesRing(k, implementation='pari')
571
+ sage: w*t^2 -w*t +13 - (w*t^2 + w*t)
572
+ 13 - 2*w*t
573
+ """
574
+ return construct_from_pari(self._parent, self.g - (<PowerSeries_pari>right).g)
575
+
576
+ cpdef _mul_(self, right):
577
+ """
578
+ Multiplication of power series.
579
+
580
+ TESTS::
581
+
582
+ sage: k.<w> = PowerSeriesRing(ZZ, implementation='pari')
583
+ sage: (1+17*w+15*w^3+O(w^5))*(19*w^10+O(w^12))
584
+ 19*w^10 + 323*w^11 + O(w^12)
585
+ """
586
+ return construct_from_pari(self._parent, self.g * (<PowerSeries_pari>right).g)
587
+
588
+ cpdef _rmul_(self, Element c):
589
+ """
590
+ Right multiplication by a scalar.
591
+
592
+ TESTS::
593
+
594
+ sage: R.<t> = PowerSeriesRing(GF(7), implementation='pari')
595
+ sage: f = t + 3*t^4 + O(t^11)
596
+ sage: f * GF(7)(3)
597
+ 3*t + 2*t^4 + O(t^11)
598
+ """
599
+ return construct_from_pari(self._parent, self.g * c)
600
+
601
+ cpdef _lmul_(self, Element c):
602
+ """
603
+ Left multiplication by a scalar.
604
+
605
+ TESTS::
606
+
607
+ sage: R.<t> = PowerSeriesRing(GF(11), implementation='pari')
608
+ sage: f = 1 + 3*t^4 + O(t^120)
609
+ sage: 2 * f
610
+ 2 + 6*t^4 + O(t^120)
611
+ """
612
+ return construct_from_pari(self._parent, c * self.g)
613
+
614
+ cpdef _div_(self, right):
615
+ """
616
+ Division of power series.
617
+
618
+ TESTS::
619
+
620
+ sage: R.<t> = PowerSeriesRing(GF(11), default_prec=8, implementation='pari')
621
+ sage: f = t/(1 - t); f
622
+ t + t^2 + t^3 + t^4 + t^5 + t^6 + t^7 + O(t^8)
623
+ sage: f.parent()
624
+ Power Series Ring in t over Finite Field of size 11
625
+ sage: g = (1 - t)/t; g
626
+ t^-1 + 10
627
+ sage: g.parent()
628
+ Laurent Series Ring in t over Finite Field of size 11
629
+ """
630
+ h = self.g / (<PowerSeries_pari>right).g
631
+ if h.valuation(self._parent.variable_name()) < 0:
632
+ return self._parent.laurent_series_ring()(h)
633
+ return construct_from_pari(self._parent, h)
634
+
635
+ def list(self):
636
+ """
637
+ Return the list of known coefficients for ``self``.
638
+
639
+ This is just the list of coefficients of the underlying
640
+ polynomial; it need not have length equal to ``self.prec()``.
641
+
642
+ EXAMPLES::
643
+
644
+ sage: R.<t> = PowerSeriesRing(ZZ, implementation='pari')
645
+ sage: f = 1 - 5*t^3 + t^5 + O(t^7)
646
+ sage: f.list()
647
+ [1, 0, 0, -5, 0, 1]
648
+
649
+ sage: # needs sage.rings.padics
650
+ sage: S.<u> = PowerSeriesRing(pAdicRing(5), implementation='pari')
651
+ sage: (2 + u).list()
652
+ [2 + O(5^20), 1 + O(5^20)]
653
+ """
654
+ cdef pari_gen g = self.g
655
+ cdef long vn = get_var(self._parent.variable_name())
656
+ R = self.base_ring()
657
+ if typ(g.g) == t_SER and varn(g.g) == vn:
658
+ g = g.truncate()
659
+ if typ(g.g) == t_POL and varn(g.g) == vn:
660
+ # t_POL has 2 codewords. Use new_ref instead of g[i] for speed.
661
+ G = g.fixGEN()
662
+ return [R(g.new_ref(gel(G, i))) for i in range(2, lg(G))]
663
+ else:
664
+ return [R(g)]
665
+
666
+ def padded_list(self, n=None):
667
+ """
668
+ Return a list of coefficients of ``self`` up to (but not
669
+ including) `q^n`.
670
+
671
+ The list is padded with zeroes on the right so that it has
672
+ length `n`.
673
+
674
+ INPUT:
675
+
676
+ - ``n`` -- nonnegative integer (optional); if `n` is not
677
+ given, it will be taken to be the precision of ``self``,
678
+ unless this is ``+Infinity``, in which case we just
679
+ return ``self.list()``
680
+
681
+ EXAMPLES::
682
+
683
+ sage: R.<q> = PowerSeriesRing(QQ, implementation='pari')
684
+ sage: f = 1 - 17*q + 13*q^2 + 10*q^4 + O(q^7)
685
+ sage: f.list()
686
+ [1, -17, 13, 0, 10]
687
+ sage: f.padded_list(7)
688
+ [1, -17, 13, 0, 10, 0, 0]
689
+ sage: f.padded_list(10)
690
+ [1, -17, 13, 0, 10, 0, 0, 0, 0, 0]
691
+ sage: f.padded_list(3)
692
+ [1, -17, 13]
693
+ sage: f.padded_list()
694
+ [1, -17, 13, 0, 10, 0, 0]
695
+ sage: g = 1 - 17*q + 13*q^2 + 10*q^4
696
+ sage: g.list()
697
+ [1, -17, 13, 0, 10]
698
+ sage: g.padded_list()
699
+ [1, -17, 13, 0, 10]
700
+ sage: g.padded_list(10)
701
+ [1, -17, 13, 0, 10, 0, 0, 0, 0, 0]
702
+ """
703
+ if n is None:
704
+ if self._prec is infinity:
705
+ return self.list()
706
+ else:
707
+ n = self._prec
708
+ if not n:
709
+ return []
710
+
711
+ cdef pari_gen g = self.g
712
+ g.fixGEN()
713
+ cdef long l, m
714
+
715
+ R = self.base_ring()
716
+ if typ(g.g) == t_POL and varn(g.g) == get_var(self._parent.variable_name()):
717
+ l = lg(g.g) - 2 # t_POL has 2 codewords
718
+ if n <= l:
719
+ return [R(g.new_ref(gel(g.g, i + 2))) for i in range(n)]
720
+ else:
721
+ return ([R(g.new_ref(gel(g.g, i + 2))) for i in range(l)]
722
+ + [R.zero()] * (n - l))
723
+ elif typ(g.g) == t_SER and varn(g.g) == get_var(self._parent.variable_name()):
724
+ l = lg(g.g) - 2 # t_SER has 2 codewords
725
+ m = valp(g.g)
726
+ if n <= m:
727
+ return [R.zero()] * n
728
+ elif n <= l + m:
729
+ return ([R.zero()] * m
730
+ + [R(g.new_ref(gel(g.g, i + 2))) for i in range(n - m)])
731
+ else:
732
+ return ([R.zero()] * m
733
+ + [R(g.new_ref(gel(g.g, i + 2))) for i in range(l)]
734
+ + [R.zero()] * (n - l - m))
735
+ else:
736
+ return [R(g)] + [R.zero()] * (n - 1)
737
+
738
+ def monomial_coefficients(self, copy=None):
739
+ """
740
+ Return a dictionary of coefficients for ``self``.
741
+
742
+ This is simply a dict for the underlying polynomial; it need
743
+ not have keys corresponding to every number smaller than
744
+ ``self.prec()``.
745
+
746
+ EXAMPLES::
747
+
748
+ sage: R.<t> = PowerSeriesRing(ZZ, implementation='pari')
749
+ sage: f = 1 + t^10 + O(t^12)
750
+ sage: f.monomial_coefficients()
751
+ {0: 1, 10: 1}
752
+
753
+ ``dict`` is an alias::
754
+
755
+ sage: f.dict()
756
+ {0: 1, 10: 1}
757
+ """
758
+ return self.polynomial().monomial_coefficients()
759
+
760
+ dict = monomial_coefficients
761
+
762
+ def _derivative(self, var=None):
763
+ """
764
+ Return the derivative of ``self`` with respect to the
765
+ variable ``var``.
766
+
767
+ If ``var`` is ``None``, the variable of the power series ring
768
+ is used.
769
+
770
+ .. SEEALSO::
771
+
772
+ :meth:`derivative()`
773
+
774
+ EXAMPLES::
775
+
776
+ sage: R.<w> = PowerSeriesRing(QQ, implementation='pari')
777
+ sage: f = 2 + 3*w^2 + w^10 + O(w^100); f
778
+ 2 + 3*w^2 + w^10 + O(w^100)
779
+ sage: f._derivative()
780
+ 6*w + 10*w^9 + O(w^99)
781
+ sage: f._derivative(w)
782
+ 6*w + 10*w^9 + O(w^99)
783
+
784
+ sage: R.<t> = PolynomialRing(ZZ)
785
+ sage: S.<x> = PowerSeriesRing(R, implementation='pari')
786
+ sage: f = t^3*x^4 + O(x^5)
787
+ sage: f._derivative()
788
+ 4*t^3*x^3 + O(x^4)
789
+ sage: f._derivative(x)
790
+ 4*t^3*x^3 + O(x^4)
791
+ sage: f._derivative(t)
792
+ 3*t^2*x^4 + O(x^5)
793
+ """
794
+ if var is None:
795
+ var = self._parent.variable_name()
796
+ return construct_from_pari(self._parent, self.g.deriv(var))
797
+
798
+ def integral(self, var=None):
799
+ """
800
+ Return the formal integral of ``self``.
801
+
802
+ By default, the integration variable is the variable of the
803
+ power series. Otherwise, the integration variable is the
804
+ optional parameter ``var``.
805
+
806
+ .. NOTE::
807
+
808
+ The integral is always chosen so the constant term is 0.
809
+
810
+ EXAMPLES::
811
+
812
+ sage: k.<w> = PowerSeriesRing(QQ, implementation='pari')
813
+ sage: (1+17*w+15*w^3+O(w^5)).integral()
814
+ w + 17/2*w^2 + 15/4*w^4 + O(w^6)
815
+ sage: (w^3 + 4*w^4 + O(w^7)).integral()
816
+ 1/4*w^4 + 4/5*w^5 + O(w^8)
817
+ sage: (3*w^2).integral()
818
+ w^3
819
+
820
+ TESTS::
821
+
822
+ sage: t = PowerSeriesRing(QQ, 't', implementation='pari').gen()
823
+ sage: f = t + 5*t^2 + 21*t^3
824
+ sage: g = f.integral() ; g
825
+ 1/2*t^2 + 5/3*t^3 + 21/4*t^4
826
+ sage: g.parent()
827
+ Power Series Ring in t over Rational Field
828
+
829
+ sage: R.<a> = QQ[]
830
+ sage: t = PowerSeriesRing(R, 't', implementation='pari').gen()
831
+ sage: f = a*t +5*t^2
832
+ sage: f.integral()
833
+ 1/2*a*t^2 + 5/3*t^3
834
+ sage: f.integral(a)
835
+ 1/2*a^2*t + 5*a*t^2
836
+ """
837
+ if var is None:
838
+ var = self._parent.variable_name()
839
+ return construct_from_pari(self._parent, self.g.intformal(var))
840
+
841
+ def reverse(self, precision=None):
842
+ r"""
843
+ Return the reverse of ``self``.
844
+
845
+ The reverse of a power series `f` is the power series `g` such
846
+ that `g(f(x)) = x`. This exists if and only if the valuation
847
+ of ``self`` is exactly 1 and the coefficient of `x` is a unit.
848
+
849
+ If the optional argument ``precision`` is given, the reverse
850
+ is returned with this precision. If ``f`` has infinite
851
+ precision and the argument ``precision`` is not given, then
852
+ the reverse is returned with the default precision of
853
+ ``f.parent()``.
854
+
855
+ EXAMPLES::
856
+
857
+ sage: R.<x> = PowerSeriesRing(QQ, implementation='pari')
858
+ sage: f = 2*x + 3*x^2 - x^4 + O(x^5)
859
+ sage: g = f.reverse()
860
+ sage: g
861
+ 1/2*x - 3/8*x^2 + 9/16*x^3 - 131/128*x^4 + O(x^5)
862
+ sage: f(g)
863
+ x + O(x^5)
864
+ sage: g(f)
865
+ x + O(x^5)
866
+
867
+ sage: A.<t> = PowerSeriesRing(ZZ, implementation='pari')
868
+ sage: a = t - t^2 - 2*t^4 + t^5 + O(t^6)
869
+ sage: b = a.reverse(); b
870
+ t + t^2 + 2*t^3 + 7*t^4 + 25*t^5 + O(t^6)
871
+ sage: a(b)
872
+ t + O(t^6)
873
+ sage: b(a)
874
+ t + O(t^6)
875
+
876
+ sage: B.<b,c> = PolynomialRing(ZZ)
877
+ sage: A.<t> = PowerSeriesRing(B, implementation='pari')
878
+ sage: f = t + b*t^2 + c*t^3 + O(t^4)
879
+ sage: g = f.reverse(); g
880
+ t - b*t^2 + (2*b^2 - c)*t^3 + O(t^4)
881
+ sage: f(g)
882
+ t + O(t^4)
883
+ sage: g(f)
884
+ t + O(t^4)
885
+
886
+ sage: A.<t> = PowerSeriesRing(ZZ, implementation='pari')
887
+ sage: B.<x> = PowerSeriesRing(A, implementation='pari')
888
+ sage: f = (1 - 3*t + 4*t^3 + O(t^4))*x + (2 + t + t^2 + O(t^3))*x^2 + O(x^3)
889
+ sage: g = f.reverse(); g
890
+ (1 + 3*t + 9*t^2 + 23*t^3 + O(t^4))*x + (-2 - 19*t - 118*t^2 + O(t^3))*x^2 + O(x^3)
891
+
892
+ The optional argument ``precision`` sets the precision of the output::
893
+
894
+ sage: R.<x> = PowerSeriesRing(QQ, implementation='pari')
895
+ sage: f = 2*x + 3*x^2 - 7*x^3 + x^4 + O(x^5)
896
+ sage: g = f.reverse(precision=3); g
897
+ 1/2*x - 3/8*x^2 + O(x^3)
898
+ sage: f(g)
899
+ x + O(x^3)
900
+ sage: g(f)
901
+ x + O(x^3)
902
+
903
+ If the input series has infinite precision, the precision of the
904
+ output is automatically set to the default precision of the parent
905
+ ring::
906
+
907
+ sage: R.<x> = PowerSeriesRing(QQ, default_prec=20, implementation='pari')
908
+ sage: (x - x^2).reverse() # get some Catalan numbers
909
+ x + x^2 + 2*x^3 + 5*x^4 + 14*x^5 + 42*x^6 + 132*x^7 + 429*x^8
910
+ + 1430*x^9 + 4862*x^10 + 16796*x^11 + 58786*x^12 + 208012*x^13
911
+ + 742900*x^14 + 2674440*x^15 + 9694845*x^16 + 35357670*x^17
912
+ + 129644790*x^18 + 477638700*x^19 + O(x^20)
913
+ sage: (x - x^2).reverse(precision=3)
914
+ x + x^2 + O(x^3)
915
+
916
+ TESTS::
917
+
918
+ sage: R.<x> = PowerSeriesRing(QQ, implementation='pari')
919
+ sage: f = 1 + 2*x + 3*x^2 - x^4 + O(x^5)
920
+ sage: f.reverse()
921
+ Traceback (most recent call last):
922
+ ...
923
+ PariError: domain error in serreverse: valuation != 1
924
+ """
925
+ cdef PowerSeries_pari f
926
+ if self._prec is infinity:
927
+ if precision is None:
928
+ precision = self._parent.default_prec()
929
+ f = self.add_bigoh(precision)
930
+ else:
931
+ if precision is None:
932
+ precision = self._prec
933
+ f = self
934
+ return PowerSeries_pari(self._parent, f.g.serreverse(), precision)