passagemath-categories 10.6.32__cp314-cp314t-musllinux_1_2_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 (719) hide show
  1. passagemath_categories-10.6.32.dist-info/METADATA +156 -0
  2. passagemath_categories-10.6.32.dist-info/RECORD +719 -0
  3. passagemath_categories-10.6.32.dist-info/WHEEL +5 -0
  4. passagemath_categories-10.6.32.dist-info/top_level.txt +2 -0
  5. passagemath_categories.libs/libgcc_s-2d945d6c.so.1 +0 -0
  6. passagemath_categories.libs/libgmp-28992bcb.so.10.5.0 +0 -0
  7. passagemath_categories.libs/libstdc++-85f2cd6d.so.6.0.33 +0 -0
  8. sage/all__sagemath_categories.py +28 -0
  9. sage/arith/all.py +38 -0
  10. sage/arith/constants.pxd +27 -0
  11. sage/arith/functions.cpython-314t-aarch64-linux-musl.so +0 -0
  12. sage/arith/functions.pxd +4 -0
  13. sage/arith/functions.pyx +221 -0
  14. sage/arith/misc.py +6552 -0
  15. sage/arith/multi_modular.cpython-314t-aarch64-linux-musl.so +0 -0
  16. sage/arith/multi_modular.pxd +39 -0
  17. sage/arith/multi_modular.pyx +994 -0
  18. sage/arith/rational_reconstruction.cpython-314t-aarch64-linux-musl.so +0 -0
  19. sage/arith/rational_reconstruction.pxd +4 -0
  20. sage/arith/rational_reconstruction.pyx +115 -0
  21. sage/arith/srange.cpython-314t-aarch64-linux-musl.so +0 -0
  22. sage/arith/srange.pyx +571 -0
  23. sage/calculus/all__sagemath_categories.py +2 -0
  24. sage/calculus/functional.py +481 -0
  25. sage/calculus/functions.py +151 -0
  26. sage/categories/additive_groups.py +73 -0
  27. sage/categories/additive_magmas.py +1044 -0
  28. sage/categories/additive_monoids.py +114 -0
  29. sage/categories/additive_semigroups.py +184 -0
  30. sage/categories/affine_weyl_groups.py +238 -0
  31. sage/categories/algebra_ideals.py +95 -0
  32. sage/categories/algebra_modules.py +96 -0
  33. sage/categories/algebras.py +349 -0
  34. sage/categories/algebras_with_basis.py +377 -0
  35. sage/categories/all.py +160 -0
  36. sage/categories/aperiodic_semigroups.py +29 -0
  37. sage/categories/associative_algebras.py +47 -0
  38. sage/categories/bialgebras.py +101 -0
  39. sage/categories/bialgebras_with_basis.py +414 -0
  40. sage/categories/bimodules.py +206 -0
  41. sage/categories/chain_complexes.py +268 -0
  42. sage/categories/classical_crystals.py +480 -0
  43. sage/categories/coalgebras.py +405 -0
  44. sage/categories/coalgebras_with_basis.py +232 -0
  45. sage/categories/coercion_methods.cpython-314t-aarch64-linux-musl.so +0 -0
  46. sage/categories/coercion_methods.pyx +52 -0
  47. sage/categories/commutative_additive_groups.py +104 -0
  48. sage/categories/commutative_additive_monoids.py +45 -0
  49. sage/categories/commutative_additive_semigroups.py +48 -0
  50. sage/categories/commutative_algebra_ideals.py +87 -0
  51. sage/categories/commutative_algebras.py +94 -0
  52. sage/categories/commutative_ring_ideals.py +58 -0
  53. sage/categories/commutative_rings.py +736 -0
  54. sage/categories/complete_discrete_valuation.py +293 -0
  55. sage/categories/complex_reflection_groups.py +145 -0
  56. sage/categories/complex_reflection_or_generalized_coxeter_groups.py +1249 -0
  57. sage/categories/coxeter_group_algebras.py +186 -0
  58. sage/categories/coxeter_groups.py +3402 -0
  59. sage/categories/crystals.py +2628 -0
  60. sage/categories/cw_complexes.py +216 -0
  61. sage/categories/dedekind_domains.py +137 -0
  62. sage/categories/discrete_valuation.py +325 -0
  63. sage/categories/distributive_magmas_and_additive_magmas.py +100 -0
  64. sage/categories/division_rings.py +114 -0
  65. sage/categories/domains.py +95 -0
  66. sage/categories/drinfeld_modules.py +789 -0
  67. sage/categories/dual.py +42 -0
  68. sage/categories/enumerated_sets.py +1146 -0
  69. sage/categories/euclidean_domains.py +271 -0
  70. sage/categories/examples/algebras_with_basis.py +102 -0
  71. sage/categories/examples/all.py +1 -0
  72. sage/categories/examples/commutative_additive_monoids.py +130 -0
  73. sage/categories/examples/commutative_additive_semigroups.py +199 -0
  74. sage/categories/examples/coxeter_groups.py +8 -0
  75. sage/categories/examples/crystals.py +236 -0
  76. sage/categories/examples/cw_complexes.py +163 -0
  77. sage/categories/examples/facade_sets.py +187 -0
  78. sage/categories/examples/filtered_algebras_with_basis.py +204 -0
  79. sage/categories/examples/filtered_modules_with_basis.py +154 -0
  80. sage/categories/examples/finite_coxeter_groups.py +252 -0
  81. sage/categories/examples/finite_dimensional_algebras_with_basis.py +148 -0
  82. sage/categories/examples/finite_dimensional_lie_algebras_with_basis.py +495 -0
  83. sage/categories/examples/finite_enumerated_sets.py +208 -0
  84. sage/categories/examples/finite_monoids.py +150 -0
  85. sage/categories/examples/finite_semigroups.py +190 -0
  86. sage/categories/examples/finite_weyl_groups.py +191 -0
  87. sage/categories/examples/graded_connected_hopf_algebras_with_basis.py +152 -0
  88. sage/categories/examples/graded_modules_with_basis.py +168 -0
  89. sage/categories/examples/graphs.py +122 -0
  90. sage/categories/examples/hopf_algebras_with_basis.py +145 -0
  91. sage/categories/examples/infinite_enumerated_sets.py +190 -0
  92. sage/categories/examples/lie_algebras.py +352 -0
  93. sage/categories/examples/lie_algebras_with_basis.py +196 -0
  94. sage/categories/examples/magmas.py +162 -0
  95. sage/categories/examples/manifolds.py +94 -0
  96. sage/categories/examples/monoids.py +144 -0
  97. sage/categories/examples/posets.py +178 -0
  98. sage/categories/examples/semigroups.py +580 -0
  99. sage/categories/examples/semigroups_cython.cpython-314t-aarch64-linux-musl.so +0 -0
  100. sage/categories/examples/semigroups_cython.pyx +221 -0
  101. sage/categories/examples/semirings.py +249 -0
  102. sage/categories/examples/sets_cat.py +706 -0
  103. sage/categories/examples/sets_with_grading.py +101 -0
  104. sage/categories/examples/with_realizations.py +542 -0
  105. sage/categories/fields.py +991 -0
  106. sage/categories/filtered_algebras.py +63 -0
  107. sage/categories/filtered_algebras_with_basis.py +548 -0
  108. sage/categories/filtered_hopf_algebras_with_basis.py +138 -0
  109. sage/categories/filtered_modules.py +210 -0
  110. sage/categories/filtered_modules_with_basis.py +1209 -0
  111. sage/categories/finite_complex_reflection_groups.py +1506 -0
  112. sage/categories/finite_coxeter_groups.py +1138 -0
  113. sage/categories/finite_crystals.py +103 -0
  114. sage/categories/finite_dimensional_algebras_with_basis.py +1860 -0
  115. sage/categories/finite_dimensional_bialgebras_with_basis.py +33 -0
  116. sage/categories/finite_dimensional_coalgebras_with_basis.py +33 -0
  117. sage/categories/finite_dimensional_graded_lie_algebras_with_basis.py +231 -0
  118. sage/categories/finite_dimensional_hopf_algebras_with_basis.py +38 -0
  119. sage/categories/finite_dimensional_lie_algebras_with_basis.py +2774 -0
  120. sage/categories/finite_dimensional_modules_with_basis.py +1407 -0
  121. sage/categories/finite_dimensional_nilpotent_lie_algebras_with_basis.py +167 -0
  122. sage/categories/finite_dimensional_semisimple_algebras_with_basis.py +270 -0
  123. sage/categories/finite_enumerated_sets.py +769 -0
  124. sage/categories/finite_fields.py +252 -0
  125. sage/categories/finite_groups.py +256 -0
  126. sage/categories/finite_lattice_posets.py +242 -0
  127. sage/categories/finite_monoids.py +316 -0
  128. sage/categories/finite_permutation_groups.py +339 -0
  129. sage/categories/finite_posets.py +1994 -0
  130. sage/categories/finite_semigroups.py +136 -0
  131. sage/categories/finite_sets.py +93 -0
  132. sage/categories/finite_weyl_groups.py +39 -0
  133. sage/categories/finitely_generated_lambda_bracket_algebras.py +112 -0
  134. sage/categories/finitely_generated_lie_conformal_algebras.py +114 -0
  135. sage/categories/finitely_generated_magmas.py +57 -0
  136. sage/categories/finitely_generated_semigroups.py +214 -0
  137. sage/categories/function_fields.py +76 -0
  138. sage/categories/g_sets.py +77 -0
  139. sage/categories/gcd_domains.py +65 -0
  140. sage/categories/generalized_coxeter_groups.py +94 -0
  141. sage/categories/graded_algebras.py +85 -0
  142. sage/categories/graded_algebras_with_basis.py +258 -0
  143. sage/categories/graded_bialgebras.py +32 -0
  144. sage/categories/graded_bialgebras_with_basis.py +32 -0
  145. sage/categories/graded_coalgebras.py +65 -0
  146. sage/categories/graded_coalgebras_with_basis.py +51 -0
  147. sage/categories/graded_hopf_algebras.py +41 -0
  148. sage/categories/graded_hopf_algebras_with_basis.py +169 -0
  149. sage/categories/graded_lie_algebras.py +91 -0
  150. sage/categories/graded_lie_algebras_with_basis.py +44 -0
  151. sage/categories/graded_lie_conformal_algebras.py +74 -0
  152. sage/categories/graded_modules.py +133 -0
  153. sage/categories/graded_modules_with_basis.py +329 -0
  154. sage/categories/graphs.py +138 -0
  155. sage/categories/group_algebras.py +430 -0
  156. sage/categories/groupoid.py +94 -0
  157. sage/categories/groups.py +667 -0
  158. sage/categories/h_trivial_semigroups.py +64 -0
  159. sage/categories/hecke_modules.py +185 -0
  160. sage/categories/highest_weight_crystals.py +980 -0
  161. sage/categories/hopf_algebras.py +219 -0
  162. sage/categories/hopf_algebras_with_basis.py +309 -0
  163. sage/categories/infinite_enumerated_sets.py +115 -0
  164. sage/categories/integral_domains.py +203 -0
  165. sage/categories/j_trivial_semigroups.py +29 -0
  166. sage/categories/kac_moody_algebras.py +82 -0
  167. sage/categories/kahler_algebras.py +203 -0
  168. sage/categories/l_trivial_semigroups.py +63 -0
  169. sage/categories/lambda_bracket_algebras.py +280 -0
  170. sage/categories/lambda_bracket_algebras_with_basis.py +107 -0
  171. sage/categories/lattice_posets.py +89 -0
  172. sage/categories/left_modules.py +49 -0
  173. sage/categories/lie_algebras.py +1070 -0
  174. sage/categories/lie_algebras_with_basis.py +261 -0
  175. sage/categories/lie_conformal_algebras.py +350 -0
  176. sage/categories/lie_conformal_algebras_with_basis.py +147 -0
  177. sage/categories/lie_groups.py +73 -0
  178. sage/categories/loop_crystals.py +1290 -0
  179. sage/categories/magmas.py +1189 -0
  180. sage/categories/magmas_and_additive_magmas.py +149 -0
  181. sage/categories/magmatic_algebras.py +365 -0
  182. sage/categories/manifolds.py +352 -0
  183. sage/categories/matrix_algebras.py +40 -0
  184. sage/categories/metric_spaces.py +387 -0
  185. sage/categories/modular_abelian_varieties.py +78 -0
  186. sage/categories/modules.py +989 -0
  187. sage/categories/modules_with_basis.py +2794 -0
  188. sage/categories/monoid_algebras.py +38 -0
  189. sage/categories/monoids.py +739 -0
  190. sage/categories/noetherian_rings.py +87 -0
  191. sage/categories/number_fields.py +242 -0
  192. sage/categories/ore_modules.py +189 -0
  193. sage/categories/partially_ordered_monoids.py +49 -0
  194. sage/categories/permutation_groups.py +63 -0
  195. sage/categories/pointed_sets.py +42 -0
  196. sage/categories/polyhedra.py +74 -0
  197. sage/categories/poor_man_map.py +270 -0
  198. sage/categories/posets.py +722 -0
  199. sage/categories/principal_ideal_domains.py +270 -0
  200. sage/categories/quantum_group_representations.py +543 -0
  201. sage/categories/quotient_fields.py +728 -0
  202. sage/categories/r_trivial_semigroups.py +45 -0
  203. sage/categories/regular_crystals.py +898 -0
  204. sage/categories/regular_supercrystals.py +170 -0
  205. sage/categories/right_modules.py +49 -0
  206. sage/categories/ring_ideals.py +74 -0
  207. sage/categories/rings.py +1904 -0
  208. sage/categories/rngs.py +175 -0
  209. sage/categories/schemes.py +393 -0
  210. sage/categories/semigroups.py +1060 -0
  211. sage/categories/semirings.py +71 -0
  212. sage/categories/semisimple_algebras.py +114 -0
  213. sage/categories/sets_with_grading.py +235 -0
  214. sage/categories/shephard_groups.py +43 -0
  215. sage/categories/signed_tensor.py +120 -0
  216. sage/categories/simplicial_complexes.py +134 -0
  217. sage/categories/simplicial_sets.py +1206 -0
  218. sage/categories/super_algebras.py +149 -0
  219. sage/categories/super_algebras_with_basis.py +144 -0
  220. sage/categories/super_hopf_algebras_with_basis.py +126 -0
  221. sage/categories/super_lie_conformal_algebras.py +193 -0
  222. sage/categories/super_modules.py +229 -0
  223. sage/categories/super_modules_with_basis.py +193 -0
  224. sage/categories/supercommutative_algebras.py +99 -0
  225. sage/categories/supercrystals.py +406 -0
  226. sage/categories/tensor.py +110 -0
  227. sage/categories/topological_spaces.py +170 -0
  228. sage/categories/triangular_kac_moody_algebras.py +439 -0
  229. sage/categories/tutorial.py +58 -0
  230. sage/categories/unique_factorization_domains.py +318 -0
  231. sage/categories/unital_algebras.py +426 -0
  232. sage/categories/vector_bundles.py +159 -0
  233. sage/categories/vector_spaces.py +357 -0
  234. sage/categories/weyl_groups.py +853 -0
  235. sage/combinat/all__sagemath_categories.py +34 -0
  236. sage/combinat/backtrack.py +180 -0
  237. sage/combinat/combinat.py +2269 -0
  238. sage/combinat/combinat_cython.cpython-314t-aarch64-linux-musl.so +0 -0
  239. sage/combinat/combinat_cython.pxd +6 -0
  240. sage/combinat/combinat_cython.pyx +390 -0
  241. sage/combinat/combination.py +796 -0
  242. sage/combinat/combinatorial_map.py +416 -0
  243. sage/combinat/composition.py +2192 -0
  244. sage/combinat/dlx.py +510 -0
  245. sage/combinat/integer_lists/__init__.py +7 -0
  246. sage/combinat/integer_lists/base.cpython-314t-aarch64-linux-musl.so +0 -0
  247. sage/combinat/integer_lists/base.pxd +16 -0
  248. sage/combinat/integer_lists/base.pyx +713 -0
  249. sage/combinat/integer_lists/invlex.cpython-314t-aarch64-linux-musl.so +0 -0
  250. sage/combinat/integer_lists/invlex.pxd +4 -0
  251. sage/combinat/integer_lists/invlex.pyx +1650 -0
  252. sage/combinat/integer_lists/lists.py +328 -0
  253. sage/combinat/integer_lists/nn.py +48 -0
  254. sage/combinat/integer_vector.py +1818 -0
  255. sage/combinat/integer_vector_weighted.py +413 -0
  256. sage/combinat/matrices/all__sagemath_categories.py +5 -0
  257. sage/combinat/matrices/dancing_links.cpython-314t-aarch64-linux-musl.so +0 -0
  258. sage/combinat/matrices/dancing_links.pyx +1159 -0
  259. sage/combinat/matrices/dancing_links_c.h +380 -0
  260. sage/combinat/matrices/dlxcpp.py +136 -0
  261. sage/combinat/partition.py +10070 -0
  262. sage/combinat/partitions.cpython-314t-aarch64-linux-musl.so +0 -0
  263. sage/combinat/partitions.pyx +743 -0
  264. sage/combinat/permutation.py +10168 -0
  265. sage/combinat/permutation_cython.cpython-314t-aarch64-linux-musl.so +0 -0
  266. sage/combinat/permutation_cython.pxd +11 -0
  267. sage/combinat/permutation_cython.pyx +407 -0
  268. sage/combinat/q_analogues.py +1090 -0
  269. sage/combinat/ranker.py +268 -0
  270. sage/combinat/subset.py +1561 -0
  271. sage/combinat/subsets_hereditary.py +202 -0
  272. sage/combinat/subsets_pairwise.py +184 -0
  273. sage/combinat/tools.py +63 -0
  274. sage/combinat/tuple.py +348 -0
  275. sage/data_structures/all.py +2 -0
  276. sage/data_structures/all__sagemath_categories.py +2 -0
  277. sage/data_structures/binary_matrix.pxd +138 -0
  278. sage/data_structures/binary_search.cpython-314t-aarch64-linux-musl.so +0 -0
  279. sage/data_structures/binary_search.pxd +3 -0
  280. sage/data_structures/binary_search.pyx +66 -0
  281. sage/data_structures/bitset.cpython-314t-aarch64-linux-musl.so +0 -0
  282. sage/data_structures/bitset.pxd +40 -0
  283. sage/data_structures/bitset.pyx +2385 -0
  284. sage/data_structures/bitset_base.cpython-314t-aarch64-linux-musl.so +0 -0
  285. sage/data_structures/bitset_base.pxd +926 -0
  286. sage/data_structures/bitset_base.pyx +117 -0
  287. sage/data_structures/bitset_intrinsics.h +487 -0
  288. sage/data_structures/blas_dict.cpython-314t-aarch64-linux-musl.so +0 -0
  289. sage/data_structures/blas_dict.pxd +12 -0
  290. sage/data_structures/blas_dict.pyx +469 -0
  291. sage/data_structures/list_of_pairs.cpython-314t-aarch64-linux-musl.so +0 -0
  292. sage/data_structures/list_of_pairs.pxd +16 -0
  293. sage/data_structures/list_of_pairs.pyx +122 -0
  294. sage/data_structures/mutable_poset.py +3312 -0
  295. sage/data_structures/pairing_heap.cpython-314t-aarch64-linux-musl.so +0 -0
  296. sage/data_structures/pairing_heap.h +346 -0
  297. sage/data_structures/pairing_heap.pxd +88 -0
  298. sage/data_structures/pairing_heap.pyx +1464 -0
  299. sage/data_structures/sparse_bitset.pxd +62 -0
  300. sage/data_structures/stream.py +5070 -0
  301. sage/databases/all__sagemath_categories.py +7 -0
  302. sage/databases/sql_db.py +2236 -0
  303. sage/ext/all__sagemath_categories.py +3 -0
  304. sage/ext/fast_callable.cpython-314t-aarch64-linux-musl.so +0 -0
  305. sage/ext/fast_callable.pxd +4 -0
  306. sage/ext/fast_callable.pyx +2746 -0
  307. sage/ext/fast_eval.cpython-314t-aarch64-linux-musl.so +0 -0
  308. sage/ext/fast_eval.pxd +1 -0
  309. sage/ext/fast_eval.pyx +102 -0
  310. sage/ext/interpreters/__init__.py +1 -0
  311. sage/ext/interpreters/all__sagemath_categories.py +2 -0
  312. sage/ext/interpreters/wrapper_el.cpython-314t-aarch64-linux-musl.so +0 -0
  313. sage/ext/interpreters/wrapper_el.pxd +18 -0
  314. sage/ext/interpreters/wrapper_el.pyx +148 -0
  315. sage/ext/interpreters/wrapper_py.cpython-314t-aarch64-linux-musl.so +0 -0
  316. sage/ext/interpreters/wrapper_py.pxd +17 -0
  317. sage/ext/interpreters/wrapper_py.pyx +133 -0
  318. sage/functions/airy.py +937 -0
  319. sage/functions/all.py +97 -0
  320. sage/functions/bessel.py +2102 -0
  321. sage/functions/error.py +784 -0
  322. sage/functions/exp_integral.py +1529 -0
  323. sage/functions/gamma.py +1087 -0
  324. sage/functions/generalized.py +672 -0
  325. sage/functions/hyperbolic.py +747 -0
  326. sage/functions/hypergeometric.py +1156 -0
  327. sage/functions/jacobi.py +1705 -0
  328. sage/functions/log.py +1402 -0
  329. sage/functions/min_max.py +338 -0
  330. sage/functions/orthogonal_polys.py +3106 -0
  331. sage/functions/other.py +2303 -0
  332. sage/functions/piecewise.py +1505 -0
  333. sage/functions/prime_pi.cpython-314t-aarch64-linux-musl.so +0 -0
  334. sage/functions/prime_pi.pyx +262 -0
  335. sage/functions/special.py +1212 -0
  336. sage/functions/spike_function.py +278 -0
  337. sage/functions/transcendental.py +690 -0
  338. sage/functions/trig.py +1062 -0
  339. sage/functions/wigner.py +726 -0
  340. sage/geometry/abc.cpython-314t-aarch64-linux-musl.so +0 -0
  341. sage/geometry/abc.pyx +82 -0
  342. sage/geometry/all__sagemath_categories.py +1 -0
  343. sage/groups/all__sagemath_categories.py +11 -0
  344. sage/groups/generic.py +1733 -0
  345. sage/groups/groups_catalog.py +113 -0
  346. sage/groups/perm_gps/all__sagemath_categories.py +1 -0
  347. sage/groups/perm_gps/partn_ref/all.py +1 -0
  348. sage/groups/perm_gps/partn_ref/all__sagemath_categories.py +1 -0
  349. sage/groups/perm_gps/partn_ref/automorphism_group_canonical_label.cpython-314t-aarch64-linux-musl.so +0 -0
  350. sage/groups/perm_gps/partn_ref/automorphism_group_canonical_label.pxd +52 -0
  351. sage/groups/perm_gps/partn_ref/automorphism_group_canonical_label.pyx +906 -0
  352. sage/groups/perm_gps/partn_ref/canonical_augmentation.cpython-314t-aarch64-linux-musl.so +0 -0
  353. sage/groups/perm_gps/partn_ref/canonical_augmentation.pxd +85 -0
  354. sage/groups/perm_gps/partn_ref/canonical_augmentation.pyx +534 -0
  355. sage/groups/perm_gps/partn_ref/data_structures.cpython-314t-aarch64-linux-musl.so +0 -0
  356. sage/groups/perm_gps/partn_ref/data_structures.pxd +576 -0
  357. sage/groups/perm_gps/partn_ref/data_structures.pyx +1792 -0
  358. sage/groups/perm_gps/partn_ref/double_coset.cpython-314t-aarch64-linux-musl.so +0 -0
  359. sage/groups/perm_gps/partn_ref/double_coset.pxd +45 -0
  360. sage/groups/perm_gps/partn_ref/double_coset.pyx +739 -0
  361. sage/groups/perm_gps/partn_ref/refinement_lists.cpython-314t-aarch64-linux-musl.so +0 -0
  362. sage/groups/perm_gps/partn_ref/refinement_lists.pxd +18 -0
  363. sage/groups/perm_gps/partn_ref/refinement_lists.pyx +82 -0
  364. sage/groups/perm_gps/partn_ref/refinement_python.cpython-314t-aarch64-linux-musl.so +0 -0
  365. sage/groups/perm_gps/partn_ref/refinement_python.pxd +16 -0
  366. sage/groups/perm_gps/partn_ref/refinement_python.pyx +564 -0
  367. sage/groups/perm_gps/partn_ref/refinement_sets.cpython-314t-aarch64-linux-musl.so +0 -0
  368. sage/groups/perm_gps/partn_ref/refinement_sets.pxd +60 -0
  369. sage/groups/perm_gps/partn_ref/refinement_sets.pyx +858 -0
  370. sage/interfaces/abc.py +140 -0
  371. sage/interfaces/all.py +58 -0
  372. sage/interfaces/all__sagemath_categories.py +1 -0
  373. sage/interfaces/expect.py +1643 -0
  374. sage/interfaces/interface.py +1682 -0
  375. sage/interfaces/process.cpython-314t-aarch64-linux-musl.so +0 -0
  376. sage/interfaces/process.pxd +5 -0
  377. sage/interfaces/process.pyx +288 -0
  378. sage/interfaces/quit.py +167 -0
  379. sage/interfaces/sage0.py +604 -0
  380. sage/interfaces/sagespawn.cpython-314t-aarch64-linux-musl.so +0 -0
  381. sage/interfaces/sagespawn.pyx +308 -0
  382. sage/interfaces/tab_completion.py +101 -0
  383. sage/misc/all__sagemath_categories.py +78 -0
  384. sage/misc/allocator.cpython-314t-aarch64-linux-musl.so +0 -0
  385. sage/misc/allocator.pxd +6 -0
  386. sage/misc/allocator.pyx +47 -0
  387. sage/misc/binary_tree.cpython-314t-aarch64-linux-musl.so +0 -0
  388. sage/misc/binary_tree.pxd +29 -0
  389. sage/misc/binary_tree.pyx +537 -0
  390. sage/misc/callable_dict.cpython-314t-aarch64-linux-musl.so +0 -0
  391. sage/misc/callable_dict.pyx +89 -0
  392. sage/misc/citation.cpython-314t-aarch64-linux-musl.so +0 -0
  393. sage/misc/citation.pyx +159 -0
  394. sage/misc/converting_dict.py +293 -0
  395. sage/misc/defaults.py +129 -0
  396. sage/misc/derivative.cpython-314t-aarch64-linux-musl.so +0 -0
  397. sage/misc/derivative.pyx +223 -0
  398. sage/misc/functional.py +2005 -0
  399. sage/misc/html.py +589 -0
  400. sage/misc/latex.py +2673 -0
  401. sage/misc/latex_macros.py +236 -0
  402. sage/misc/latex_standalone.py +1833 -0
  403. sage/misc/map_threaded.py +38 -0
  404. sage/misc/mathml.py +76 -0
  405. sage/misc/method_decorator.py +88 -0
  406. sage/misc/mrange.py +755 -0
  407. sage/misc/multireplace.py +41 -0
  408. sage/misc/object_multiplexer.py +92 -0
  409. sage/misc/parser.cpython-314t-aarch64-linux-musl.so +0 -0
  410. sage/misc/parser.pyx +1107 -0
  411. sage/misc/random_testing.py +264 -0
  412. sage/misc/rest_index_of_methods.py +377 -0
  413. sage/misc/search.cpython-314t-aarch64-linux-musl.so +0 -0
  414. sage/misc/search.pxd +2 -0
  415. sage/misc/search.pyx +68 -0
  416. sage/misc/stopgap.cpython-314t-aarch64-linux-musl.so +0 -0
  417. sage/misc/stopgap.pyx +95 -0
  418. sage/misc/table.py +853 -0
  419. sage/monoids/all__sagemath_categories.py +1 -0
  420. sage/monoids/indexed_free_monoid.py +1071 -0
  421. sage/monoids/monoid.py +82 -0
  422. sage/numerical/all__sagemath_categories.py +1 -0
  423. sage/numerical/backends/all__sagemath_categories.py +1 -0
  424. sage/numerical/backends/generic_backend.cpython-314t-aarch64-linux-musl.so +0 -0
  425. sage/numerical/backends/generic_backend.pxd +61 -0
  426. sage/numerical/backends/generic_backend.pyx +1893 -0
  427. sage/numerical/backends/generic_sdp_backend.cpython-314t-aarch64-linux-musl.so +0 -0
  428. sage/numerical/backends/generic_sdp_backend.pxd +38 -0
  429. sage/numerical/backends/generic_sdp_backend.pyx +755 -0
  430. sage/parallel/all.py +6 -0
  431. sage/parallel/decorate.py +575 -0
  432. sage/parallel/map_reduce.py +1997 -0
  433. sage/parallel/multiprocessing_sage.py +76 -0
  434. sage/parallel/ncpus.py +35 -0
  435. sage/parallel/parallelism.py +364 -0
  436. sage/parallel/reference.py +47 -0
  437. sage/parallel/use_fork.py +333 -0
  438. sage/rings/abc.cpython-314t-aarch64-linux-musl.so +0 -0
  439. sage/rings/abc.pxd +31 -0
  440. sage/rings/abc.pyx +526 -0
  441. sage/rings/algebraic_closure_finite_field.py +1154 -0
  442. sage/rings/all__sagemath_categories.py +91 -0
  443. sage/rings/big_oh.py +227 -0
  444. sage/rings/continued_fraction.py +2754 -0
  445. sage/rings/continued_fraction_gosper.py +220 -0
  446. sage/rings/factorint.cpython-314t-aarch64-linux-musl.so +0 -0
  447. sage/rings/factorint.pyx +295 -0
  448. sage/rings/fast_arith.cpython-314t-aarch64-linux-musl.so +0 -0
  449. sage/rings/fast_arith.pxd +21 -0
  450. sage/rings/fast_arith.pyx +535 -0
  451. sage/rings/finite_rings/all__sagemath_categories.py +9 -0
  452. sage/rings/finite_rings/conway_polynomials.py +542 -0
  453. sage/rings/finite_rings/element_base.cpython-314t-aarch64-linux-musl.so +0 -0
  454. sage/rings/finite_rings/element_base.pxd +12 -0
  455. sage/rings/finite_rings/element_base.pyx +1176 -0
  456. sage/rings/finite_rings/finite_field_base.cpython-314t-aarch64-linux-musl.so +0 -0
  457. sage/rings/finite_rings/finite_field_base.pxd +7 -0
  458. sage/rings/finite_rings/finite_field_base.pyx +2171 -0
  459. sage/rings/finite_rings/finite_field_constructor.py +827 -0
  460. sage/rings/finite_rings/finite_field_prime_modn.py +372 -0
  461. sage/rings/finite_rings/galois_group.py +154 -0
  462. sage/rings/finite_rings/hom_finite_field.cpython-314t-aarch64-linux-musl.so +0 -0
  463. sage/rings/finite_rings/hom_finite_field.pxd +23 -0
  464. sage/rings/finite_rings/hom_finite_field.pyx +856 -0
  465. sage/rings/finite_rings/hom_prime_finite_field.cpython-314t-aarch64-linux-musl.so +0 -0
  466. sage/rings/finite_rings/hom_prime_finite_field.pxd +15 -0
  467. sage/rings/finite_rings/hom_prime_finite_field.pyx +164 -0
  468. sage/rings/finite_rings/homset.py +357 -0
  469. sage/rings/finite_rings/integer_mod.cpython-314t-aarch64-linux-musl.so +0 -0
  470. sage/rings/finite_rings/integer_mod.pxd +56 -0
  471. sage/rings/finite_rings/integer_mod.pyx +4586 -0
  472. sage/rings/finite_rings/integer_mod_limits.h +11 -0
  473. sage/rings/finite_rings/integer_mod_ring.py +2044 -0
  474. sage/rings/finite_rings/residue_field.cpython-314t-aarch64-linux-musl.so +0 -0
  475. sage/rings/finite_rings/residue_field.pxd +30 -0
  476. sage/rings/finite_rings/residue_field.pyx +1811 -0
  477. sage/rings/finite_rings/stdint.pxd +19 -0
  478. sage/rings/fraction_field.py +1452 -0
  479. sage/rings/fraction_field_element.cpython-314t-aarch64-linux-musl.so +0 -0
  480. sage/rings/fraction_field_element.pyx +1357 -0
  481. sage/rings/function_field/all.py +7 -0
  482. sage/rings/function_field/all__sagemath_categories.py +2 -0
  483. sage/rings/function_field/constructor.py +218 -0
  484. sage/rings/function_field/element.cpython-314t-aarch64-linux-musl.so +0 -0
  485. sage/rings/function_field/element.pxd +11 -0
  486. sage/rings/function_field/element.pyx +1008 -0
  487. sage/rings/function_field/element_rational.cpython-314t-aarch64-linux-musl.so +0 -0
  488. sage/rings/function_field/element_rational.pyx +513 -0
  489. sage/rings/function_field/extensions.py +230 -0
  490. sage/rings/function_field/function_field.py +1468 -0
  491. sage/rings/function_field/function_field_rational.py +1005 -0
  492. sage/rings/function_field/ideal.py +1155 -0
  493. sage/rings/function_field/ideal_rational.py +629 -0
  494. sage/rings/function_field/jacobian_base.py +826 -0
  495. sage/rings/function_field/jacobian_hess.py +1053 -0
  496. sage/rings/function_field/jacobian_khuri_makdisi.py +1027 -0
  497. sage/rings/function_field/maps.py +1039 -0
  498. sage/rings/function_field/order.py +281 -0
  499. sage/rings/function_field/order_basis.py +586 -0
  500. sage/rings/function_field/order_rational.py +576 -0
  501. sage/rings/function_field/place.py +426 -0
  502. sage/rings/function_field/place_rational.py +181 -0
  503. sage/rings/generic.py +320 -0
  504. sage/rings/homset.py +332 -0
  505. sage/rings/ideal.py +1885 -0
  506. sage/rings/ideal_monoid.py +215 -0
  507. sage/rings/infinity.py +1890 -0
  508. sage/rings/integer.cpython-314t-aarch64-linux-musl.so +0 -0
  509. sage/rings/integer.pxd +45 -0
  510. sage/rings/integer.pyx +7874 -0
  511. sage/rings/integer_ring.cpython-314t-aarch64-linux-musl.so +0 -0
  512. sage/rings/integer_ring.pxd +8 -0
  513. sage/rings/integer_ring.pyx +1693 -0
  514. sage/rings/laurent_series_ring.py +931 -0
  515. sage/rings/laurent_series_ring_element.cpython-314t-aarch64-linux-musl.so +0 -0
  516. sage/rings/laurent_series_ring_element.pxd +11 -0
  517. sage/rings/laurent_series_ring_element.pyx +1927 -0
  518. sage/rings/lazy_series.py +7815 -0
  519. sage/rings/lazy_series_ring.py +4356 -0
  520. sage/rings/localization.py +1043 -0
  521. sage/rings/morphism.cpython-314t-aarch64-linux-musl.so +0 -0
  522. sage/rings/morphism.pxd +39 -0
  523. sage/rings/morphism.pyx +3299 -0
  524. sage/rings/multi_power_series_ring.py +1145 -0
  525. sage/rings/multi_power_series_ring_element.py +2184 -0
  526. sage/rings/noncommutative_ideals.cpython-314t-aarch64-linux-musl.so +0 -0
  527. sage/rings/noncommutative_ideals.pyx +423 -0
  528. sage/rings/number_field/all__sagemath_categories.py +1 -0
  529. sage/rings/number_field/number_field_base.cpython-314t-aarch64-linux-musl.so +0 -0
  530. sage/rings/number_field/number_field_base.pxd +8 -0
  531. sage/rings/number_field/number_field_base.pyx +507 -0
  532. sage/rings/number_field/number_field_element_base.cpython-314t-aarch64-linux-musl.so +0 -0
  533. sage/rings/number_field/number_field_element_base.pxd +6 -0
  534. sage/rings/number_field/number_field_element_base.pyx +36 -0
  535. sage/rings/number_field/number_field_ideal.py +3550 -0
  536. sage/rings/padics/all__sagemath_categories.py +4 -0
  537. sage/rings/padics/local_generic.py +1670 -0
  538. sage/rings/padics/local_generic_element.cpython-314t-aarch64-linux-musl.so +0 -0
  539. sage/rings/padics/local_generic_element.pxd +5 -0
  540. sage/rings/padics/local_generic_element.pyx +1017 -0
  541. sage/rings/padics/misc.py +256 -0
  542. sage/rings/padics/padic_generic.py +1911 -0
  543. sage/rings/padics/pow_computer.cpython-314t-aarch64-linux-musl.so +0 -0
  544. sage/rings/padics/pow_computer.pxd +38 -0
  545. sage/rings/padics/pow_computer.pyx +671 -0
  546. sage/rings/padics/precision_error.py +24 -0
  547. sage/rings/polynomial/all__sagemath_categories.py +25 -0
  548. sage/rings/polynomial/commutative_polynomial.cpython-314t-aarch64-linux-musl.so +0 -0
  549. sage/rings/polynomial/commutative_polynomial.pxd +6 -0
  550. sage/rings/polynomial/commutative_polynomial.pyx +24 -0
  551. sage/rings/polynomial/cyclotomic.cpython-314t-aarch64-linux-musl.so +0 -0
  552. sage/rings/polynomial/cyclotomic.pyx +404 -0
  553. sage/rings/polynomial/flatten.py +711 -0
  554. sage/rings/polynomial/ideal.py +102 -0
  555. sage/rings/polynomial/infinite_polynomial_element.py +1768 -0
  556. sage/rings/polynomial/infinite_polynomial_ring.py +1653 -0
  557. sage/rings/polynomial/laurent_polynomial.cpython-314t-aarch64-linux-musl.so +0 -0
  558. sage/rings/polynomial/laurent_polynomial.pxd +18 -0
  559. sage/rings/polynomial/laurent_polynomial.pyx +2190 -0
  560. sage/rings/polynomial/laurent_polynomial_ideal.py +590 -0
  561. sage/rings/polynomial/laurent_polynomial_ring.py +832 -0
  562. sage/rings/polynomial/laurent_polynomial_ring_base.py +708 -0
  563. sage/rings/polynomial/multi_polynomial.cpython-314t-aarch64-linux-musl.so +0 -0
  564. sage/rings/polynomial/multi_polynomial.pxd +12 -0
  565. sage/rings/polynomial/multi_polynomial.pyx +3082 -0
  566. sage/rings/polynomial/multi_polynomial_element.py +2570 -0
  567. sage/rings/polynomial/multi_polynomial_ideal.py +5771 -0
  568. sage/rings/polynomial/multi_polynomial_ring.py +947 -0
  569. sage/rings/polynomial/multi_polynomial_ring_base.cpython-314t-aarch64-linux-musl.so +0 -0
  570. sage/rings/polynomial/multi_polynomial_ring_base.pxd +15 -0
  571. sage/rings/polynomial/multi_polynomial_ring_base.pyx +1855 -0
  572. sage/rings/polynomial/multi_polynomial_sequence.py +2204 -0
  573. sage/rings/polynomial/polydict.cpython-314t-aarch64-linux-musl.so +0 -0
  574. sage/rings/polynomial/polydict.pxd +45 -0
  575. sage/rings/polynomial/polydict.pyx +2701 -0
  576. sage/rings/polynomial/polynomial_compiled.cpython-314t-aarch64-linux-musl.so +0 -0
  577. sage/rings/polynomial/polynomial_compiled.pxd +59 -0
  578. sage/rings/polynomial/polynomial_compiled.pyx +509 -0
  579. sage/rings/polynomial/polynomial_element.cpython-314t-aarch64-linux-musl.so +0 -0
  580. sage/rings/polynomial/polynomial_element.pxd +64 -0
  581. sage/rings/polynomial/polynomial_element.pyx +13255 -0
  582. sage/rings/polynomial/polynomial_element_generic.py +1637 -0
  583. sage/rings/polynomial/polynomial_fateman.py +97 -0
  584. sage/rings/polynomial/polynomial_quotient_ring.py +2465 -0
  585. sage/rings/polynomial/polynomial_quotient_ring_element.py +779 -0
  586. sage/rings/polynomial/polynomial_ring.py +3784 -0
  587. sage/rings/polynomial/polynomial_ring_constructor.py +1051 -0
  588. sage/rings/polynomial/polynomial_ring_homomorphism.cpython-314t-aarch64-linux-musl.so +0 -0
  589. sage/rings/polynomial/polynomial_ring_homomorphism.pxd +5 -0
  590. sage/rings/polynomial/polynomial_ring_homomorphism.pyx +121 -0
  591. sage/rings/polynomial/polynomial_singular_interface.py +549 -0
  592. sage/rings/polynomial/symmetric_ideal.py +989 -0
  593. sage/rings/polynomial/symmetric_reduction.cpython-314t-aarch64-linux-musl.so +0 -0
  594. sage/rings/polynomial/symmetric_reduction.pxd +8 -0
  595. sage/rings/polynomial/symmetric_reduction.pyx +669 -0
  596. sage/rings/polynomial/term_order.py +2279 -0
  597. sage/rings/polynomial/toy_buchberger.py +449 -0
  598. sage/rings/polynomial/toy_d_basis.py +387 -0
  599. sage/rings/polynomial/toy_variety.py +362 -0
  600. sage/rings/power_series_mpoly.cpython-314t-aarch64-linux-musl.so +0 -0
  601. sage/rings/power_series_mpoly.pxd +9 -0
  602. sage/rings/power_series_mpoly.pyx +161 -0
  603. sage/rings/power_series_poly.cpython-314t-aarch64-linux-musl.so +0 -0
  604. sage/rings/power_series_poly.pxd +10 -0
  605. sage/rings/power_series_poly.pyx +1317 -0
  606. sage/rings/power_series_ring.py +1441 -0
  607. sage/rings/power_series_ring_element.cpython-314t-aarch64-linux-musl.so +0 -0
  608. sage/rings/power_series_ring_element.pxd +12 -0
  609. sage/rings/power_series_ring_element.pyx +3028 -0
  610. sage/rings/puiseux_series_ring.py +487 -0
  611. sage/rings/puiseux_series_ring_element.cpython-314t-aarch64-linux-musl.so +0 -0
  612. sage/rings/puiseux_series_ring_element.pxd +7 -0
  613. sage/rings/puiseux_series_ring_element.pyx +1055 -0
  614. sage/rings/qqbar_decorators.py +167 -0
  615. sage/rings/quotient_ring.py +1598 -0
  616. sage/rings/quotient_ring_element.py +979 -0
  617. sage/rings/rational.cpython-314t-aarch64-linux-musl.so +0 -0
  618. sage/rings/rational.pxd +20 -0
  619. sage/rings/rational.pyx +4284 -0
  620. sage/rings/rational_field.py +1730 -0
  621. sage/rings/real_double.cpython-314t-aarch64-linux-musl.so +0 -0
  622. sage/rings/real_double.pxd +16 -0
  623. sage/rings/real_double.pyx +2218 -0
  624. sage/rings/real_lazy.cpython-314t-aarch64-linux-musl.so +0 -0
  625. sage/rings/real_lazy.pxd +30 -0
  626. sage/rings/real_lazy.pyx +1773 -0
  627. sage/rings/ring.cpython-314t-aarch64-linux-musl.so +0 -0
  628. sage/rings/ring.pxd +30 -0
  629. sage/rings/ring.pyx +850 -0
  630. sage/rings/semirings/all.py +3 -0
  631. sage/rings/semirings/non_negative_integer_semiring.py +107 -0
  632. sage/rings/semirings/tropical_mpolynomial.py +972 -0
  633. sage/rings/semirings/tropical_polynomial.py +997 -0
  634. sage/rings/semirings/tropical_semiring.cpython-314t-aarch64-linux-musl.so +0 -0
  635. sage/rings/semirings/tropical_semiring.pyx +676 -0
  636. sage/rings/semirings/tropical_variety.py +1701 -0
  637. sage/rings/sum_of_squares.cpython-314t-aarch64-linux-musl.so +0 -0
  638. sage/rings/sum_of_squares.pxd +3 -0
  639. sage/rings/sum_of_squares.pyx +336 -0
  640. sage/rings/tests.py +504 -0
  641. sage/schemes/affine/affine_homset.py +508 -0
  642. sage/schemes/affine/affine_morphism.py +1574 -0
  643. sage/schemes/affine/affine_point.py +460 -0
  644. sage/schemes/affine/affine_rational_point.py +308 -0
  645. sage/schemes/affine/affine_space.py +1264 -0
  646. sage/schemes/affine/affine_subscheme.py +592 -0
  647. sage/schemes/affine/all.py +25 -0
  648. sage/schemes/all__sagemath_categories.py +5 -0
  649. sage/schemes/generic/algebraic_scheme.py +2092 -0
  650. sage/schemes/generic/all.py +5 -0
  651. sage/schemes/generic/ambient_space.py +400 -0
  652. sage/schemes/generic/divisor.py +465 -0
  653. sage/schemes/generic/divisor_group.py +313 -0
  654. sage/schemes/generic/glue.py +84 -0
  655. sage/schemes/generic/homset.py +820 -0
  656. sage/schemes/generic/hypersurface.py +234 -0
  657. sage/schemes/generic/morphism.py +2107 -0
  658. sage/schemes/generic/point.py +237 -0
  659. sage/schemes/generic/scheme.py +1190 -0
  660. sage/schemes/generic/spec.py +199 -0
  661. sage/schemes/product_projective/all.py +6 -0
  662. sage/schemes/product_projective/homset.py +236 -0
  663. sage/schemes/product_projective/morphism.py +517 -0
  664. sage/schemes/product_projective/point.py +568 -0
  665. sage/schemes/product_projective/rational_point.py +550 -0
  666. sage/schemes/product_projective/space.py +1301 -0
  667. sage/schemes/product_projective/subscheme.py +466 -0
  668. sage/schemes/projective/all.py +24 -0
  669. sage/schemes/projective/proj_bdd_height.py +453 -0
  670. sage/schemes/projective/projective_homset.py +718 -0
  671. sage/schemes/projective/projective_morphism.py +2792 -0
  672. sage/schemes/projective/projective_point.py +1484 -0
  673. sage/schemes/projective/projective_rational_point.py +569 -0
  674. sage/schemes/projective/projective_space.py +2571 -0
  675. sage/schemes/projective/projective_subscheme.py +1574 -0
  676. sage/sets/all.py +17 -0
  677. sage/sets/cartesian_product.py +376 -0
  678. sage/sets/condition_set.py +525 -0
  679. sage/sets/disjoint_set.cpython-314t-aarch64-linux-musl.so +0 -0
  680. sage/sets/disjoint_set.pxd +36 -0
  681. sage/sets/disjoint_set.pyx +998 -0
  682. sage/sets/disjoint_union_enumerated_sets.py +625 -0
  683. sage/sets/family.cpython-314t-aarch64-linux-musl.so +0 -0
  684. sage/sets/family.pxd +12 -0
  685. sage/sets/family.pyx +1556 -0
  686. sage/sets/finite_enumerated_set.py +406 -0
  687. sage/sets/finite_set_map_cy.cpython-314t-aarch64-linux-musl.so +0 -0
  688. sage/sets/finite_set_map_cy.pxd +34 -0
  689. sage/sets/finite_set_map_cy.pyx +708 -0
  690. sage/sets/finite_set_maps.py +591 -0
  691. sage/sets/image_set.py +448 -0
  692. sage/sets/integer_range.py +829 -0
  693. sage/sets/non_negative_integers.py +241 -0
  694. sage/sets/positive_integers.py +93 -0
  695. sage/sets/primes.py +188 -0
  696. sage/sets/real_set.py +2760 -0
  697. sage/sets/recursively_enumerated_set.cpython-314t-aarch64-linux-musl.so +0 -0
  698. sage/sets/recursively_enumerated_set.pxd +31 -0
  699. sage/sets/recursively_enumerated_set.pyx +2082 -0
  700. sage/sets/set.py +2083 -0
  701. sage/sets/set_from_iterator.py +1021 -0
  702. sage/sets/totally_ordered_finite_set.py +329 -0
  703. sage/symbolic/all__sagemath_categories.py +1 -0
  704. sage/symbolic/function.cpython-314t-aarch64-linux-musl.so +0 -0
  705. sage/symbolic/function.pxd +29 -0
  706. sage/symbolic/function.pyx +1488 -0
  707. sage/symbolic/symbols.py +56 -0
  708. sage/tests/all__sagemath_categories.py +1 -0
  709. sage/tests/cython.cpython-314t-aarch64-linux-musl.so +0 -0
  710. sage/tests/cython.pyx +37 -0
  711. sage/tests/stl_vector.cpython-314t-aarch64-linux-musl.so +0 -0
  712. sage/tests/stl_vector.pyx +171 -0
  713. sage/typeset/all.py +6 -0
  714. sage/typeset/ascii_art.py +295 -0
  715. sage/typeset/character_art.py +789 -0
  716. sage/typeset/character_art_factory.py +572 -0
  717. sage/typeset/symbols.py +334 -0
  718. sage/typeset/unicode_art.py +183 -0
  719. sage/typeset/unicode_characters.py +101 -0
