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,1357 @@
1
+ # sage_setup: distribution = sagemath-categories
2
+ """
3
+ Fraction Field Elements
4
+
5
+ AUTHORS:
6
+
7
+ - William Stein (input from David Joyner, David Kohel, and Joe Wetherell)
8
+
9
+ - Sebastian Pancratz (2010-01-06): Rewrite of addition, multiplication and
10
+ derivative to use Henrici's algorithms [Hor1972]_
11
+ """
12
+
13
+ # ****************************************************************************
14
+ # Copyright (C) 2005 William Stein <wstein@gmail.com>
15
+ #
16
+ # This program is free software: you can redistribute it and/or modify
17
+ # it under the terms of the GNU General Public License as published by
18
+ # the Free Software Foundation, either version 2 of the License, or
19
+ # (at your option) any later version.
20
+ # https://www.gnu.org/licenses/
21
+ # ****************************************************************************
22
+
23
+ from sage.structure.element cimport FieldElement, parent
24
+ from sage.structure.richcmp cimport richcmp
25
+
26
+ from sage.rings.rational_field import QQ
27
+ from sage.rings.integer_ring import ZZ
28
+
29
+ import sage.misc.latex as latex
30
+ import sage.misc.superseded
31
+
32
+
33
+ def is_FractionFieldElement(x) -> bool:
34
+ """
35
+ Return whether or not ``x`` is a :class:`FractionFieldElement`.
36
+
37
+ EXAMPLES::
38
+
39
+ sage: from sage.rings.fraction_field_element import is_FractionFieldElement
40
+ sage: R.<x> = ZZ[]
41
+ sage: is_FractionFieldElement(x/2)
42
+ doctest:warning...
43
+ DeprecationWarning: The function is_FractionFieldElement is deprecated;
44
+ use 'isinstance(..., FractionFieldElement)' instead.
45
+ See https://github.com/sagemath/sage/issues/38128 for details.
46
+ False
47
+ sage: is_FractionFieldElement(2/x)
48
+ True
49
+ sage: is_FractionFieldElement(1/3)
50
+ False
51
+ """
52
+ from sage.misc.superseded import deprecation_cython
53
+ deprecation_cython(38128,
54
+ "The function is_FractionFieldElement is deprecated; "
55
+ "use 'isinstance(..., FractionFieldElement)' instead.")
56
+ return isinstance(x, FractionFieldElement)
57
+
58
+
59
+ cdef class FractionFieldElement(FieldElement):
60
+ """
61
+ EXAMPLES::
62
+
63
+ sage: K = FractionField(PolynomialRing(QQ, 'x'))
64
+ sage: K
65
+ Fraction Field of Univariate Polynomial Ring in x over Rational Field
66
+ sage: loads(K.dumps()) == K
67
+ True
68
+ sage: x = K.gen()
69
+ sage: f = (x^3 + x)/(17 - x^19); f
70
+ (-x^3 - x)/(x^19 - 17)
71
+ sage: loads(f.dumps()) == f
72
+ True
73
+
74
+ TESTS:
75
+
76
+ Test if :issue:`5451` is fixed::
77
+
78
+ sage: A = FiniteField(9,'theta')['t'] # needs sage.rings.finite_rings
79
+ sage: K.<t> = FractionField(A) # needs sage.rings.finite_rings
80
+ sage: f = 2/(t^2 + 2*t); g = t^9/(t^18 + t^10 + t^2); f + g # needs sage.rings.finite_rings
81
+ (2*t^15 + 2*t^14 + 2*t^13 + 2*t^12 + 2*t^11 + 2*t^10 + 2*t^9 + t^7 + t^6 + t^5 + t^4 + t^3 + t^2 + t + 1)/(t^17 + t^9 + t)
82
+
83
+ Test if :issue:`8671` is fixed::
84
+
85
+ sage: P.<n> = QQ[]
86
+ sage: F = P.fraction_field()
87
+ sage: P.one()//F.one()
88
+ 1
89
+ sage: F.one().quo_rem(F.one())
90
+ (1, 0)
91
+ """
92
+ cdef object _numerator
93
+ cdef object _denominator
94
+ cdef bint _is_reduced
95
+
96
+ def __init__(self, parent, numerator, denominator=1,
97
+ coerce=True, reduce=True):
98
+ """
99
+ Initialize ``self``.
100
+
101
+ EXAMPLES::
102
+
103
+ sage: from sage.rings.fraction_field_element import FractionFieldElement
104
+ sage: K.<x> = Frac(ZZ['x'])
105
+ sage: FractionFieldElement(K, x, 4)
106
+ x/4
107
+ sage: FractionFieldElement(K, x, x, reduce=False)
108
+ x/x
109
+ sage: f = FractionFieldElement(K, 'hi', 1, coerce=False, reduce=False)
110
+ sage: f.numerator()
111
+ 'hi'
112
+
113
+ sage: x = var('x') # needs sage.symbolic
114
+ sage: K((x + 1)/(x^2 + x + 1))
115
+ (x + 1)/(x^2 + x + 1)
116
+ sage: K(355/113)
117
+ 355/113
118
+ """
119
+ FieldElement.__init__(self, parent)
120
+ if coerce:
121
+ self._numerator = parent.ring()(numerator)
122
+ self._denominator = parent.ring()(denominator)
123
+ else:
124
+ self._numerator = numerator
125
+ self._denominator = denominator
126
+ if reduce and parent.is_exact():
127
+ try:
128
+ self.reduce()
129
+ except ArithmeticError:
130
+ pass
131
+ if self._denominator.is_zero():
132
+ raise ZeroDivisionError("fraction field element division by zero")
133
+
134
+ def _im_gens_(self, codomain, im_gens, base_map=None):
135
+ """
136
+ EXAMPLES::
137
+
138
+ sage: F = ZZ['x,y'].fraction_field()
139
+ sage: x,y = F.gens()
140
+ sage: K = GF(7)['a,b'].fraction_field()
141
+ sage: a,b = K.gens()
142
+
143
+ ::
144
+
145
+ sage: # needs sage.libs.singular
146
+ sage: phi = F.hom([a + b, a*b], K)
147
+ sage: phi(x + y) # indirect doctest
148
+ a*b + a + b
149
+
150
+ ::
151
+
152
+ sage: (x^2/y)._im_gens_(K, [a + b, a*b])
153
+ (a^2 + 2*a*b + b^2)/(a*b)
154
+ sage: (x^2/y)._im_gens_(K, [a, a*b])
155
+ a/b
156
+
157
+ ::
158
+
159
+ sage: # needs sage.rings.number_field
160
+ sage: Zx.<x> = ZZ[]
161
+ sage: K.<i> = NumberField(x^2 + 1)
162
+ sage: cc = K.hom([-i])
163
+ sage: R.<a,b> = K[]
164
+ sage: F = R.fraction_field()
165
+ sage: phi = F.hom([F(b), F(a)], base_map=cc)
166
+ sage: phi(i/a)
167
+ ((-i))/b
168
+ """
169
+ nnum = codomain.coerce(self._numerator._im_gens_(codomain, im_gens, base_map=base_map))
170
+ nden = codomain.coerce(self._denominator._im_gens_(codomain, im_gens, base_map=base_map))
171
+ return codomain.coerce(nnum/nden)
172
+
173
+ cpdef reduce(self):
174
+ """
175
+ Reduce this fraction.
176
+
177
+ Divides out the gcd of the numerator and denominator. If the
178
+ denominator becomes a unit, it becomes 1. Additionally, depending on
179
+ the base ring, the leading coefficients of the numerator and the
180
+ denominator may be normalized to 1.
181
+
182
+ Automatically called for exact rings, but because it may be
183
+ numerically unstable for inexact rings it must be called manually
184
+ in that case.
185
+
186
+ EXAMPLES::
187
+
188
+ sage: R.<x> = RealField(10)[] # needs sage.rings.real_mpfr
189
+ sage: f = (x^2+2*x+1)/(x+1); f # needs sage.rings.real_mpfr
190
+ (x^2 + 2.0*x + 1.0)/(x + 1.0)
191
+ sage: f.reduce(); f # needs sage.rings.real_mpfr
192
+ x + 1.0
193
+
194
+ TESTS:
195
+
196
+ Check that :issue:`8111` is fixed::
197
+
198
+ sage: K.<k>= QQ[]
199
+ sage: frac = (64*k^2+128)/(64*k^3+256)
200
+ sage: frac.reduce(); frac
201
+ (k^2 + 2)/(k^3 + 4)
202
+ """
203
+ if self._is_reduced:
204
+ return
205
+ try:
206
+ g = self._numerator.gcd(self._denominator)
207
+ if not g.is_unit():
208
+ self._numerator //= g
209
+ self._denominator //= g
210
+ self._is_reduced = True
211
+ except AttributeError:
212
+ raise ArithmeticError("unable to reduce because lack of gcd or quo_rem algorithm")
213
+ except TypeError:
214
+ raise ArithmeticError("unable to reduce because gcd algorithm doesn't work on input")
215
+ except NotImplementedError:
216
+ raise ArithmeticError("unable to reduce because gcd algorithm not implemented on input")
217
+ if not self._denominator.is_one() and self._denominator.is_unit():
218
+ try:
219
+ inv = self._denominator.inverse_of_unit()
220
+ except Exception:
221
+ pass
222
+ else:
223
+ self._numerator *= inv
224
+ self._denominator = self._denominator.parent().one()
225
+
226
+ def __copy__(self):
227
+ """
228
+ Make a copy of ``self``.
229
+
230
+ EXAMPLES::
231
+
232
+ sage: # needs sage.libs.singular
233
+ sage: R.<x,y> = ZZ[]
234
+ sage: f = x/y + 1; f
235
+ (x + y)/y
236
+ sage: copy(f)
237
+ (x + y)/y
238
+ """
239
+ return self.__class__(self._parent, self._numerator,
240
+ self._denominator, coerce=False, reduce=False)
241
+
242
+ def numerator(self):
243
+ """
244
+ Return the numerator of ``self``.
245
+
246
+ EXAMPLES::
247
+
248
+ sage: # needs sage.libs.singular
249
+ sage: R.<x,y> = ZZ[]
250
+ sage: f = x/y + 1; f
251
+ (x + y)/y
252
+ sage: f.numerator()
253
+ x + y
254
+ """
255
+ return self._numerator
256
+
257
+ def denominator(self):
258
+ """
259
+ Return the denominator of ``self``.
260
+
261
+ EXAMPLES::
262
+
263
+ sage: # needs sage.libs.singular
264
+ sage: R.<x,y> = ZZ[]
265
+ sage: f = x/y + 1; f
266
+ (x + y)/y
267
+ sage: f.denominator()
268
+ y
269
+ """
270
+ return self._denominator
271
+
272
+ def is_square(self, root=False):
273
+ """
274
+ Return whether or not ``self`` is a perfect square.
275
+
276
+ If the optional
277
+ argument ``root`` is ``True``, then also returns a square root (or
278
+ ``None``, if the fraction field element is not square).
279
+
280
+ INPUT:
281
+
282
+ - ``root`` -- whether or not to also return a square
283
+ root (default: ``False``)
284
+
285
+ OUTPUT:
286
+
287
+ - boolean; whether or not a square
288
+
289
+ - object (optional); an actual square root if found, and ``None``
290
+ otherwise
291
+
292
+ EXAMPLES::
293
+
294
+ sage: R.<t> = QQ[]
295
+ sage: (1/t).is_square()
296
+ False
297
+ sage: (1/t^6).is_square()
298
+ True
299
+ sage: ((1+t)^4/t^6).is_square()
300
+ True
301
+ sage: (4*(1+t)^4/t^6).is_square()
302
+ True
303
+ sage: (2*(1+t)^4/t^6).is_square()
304
+ False
305
+ sage: ((1+t)/t^6).is_square()
306
+ False
307
+
308
+ sage: (4*(1+t)^4/t^6).is_square(root=True)
309
+ (True, (2*t^2 + 4*t + 2)/t^3)
310
+ sage: (2*(1+t)^4/t^6).is_square(root=True)
311
+ (False, None)
312
+
313
+ sage: R.<x> = QQ[]
314
+ sage: a = 2*(x+1)^2 / (2*(x-1)^2); a
315
+ (x^2 + 2*x + 1)/(x^2 - 2*x + 1)
316
+ sage: a.is_square()
317
+ True
318
+ sage: (0/x).is_square()
319
+ True
320
+ """
321
+ a = self.numerator()
322
+ b = self.denominator()
323
+ if not root:
324
+ return (a * b).is_square(root=False)
325
+ is_sqr, sq_rt = (a * b).is_square(root=True)
326
+ if is_sqr:
327
+ return True, self._parent(sq_rt / b)
328
+ return False, None
329
+
330
+ def nth_root(self, n):
331
+ r"""
332
+ Return a ``n``-th root of this element.
333
+
334
+ EXAMPLES::
335
+
336
+ sage: R = QQ['t'].fraction_field()
337
+ sage: t = R.gen()
338
+ sage: p = (t+1)^3 / (t^2+t-1)^3
339
+ sage: p.nth_root(3)
340
+ (t + 1)/(t^2 + t - 1)
341
+
342
+ sage: p = (t+1) / (t-1)
343
+ sage: p.nth_root(2)
344
+ Traceback (most recent call last):
345
+ ...
346
+ ValueError: not a 2nd power
347
+ """
348
+ a = self.numerator()
349
+ b = self.denominator()
350
+ return a.nth_root(n) / b.nth_root(n)
351
+
352
+ def __hash__(self):
353
+ """
354
+ This function hashes in a special way to ensure that generators of
355
+ a ring `R` and generators of a fraction field of `R` have the same
356
+ hash. This enables them to be used as keys interchangeably in a
357
+ dictionary (since ``==`` will claim them equal).
358
+
359
+ This is useful for substitution using dicts.
360
+
361
+ EXAMPLES::
362
+
363
+ sage: R.<x> = ZZ[]
364
+ sage: hash(R.0) == hash(FractionField(R).0)
365
+ True
366
+ sage: ((x+1)/(x^2+1)).subs({x:1})
367
+ 1
368
+ sage: d={x:1}
369
+ sage: d[FractionField(R).0]
370
+ 1
371
+ sage: R.<x>=QQ[] # this probably has a separate implementation from ZZ[]
372
+ sage: hash(R.0)==hash(FractionField(R).0)
373
+ True
374
+ sage: d={x:1}
375
+ sage: d[FractionField(R).0]
376
+ 1
377
+
378
+ sage: # needs sage.libs.singular
379
+ sage: R.<x,y,z> = ZZ[] # this probably has a separate implementation from ZZ[]
380
+ sage: hash(R.0) == hash(FractionField(R).0)
381
+ True
382
+ sage: d = {x: 1}
383
+ sage: d[FractionField(R).0]
384
+ 1
385
+ sage: R.<x,y,z> = QQ[] # this probably has a separate implementation from ZZ[]
386
+ sage: hash(R.0) == hash(FractionField(R).0)
387
+ True
388
+ sage: ((x+1)/(x^2+1)).subs({x: 1})
389
+ 1
390
+ sage: d = {x: 1}
391
+ sage: d[FractionField(R).0]
392
+ 1
393
+ sage: hash(R(1)/R(2)) == hash(1/2)
394
+ True
395
+
396
+ Check that :issue:`16268` is fixed::
397
+
398
+ sage: ku.<u> = FractionField(PolynomialRing(QQ,'u'))
399
+ sage: a = 27*u^2+81*u+243
400
+ sage: b = 27*u-81
401
+ sage: c = u^2 + 3*u + 9
402
+ sage: d = u-3
403
+ sage: s = a/b
404
+ sage: t = c/d
405
+ sage: s == t
406
+ True
407
+ sage: len(set([s,t]))
408
+ 1
409
+
410
+ Check that :issue:`25199` is fixed::
411
+
412
+ sage: R.<x,y,z> = QQbar[] # needs sage.rings.number_field
413
+ sage: hash(R.0) == hash(FractionField(R).0)
414
+ True
415
+ sage: ((x+1)/(x^2+1)).subs({x: 1}) # needs sage.libs.pari
416
+ 1
417
+
418
+ Check that :issue:`35238` is fixed::
419
+
420
+ sage: K.<x,y>=ZZ[]
421
+ sage: hash(x/y) == hash((-x)/(-y))
422
+ True
423
+ """
424
+ if self._denominator.is_one():
425
+ # Handle this case even over rings that don't support reduction, to
426
+ # avoid breaking existing code that carelessly mixes p and p/1
427
+ return hash(self._numerator)
428
+ if self._parent.is_exact():
429
+ # May fail; let the exception propagate then.
430
+ # (In contrast, over inexact rings, we hash unreduced fractions
431
+ # without complaining. This is not ideal, but there is code in Sage
432
+ # that uses dictionaries indexed by rational functions with
433
+ # floating-point coefficients, and since the equality test involves
434
+ # potentially inexact operations, there would be compatibility
435
+ # issues even if we didn't...)
436
+ self.reduce()
437
+ try:
438
+ can_associate = self._denominator.canonical_associate()
439
+ except AttributeError:
440
+ can_associate = NotImplemented
441
+ if can_associate is NotImplemented:
442
+ sage.misc.superseded.warning(40019, "Hashing for {} not implemented. Using constant value".format(self.parent()))
443
+ return 0
444
+ den = can_associate[0]
445
+ num = self._numerator * can_associate[1].inverse_of_unit()
446
+ n = hash(num)
447
+ d = hash(den)
448
+ else:
449
+ n = hash(self._numerator)
450
+ d = hash(self._denominator)
451
+
452
+ if d == 1:
453
+ return n
454
+ else:
455
+ return n ^ d
456
+
457
+ def __call__(self, *x, **kwds):
458
+ """
459
+ Evaluate the fraction at the given arguments.
460
+
461
+ This assumes that a
462
+ call function is defined for the numerator and denominator.
463
+
464
+ EXAMPLES::
465
+
466
+ sage: # needs sage.libs.singular
467
+ sage: x = PolynomialRing(RationalField(), 'x', 3).gens()
468
+ sage: f = x[0] + x[1] - 2*x[1]*x[2]
469
+ sage: f
470
+ -2*x1*x2 + x0 + x1
471
+ sage: f(1,2,5)
472
+ -17
473
+ sage: h = f / (x[1] + x[2])
474
+ sage: h
475
+ (-2*x1*x2 + x0 + x1)/(x1 + x2)
476
+ sage: h(1,2,5)
477
+ -17/7
478
+ sage: h(x0=1)
479
+ (-2*x1*x2 + x1 + 1)/(x1 + x2)
480
+ """
481
+ return self._numerator(*x, **kwds) / self._denominator(*x, **kwds)
482
+
483
+ def subs(self, in_dict=None, *args, **kwds):
484
+ r"""
485
+ Substitute variables in the numerator and denominator of ``self``.
486
+
487
+ If a dictionary is passed, the keys are mapped to generators
488
+ of the parent ring. Otherwise, the arguments are transmitted
489
+ unchanged to the method ``subs`` of the numerator and the
490
+ denominator.
491
+
492
+ EXAMPLES::
493
+
494
+ sage: x, y = PolynomialRing(ZZ, 2, 'xy').gens()
495
+ sage: f = x^2 + y + x^2*y^2 + 5
496
+ sage: (1/f).subs(x=5) # needs sage.libs.singular
497
+ 1/(25*y^2 + y + 30)
498
+
499
+ TESTS:
500
+
501
+ Check that :issue:`37122` is fixed::
502
+
503
+ sage: # needs sage.libs.singular
504
+ sage: P = PolynomialRing(QQ, ["x%s" % i for i in range(10000)])
505
+ sage: PF = P.fraction_field()
506
+ sage: p = sum(i*P.gen(i) for i in range(5)) / sum(i*P.gen(i) for i in range(8))
507
+ sage: v = P.gen(4)
508
+ sage: p.subs({v: 100})
509
+ (x1 + 2*x2 + 3*x3 + 400)/(x1 + 2*x2 + 3*x3 + 5*x5 + 6*x6 + 7*x7 + 400)
510
+ """
511
+ if isinstance(in_dict, dict):
512
+ R = self.parent().base()
513
+ in_dict = {ZZ(m) if m in ZZ else R(m): v for m, v in in_dict.items()}
514
+
515
+ num = self._numerator.subs(in_dict, *args, **kwds)
516
+ den = self._denominator.subs(in_dict, *args, **kwds)
517
+ return num / den
518
+
519
+ def _is_atomic(self):
520
+ """
521
+ EXAMPLES::
522
+
523
+ sage: K.<x> = Frac(ZZ['x'])
524
+ sage: x._is_atomic()
525
+ True
526
+ sage: f = 1/(x+1)
527
+ sage: f._is_atomic()
528
+ False
529
+ """
530
+ return self._numerator._is_atomic() and self._denominator._is_atomic()
531
+
532
+ def _repr_(self):
533
+ """
534
+ Return a string representation of ``self``.
535
+
536
+ EXAMPLES::
537
+
538
+ sage: K.<x> = Frac(ZZ['x'])
539
+ sage: repr(x+1) # indirect doctest
540
+ 'x + 1'
541
+ sage: repr((x+1)/(x-1))
542
+ '(x + 1)/(x - 1)'
543
+ sage: repr(1/(x-1))
544
+ '1/(x - 1)'
545
+ sage: repr(1/x)
546
+ '1/x'
547
+ """
548
+ if self.is_zero():
549
+ return "0"
550
+ s = str(self._numerator)
551
+ if self._denominator != 1:
552
+ denom_string = str(self._denominator)
553
+ if self._denominator._is_atomic() and not ('*' in denom_string or '/' in denom_string):
554
+ s = "%s/%s" % (self._numerator._coeff_repr(no_space=False),
555
+ denom_string)
556
+ else:
557
+ s = "%s/(%s)" % (self._numerator._coeff_repr(no_space=False),
558
+ denom_string)
559
+ return s
560
+
561
+ def _latex_(self):
562
+ r"""
563
+ Return a latex representation of this fraction field element.
564
+
565
+ EXAMPLES::
566
+
567
+ sage: R = PolynomialRing(QQ, 'x')
568
+ sage: F = R.fraction_field()
569
+ sage: x = F.gen()
570
+ sage: a = x^2 / 1
571
+ sage: latex(a) # indirect doctest
572
+ x^{2}
573
+ sage: latex(x^2/(x^2+1))
574
+ \frac{x^{2}}{x^{2} + 1}
575
+ sage: a = 1/x
576
+ sage: latex(a)
577
+ \frac{1}{x}
578
+
579
+ TESTS::
580
+
581
+ sage: R = RR['x'] # Inexact, so no reduction.
582
+ sage: F = Frac(R)
583
+ sage: from sage.rings.fraction_field_element import FractionFieldElement
584
+ sage: z = FractionFieldElement(F, 0, R.gen(), coerce=False)
585
+ sage: z.numerator() == 0
586
+ True
587
+ sage: z.denominator() == R.gen()
588
+ True
589
+ sage: latex(z) # indirect doctest
590
+ 0
591
+ """
592
+ if self.is_zero():
593
+ return "0"
594
+ if self._denominator == 1:
595
+ return latex.latex(self._numerator)
596
+ return "\\frac{%s}{%s}" % (latex.latex(self._numerator),
597
+ latex.latex(self._denominator))
598
+
599
+ def _magma_init_(self, magma):
600
+ """
601
+ Return a string representation of ``self`` Magma can understand.
602
+
603
+ EXAMPLES::
604
+
605
+ sage: R.<x> = ZZ[]
606
+ sage: magma((x^2 + x + 1)/(x + 1)) # optional - magma # indirect doctest
607
+ (x^2 + x + 1)/(x + 1)
608
+
609
+ ::
610
+
611
+ sage: R.<x,y> = QQ[]
612
+ sage: magma((x+y)/x) # optional - magma
613
+ (x + y)/x
614
+ """
615
+ pgens = magma(self._parent).gens()
616
+
617
+ s = self._repr_()
618
+ for i, j in zip(self._parent.variable_names(), pgens):
619
+ s = s.replace(i, j.name())
620
+
621
+ return s
622
+
623
+ cpdef _add_(self, right):
624
+ """
625
+ Compute the sum of ``self`` and ``right``.
626
+
627
+ INPUT:
628
+
629
+ - ``right`` -- ``ModuleElement`` to add to ``self``
630
+
631
+ OUTPUT: sum of ``self`` and ``right``
632
+
633
+ EXAMPLES::
634
+
635
+ sage: # needs sage.libs.singular
636
+ sage: K.<x,y> = Frac(ZZ['x,y'])
637
+ sage: x + y # indirect doctest
638
+ x + y
639
+ sage: 1/x + 1/y
640
+ (x + y)/(x*y)
641
+ sage: 1/x + 1/(x*y)
642
+ (y + 1)/(x*y)
643
+
644
+ sage: Frac(CDF['x']).gen() + 3 # needs sage.rings.complex_double
645
+ x + 3.0
646
+
647
+ Subtraction is implemented by adding the negative::
648
+
649
+ sage: K.<t> = Frac(GF(7)['t'])
650
+ sage: t - 1/t # indirect doctest
651
+ (t^2 + 6)/t
652
+ """
653
+ rnum = self._numerator
654
+ rden = self._denominator
655
+ snum = (<FractionFieldElement> right)._numerator
656
+ sden = (<FractionFieldElement> right)._denominator
657
+
658
+ if (rnum.is_zero()):
659
+ return <FractionFieldElement> right
660
+ if (snum.is_zero()):
661
+ return self
662
+
663
+ if self._parent.is_exact():
664
+ try:
665
+ d = rden.gcd(sden)
666
+ if d.is_unit():
667
+ return self.__class__(self._parent, rnum*sden + rden*snum,
668
+ rden*sden, coerce=False, reduce=False)
669
+ else:
670
+ rden = rden // d
671
+ sden = sden // d
672
+ tnum = rnum * sden + rden * snum
673
+ if tnum.is_zero():
674
+ return self.__class__(self._parent, tnum,
675
+ self._parent.ring().one(), coerce=False,
676
+ reduce=False)
677
+ else:
678
+ tden = self._denominator * sden
679
+ e = tnum.gcd(d)
680
+ if not e.is_unit():
681
+ tnum = tnum // e
682
+ tden = tden // e
683
+ if not tden.is_one() and tden.is_unit():
684
+ try:
685
+ tnum = tnum * tden.inverse_of_unit()
686
+ tden = self._parent.ring().one()
687
+ except AttributeError:
688
+ pass
689
+ except NotImplementedError:
690
+ pass
691
+ return self.__class__(self._parent, tnum, tden,
692
+ coerce=False, reduce=False)
693
+ except AttributeError:
694
+ pass
695
+ except NotImplementedError:
696
+ pass
697
+ except TypeError:
698
+ pass
699
+
700
+ rnum = self._numerator
701
+ rden = self._denominator
702
+ snum = (<FractionFieldElement> right)._numerator
703
+ sden = (<FractionFieldElement> right)._denominator
704
+
705
+ return self.__class__(self._parent, rnum*sden + rden*snum, rden*sden,
706
+ coerce=False, reduce=False)
707
+
708
+ cpdef _mul_(self, right):
709
+ """
710
+ Compute the product of ``self`` and ``right``.
711
+
712
+ INPUT:
713
+
714
+ - ``right`` -- ``RingElement`` to multiply with ``self``
715
+
716
+ OUTPUT: product of ``self`` and ``right``
717
+
718
+ EXAMPLES::
719
+
720
+ sage: # needs sage.rings.finite_rings
721
+ sage: K.<t> = Frac(GF(7)['t'])
722
+ sage: a = t/(1+t)
723
+ sage: b = 3/t
724
+ sage: a * b # indirect doctest
725
+ 3/(t + 1)
726
+ """
727
+ rnum = self._numerator
728
+ rden = self._denominator
729
+ snum = (<FractionFieldElement> right)._numerator
730
+ sden = (<FractionFieldElement> right)._denominator
731
+
732
+ if (rnum.is_zero() or snum.is_zero()):
733
+ return self._parent.zero()
734
+
735
+ if self._parent.is_exact():
736
+ try:
737
+ d1 = rnum.gcd(sden)
738
+ d2 = snum.gcd(rden)
739
+ if not d1.is_unit():
740
+ rnum = rnum // d1
741
+ sden = sden // d1
742
+ if not d2.is_unit():
743
+ rden = rden // d2
744
+ snum = snum // d2
745
+ tnum = rnum * snum
746
+ tden = rden * sden
747
+ if not tden.is_one() and tden.is_unit():
748
+ try:
749
+ tnum = tnum * tden.inverse_of_unit()
750
+ tden = self._parent.ring().one()
751
+ except AttributeError:
752
+ pass
753
+ except NotImplementedError:
754
+ pass
755
+ return self.__class__(self._parent, tnum, tden,
756
+ coerce=False, reduce=False)
757
+ except AttributeError:
758
+ pass
759
+ except NotImplementedError:
760
+ pass
761
+ except TypeError:
762
+ pass
763
+
764
+ rnum = self._numerator
765
+ rden = self._denominator
766
+ snum = (<FractionFieldElement> right)._numerator
767
+ sden = (<FractionFieldElement> right)._denominator
768
+
769
+ return self.__class__(self._parent, rnum * snum, rden * sden,
770
+ coerce=False, reduce=False)
771
+
772
+ cpdef _div_(self, right):
773
+ """
774
+ Compute the quotient of ``self`` and ``right``.
775
+
776
+ INPUT:
777
+
778
+ - ``right`` -- ``RingElement`` that is the divisor
779
+
780
+ OUTPUT: quotient of ``self`` and ``right``
781
+
782
+ EXAMPLES::
783
+
784
+ sage: # needs sage.libs.singular
785
+ sage: K.<x,y,z> = Frac(ZZ['x,y,z'])
786
+ sage: a = (x+1)*(x+y)/(z-3) # indirect doctest
787
+ sage: b = (x+y)/(z-1)
788
+ sage: a/b
789
+ (x*z - x + z - 1)/(z - 3)
790
+ """
791
+ snum = (<FractionFieldElement> right)._numerator
792
+ sden = (<FractionFieldElement> right)._denominator
793
+
794
+ if snum.is_zero():
795
+ raise ZeroDivisionError("fraction field element division by zero")
796
+
797
+ rightinv = self.__class__(self._parent, sden, snum,
798
+ coerce=True, reduce=False)
799
+
800
+ return self._mul_(rightinv)
801
+
802
+ def __int__(self):
803
+ """
804
+ EXAMPLES::
805
+
806
+ sage: K = Frac(ZZ['x'])
807
+ sage: int(K(-3))
808
+ -3
809
+ sage: K.<x> = Frac(RR['x'])
810
+ sage: x/x
811
+ x/x
812
+ sage: int(x/x)
813
+ 1
814
+ sage: int(K(.5))
815
+ 0
816
+ """
817
+ if self._denominator != 1:
818
+ self.reduce()
819
+ if self._denominator == 1:
820
+ return int(self._numerator)
821
+ else:
822
+ raise TypeError("denominator must equal 1")
823
+
824
+ def __float__(self):
825
+ """
826
+ EXAMPLES::
827
+
828
+ sage: # needs sage.libs.singular
829
+ sage: K.<x,y> = Frac(ZZ['x,y'])
830
+ sage: float(x/x + y/y)
831
+ 2.0
832
+ """
833
+ return float(self._numerator) / float(self._denominator)
834
+
835
+ def __complex__(self):
836
+ """
837
+ EXAMPLES::
838
+
839
+ sage: K.<x,y> = Frac(I.parent()['x,y']) # needs sage.symbolic
840
+ sage: complex(x/(I*x) + (I*y)/y) # needs sage.symbolic
841
+ 0j
842
+ """
843
+ return complex(self._numerator) / complex(self._denominator)
844
+
845
+ def _rational_(self):
846
+ r"""
847
+ TESTS::
848
+
849
+ sage: K = Frac(ZZ['x'])
850
+ sage: QQ(K(x) / K(2*x)) # needs sage.symbolic
851
+ 1/2
852
+ """
853
+ return self._conversion(QQ)
854
+
855
+ def _conversion(self, R):
856
+ r"""
857
+ Generic conversion.
858
+
859
+ TESTS::
860
+
861
+ sage: K = Frac(ZZ['x'])
862
+ sage: ZZ(K(5)) # indirect doctest
863
+ 5
864
+ sage: ZZ(K(1) / K(2))
865
+ Traceback (most recent call last):
866
+ ...
867
+ ArithmeticError: inverse does not exist
868
+ sage: RDF(K(1) / K(2))
869
+ 0.5
870
+
871
+ sage: K.<x> = Frac(RR['x'])
872
+ sage: ZZ(2*x/x)
873
+ 2
874
+ sage: RDF(x)
875
+ Traceback (most recent call last):
876
+ ...
877
+ TypeError: ...not...constant polynomial
878
+
879
+ sage: K.<x> = Frac(QQ['x'])
880
+ sage: QQ(K(1/2))
881
+ 1/2
882
+ sage: QQ(K(1/2 + x/x))
883
+ 3/2
884
+
885
+ sage: x = polygen(QQ)
886
+ sage: A.<u> = NumberField(x^3 - 2) # needs sage.rings.number_field
887
+ sage: A((x+3) / (2*x - 1)) # needs sage.rings.number_field
888
+ 14/15*u^2 + 7/15*u + 11/15
889
+
890
+ sage: # needs sage.rings.number_field
891
+ sage: B = A['y'].fraction_field()
892
+ sage: A(B(u))
893
+ u
894
+ sage: C = A['x,y'].fraction_field()
895
+ sage: A(C(u))
896
+ u
897
+ """
898
+ if self._denominator.is_one():
899
+ return R(self._numerator)
900
+ else:
901
+ self.reduce()
902
+ num = R(self._numerator)
903
+ inv_den = R(self._denominator).inverse_of_unit()
904
+ return num * inv_den
905
+
906
+ _real_double_ = _conversion
907
+ _complex_double_ = _conversion
908
+ _mpfr_ = _conversion
909
+ _complex_mpfr_ = _conversion
910
+ _real_mpfi_ = _conversion
911
+ _complex_mpfi_ = _conversion
912
+ _arb_ = _conversion
913
+ _acb_ = _conversion
914
+ _integer_ = _conversion
915
+ _algebraic_ = _conversion
916
+ _number_field_ = _conversion
917
+
918
+ def __pow__(self, right, dummy):
919
+ r"""
920
+ Return ``self`` raised to the ``right``-th power.
921
+
922
+ Note that we need to check whether or not right is negative so we
923
+ don't set ``_numerator`` or ``_denominator`` to an element of the
924
+ fraction field instead of the underlying ring.
925
+
926
+ EXAMPLES::
927
+
928
+ sage: R = QQ['x','y']
929
+ sage: FR = R.fraction_field()
930
+ sage: x,y = FR.gens()
931
+ sage: a = x^2; a
932
+ x^2
933
+ sage: type(a.numerator()) # needs sage.libs.singular
934
+ <class 'sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular'>
935
+ sage: type(a.denominator()) # needs sage.libs.singular
936
+ <class 'sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular'>
937
+ sage: a = x^(-2); a
938
+ 1/x^2
939
+ sage: type(a.numerator()) # needs sage.libs.singular
940
+ <class 'sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular'>
941
+ sage: type(a.denominator()) # needs sage.libs.singular
942
+ <class 'sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular'>
943
+ sage: x^0
944
+ 1
945
+ sage: ((x+y)/(x-y))^2 # needs sage.libs.singular
946
+ (x^2 + 2*x*y + y^2)/(x^2 - 2*x*y + y^2)
947
+ sage: ((x+y)/(x-y))^-2 # needs sage.libs.singular
948
+ (x^2 - 2*x*y + y^2)/(x^2 + 2*x*y + y^2)
949
+ sage: ((x+y)/(x-y))^0 # needs sage.libs.singular
950
+ 1
951
+ """
952
+ snum = (<FractionFieldElement> self)._numerator
953
+ sden = (<FractionFieldElement> self)._denominator
954
+ if right == 0:
955
+ R = self.parent().ring()
956
+ return self.__class__(self.parent(),
957
+ R.one(), R.one(),
958
+ coerce=False, reduce=False)
959
+ elif right > 0:
960
+ return self.__class__(self.parent(),
961
+ snum**right, sden**right,
962
+ coerce=False, reduce=False)
963
+ else:
964
+ right = -right
965
+ return self.__class__(self.parent(),
966
+ sden**right, snum**right,
967
+ coerce=False, reduce=False)
968
+
969
+ def __neg__(self):
970
+ """
971
+ EXAMPLES::
972
+
973
+ sage: K.<t> = Frac(GF(5)['t'])
974
+ sage: f = (t^2+t)/(t+2); f
975
+ (t^2 + t)/(t + 2)
976
+ sage: -f
977
+ (4*t^2 + 4*t)/(t + 2)
978
+ """
979
+ return self.__class__(self._parent,
980
+ -self._numerator, self._denominator,
981
+ coerce=False, reduce=False)
982
+
983
+ def __abs__(self):
984
+ """
985
+ EXAMPLES::
986
+
987
+ sage: from sage.rings.fraction_field_element import FractionFieldElement
988
+ sage: abs(FractionFieldElement(QQ, -2, 3, coerce=False))
989
+ 2/3
990
+ """
991
+ return abs(self._numerator) / abs(self._denominator)
992
+
993
+ def __invert__(self):
994
+ """
995
+ EXAMPLES::
996
+
997
+ sage: K.<t> = Frac(GF(7)['t'])
998
+ sage: f = (t^2+5)/(t-1)
999
+ sage: ~f
1000
+ (t + 6)/(t^2 + 5)
1001
+ """
1002
+ if self.is_zero():
1003
+ raise ZeroDivisionError("Cannot invert 0")
1004
+ return self.__class__(self._parent,
1005
+ self._denominator, self._numerator, coerce=False, reduce=False)
1006
+
1007
+ cpdef _richcmp_(self, other, int op):
1008
+ """
1009
+ EXAMPLES::
1010
+
1011
+ sage: # needs sage.rings.finite_rings
1012
+ sage: K.<t> = Frac(GF(7)['t'])
1013
+ sage: t/t == 1
1014
+ True
1015
+ sage: t + 1/t == (t^2+1)/t
1016
+ True
1017
+ sage: t == t/5
1018
+ False
1019
+
1020
+ ::
1021
+
1022
+ sage: # needs sage.libs.singular
1023
+ sage: K.<x,y> = Frac(ZZ['x,y'])
1024
+ sage: x > y
1025
+ True
1026
+ sage: 1 > y
1027
+ False
1028
+ """
1029
+ return richcmp(self._numerator *
1030
+ (<FractionFieldElement>other)._denominator,
1031
+ self._denominator *
1032
+ (<FractionFieldElement>other)._numerator, op)
1033
+
1034
+ def valuation(self, v=None):
1035
+ """
1036
+ Return the valuation of ``self``, assuming that the numerator and
1037
+ denominator have valuation functions defined on them.
1038
+
1039
+ EXAMPLES::
1040
+
1041
+ sage: x = PolynomialRing(RationalField(),'x').gen()
1042
+ sage: f = (x^3 + x)/(x^2 - 2*x^3)
1043
+ sage: f
1044
+ (-1/2*x^2 - 1/2)/(x^2 - 1/2*x)
1045
+ sage: f.valuation()
1046
+ -1
1047
+ sage: f.valuation(x^2 + 1)
1048
+ 1
1049
+ """
1050
+ return self._numerator.valuation(v) - self._denominator.valuation(v)
1051
+
1052
+ def __bool__(self):
1053
+ """
1054
+ Return ``True`` if this element is nonzero.
1055
+
1056
+ EXAMPLES::
1057
+
1058
+ sage: # needs sage.libs.singular
1059
+ sage: F = ZZ['x,y'].fraction_field()
1060
+ sage: x,y = F.gens()
1061
+ sage: t = F(0)/x
1062
+ sage: bool(t)
1063
+ False
1064
+
1065
+ ::
1066
+
1067
+ sage: bool(1/x) # needs sage.libs.singular
1068
+ True
1069
+ """
1070
+ return not self._numerator.is_zero()
1071
+
1072
+ def is_zero(self):
1073
+ """
1074
+ Return ``True`` if this element is equal to zero.
1075
+
1076
+ EXAMPLES::
1077
+
1078
+ sage: # needs sage.libs.singular
1079
+ sage: F = ZZ['x,y'].fraction_field()
1080
+ sage: x,y = F.gens()
1081
+ sage: t = F(0)/x
1082
+ sage: t.is_zero()
1083
+ True
1084
+ sage: u = 1/x - 1/x
1085
+ sage: u.is_zero()
1086
+ True
1087
+ sage: u.parent() is F
1088
+ True
1089
+ """
1090
+ return self._numerator.is_zero()
1091
+
1092
+ def is_one(self):
1093
+ """
1094
+ Return ``True`` if this element is equal to one.
1095
+
1096
+ EXAMPLES::
1097
+
1098
+ sage: # needs sage.libs.singular
1099
+ sage: F = ZZ['x,y'].fraction_field()
1100
+ sage: x,y = F.gens()
1101
+ sage: (x/x).is_one()
1102
+ True
1103
+ sage: (x/y).is_one()
1104
+ False
1105
+ """
1106
+ return self._numerator == self._denominator
1107
+
1108
+ def _symbolic_(self, ring):
1109
+ """
1110
+ Return ``self`` as a fraction in the ring ``ring``. Used for
1111
+ :func:`symbolic_expression` in creating a symbolic expression of
1112
+ ``self``.
1113
+
1114
+ EXAMPLES::
1115
+
1116
+ sage: # needs sage.libs.singular
1117
+ sage: F = ZZ['x,y'].fraction_field()
1118
+ sage: x,y = F.gens()
1119
+ sage: elt = (2*x + 2*y) / (3*x - 3*y); elt
1120
+ (2*x + 2*y)/(3*x - 3*y)
1121
+ sage: elt._symbolic_(SR) # needs sage.symbolic
1122
+ 2/3*(x + y)/(x - y)
1123
+ sage: symbolic_expression(elt) # needs sage.symbolic
1124
+ 2/3*(x + y)/(x - y)
1125
+ """
1126
+ return ring(self._numerator)/ring(self._denominator)
1127
+
1128
+ def __reduce__(self):
1129
+ """
1130
+ For pickling.
1131
+
1132
+ EXAMPLES::
1133
+
1134
+ sage: # needs sage.libs.singular
1135
+ sage: F = ZZ['x,y'].fraction_field()
1136
+ sage: f = F.random_element()
1137
+ sage: loads(f.dumps()) == f
1138
+ True
1139
+ """
1140
+ return (make_element,
1141
+ (self._parent, self._numerator, self._denominator))
1142
+
1143
+ def _evaluate_polynomial(self, pol):
1144
+ """
1145
+ Return the value of the univariate polynomial ``pol`` evaluated at this
1146
+ fraction.
1147
+
1148
+ EXAMPLES::
1149
+
1150
+ sage: R.<x> = QQ[]
1151
+ sage: pol = x^3 + 1
1152
+ sage: pol(1/x) # indirect doctest
1153
+ (x^3 + 1)/x^3
1154
+
1155
+ This method only works for fractions with numerator one::
1156
+
1157
+ sage: fraction = 1/x
1158
+ sage: fraction._evaluate_polynomial(pol)
1159
+ (x^3 + 1)/x^3
1160
+ sage: fraction = 2/x
1161
+ sage: fraction._evaluate_polynomial(pol)
1162
+ Traceback (most recent call last):
1163
+ ...
1164
+ NotImplementedError
1165
+
1166
+ TESTS::
1167
+
1168
+ sage: # needs sage.libs.singular
1169
+ sage: R.<y,z> = ZZ[]
1170
+ sage: (~(y+z))._evaluate_polynomial(pol)
1171
+ (y^3 + 3*y^2*z + 3*y*z^2 + z^3 + 1)/(y^3 + 3*y^2*z + 3*y*z^2 + z^3)
1172
+ sage: rat = (y+z)/y
1173
+ sage: rat._evaluate_polynomial(pol)
1174
+ Traceback (most recent call last):
1175
+ ...
1176
+ NotImplementedError
1177
+ sage: pol(rat)
1178
+ (2*y^3 + 3*y^2*z + 3*y*z^2 + z^3)/y^3
1179
+
1180
+ Check that :issue:`25440` has been resolved::
1181
+
1182
+ sage: R.<x> = GF(2)[]
1183
+ sage: S.<y> = R.fraction_field()[]
1184
+ sage: (y+1)(R.one())
1185
+ 0
1186
+
1187
+ Check that inexact elements are treated correctly::
1188
+
1189
+ sage: # needs sage.rings.padics
1190
+ sage: K = Qp(2, 5)
1191
+ sage: R.<x> = K[]
1192
+ sage: L = R.fraction_field()
1193
+ sage: S.<y> = L[]
1194
+ sage: y(K(1,1)/x)
1195
+ (1 + O(2))/((1 + O(2))*x)
1196
+ """
1197
+ if self.numerator().is_one():
1198
+ denominator = self.denominator()
1199
+ if denominator.is_one():
1200
+ # If the numerator and the denominator are one, then the
1201
+ # following code would make us run into an infinite loop, see
1202
+ # #25440.
1203
+ # We could just sum up the coefficients of pol, but this is
1204
+ # nothing special about fraction field elements, so the general
1205
+ # polynomial code should take care of this (and also of correct
1206
+ # handling of an inexact 1 in this case.)
1207
+ raise NotImplementedError
1208
+
1209
+ if not self.parent().is_exact():
1210
+ # Account for precision information that inexact elements might
1211
+ # carry in their numerator.
1212
+ denominator *= self.parent()(~self.numerator())
1213
+
1214
+ return pol.reverse()(denominator)/denominator**pol.degree()
1215
+
1216
+ raise NotImplementedError
1217
+
1218
+ def specialization(self, D=None, phi=None):
1219
+ """
1220
+ Return the specialization of a fraction element of a polynomial ring.
1221
+ """
1222
+ numerator = self.numerator().specialization(D, phi)
1223
+ denominator = self.denominator().specialization(D, phi)
1224
+ return numerator / denominator
1225
+
1226
+ cdef class FractionFieldElement_1poly_field(FractionFieldElement):
1227
+ """
1228
+ A fraction field element where the parent is the fraction field of a
1229
+ univariate polynomial ring over a field.
1230
+
1231
+ Many of the functions here are included for coherence with number fields.
1232
+ """
1233
+
1234
+ def __init__(self, parent, numerator, denominator=1,
1235
+ coerce=True, reduce=True):
1236
+ """
1237
+ TESTS:
1238
+
1239
+ sage: P.<x> = QQ[]
1240
+ sage: a = (2*x^2)/x
1241
+ sage: ~a
1242
+ 1/2/x
1243
+ sage: 1/a
1244
+ 1/2/x
1245
+ """
1246
+ FractionFieldElement.__init__(self, parent, numerator, denominator,
1247
+ coerce, reduce)
1248
+ if not reduce:
1249
+ self.normalize_leading_coefficients()
1250
+
1251
+ cdef normalize_leading_coefficients(self):
1252
+ """
1253
+ See :meth:`reduce`.
1254
+ """
1255
+ invlc = ~self._denominator.leading_coefficient()
1256
+ self._denominator = self._denominator.monic()
1257
+ self._numerator *= invlc
1258
+
1259
+ def is_integral(self):
1260
+ """
1261
+ Return whether this element is actually a polynomial.
1262
+
1263
+ EXAMPLES::
1264
+
1265
+ sage: R.<t> = QQ[]
1266
+ sage: elt = (t^2 + t - 2) / (t + 2); elt # == (t + 2)*(t - 1)/(t + 2)
1267
+ t - 1
1268
+ sage: elt.is_integral()
1269
+ True
1270
+ sage: elt = (t^2 - t) / (t+2); elt # == t*(t - 1)/(t + 2)
1271
+ (t^2 - t)/(t + 2)
1272
+ sage: elt.is_integral()
1273
+ False
1274
+ """
1275
+ if self.denominator() != 1:
1276
+ self.reduce()
1277
+ return self.denominator() == 1
1278
+
1279
+ def support(self):
1280
+ """
1281
+ Return a sorted list of primes dividing either the numerator or
1282
+ denominator of this element.
1283
+
1284
+ EXAMPLES::
1285
+
1286
+ sage: R.<t> = QQ[]
1287
+ sage: h = (t^14 + 2*t^12 - 4*t^11 - 8*t^9 + 6*t^8 + 12*t^6 - 4*t^5
1288
+ ....: - 8*t^3 + t^2 + 2)/(t^6 + 6*t^5 + 9*t^4 - 2*t^2 - 12*t - 18)
1289
+ sage: h.support() # needs sage.libs.pari
1290
+ [t - 1, t + 3, t^2 + 2, t^2 + t + 1, t^4 - 2]
1291
+ """
1292
+ L = [fac[0] for fac in self.numerator().factor()] + [fac[0] for fac in self.denominator().factor()]
1293
+ L.sort()
1294
+ return L
1295
+
1296
+ cpdef reduce(self):
1297
+ """
1298
+ Pick a normalized representation of ``self``.
1299
+
1300
+ In particular, for any a == b, after normalization they will have the
1301
+ same numerator and denominator.
1302
+
1303
+ EXAMPLES:
1304
+
1305
+ For univariate rational functions over a field, we have::
1306
+
1307
+ sage: R.<x> = QQ[]
1308
+ sage: (2 + 2*x) / (4*x) # indirect doctest
1309
+ (1/2*x + 1/2)/x
1310
+
1311
+ Compare with::
1312
+
1313
+ sage: R.<x> = ZZ[]
1314
+ sage: (2 + 2*x) / (4*x)
1315
+ (x + 1)/(2*x)
1316
+ """
1317
+ if self._is_reduced:
1318
+ return
1319
+ super(self.__class__, self).reduce()
1320
+ self.normalize_leading_coefficients()
1321
+
1322
+
1323
+ def make_element(parent, numerator, denominator):
1324
+ """
1325
+ Used for unpickling :class:`FractionFieldElement` objects (and subclasses).
1326
+
1327
+ EXAMPLES::
1328
+
1329
+ sage: # needs sage.libs.singular
1330
+ sage: from sage.rings.fraction_field_element import make_element
1331
+ sage: R = ZZ['x,y']
1332
+ sage: x,y = R.gens()
1333
+ sage: F = R.fraction_field()
1334
+ sage: make_element(F, 1 + x, 1 + y)
1335
+ (x + 1)/(y + 1)
1336
+ """
1337
+
1338
+ return parent._element_class(parent, numerator, denominator)
1339
+
1340
+
1341
+ def make_element_old(parent, cdict):
1342
+ """
1343
+ Used for unpickling old :class:`FractionFieldElement` pickles.
1344
+
1345
+ EXAMPLES::
1346
+
1347
+ sage: from sage.rings.fraction_field_element import make_element_old
1348
+ sage: R.<x,y> = ZZ[]
1349
+ sage: F = R.fraction_field()
1350
+ sage: make_element_old(F, {'_FractionFieldElement__numerator': x + y,
1351
+ ....: '_FractionFieldElement__denominator': x - y})
1352
+ (x + y)/(x - y)
1353
+ """
1354
+ return FractionFieldElement(parent,
1355
+ cdict['_FractionFieldElement__numerator'],
1356
+ cdict['_FractionFieldElement__denominator'],
1357
+ coerce=False, reduce=False)