@@ -0,0 +1,1441 @@
1
+ # sage_setup: distribution = sagemath-categories
2
+ r"""
3
+ Power Series Rings
4
+
5
+ Power series rings are constructed in the standard Sage
6
+ fashion. See also :doc:`multi_power_series_ring`.
7
+
8
+ EXAMPLES:
9
+
10
+ Construct rings and elements::
11
+
12
+ sage: R.<t> = PowerSeriesRing(QQ)
13
+ sage: R.random_element(6) # random
14
+ -4 - 1/2*t^2 - 1/95*t^3 + 1/2*t^4 - 12*t^5 + O(t^6)
15
+
16
+ ::
17
+
18
+ sage: R.<t,u,v> = PowerSeriesRing(QQ); R
19
+ Multivariate Power Series Ring in t, u, v over Rational Field
20
+ sage: p = -t + 1/2*t^3*u - 1/4*t^4*u + 2/3*v^5 + R.O(6); p
21
+ -t + 1/2*t^3*u - 1/4*t^4*u + 2/3*v^5 + O(t, u, v)^6
22
+ sage: p in R
23
+ True
24
+
25
+ The default precision is specified at construction, but does not
26
+ bound the precision of created elements.
27
+
28
+ ::
29
+
30
+ sage: R.<t> = PowerSeriesRing(QQ, default_prec=5)
31
+ sage: R.random_element(6) # random
32
+ 1/2 - 1/4*t + 2/3*t^2 - 5/2*t^3 + 2/3*t^5 + O(t^6)
33
+
34
+ Construct univariate power series from a list of coefficients::
35
+
36
+ sage: S = R([1, 3, 5, 7]); S
37
+ 1 + 3*t + 5*t^2 + 7*t^3
38
+
39
+ The default precision of a power series ring stays fixed and cannot be
40
+ changed. To work with different default precision, create a new power series
41
+ ring::
42
+
43
+ sage: R.<x> = PowerSeriesRing(QQ, default_prec=10)
44
+ sage: sin(x)
45
+ x - 1/6*x^3 + 1/120*x^5 - 1/5040*x^7 + 1/362880*x^9 + O(x^10)
46
+ sage: R.<x> = PowerSeriesRing(QQ, default_prec=15)
47
+ sage: sin(x)
48
+ x - 1/6*x^3 + 1/120*x^5 - 1/5040*x^7 + 1/362880*x^9 - 1/39916800*x^11
49
+ + 1/6227020800*x^13 + O(x^15)
50
+
51
+ An iterated example::
52
+
53
+ sage: R.<t> = PowerSeriesRing(ZZ)
54
+ sage: S.<t2> = PowerSeriesRing(R)
55
+ sage: S
56
+ Power Series Ring in t2 over Power Series Ring in t over Integer Ring
57
+ sage: S.base_ring()
58
+ Power Series Ring in t over Integer Ring
59
+
60
+ Sage can compute with power series over the symbolic ring.
61
+
62
+ ::
63
+
64
+ sage: # needs sage.symbolic
65
+ sage: K.<t> = PowerSeriesRing(SR, default_prec=5)
66
+ sage: a, b, c = var('a,b,c')
67
+ sage: f = a + b*t + c*t^2 + O(t^3)
68
+ sage: f*f
69
+ a^2 + 2*a*b*t + (b^2 + 2*a*c)*t^2 + O(t^3)
70
+ sage: f = sqrt(2) + sqrt(3)*t + O(t^3)
71
+ sage: f^2
72
+ 2 + 2*sqrt(3)*sqrt(2)*t + 3*t^2 + O(t^3)
73
+
74
+ Elements are first coerced to constants in ``base_ring``, then coerced
75
+ into the ``PowerSeriesRing``::
76
+
77
+ sage: R.<t> = PowerSeriesRing(ZZ)
78
+ sage: f = Mod(2, 3) * t; (f, f.parent())
79
+ (2*t, Power Series Ring in t over Ring of integers modulo 3)
80
+
81
+ We make a sparse power series.
82
+
83
+ ::
84
+
85
+ sage: R.<x> = PowerSeriesRing(QQ, sparse=True); R
86
+ Sparse Power Series Ring in x over Rational Field
87
+ sage: f = 1 + x^1000000
88
+ sage: g = f*f
89
+ sage: g.degree()
90
+ 2000000
91
+
92
+ We make a sparse Laurent series from a power series generator::
93
+
94
+ sage: R.<t> = PowerSeriesRing(QQ, sparse=True)
95
+ sage: latex(-2/3*(1/t^3) + 1/t + 3/5*t^2 + O(t^5))
96
+ \frac{-\frac{2}{3}}{t^{3}} + \frac{1}{t} + \frac{3}{5}t^{2} + O(t^{5})
97
+ sage: S = parent(1/t); S
98
+ Sparse Laurent Series Ring in t over Rational Field
99
+
100
+ Choose another implementation of the attached polynomial ring::
101
+
102
+ sage: R.<t> = PowerSeriesRing(ZZ)
103
+ sage: type(t.polynomial()) # needs sage.libs.flint
104
+ <... 'sage.rings.polynomial.polynomial_integer_dense_flint.Polynomial_integer_dense_flint'>
105
+ sage: S.<s> = PowerSeriesRing(ZZ, implementation='NTL') # needs sage.libs.ntl
106
+ sage: type(s.polynomial()) # needs sage.libs.ntl
107
+ <... 'sage.rings.polynomial.polynomial_integer_dense_ntl.Polynomial_integer_dense_ntl'>
108
+
109
+ AUTHORS:
110
+
111
+ - William Stein: the code
112
+ - Jeremy Cho (2006-05-17): some examples (above)
113
+ - Niles Johnson (2010-09): implement multivariate power series
114
+ - Simon King (2012-08): use category and coercion framework, :issue:`13412`
115
+
116
+ TESTS::
117
+
118
+ sage: R.<t> = PowerSeriesRing(QQ)
119
+ sage: R is loads(dumps(R))
120
+ True
121
+ sage: TestSuite(R).run()
122
+
123
+ ::
124
+
125
+ sage: R.<x> = PowerSeriesRing(QQ, sparse=True)
126
+ sage: R is loads(dumps(R))
127
+ True
128
+ sage: TestSuite(R).run()
129
+
130
+ ::
131
+
132
+ sage: M = PowerSeriesRing(QQ, 't,u,v,w', default_prec=20)
133
+ sage: M is loads(dumps(M))
134
+ True
135
+ sage: TestSuite(M).run()
136
+ """
137
+
138
+ import sage.categories.commutative_rings as commutative_rings
139
+ import sage.misc.latex as latex
140
+ from sage.interfaces.abc import MagmaElement
141
+ from sage.misc.lazy_import import lazy_import
142
+ from sage.rings import (
143
+ integer,
144
+ power_series_mpoly,
145
+ power_series_poly,
146
+ power_series_ring_element,
147
+ )
148
+ from sage.rings.fraction_field_element import FractionFieldElement
149
+ from sage.rings.infinity import infinity
150
+ from sage.rings.polynomial.multi_polynomial_ring_base import MPolynomialRing_base
151
+ from sage.rings.polynomial.polynomial_ring import PolynomialRing_generic
152
+ from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
153
+ from sage.structure.category_object import normalize_names
154
+ from sage.structure.element import Expression, parent
155
+ from sage.structure.parent import Parent
156
+ from sage.structure.nonexact import Nonexact
157
+ from sage.structure.unique_representation import UniqueRepresentation
158
+
159
+ _CommutativeRings = commutative_rings.CommutativeRings()
160
+ import sage.categories.integral_domains as integral_domains
161
+
162
+ _IntegralDomains = integral_domains.IntegralDomains()
163
+ import sage.categories.fields as fields
164
+
165
+ _Fields = fields.Fields()
166
+
167
+ from sage.categories.complete_discrete_valuation import CompleteDiscreteValuationRings
168
+
169
+ lazy_import('sage.misc.sage_eval', 'sage_eval')
170
+
171
+ try:
172
+ from .laurent_series_ring import LaurentSeriesRing
173
+ from .laurent_series_ring_element import LaurentSeries
174
+ except ImportError:
175
+ LaurentSeriesRing = ()
176
+ LaurentSeries = ()
177
+
178
+ lazy_import('sage.rings.lazy_series', 'LazyPowerSeries')
179
+ lazy_import('sage.rings.lazy_series_ring', 'LazyPowerSeriesRing')
180
+
181
+
182
+ def PowerSeriesRing(base_ring, name=None, arg2=None, names=None,
183
+ sparse=False, default_prec=None, order='negdeglex',
184
+ num_gens=None, implementation=None):
185
+ r"""
186
+ Create a univariate or multivariate power series ring over a given
187
+ (commutative) base ring.
188
+
189
+ INPUT:
190
+
191
+ - ``base_ring`` -- a commutative ring
192
+
193
+ - ``name``, ``names`` -- name(s) of the indeterminate
194
+
195
+ - ``default_prec`` -- the default precision used if an exact object must
196
+ be changed to an approximate object in order to do an arithmetic
197
+ operation. If left as ``None``, it will be set to the global
198
+ default (20) in the univariate case, and 12 in the multivariate case.
199
+
200
+ - ``sparse`` -- boolean (default: ``False``); whether power series
201
+ are represented as sparse objects
202
+
203
+ - ``order`` -- (default: ``negdeglex``) term ordering, for multivariate case
204
+
205
+ - ``num_gens`` -- number of generators, for multivariate case
206
+
207
+ There is a unique power series ring over each base ring with given
208
+ variable name. Two power series over the same base ring with
209
+ different variable names are not equal or isomorphic.
210
+
211
+ EXAMPLES (Univariate)::
212
+
213
+ sage: R = PowerSeriesRing(QQ, 'x'); R
214
+ Power Series Ring in x over Rational Field
215
+
216
+ ::
217
+
218
+ sage: S = PowerSeriesRing(QQ, 'y'); S
219
+ Power Series Ring in y over Rational Field
220
+
221
+ ::
222
+
223
+ sage: R = PowerSeriesRing(QQ, 10)
224
+ Traceback (most recent call last):
225
+ ...
226
+ ValueError: variable name '10' does not start with a letter
227
+
228
+ ::
229
+
230
+ sage: S = PowerSeriesRing(QQ, 'x', default_prec=15); S
231
+ Power Series Ring in x over Rational Field
232
+ sage: S.default_prec()
233
+ 15
234
+
235
+ EXAMPLES (Multivariate) See also :doc:`multi_power_series_ring`::
236
+
237
+ sage: R = PowerSeriesRing(QQ, 't,u,v'); R
238
+ Multivariate Power Series Ring in t, u, v over Rational Field
239
+
240
+ ::
241
+
242
+ sage: N = PowerSeriesRing(QQ,'w',num_gens=5); N
243
+ Multivariate Power Series Ring in w0, w1, w2, w3, w4 over Rational Field
244
+
245
+ Number of generators can be specified before variable name without using keyword::
246
+
247
+ sage: M = PowerSeriesRing(QQ,4,'k'); M
248
+ Multivariate Power Series Ring in k0, k1, k2, k3 over Rational Field
249
+
250
+ Multivariate power series can be constructed using angle bracket or double square bracket notation::
251
+
252
+ sage: R.<t,u,v> = PowerSeriesRing(QQ, 't,u,v'); R
253
+ Multivariate Power Series Ring in t, u, v over Rational Field
254
+
255
+ sage: ZZ[['s,t,u']]
256
+ Multivariate Power Series Ring in s, t, u over Integer Ring
257
+
258
+ Sparse multivariate power series ring::
259
+
260
+ sage: M = PowerSeriesRing(QQ,4,'k',sparse=True); M
261
+ Sparse Multivariate Power Series Ring in k0, k1, k2, k3 over
262
+ Rational Field
263
+
264
+ Power series ring over polynomial ring::
265
+
266
+ sage: H = PowerSeriesRing(PolynomialRing(ZZ,3,'z'), 4, 'f'); H
267
+ Multivariate Power Series Ring in f0, f1, f2, f3 over Multivariate
268
+ Polynomial Ring in z0, z1, z2 over Integer Ring
269
+
270
+ Power series ring over finite field::
271
+
272
+ sage: S = PowerSeriesRing(GF(65537),'x,y'); S # needs sage.rings.finite_rings
273
+ Multivariate Power Series Ring in x, y over Finite Field of size
274
+ 65537
275
+
276
+ Power series ring with many variables::
277
+
278
+ sage: R = PowerSeriesRing(ZZ, ['x%s'%p for p in primes(100)]); R # needs sage.libs.pari
279
+ Multivariate Power Series Ring in x2, x3, x5, x7, x11, x13, x17, x19,
280
+ x23, x29, x31, x37, x41, x43, x47, x53, x59, x61, x67, x71, x73, x79,
281
+ x83, x89, x97 over Integer Ring
282
+
283
+ - Use :meth:`inject_variables` to make the variables available for
284
+ interactive use.
285
+
286
+ ::
287
+
288
+ sage: R.inject_variables() # needs sage.libs.pari
289
+ Defining x2, x3, x5, x7, x11, x13, x17, x19, x23, x29, x31, x37,
290
+ x41, x43, x47, x53, x59, x61, x67, x71, x73, x79, x83, x89, x97
291
+
292
+ sage: f = x47 + 3*x11*x29 - x19 + R.O(3) # needs sage.libs.pari
293
+ sage: f in R # needs sage.libs.pari
294
+ True
295
+
296
+
297
+ Variable ordering determines how series are displayed::
298
+
299
+ sage: T.<a,b> = PowerSeriesRing(ZZ,order='deglex'); T
300
+ Multivariate Power Series Ring in a, b over Integer Ring
301
+ sage: T.term_order()
302
+ Degree lexicographic term order
303
+ sage: p = - 2*b^6 + a^5*b^2 + a^7 - b^2 - a*b^3 + T.O(9); p
304
+ a^7 + a^5*b^2 - 2*b^6 - a*b^3 - b^2 + O(a, b)^9
305
+
306
+ sage: U = PowerSeriesRing(ZZ,'a,b',order='negdeglex'); U
307
+ Multivariate Power Series Ring in a, b over Integer Ring
308
+ sage: U.term_order()
309
+ Negative degree lexicographic term order
310
+ sage: U(p)
311
+ -b^2 - a*b^3 - 2*b^6 + a^7 + a^5*b^2 + O(a, b)^9
312
+
313
+
314
+ TESTS::
315
+
316
+ sage: N = PowerSeriesRing(QQ,'k',num_gens=5); N
317
+ Multivariate Power Series Ring in k0, k1, k2, k3, k4 over Rational Field
318
+
319
+ The following behavior of univariate power series ring will eventually
320
+ be deprecated and then changed to return a multivariate power series
321
+ ring::
322
+
323
+ sage: N = PowerSeriesRing(QQ,'k',5); N
324
+ Power Series Ring in k over Rational Field
325
+ sage: N.default_prec()
326
+ 5
327
+ sage: L.<m> = PowerSeriesRing(QQ,5); L
328
+ Power Series Ring in m over Rational Field
329
+ sage: L.default_prec()
330
+ 5
331
+
332
+ By :issue:`14084`, a power series ring belongs to the category of integral
333
+ domains, if the base ring does::
334
+
335
+ sage: P = ZZ[['x']]
336
+ sage: P.category()
337
+ Category of integral domains
338
+ sage: TestSuite(P).run()
339
+ sage: M = ZZ[['x','y']]
340
+ sage: M.category()
341
+ Category of integral domains
342
+ sage: TestSuite(M).run()
343
+
344
+ Otherwise, it belongs to the category of commutative rings::
345
+
346
+ sage: P = Integers(15)[['x']]
347
+ sage: P.category()
348
+ Category of commutative rings
349
+ sage: TestSuite(P).run()
350
+ sage: M = Integers(15)[['x','y']]
351
+ sage: M.category()
352
+ Category of commutative rings
353
+ sage: TestSuite(M).run()
354
+
355
+ .. SEEALSO::
356
+
357
+ * :func:`sage.misc.defaults.set_series_precision`
358
+ """
359
+ # multivariate case:
360
+ # examples for first case:
361
+ # PowerSeriesRing(QQ,'x,y,z')
362
+ # PowerSeriesRing(QQ,['x','y','z'])
363
+ # PowerSeriesRing(QQ,['x','y','z'], 3)
364
+ if names is None and name is not None:
365
+ names = name
366
+ if isinstance(names, (tuple, list)) and len(names) > 1 or (isinstance(names, str) and ',' in names):
367
+ return _multi_variate(base_ring, num_gens=arg2, names=names,
368
+ order=order, default_prec=default_prec, sparse=sparse)
369
+ # examples for second case:
370
+ # PowerSeriesRing(QQ,3,'t')
371
+ if arg2 is None and num_gens is not None:
372
+ arg2 = names
373
+ names = num_gens
374
+ if (isinstance(arg2, str) and
375
+ isinstance(names, (int, integer.Integer))):
376
+ return _multi_variate(base_ring, num_gens=names, names=arg2,
377
+ order=order, default_prec=default_prec, sparse=sparse)
378
+
379
+ # univariate case: the arguments to PowerSeriesRing used to be
380
+ # (base_ring, name=None, default_prec=20, names=None, sparse=False),
381
+ # and thus that is what the code below expects; this behavior is being
382
+ # deprecated, and will eventually be removed.
383
+ if default_prec is None and arg2 is None:
384
+ from sage.misc.defaults import series_precision
385
+ default_prec = series_precision()
386
+ elif arg2 is not None:
387
+ default_prec = arg2
388
+
389
+ # ## too many things (padics, elliptic curves) depend on this behavior,
390
+ # ## so no warning for now.
391
+
392
+ # if isinstance(name, (int, integer.Integer)) or isinstance(arg2, (int, integer.Integer)):
393
+ # deprecation(issue_number, "This behavior of PowerSeriesRing is being deprecated in favor of constructing multivariate power series rings. (See Github issue #1956.)")
394
+
395
+ # the following is the original, univariate-only code
396
+
397
+ if isinstance(name, (int, integer.Integer)):
398
+ default_prec = name
399
+ if names is not None:
400
+ name = names
401
+ name = normalize_names(1, name)
402
+
403
+ if name is None:
404
+ raise TypeError("You must specify the name of the indeterminate of the Power series ring.")
405
+
406
+ key = (base_ring, name, default_prec, sparse, implementation)
407
+ if PowerSeriesRing_generic.__classcall__.is_in_cache(key):
408
+ return PowerSeriesRing_generic(*key)
409
+
410
+ if isinstance(name, (tuple, list)):
411
+ assert len(name) == 1
412
+ name = name[0]
413
+
414
+ if not (name is None or isinstance(name, str)):
415
+ raise TypeError("variable name must be a string or None")
416
+
417
+ if base_ring in _Fields:
418
+ R = PowerSeriesRing_over_field(base_ring, name, default_prec,
419
+ sparse=sparse, implementation=implementation)
420
+ elif base_ring in _IntegralDomains:
421
+ R = PowerSeriesRing_domain(base_ring, name, default_prec,
422
+ sparse=sparse, implementation=implementation)
423
+ elif base_ring in _CommutativeRings:
424
+ R = PowerSeriesRing_generic(base_ring, name, default_prec,
425
+ sparse=sparse, implementation=implementation)
426
+ else:
427
+ raise TypeError("base_ring must be a commutative ring")
428
+ return R
429
+
430
+
431
+ def _multi_variate(base_ring, num_gens=None, names=None,
432
+ order='negdeglex', default_prec=None, sparse=False):
433
+ """
434
+ Construct multivariate power series ring.
435
+ """
436
+ if names is None:
437
+ raise TypeError("you must specify a variable name or names")
438
+
439
+ if num_gens is None:
440
+ if isinstance(names, str):
441
+ num_gens = len(names.split(','))
442
+ elif isinstance(names, (list, tuple)):
443
+ num_gens = len(names)
444
+ else:
445
+ raise TypeError("variable names must be a string, tuple or list")
446
+ names = normalize_names(num_gens, names)
447
+ num_gens = len(names)
448
+ if default_prec is None:
449
+ default_prec = 12
450
+
451
+ if base_ring not in commutative_rings.CommutativeRings():
452
+ raise TypeError("base_ring must be a commutative ring")
453
+ from sage.rings.multi_power_series_ring import MPowerSeriesRing_generic
454
+ R = MPowerSeriesRing_generic(base_ring, num_gens, names,
455
+ order=order, default_prec=default_prec, sparse=sparse)
456
+ return R
457
+
458
+
459
+ def _single_variate():
460
+ pass
461
+
462
+
463
+ def is_PowerSeriesRing(R):
464
+ """
465
+ Return ``True`` if this is a *univariate* power series ring. This is in
466
+ keeping with the behavior of ``is_PolynomialRing``
467
+ versus ``is_MPolynomialRing``.
468
+
469
+ EXAMPLES::
470
+
471
+ sage: from sage.rings.power_series_ring import is_PowerSeriesRing
472
+ sage: is_PowerSeriesRing(10)
473
+ doctest:warning...
474
+ DeprecationWarning: The function is_PowerSeriesRing is deprecated;
475
+ use 'isinstance(..., (PowerSeriesRing_generic, LazyPowerSeriesRing) and ....ngens() == 1)' instead.
476
+ See https://github.com/sagemath/sage/issues/38290 for details.
477
+ False
478
+ sage: is_PowerSeriesRing(QQ[['x']])
479
+ True
480
+
481
+ sage: # needs sage.combinat
482
+ sage: is_PowerSeriesRing(LazyPowerSeriesRing(QQ, 'x'))
483
+ True
484
+ sage: is_PowerSeriesRing(LazyPowerSeriesRing(QQ, 'x, y'))
485
+ False
486
+ """
487
+ from sage.misc.superseded import deprecation
488
+ deprecation(38290,
489
+ "The function is_PowerSeriesRing is deprecated; "
490
+ "use 'isinstance(..., (PowerSeriesRing_generic, LazyPowerSeriesRing) and ....ngens() == 1)' instead.")
491
+ if isinstance(R, (PowerSeriesRing_generic, LazyPowerSeriesRing)):
492
+ return R.ngens() == 1
493
+ else:
494
+ return False
495
+
496
+
497
+ class PowerSeriesRing_generic(UniqueRepresentation, Parent, Nonexact):
498
+ """
499
+ A power series ring.
500
+ """
501
+
502
+ def __init__(self, base_ring, name=None, default_prec=None, sparse=False,
503
+ implementation=None, category=None):
504
+ """
505
+ Initialize a power series ring.
506
+
507
+ INPUT:
508
+
509
+ - ``base_ring`` -- a commutative ring
510
+
511
+ - ``name`` -- name of the indeterminate
512
+
513
+ - ``default_prec`` -- the default precision
514
+
515
+ - ``sparse`` -- whether or not power series are sparse
516
+
517
+ - ``implementation`` -- either ``'poly'``, ``'mpoly'``, or
518
+ ``'pari'``. Other values (for example ``'NTL'``) are passed to
519
+ the attached polynomial ring. The default is ``'pari'`` if
520
+ the base field is a PARI finite field, and ``'poly'`` otherwise.
521
+
522
+ If the base ring is a polynomial ring, then the option
523
+ ``implementation='mpoly'`` causes computations to be done with
524
+ multivariate polynomials instead of a univariate polynomial
525
+ ring over the base ring. Only use this for dense power series
526
+ where you won't do too much arithmetic, but the arithmetic you
527
+ do must be fast. You must explicitly call
528
+ ``f.do_truncation()`` on an element for it to truncate away
529
+ higher order terms (this is called automatically before
530
+ printing).
531
+
532
+ EXAMPLES:
533
+
534
+ This base class inherits from :class:`~sage.rings.ring.CommutativeRing`.
535
+ Since :issue:`11900`, it is also initialised as such, and since :issue:`14084`
536
+ it is actually initialised as an integral domain::
537
+
538
+ sage: R.<x> = ZZ[[]]
539
+ sage: R.category()
540
+ Category of integral domains
541
+ sage: TestSuite(R).run()
542
+
543
+ When the base ring `k` is a field, the ring `k[[x]]` is not only a
544
+ commutative ring, but also a complete discrete valuation ring (CDVR).
545
+ The appropriate (sub)category is automatically set in this case::
546
+
547
+ sage: k = GF(11)
548
+ sage: R.<x> = k[[]]
549
+ sage: R.category()
550
+ Category of complete discrete valuation rings
551
+ sage: TestSuite(R).run()
552
+
553
+ It is checked that the default precision is nonnegative
554
+ (see :issue:`19409`)::
555
+
556
+ sage: PowerSeriesRing(ZZ, 'x', default_prec=-5)
557
+ Traceback (most recent call last):
558
+ ...
559
+ ValueError: default_prec (= -5) must be nonnegative
560
+ """
561
+ if implementation is None:
562
+ try:
563
+ from sage.rings.finite_rings.finite_field_pari_ffelt import FiniteField_pari_ffelt
564
+ except ImportError:
565
+ FiniteField_pari_ffelt = ()
566
+ if isinstance(base_ring, FiniteField_pari_ffelt):
567
+ implementation = 'pari'
568
+ else:
569
+ implementation = 'poly'
570
+ R = PolynomialRing(base_ring, name, sparse=sparse)
571
+ elif implementation not in ['pari', 'mpoly']: # see :issue:`28996`
572
+ R = PolynomialRing(base_ring, name, sparse=sparse, implementation=implementation)
573
+ implementation = 'poly'
574
+ else:
575
+ R = PolynomialRing(base_ring, name, sparse=sparse)
576
+
577
+ self.__poly_ring = R
578
+ self.__is_sparse = sparse
579
+ if default_prec is None:
580
+ from sage.misc.defaults import series_precision
581
+ default_prec = series_precision()
582
+ elif default_prec < 0:
583
+ raise ValueError("default_prec (= %s) must be nonnegative"
584
+ % default_prec)
585
+
586
+ if implementation == 'poly':
587
+ self.Element = power_series_poly.PowerSeries_poly
588
+ elif implementation == 'mpoly':
589
+ K = base_ring
590
+ names = K.variable_names() + (name,)
591
+ self.__mpoly_ring = PolynomialRing(K.base_ring(), names=names)
592
+ assert isinstance(self.__mpoly_ring, MPolynomialRing_base)
593
+ self.Element = power_series_mpoly.PowerSeries_mpoly
594
+ elif implementation == 'pari':
595
+ from .power_series_pari import PowerSeries_pari
596
+ self.Element = PowerSeries_pari
597
+ else:
598
+ raise ValueError('unknown power series implementation: %r' % implementation)
599
+
600
+ Parent.__init__(self, base=base_ring, names=name,
601
+ category=getattr(self, '_default_category',
602
+ _CommutativeRings))
603
+ Nonexact.__init__(self, default_prec)
604
+ if implementation == 'pari':
605
+ self.__generator = self.element_class(self, R.gen().__pari__())
606
+ else:
607
+ self.__generator = self.element_class(self, R.gen(), is_gen=True)
608
+
609
+ def variable_names_recursive(self, depth=None):
610
+ r"""
611
+ Return the list of variable names of this and its base rings.
612
+
613
+ EXAMPLES::
614
+
615
+ sage: R = QQ[['x']][['y']][['z']]
616
+ sage: R.variable_names_recursive()
617
+ ('x', 'y', 'z')
618
+ sage: R.variable_names_recursive(2)
619
+ ('y', 'z')
620
+ """
621
+ if depth is None:
622
+ from sage.rings.infinity import infinity
623
+ depth = infinity
624
+
625
+ if depth <= 0:
626
+ all = ()
627
+ elif depth == 1:
628
+ all = self.variable_names()
629
+ else:
630
+ my_vars = self.variable_names()
631
+ try:
632
+ all = self.base_ring().variable_names_recursive(depth - len(my_vars)) + my_vars
633
+ except AttributeError:
634
+ all = my_vars
635
+ if len(all) > depth:
636
+ all = all[-depth:]
637
+ return all
638
+
639
+ def _repr_(self):
640
+ """
641
+ Print out a power series ring.
642
+
643
+ EXAMPLES::
644
+
645
+ sage: R = GF(17)[['y']]
646
+ sage: R
647
+ Power Series Ring in y over Finite Field of size 17
648
+ sage: R.__repr__()
649
+ 'Power Series Ring in y over Finite Field of size 17'
650
+ sage: R.rename('my power series ring')
651
+ sage: R
652
+ my power series ring
653
+ """
654
+ s = "Power Series Ring in %s over %s" % (self.variable_name(), self.base_ring())
655
+ if self.is_sparse():
656
+ s = 'Sparse ' + s
657
+ return s
658
+
659
+ def is_sparse(self):
660
+ """
661
+ EXAMPLES::
662
+
663
+ sage: R.<t> = PowerSeriesRing(ZZ)
664
+ sage: t.is_sparse()
665
+ False
666
+ sage: R.<t> = PowerSeriesRing(ZZ, sparse=True)
667
+ sage: t.is_sparse()
668
+ True
669
+ """
670
+ return self.__is_sparse
671
+
672
+ def is_dense(self):
673
+ """
674
+ EXAMPLES::
675
+
676
+ sage: R.<t> = PowerSeriesRing(ZZ)
677
+ sage: t.is_dense()
678
+ True
679
+ sage: R.<t> = PowerSeriesRing(ZZ, sparse=True)
680
+ sage: t.is_dense()
681
+ False
682
+ """
683
+ return not self.__is_sparse
684
+
685
+ def _latex_(self):
686
+ r"""
687
+ Display latex representation of this power series ring.
688
+
689
+ EXAMPLES::
690
+
691
+ sage: R = GF(17)[['y']]
692
+ sage: latex(R) # indirect doctest
693
+ \Bold{F}_{17}[[y]]
694
+ sage: R = GF(17)[['y12']]
695
+ sage: latex(R)
696
+ \Bold{F}_{17}[[y_{12}]]
697
+ """
698
+ return "%s[[%s]]" % (latex.latex(self.base_ring()), self.latex_variable_names()[0])
699
+
700
+ def _coerce_map_from_(self, S):
701
+ """
702
+ A coercion from ``S`` exists, if ``S`` coerces into ``self``'s base ring,
703
+ or if ``S`` is a univariate polynomial or power series ring with the
704
+ same variable name as self, defined over a base ring that coerces into
705
+ ``self``'s base ring.
706
+
707
+ EXAMPLES::
708
+
709
+ sage: A = GF(17)[['x']]
710
+ sage: A.has_coerce_map_from(ZZ) # indirect doctest
711
+ True
712
+ sage: A.has_coerce_map_from(ZZ['x'])
713
+ True
714
+ sage: A.has_coerce_map_from(ZZ['y'])
715
+ False
716
+ sage: A.has_coerce_map_from(ZZ[['x']])
717
+ True
718
+ sage: A.has_coerce_map_from(LazyPowerSeriesRing(ZZ, 'x')) # needs sage.combinat
719
+ True
720
+ """
721
+ if self.base_ring().has_coerce_map_from(S):
722
+ return True
723
+ if (isinstance(S, (PolynomialRing_generic, PowerSeriesRing_generic, LazyPowerSeriesRing))
724
+ and self.base_ring().has_coerce_map_from(S.base_ring())
725
+ and self.variable_names() == S.variable_names()):
726
+ return True
727
+
728
+ def _magma_init_(self, magma):
729
+ """
730
+ Used in converting this ring to the corresponding ring in MAGMA.
731
+
732
+ EXAMPLES::
733
+
734
+ sage: # optional - magma
735
+ sage: R = QQ[['y']]
736
+ sage: R._magma_init_(magma)
737
+ 'SageCreateWithNames(PowerSeriesRing(_sage_ref...),["y"])'
738
+ sage: S = magma(R)
739
+ sage: S
740
+ Power series ring in y over Rational Field
741
+ sage: S.1
742
+ y
743
+ sage: S.sage() == R
744
+ True
745
+
746
+ sage: # optional - magma
747
+ sage: magma(PowerSeriesRing(GF(7), 'x')) # needs sage.rings.finite_rings
748
+ Power series ring in x over GF(7)
749
+ """
750
+ B = magma(self.base_ring())
751
+ Bref = B._ref()
752
+ s = 'PowerSeriesRing(%s)' % (Bref)
753
+ return magma._with_names(s, self.variable_names())
754
+
755
+ def _element_constructor_(self, f, prec=infinity, check=True):
756
+ """
757
+ Coerce object to this power series ring.
758
+
759
+ Returns a new instance unless the parent of ``f`` is ``self``, in
760
+ which case ``f`` is returned (since ``f`` is immutable).
761
+
762
+ INPUT:
763
+
764
+ - ``f`` -- object, e.g., a power series ring element
765
+
766
+ - ``prec`` -- (default: infinity) truncation precision for coercion
767
+
768
+ - ``check`` -- boolean (default: ``True``); whether to verify
769
+ that the coefficients, etc., coerce in correctly
770
+
771
+ EXAMPLES::
772
+
773
+ sage: R.<t> = PowerSeriesRing(ZZ)
774
+ sage: R(t+O(t^5)) # indirect doctest
775
+ t + O(t^5)
776
+ sage: R(13)
777
+ 13
778
+ sage: R(2/3)
779
+ Traceback (most recent call last):
780
+ ...
781
+ TypeError: no conversion of this rational to integer
782
+ sage: R([1,2,3])
783
+ 1 + 2*t + 3*t^2
784
+ sage: S.<w> = PowerSeriesRing(QQ)
785
+ sage: R(w + 3*w^2 + O(w^3))
786
+ t + 3*t^2 + O(t^3)
787
+ sage: x = polygen(QQ,'x')
788
+ sage: R(x + x^2 + x^3 + x^5, 3)
789
+ t + t^2 + O(t^3)
790
+ sage: R(1/(1-x), prec=5)
791
+ 1 + t + t^2 + t^3 + t^4 + O(t^5)
792
+ sage: R(1/x, 5)
793
+ Traceback (most recent call last):
794
+ ...
795
+ TypeError: no canonical coercion from Laurent Series Ring in t over
796
+ Rational Field to Power Series Ring in t over Integer Ring
797
+
798
+ sage: PowerSeriesRing(PowerSeriesRing(QQ,'x'),'y')(x)
799
+ x
800
+ sage: PowerSeriesRing(PowerSeriesRing(QQ,'y'),'x')(x)
801
+ x
802
+ sage: PowerSeriesRing(PowerSeriesRing(QQ,'t'),'y')(x)
803
+ y
804
+ sage: PowerSeriesRing(PowerSeriesRing(QQ,'t'),'y')(1/(1+x), 5)
805
+ 1 - y + y^2 - y^3 + y^4 + O(y^5)
806
+ sage: PowerSeriesRing(PowerSeriesRing(QQ,'x',5),'y')(1/(1+x))
807
+ 1 - x + x^2 - x^3 + x^4 + O(x^5)
808
+ sage: PowerSeriesRing(PowerSeriesRing(QQ,'y'),'x')(1/(1+x), 5)
809
+ 1 - x + x^2 - x^3 + x^4 + O(x^5)
810
+ sage: PowerSeriesRing(PowerSeriesRing(QQ,'x'),'x')(x).coefficients()
811
+ [x]
812
+
813
+ Conversion from symbolic series::
814
+
815
+ sage: # needs sage.symbolic
816
+ sage: x,y = var('x,y')
817
+ sage: s = (1/(1-x)).series(x,3); s
818
+ 1 + 1*x + 1*x^2 + Order(x^3)
819
+ sage: R.<x> = PowerSeriesRing(QQ)
820
+ sage: R(s)
821
+ 1 + x + x^2 + O(x^3)
822
+ sage: ex = (gamma(1-y)).series(y,3)
823
+ sage: R.<y> = PowerSeriesRing(SR)
824
+ sage: R(ex)
825
+ 1 + euler_gamma*y + (1/2*euler_gamma^2 + 1/12*pi^2)*y^2 + O(y^3)
826
+
827
+ Laurent series with nonnegative valuation are accepted (see
828
+ :issue:`6431`)::
829
+
830
+ sage: L.<q> = LaurentSeriesRing(QQ)
831
+ sage: P = L.power_series_ring()
832
+ sage: P(q)
833
+ q
834
+ sage: P(1/q)
835
+ Traceback (most recent call last):
836
+ ...
837
+ TypeError: self is not a power series
838
+
839
+ It is checked that the precision is nonnegative
840
+ (see :issue:`19409`)::
841
+
842
+ sage: PowerSeriesRing(ZZ, 'x')(1, prec=-5)
843
+ Traceback (most recent call last):
844
+ ...
845
+ ValueError: prec (= -5) must be nonnegative
846
+
847
+ From lazy series::
848
+
849
+ sage: # needs sage.combinat
850
+ sage: L.<x> = LazyPowerSeriesRing(QQ)
851
+ sage: R = PowerSeriesRing(QQ, 'x')
852
+ sage: R(1 / (1 + x^3))
853
+ 1 - x^3 + x^6 - x^9 + x^12 - x^15 + x^18 + O(x^20)
854
+ sage: R(2 - x^2 + x^6)
855
+ 2 - x^2 + x^6
856
+ """
857
+ if prec is not infinity:
858
+ prec = integer.Integer(prec)
859
+ if prec < 0:
860
+ raise ValueError("prec (= %s) must be nonnegative" % prec)
861
+ if isinstance(f, power_series_ring_element.PowerSeries) and f.parent() is self:
862
+ if prec >= f.prec():
863
+ return f
864
+ f = f.truncate(prec)
865
+ elif isinstance(f, LaurentSeries) and f.parent().power_series_ring() is self:
866
+ return self(f.power_series(), prec, check=check)
867
+ elif isinstance(f, MagmaElement) and str(f.Type()) == 'RngSerPowElt':
868
+ v = sage_eval(f.Eltseq()) # could use .sage() ?
869
+ return self(v) * (self.gen(0)**f.Valuation())
870
+ elif isinstance(f, FractionFieldElement):
871
+ if self.base_ring().has_coerce_map_from(f.parent()):
872
+ return self.element_class(self, [f], prec, check=check)
873
+ else:
874
+ num = self.element_class(self, f.numerator(), prec, check=check)
875
+ den = self.element_class(self, f.denominator(), prec, check=check)
876
+ return self.coerce(num/den)
877
+ elif isinstance(f, Expression):
878
+ from sage.symbolic.expression import SymbolicSeries
879
+ if isinstance(f, SymbolicSeries):
880
+ if str(f.default_variable()) == self.variable_name():
881
+ return self.element_class(self, f.list(),
882
+ f.degree(f.default_variable()),
883
+ check=check)
884
+ else:
885
+ raise TypeError("Can only convert series into ring with same variable name.")
886
+ else:
887
+ if isinstance(f, LazyPowerSeries):
888
+ if prec is infinity:
889
+ try:
890
+ f = f.polynomial()
891
+ except ValueError:
892
+ f = f.add_bigoh(self.default_prec())
893
+ else:
894
+ f = f.add_bigoh(prec)
895
+ return self.element_class(self, f, prec, check=check)
896
+
897
+ def construction(self):
898
+ """
899
+ Return the functorial construction of ``self``, namely, completion of
900
+ the univariate polynomial ring with respect to the indeterminate
901
+ (to a given precision).
902
+
903
+ EXAMPLES::
904
+
905
+ sage: R = PowerSeriesRing(ZZ, 'x')
906
+ sage: c, S = R.construction(); S
907
+ Univariate Polynomial Ring in x over Integer Ring
908
+ sage: R == c(S)
909
+ True
910
+ sage: R = PowerSeriesRing(ZZ, 'x', sparse=True)
911
+ sage: c, S = R.construction()
912
+ sage: R == c(S)
913
+ True
914
+ """
915
+ from sage.categories.pushout import CompletionFunctor
916
+ if self.is_sparse():
917
+ extras = {'sparse': True}
918
+ else:
919
+ extras = None
920
+ return CompletionFunctor(self._names[0], self.default_prec(), extras), self._poly_ring()
921
+
922
+ def _coerce_impl(self, x):
923
+ """
924
+ Return canonical coercion of x into ``self``.
925
+
926
+ Rings that canonically coerce to this power series ring `R`:
927
+
928
+ - `R` itself
929
+
930
+ - Any power series ring in the same variable whose base ring
931
+ canonically coerces to the base ring of `R`
932
+
933
+ - Any ring that canonically coerces to the polynomial ring
934
+ over the base ring of `R`
935
+
936
+ - Any ring that canonically coerces to the base ring of `R`
937
+
938
+ EXAMPLES::
939
+
940
+ sage: R.<t> = PowerSeriesRing(ZZ)
941
+ sage: R.coerce(t + t^2) # indirect doctest
942
+ t + t^2
943
+ sage: R.coerce(1/t)
944
+ Traceback (most recent call last):
945
+ ...
946
+ TypeError: no canonical coercion from Laurent Series Ring in t over
947
+ Rational Field to Power Series Ring in t over Integer Ring
948
+ sage: R.coerce(5)
949
+ 5
950
+ sage: tt = PolynomialRing(ZZ,'t').gen()
951
+ sage: R.coerce(tt^2 + tt - 1)
952
+ -1 + t + t^2
953
+ sage: R.coerce(1/2)
954
+ Traceback (most recent call last):
955
+ ...
956
+ TypeError: no canonical coercion from Rational Field to Power Series Ring in t over Integer Ring
957
+ sage: S.<s> = PowerSeriesRing(ZZ)
958
+ sage: R.coerce(s)
959
+ Traceback (most recent call last):
960
+ ...
961
+ TypeError: no canonical coercion from Power Series Ring in s over Integer Ring to Power Series Ring in t over Integer Ring
962
+
963
+ We illustrate canonical coercion between power series rings with
964
+ compatible base rings::
965
+
966
+ sage: R.<t> = PowerSeriesRing(GF(7)['w'])
967
+ sage: S = PowerSeriesRing(ZZ, 't')
968
+ sage: f = S([1,2,3,4]); f
969
+ 1 + 2*t + 3*t^2 + 4*t^3
970
+ sage: g = R.coerce(f); g
971
+ 1 + 2*t + 3*t^2 + 4*t^3
972
+ sage: parent(g)
973
+ Power Series Ring in t over
974
+ Univariate Polynomial Ring in w over Finite Field of size 7
975
+ sage: S.coerce(g)
976
+ Traceback (most recent call last):
977
+ ...
978
+ TypeError: no canonical coercion
979
+ from Power Series Ring in t over Univariate Polynomial Ring in w over Finite Field of size 7
980
+ to Power Series Ring in t over Integer Ring
981
+ """
982
+ try:
983
+ P = x.parent()
984
+ if isinstance(P, (PowerSeriesRing_generic, LazyPowerSeriesRing)):
985
+ if P.variable_name() == self.variable_name():
986
+ if self.has_coerce_map_from(P.base_ring()):
987
+ return self(x)
988
+ else:
989
+ raise TypeError("no natural map between bases of power series rings")
990
+ except AttributeError:
991
+ pass
992
+
993
+ return self._coerce_map_via([self.base_ring(), self.__poly_ring], P)(x)
994
+
995
+ def _is_valid_homomorphism_(self, codomain, im_gens, base_map=None):
996
+ r"""
997
+ This gets called implicitly when one constructs a ring homomorphism
998
+ from a power series ring.
999
+
1000
+ EXAMPLES::
1001
+
1002
+ sage: S = RationalField(); R.<t> = PowerSeriesRing(S)
1003
+ sage: f = R.hom([0])
1004
+ sage: f(3)
1005
+ 3
1006
+ sage: g = R.hom([t^2])
1007
+ sage: g(-1 + 3/5 * t)
1008
+ -1 + 3/5*t^2
1009
+
1010
+ .. NOTE::
1011
+
1012
+ There are no ring homomorphisms from the ring of all formal
1013
+ power series to most rings, e.g, the `p`-adic field, since
1014
+ you can always (mathematically!) construct some power
1015
+ series that doesn't converge. Note that 0 is not a *ring*
1016
+ homomorphism.
1017
+ """
1018
+ if im_gens[0] == 0:
1019
+ return True # this is allowed.
1020
+ if base_map is None and not codomain.has_coerce_map_from(self.base_ring()):
1021
+ return False
1022
+ v = im_gens[0]
1023
+ if isinstance(codomain, (PowerSeriesRing_generic, LazyPowerSeriesRing, LaurentSeriesRing)):
1024
+ try:
1025
+ return v.valuation() > 0 or v.is_nilpotent()
1026
+ except NotImplementedError:
1027
+ return v.valuation() > 0
1028
+ try:
1029
+ return v.is_nilpotent()
1030
+ except NotImplementedError:
1031
+ pass
1032
+ return False
1033
+
1034
+ def _poly_ring(self):
1035
+ """
1036
+ Return the underlying polynomial ring used to represent elements of
1037
+ this power series ring.
1038
+
1039
+ EXAMPLES::
1040
+
1041
+ sage: R.<t> = PowerSeriesRing(ZZ)
1042
+ sage: R._poly_ring()
1043
+ Univariate Polynomial Ring in t over Integer Ring
1044
+ """
1045
+ return self.__poly_ring
1046
+
1047
+ def base_extend(self, R):
1048
+ """
1049
+ Return the power series ring over `R` in the same variable as ``self``,
1050
+ assuming there is a canonical coerce map from the base ring of ``self``
1051
+ to `R`.
1052
+
1053
+ EXAMPLES::
1054
+
1055
+ sage: R.<T> = GF(7)[[]]; R
1056
+ Power Series Ring in T over Finite Field of size 7
1057
+ sage: R.change_ring(ZZ)
1058
+ Power Series Ring in T over Integer Ring
1059
+ sage: R.base_extend(ZZ)
1060
+ Traceback (most recent call last):
1061
+ ...
1062
+ TypeError: no base extension defined
1063
+ """
1064
+ if R.has_coerce_map_from(self.base_ring()):
1065
+ return self.change_ring(R)
1066
+ else:
1067
+ raise TypeError("no base extension defined")
1068
+
1069
+ def change_ring(self, R):
1070
+ """
1071
+ Return the power series ring over `R` in the same variable as ``self``.
1072
+
1073
+ EXAMPLES::
1074
+
1075
+ sage: R.<T> = QQ[[]]; R
1076
+ Power Series Ring in T over Rational Field
1077
+ sage: R.change_ring(GF(7))
1078
+ Power Series Ring in T over Finite Field of size 7
1079
+ sage: R.base_extend(GF(7))
1080
+ Traceback (most recent call last):
1081
+ ...
1082
+ TypeError: no base extension defined
1083
+ sage: R.base_extend(QuadraticField(3,'a')) # needs sage.rings.number_field
1084
+ Power Series Ring in T over Number Field in a
1085
+ with defining polynomial x^2 - 3 with a = 1.732050807568878?
1086
+ """
1087
+ return PowerSeriesRing(R, name=self.variable_name(), default_prec=self.default_prec())
1088
+
1089
+ def change_var(self, var):
1090
+ """
1091
+ Return the power series ring in variable ``var`` over the same base ring.
1092
+
1093
+ EXAMPLES::
1094
+
1095
+ sage: R.<T> = QQ[[]]; R
1096
+ Power Series Ring in T over Rational Field
1097
+ sage: R.change_var('D')
1098
+ Power Series Ring in D over Rational Field
1099
+ """
1100
+ return PowerSeriesRing(self.base_ring(), names=var, sparse=self.is_sparse())
1101
+
1102
+ def is_exact(self):
1103
+ """
1104
+ Return ``False`` since the ring of power series over any ring is not
1105
+ exact.
1106
+
1107
+ EXAMPLES::
1108
+
1109
+ sage: R.<t> = PowerSeriesRing(ZZ)
1110
+ sage: R.is_exact()
1111
+ False
1112
+ """
1113
+ return False
1114
+
1115
+ def gen(self, n=0):
1116
+ """
1117
+ Return the generator of this power series ring.
1118
+
1119
+ EXAMPLES::
1120
+
1121
+ sage: R.<t> = PowerSeriesRing(ZZ)
1122
+ sage: R.gen()
1123
+ t
1124
+ sage: R.gen(3)
1125
+ Traceback (most recent call last):
1126
+ ...
1127
+ IndexError: generator n>0 not defined
1128
+ """
1129
+ if n != 0:
1130
+ raise IndexError("generator n>0 not defined")
1131
+ return self.__generator
1132
+
1133
+ def gens(self) -> tuple:
1134
+ """
1135
+ Return the generators of this ring.
1136
+
1137
+ EXAMPLES::
1138
+
1139
+ sage: R.<t> = PowerSeriesRing(ZZ)
1140
+ sage: R.gens()
1141
+ (t,)
1142
+ """
1143
+ return (self.__generator,)
1144
+
1145
+ def uniformizer(self):
1146
+ """
1147
+ Return a uniformizer of this power series ring if it is
1148
+ a discrete valuation ring (i.e., if the base ring is actually
1149
+ a field). Otherwise, an error is raised.
1150
+
1151
+ EXAMPLES::
1152
+
1153
+ sage: R.<t> = PowerSeriesRing(QQ)
1154
+ sage: R.uniformizer()
1155
+ t
1156
+
1157
+ sage: R.<t> = PowerSeriesRing(ZZ)
1158
+ sage: R.uniformizer()
1159
+ Traceback (most recent call last):
1160
+ ...
1161
+ TypeError: The base ring is not a field
1162
+ """
1163
+ if self.base_ring().is_field():
1164
+ return self.gen()
1165
+ else:
1166
+ raise TypeError("The base ring is not a field")
1167
+
1168
+ def ngens(self):
1169
+ """
1170
+ Return the number of generators of this power series ring.
1171
+
1172
+ This is always 1.
1173
+
1174
+ EXAMPLES::
1175
+
1176
+ sage: R.<t> = ZZ[[]]
1177
+ sage: R.ngens()
1178
+ 1
1179
+ """
1180
+ return 1
1181
+
1182
+ def random_element(self, prec=None, *args, **kwds):
1183
+ r"""
1184
+ Return a random power series.
1185
+
1186
+ INPUT:
1187
+
1188
+ - ``prec`` -- integer specifying precision of output (default:
1189
+ default precision of ``self``)
1190
+
1191
+ - ``*args``, ``**kwds`` -- passed on to the ``random_element`` method for
1192
+ the base ring
1193
+
1194
+ OUTPUT:
1195
+
1196
+ Power series with precision ``prec`` whose coefficients are
1197
+ random elements from the base ring, randomized subject to the
1198
+ arguments ``*args`` and ``**kwds``.
1199
+
1200
+ ALGORITHM:
1201
+
1202
+ Call the ``random_element`` method on the underlying polynomial
1203
+ ring.
1204
+
1205
+ EXAMPLES::
1206
+
1207
+ sage: R.<t> = PowerSeriesRing(QQ)
1208
+ sage: R.random_element(5) # random
1209
+ -4 - 1/2*t^2 - 1/95*t^3 + 1/2*t^4 + O(t^5)
1210
+ sage: R.random_element(10) # random
1211
+ -1/2 + 2*t - 2/7*t^2 - 25*t^3 - t^4 + 2*t^5 - 4*t^7 - 1/3*t^8 - t^9 + O(t^10)
1212
+
1213
+ If given no argument, ``random_element`` uses default precision of self::
1214
+
1215
+ sage: T = PowerSeriesRing(ZZ,'t')
1216
+ sage: T.default_prec()
1217
+ 20
1218
+ sage: T.random_element() # random
1219
+ 4 + 2*t - t^2 - t^3 + 2*t^4 + t^5 + t^6 - 2*t^7 - t^8 - t^9 + t^11
1220
+ - 6*t^12 + 2*t^14 + 2*t^16 - t^17 - 3*t^18 + O(t^20)
1221
+ sage: S = PowerSeriesRing(ZZ,'t', default_prec=4)
1222
+ sage: S.random_element() # random
1223
+ 2 - t - 5*t^2 + t^3 + O(t^4)
1224
+
1225
+
1226
+ Further arguments are passed to the underlying base ring (:issue:`9481`)::
1227
+
1228
+ sage: SZ = PowerSeriesRing(ZZ,'v')
1229
+ sage: SQ = PowerSeriesRing(QQ,'v')
1230
+ sage: SR = PowerSeriesRing(RR,'v')
1231
+
1232
+ sage: SZ.random_element(x=4, y=6) # random
1233
+ 4 + 5*v + 5*v^2 + 5*v^3 + 4*v^4 + 5*v^5 + 5*v^6 + 5*v^7 + 4*v^8
1234
+ + 5*v^9 + 4*v^10 + 4*v^11 + 5*v^12 + 5*v^13 + 5*v^14 + 5*v^15
1235
+ + 5*v^16 + 5*v^17 + 4*v^18 + 5*v^19 + O(v^20)
1236
+ sage: SZ.random_element(3, x=4, y=6) # random
1237
+ 5 + 4*v + 5*v^2 + O(v^3)
1238
+ sage: SQ.random_element(3, num_bound=3, den_bound=100) # random
1239
+ 1/87 - 3/70*v - 3/44*v^2 + O(v^3)
1240
+ sage: SR.random_element(3, max=10, min=-10) # random
1241
+ 2.85948321262904 - 9.73071330911226*v - 6.60414378519265*v^2 + O(v^3)
1242
+ """
1243
+ if prec is None:
1244
+ prec = self.default_prec()
1245
+ return self(self.__poly_ring.random_element(prec-1, *args, **kwds), prec)
1246
+
1247
+ def __contains__(self, x):
1248
+ """
1249
+ Return ``True`` if x is an element of this power series ring or
1250
+ canonically coerces to this ring.
1251
+
1252
+ EXAMPLES::
1253
+
1254
+ sage: R.<t> = PowerSeriesRing(ZZ)
1255
+ sage: t + t^2 in R
1256
+ True
1257
+ sage: 1/t in R
1258
+ False
1259
+ sage: 5 in R
1260
+ True
1261
+ sage: 1/3 in R
1262
+ False
1263
+ sage: S.<s> = PowerSeriesRing(ZZ)
1264
+ sage: s in R
1265
+ False
1266
+ """
1267
+ return self.has_coerce_map_from(parent(x))
1268
+
1269
+ def is_field(self, proof=True):
1270
+ """
1271
+ Return ``False`` since the ring of power series over any ring is never
1272
+ a field.
1273
+
1274
+ EXAMPLES::
1275
+
1276
+ sage: R.<t> = PowerSeriesRing(ZZ)
1277
+ sage: R.is_field()
1278
+ False
1279
+ """
1280
+ return False
1281
+
1282
+ def is_finite(self):
1283
+ """
1284
+ Return ``False`` since the ring of power series over any ring is never
1285
+ finite.
1286
+
1287
+ EXAMPLES::
1288
+
1289
+ sage: R.<t> = PowerSeriesRing(ZZ)
1290
+ sage: R.is_finite()
1291
+ False
1292
+ """
1293
+ return False
1294
+
1295
+ def characteristic(self):
1296
+ """
1297
+ Return the characteristic of this power series ring, which is the
1298
+ same as the characteristic of the base ring of the power series
1299
+ ring.
1300
+
1301
+ EXAMPLES::
1302
+
1303
+ sage: R.<t> = PowerSeriesRing(ZZ)
1304
+ sage: R.characteristic()
1305
+ 0
1306
+ sage: R.<w> = Integers(2^50)[[]]; R
1307
+ Power Series Ring in w over Ring of integers modulo 1125899906842624
1308
+ sage: R.characteristic()
1309
+ 1125899906842624
1310
+ """
1311
+ return self.base_ring().characteristic()
1312
+
1313
+ def residue_field(self):
1314
+ """
1315
+ Return the residue field of this power series ring.
1316
+
1317
+ EXAMPLES::
1318
+
1319
+ sage: R.<x> = PowerSeriesRing(GF(17))
1320
+ sage: R.residue_field()
1321
+ Finite Field of size 17
1322
+ sage: R.<x> = PowerSeriesRing(Zp(5)) # needs sage.rings.padics
1323
+ sage: R.residue_field() # needs sage.rings.padics
1324
+ Finite Field of size 5
1325
+ """
1326
+ if self.base_ring().is_field():
1327
+ return self.base_ring()
1328
+ else:
1329
+ return self.base_ring().residue_field()
1330
+
1331
+ def laurent_series_ring(self):
1332
+ """
1333
+ If this is the power series ring `R[[t]]`, return the
1334
+ Laurent series ring `R((t))`.
1335
+
1336
+ EXAMPLES::
1337
+
1338
+ sage: R.<t> = PowerSeriesRing(ZZ, default_prec=5)
1339
+ sage: S = R.laurent_series_ring(); S
1340
+ Laurent Series Ring in t over Integer Ring
1341
+ sage: S.default_prec()
1342
+ 5
1343
+ sage: f = 1 + t; g = 1/f; g
1344
+ 1 - t + t^2 - t^3 + t^4 + O(t^5)
1345
+ """
1346
+ try:
1347
+ return self.__laurent_series_ring
1348
+ except AttributeError:
1349
+ from .laurent_series_ring import LaurentSeriesRing
1350
+
1351
+ self.__laurent_series_ring = LaurentSeriesRing(
1352
+ self.base_ring(), self.variable_name(), default_prec=self.default_prec(), sparse=self.is_sparse())
1353
+ return self.__laurent_series_ring
1354
+
1355
+
1356
+ class PowerSeriesRing_domain(PowerSeriesRing_generic):
1357
+ _default_category = _IntegralDomains
1358
+
1359
+ def fraction_field(self):
1360
+ """
1361
+ Return the Laurent series ring over the fraction field of the base
1362
+ ring.
1363
+
1364
+ This is actually *not* the fraction field of this ring, but its
1365
+ completion with respect to the topology defined by the valuation.
1366
+ When we are working at finite precision, these two fields are
1367
+ indistinguishable; that is the reason why we allow ourselves to
1368
+ make this confusion here.
1369
+
1370
+ EXAMPLES::
1371
+
1372
+ sage: R.<t> = PowerSeriesRing(ZZ)
1373
+ sage: R.fraction_field()
1374
+ Laurent Series Ring in t over Rational Field
1375
+ sage: Frac(R)
1376
+ Laurent Series Ring in t over Rational Field
1377
+ """
1378
+ laurent = self.laurent_series_ring()
1379
+ return laurent.change_ring(self.base_ring().fraction_field())
1380
+
1381
+ def _get_action_(self, other, op, self_is_left):
1382
+ r"""
1383
+ Return the actions on ``self`` by ``other`` under ``op``.
1384
+
1385
+ EXAMPLES::
1386
+
1387
+ sage: R.<t> = PowerSeriesRing(ZZ)
1388
+ sage: import operator
1389
+ sage: act = coercion_model.get_action(R, ZZ, operator.floordiv); act
1390
+ Right action by Integer Ring on Power Series Ring in t over Integer Ring
1391
+ sage: type(act)
1392
+ <class 'sage.rings.power_series_poly.BaseRingFloorDivAction'>
1393
+ sage: coercion_model.get_action(ZZ, R, operator.floordiv) is None
1394
+ True
1395
+
1396
+ sage: R.<t> = PowerSeriesRing(QQ)
1397
+ sage: coercion_model.get_action(R, ZZ, operator.floordiv)
1398
+ Right action by Integer Ring on Power Series Ring in t over Rational Field
1399
+ """
1400
+ import operator
1401
+ if op is operator.floordiv and self_is_left and self.base_ring().has_coerce_map_from(other):
1402
+ from sage.rings.power_series_poly import BaseRingFloorDivAction
1403
+ # Floor division by coefficient.
1404
+ return BaseRingFloorDivAction(other, self, is_left=False)
1405
+ return super()._get_action_(other, op, self_is_left)
1406
+
1407
+
1408
+ class PowerSeriesRing_over_field(PowerSeriesRing_domain):
1409
+ _default_category = CompleteDiscreteValuationRings()
1410
+
1411
+ def fraction_field(self):
1412
+ """
1413
+ Return the fraction field of this power series ring, which is
1414
+ defined since this is over a field.
1415
+
1416
+ This fraction field is just the Laurent series ring over the base
1417
+ field.
1418
+
1419
+ EXAMPLES::
1420
+
1421
+ sage: R.<t> = PowerSeriesRing(GF(7))
1422
+ sage: R.fraction_field()
1423
+ Laurent Series Ring in t over Finite Field of size 7
1424
+ sage: Frac(R)
1425
+ Laurent Series Ring in t over Finite Field of size 7
1426
+ """
1427
+ return self.laurent_series_ring()
1428
+
1429
+
1430
+ def unpickle_power_series_ring_v0(base_ring, name, default_prec, sparse):
1431
+ """
1432
+ Unpickle (deserialize) a univariate power series ring according to
1433
+ the given inputs.
1434
+
1435
+ EXAMPLES::
1436
+
1437
+ sage: P.<x> = PowerSeriesRing(QQ)
1438
+ sage: loads(dumps(P)) == P # indirect doctest
1439
+ True
1440
+ """
1441
+ return PowerSeriesRing(base_ring, name=name, default_prec=default_prec, sparse=sparse)