passagemath-combinat 10.6.1__cp312-cp312-musllinux_1_2_aarch64.whl → 10.8.1a1__cp312-cp312-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 (221) hide show
  1. passagemath_combinat/__init__.py +3 -0
  2. {passagemath_combinat-10.6.1.dist-info → passagemath_combinat-10.8.1a1.dist-info}/METADATA +17 -20
  3. {passagemath_combinat-10.6.1.dist-info → passagemath_combinat-10.8.1a1.dist-info}/RECORD +220 -218
  4. {passagemath_combinat-10.6.1.dist-info → passagemath_combinat-10.8.1a1.dist-info}/WHEEL +1 -1
  5. passagemath_combinat-10.8.1a1.dist-info/top_level.txt +3 -0
  6. sage/algebras/affine_nil_temperley_lieb.py +3 -3
  7. sage/algebras/all.py +0 -1
  8. sage/algebras/askey_wilson.py +1 -1
  9. sage/algebras/associated_graded.py +2 -2
  10. sage/algebras/cellular_basis.py +3 -6
  11. sage/algebras/cluster_algebra.py +2 -3
  12. sage/algebras/down_up_algebra.py +6 -6
  13. sage/algebras/free_algebra.py +3 -32
  14. sage/algebras/free_algebra_element.py +21 -25
  15. sage/algebras/free_algebra_quotient_element.py +9 -38
  16. sage/algebras/free_zinbiel_algebra.py +4 -3
  17. sage/algebras/hall_algebra.py +2 -2
  18. sage/algebras/hecke_algebras/ariki_koike_algebra.py +8 -8
  19. sage/algebras/hecke_algebras/ariki_koike_specht_modules.py +2 -2
  20. sage/algebras/hecke_algebras/cubic_hecke_algebra.py +11 -14
  21. sage/algebras/hecke_algebras/cubic_hecke_base_ring.py +1 -1
  22. sage/algebras/hecke_algebras/cubic_hecke_matrix_rep.py +5 -5
  23. sage/algebras/iwahori_hecke_algebra.py +59 -57
  24. sage/algebras/jordan_algebra.py +97 -89
  25. sage/algebras/lie_conformal_algebras/abelian_lie_conformal_algebra.py +6 -6
  26. sage/algebras/lie_conformal_algebras/affine_lie_conformal_algebra.py +14 -12
  27. sage/algebras/lie_conformal_algebras/bosonic_ghosts_lie_conformal_algebra.py +6 -6
  28. sage/algebras/lie_conformal_algebras/fermionic_ghosts_lie_conformal_algebra.py +4 -4
  29. sage/algebras/lie_conformal_algebras/finitely_freely_generated_lca.py +13 -13
  30. sage/algebras/lie_conformal_algebras/free_bosons_lie_conformal_algebra.py +8 -6
  31. sage/algebras/lie_conformal_algebras/free_fermions_lie_conformal_algebra.py +7 -5
  32. sage/algebras/lie_conformal_algebras/freely_generated_lie_conformal_algebra.py +7 -7
  33. sage/algebras/lie_conformal_algebras/graded_lie_conformal_algebra.py +6 -5
  34. sage/algebras/lie_conformal_algebras/lie_conformal_algebra.py +12 -11
  35. sage/algebras/lie_conformal_algebras/lie_conformal_algebra_element.py +3 -3
  36. sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_basis.py +3 -3
  37. sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_structure_coefs.py +11 -11
  38. sage/algebras/lie_conformal_algebras/n2_lie_conformal_algebra.py +3 -3
  39. sage/algebras/lie_conformal_algebras/neveu_schwarz_lie_conformal_algebra.py +8 -7
  40. sage/algebras/lie_conformal_algebras/virasoro_lie_conformal_algebra.py +9 -8
  41. sage/algebras/lie_conformal_algebras/weyl_lie_conformal_algebra.py +6 -5
  42. sage/algebras/nil_coxeter_algebra.py +4 -4
  43. sage/algebras/q_commuting_polynomials.py +6 -6
  44. sage/algebras/q_system.py +3 -3
  45. sage/algebras/quantum_clifford.py +8 -8
  46. sage/algebras/quantum_groups/fock_space.py +48 -8
  47. sage/algebras/quantum_groups/quantum_group_gap.py +5 -7
  48. sage/algebras/quantum_matrix_coordinate_algebra.py +7 -7
  49. sage/algebras/quantum_oscillator.py +3 -3
  50. sage/algebras/quaternion_algebra_element.py +5 -3
  51. sage/algebras/schur_algebra.py +3 -3
  52. sage/algebras/shuffle_algebra.py +5 -8
  53. sage/algebras/splitting_algebra.py +129 -85
  54. sage/algebras/tensor_algebra.py +7 -7
  55. sage/algebras/yangian.py +16 -15
  56. sage/algebras/yokonuma_hecke_algebra.py +13 -11
  57. sage/combinat/all.py +9 -0
  58. sage/combinat/all__sagemath_combinat.py +1 -0
  59. sage/combinat/alternating_sign_matrix.py +36 -29
  60. sage/combinat/baxter_permutations.py +32 -12
  61. sage/combinat/bijectionist.py +13 -17
  62. sage/combinat/chas/fsym.py +6 -6
  63. sage/combinat/chas/wqsym.py +23 -29
  64. sage/combinat/colored_permutations.py +9 -11
  65. sage/combinat/colored_permutations_representations.py +13 -12
  66. sage/combinat/composition_tableau.py +2 -2
  67. sage/combinat/constellation.py +57 -30
  68. sage/combinat/crystals/affine_factorization.py +5 -4
  69. sage/combinat/crystals/alcove_path.py +2 -2
  70. sage/combinat/crystals/fully_commutative_stable_grothendieck.py +3 -2
  71. sage/combinat/crystals/infinity_crystals.py +18 -18
  72. sage/combinat/crystals/kac_modules.py +1 -1
  73. sage/combinat/crystals/kirillov_reshetikhin.py +2 -2
  74. sage/combinat/crystals/letters.cpython-312-aarch64-linux-musl.so +0 -0
  75. sage/combinat/crystals/littelmann_path.py +1 -1
  76. sage/combinat/crystals/pbw_datum.cpython-312-aarch64-linux-musl.so +0 -0
  77. sage/combinat/crystals/pbw_datum.pyx +3 -2
  78. sage/combinat/crystals/spins.cpython-312-aarch64-linux-musl.so +0 -0
  79. sage/combinat/crystals/tensor_product.py +7 -5
  80. sage/combinat/crystals/tensor_product_element.cpython-312-aarch64-linux-musl.so +0 -0
  81. sage/combinat/debruijn_sequence.cpython-312-aarch64-linux-musl.so +0 -0
  82. sage/combinat/debruijn_sequence.pyx +1 -2
  83. sage/combinat/degree_sequences.cpython-312-aarch64-linux-musl.so +0 -0
  84. sage/combinat/degree_sequences.pyx +241 -188
  85. sage/combinat/derangements.py +28 -22
  86. sage/combinat/diagram_algebras.py +12 -14
  87. sage/combinat/dyck_word.py +15 -14
  88. sage/combinat/e_one_star.py +1 -1
  89. sage/combinat/expnums.cpython-312-aarch64-linux-musl.so +0 -0
  90. sage/combinat/fast_vector_partitions.cpython-312-aarch64-linux-musl.so +0 -0
  91. sage/combinat/fqsym.py +13 -19
  92. sage/combinat/free_dendriform_algebra.py +2 -2
  93. sage/combinat/free_prelie_algebra.py +2 -2
  94. sage/combinat/fully_commutative_elements.py +8 -8
  95. sage/combinat/fully_packed_loop.py +9 -9
  96. sage/combinat/gelfand_tsetlin_patterns.py +4 -5
  97. sage/combinat/gray_codes.py +3 -4
  98. sage/combinat/grossman_larson_algebras.py +2 -2
  99. sage/combinat/growth.py +13 -13
  100. sage/combinat/hall_polynomial.py +1 -1
  101. sage/combinat/hillman_grassl.py +1 -1
  102. sage/combinat/integer_matrices.py +5 -7
  103. sage/combinat/k_tableau.py +8 -7
  104. sage/combinat/kazhdan_lusztig.py +3 -3
  105. sage/combinat/key_polynomial.py +845 -298
  106. sage/combinat/knutson_tao_puzzles.py +11 -13
  107. sage/combinat/matrices/hadamard_matrix.py +1 -1
  108. sage/combinat/matrices/latin.py +75 -92
  109. sage/combinat/misc.py +3 -3
  110. sage/combinat/multiset_partition_into_sets_ordered.py +27 -10
  111. sage/combinat/ncsf_qsym/generic_basis_code.py +5 -5
  112. sage/combinat/ncsf_qsym/ncsf.py +6 -5
  113. sage/combinat/ncsf_qsym/qsym.py +9 -17
  114. sage/combinat/ncsym/ncsym.py +8 -12
  115. sage/combinat/nu_dyck_word.py +1 -1
  116. sage/combinat/parallelogram_polyomino.py +3 -5
  117. sage/combinat/parking_functions.py +6 -5
  118. sage/combinat/partition_algebra.py +22 -57
  119. sage/combinat/partition_kleshchev.py +4 -4
  120. sage/combinat/partition_tuple.py +12 -10
  121. sage/combinat/plane_partition.py +10 -13
  122. sage/combinat/positive_integer_semigroup_test.py +17 -0
  123. sage/combinat/q_bernoulli.cpython-312-aarch64-linux-musl.so +0 -0
  124. sage/combinat/quickref.py +2 -2
  125. sage/combinat/recognizable_series.py +2 -2
  126. sage/combinat/regular_sequence.py +7 -7
  127. sage/combinat/regular_sequence_bounded.py +15 -21
  128. sage/combinat/restricted_growth.py +3 -3
  129. sage/combinat/ribbon.py +3 -3
  130. sage/combinat/rigged_configurations/bijection.py +3 -3
  131. sage/combinat/rigged_configurations/rigged_partition.cpython-312-aarch64-linux-musl.so +0 -0
  132. sage/combinat/rsk.py +2 -0
  133. sage/combinat/schubert_polynomial.py +11 -2
  134. sage/combinat/set_partition.py +3 -7
  135. sage/combinat/set_partition_iterator.cpython-312-aarch64-linux-musl.so +0 -0
  136. sage/combinat/set_partition_iterator.pyx +0 -1
  137. sage/combinat/set_partition_ordered.py +2 -2
  138. sage/combinat/sf/classical.py +1 -1
  139. sage/combinat/sf/dual.py +4 -8
  140. sage/combinat/sf/elementary.py +13 -7
  141. sage/combinat/sf/hall_littlewood.py +10 -8
  142. sage/combinat/sf/homogeneous.py +6 -3
  143. sage/combinat/sf/jack.py +11 -9
  144. sage/combinat/sf/llt.py +4 -5
  145. sage/combinat/sf/macdonald.py +10 -11
  146. sage/combinat/sf/monomial.py +6 -0
  147. sage/combinat/sf/ns_macdonald.py +92 -51
  148. sage/combinat/sf/powersum.py +9 -14
  149. sage/combinat/sf/schur.py +6 -0
  150. sage/combinat/sf/sf.py +21 -19
  151. sage/combinat/sf/sfa.py +13 -64
  152. sage/combinat/shifted_primed_tableau.py +5 -7
  153. sage/combinat/shuffle.py +1 -1
  154. sage/combinat/sine_gordon.py +18 -38
  155. sage/combinat/skew_partition.py +9 -12
  156. sage/combinat/skew_tableau.py +2 -7
  157. sage/combinat/sloane_functions.py +1 -1
  158. sage/combinat/species/all.py +67 -2
  159. sage/combinat/species/characteristic_species.py +3 -0
  160. sage/combinat/species/composition_species.py +3 -0
  161. sage/combinat/species/cycle_species.py +4 -0
  162. sage/combinat/species/empty_species.py +3 -0
  163. sage/combinat/species/functorial_composition_species.py +3 -0
  164. sage/combinat/species/generating_series.py +3 -0
  165. sage/combinat/species/library.py +3 -0
  166. sage/combinat/species/linear_order_species.py +3 -0
  167. sage/combinat/species/partition_species.py +3 -0
  168. sage/combinat/species/permutation_species.py +4 -0
  169. sage/combinat/species/product_species.py +3 -0
  170. sage/combinat/species/recursive_species.py +3 -0
  171. sage/combinat/species/set_species.py +3 -0
  172. sage/combinat/species/species.py +13 -7
  173. sage/combinat/species/structure.py +8 -9
  174. sage/combinat/species/subset_species.py +3 -0
  175. sage/combinat/species/sum_species.py +3 -0
  176. sage/combinat/subword.py +4 -1
  177. sage/combinat/subword_complex.py +7 -7
  178. sage/combinat/subword_complex_c.cpython-312-aarch64-linux-musl.so +0 -0
  179. sage/combinat/superpartition.py +1 -1
  180. sage/combinat/symmetric_group_algebra.py +9 -9
  181. sage/combinat/symmetric_group_representations.py +5 -5
  182. sage/combinat/t_sequences.py +4 -4
  183. sage/combinat/tableau.py +3 -4
  184. sage/combinat/tableau_tuple.py +2 -2
  185. sage/combinat/tiling.py +39 -42
  186. sage/combinat/triangles_FHM.py +38 -15
  187. sage/combinat/tutorial.py +2 -2
  188. sage/combinat/vector_partition.py +43 -31
  189. sage/combinat/words/abstract_word.py +4 -4
  190. sage/combinat/words/alphabet.py +12 -12
  191. sage/combinat/words/finite_word.py +25 -229
  192. sage/combinat/words/infinite_word.py +1 -1
  193. sage/combinat/words/morphic.py +13 -13
  194. sage/combinat/words/morphism.py +3 -12
  195. sage/combinat/words/paths.py +16 -17
  196. sage/combinat/words/word.py +60 -35
  197. sage/combinat/words/word_char.cpython-312-aarch64-linux-musl.so +0 -0
  198. sage/combinat/words/word_char.pyx +46 -7
  199. sage/combinat/words/word_datatypes.cpython-312-aarch64-linux-musl.so +0 -0
  200. sage/combinat/words/word_generators.py +39 -38
  201. sage/databases/findstat.py +72 -31
  202. sage/databases/oeis.py +125 -25
  203. sage/databases/sloane.py +14 -8
  204. sage/games/sudoku_backtrack.cpython-312-aarch64-linux-musl.so +0 -0
  205. sage/groups/indexed_free_group.py +3 -4
  206. sage/libs/symmetrica/symmetrica.cpython-312-aarch64-linux-musl.so +0 -0
  207. sage/libs/symmetrica/symmetrica.pxi +1 -0
  208. sage/monoids/automatic_semigroup.py +1 -3
  209. sage/monoids/free_abelian_monoid.py +7 -33
  210. sage/monoids/free_abelian_monoid_element.cpython-312-aarch64-linux-musl.so +0 -0
  211. sage/monoids/free_monoid.py +8 -40
  212. sage/monoids/free_monoid_element.py +1 -9
  213. sage/monoids/string_monoid.py +5 -2
  214. sage/monoids/string_monoid_element.py +12 -66
  215. sage/rings/all__sagemath_combinat.py +7 -0
  216. sage/sat/solvers/__init__.py +3 -4
  217. sage/sat/solvers/cryptominisat.py +2 -3
  218. sage/sat/solvers/picosat.py +2 -3
  219. sage/sat/solvers/sat_lp.py +2 -2
  220. sage/sat/solvers/satsolver.cpython-312-aarch64-linux-musl.so +0 -0
  221. passagemath_combinat-10.6.1.dist-info/top_level.txt +0 -2
@@ -34,18 +34,18 @@ AUTHORS:
34
34
  # https://www.gnu.org/licenses/
35
35
  # ****************************************************************************
36
36
 
37
-
38
37
  from warnings import warn
39
38
 
39
+ from sage.misc.flatten import flatten as flatten_list
40
40
  from sage.misc.verbose import verbose
41
41
  from sage.misc.cachefunc import cached_method
42
42
  from sage.rings.polynomial.polynomial_quotient_ring import PolynomialQuotientRing_domain
43
43
  from sage.rings.polynomial.polynomial_quotient_ring_element import PolynomialQuotientRingElement
44
44
 
45
45
 
46
- # ------------------------------------------------------------------------------------------------------------------
46
+ # -------------------------------------------------------------------------
47
47
  # Element class for the splitting algebra
48
- # --------------------------------------------------------------------------------------------------------
48
+ # -------------------------------------------------------------------------
49
49
  class SplittingAlgebraElement(PolynomialQuotientRingElement):
50
50
  r"""
51
51
  Element class for :class:`SplittingAlgebra`.
@@ -86,7 +86,7 @@ class SplittingAlgebraElement(PolynomialQuotientRingElement):
86
86
 
87
87
  return super().__invert__()
88
88
 
89
- def is_unit(self):
89
+ def is_unit(self) -> bool:
90
90
  r"""
91
91
  Return ``True`` if ``self`` is invertible.
92
92
 
@@ -103,7 +103,7 @@ class SplittingAlgebraElement(PolynomialQuotientRingElement):
103
103
 
104
104
  return super().is_unit()
105
105
 
106
- def monomial_coefficients(self, copy=True):
106
+ def monomial_coefficients(self, copy=True) -> dict:
107
107
  r"""
108
108
  Return the dictionary of ``self`` according to its lift to the cover.
109
109
 
@@ -124,9 +124,9 @@ class SplittingAlgebraElement(PolynomialQuotientRingElement):
124
124
 
125
125
  dict = monomial_coefficients
126
126
 
127
- # ------------------------------------------------------------------------------------------------------------------
127
+ # ---------------------------------------------------------------------------
128
128
  # Parent class of the splitting algebra
129
- # --------------------------------------------------------------------------------------------------------
129
+ # ---------------------------------------------------------------------------
130
130
 
131
131
 
132
132
  class SplittingAlgebra(PolynomialQuotientRing_domain):
@@ -204,7 +204,8 @@ class SplittingAlgebra(PolynomialQuotientRing_domain):
204
204
  """
205
205
  Element = SplittingAlgebraElement
206
206
 
207
- def __init__(self, monic_polynomial, names='X', iterate=True, warning=True):
207
+ def __init__(self, monic_polynomial, names='X',
208
+ iterate=True, warning=True) -> None:
208
209
  r"""
209
210
  Python constructor.
210
211
 
@@ -213,21 +214,20 @@ class SplittingAlgebra(PolynomialQuotientRing_domain):
213
214
  sage: from sage.algebras.splitting_algebra import SplittingAlgebra
214
215
  sage: Lw.<w> = LaurentPolynomialRing(ZZ)
215
216
  sage: PuvLw.<u,v> = Lw[]; t = polygen(PuvLw)
216
- sage: S.<x, y> = SplittingAlgebra(t^3 - u*t^2 + v*t - w, warning=False)
217
+ sage: poly = t^3 - u*t^2 + v*t - w
218
+ sage: S.<x, y> = SplittingAlgebra(poly, warning=False)
217
219
  sage: TestSuite(S).run()
218
220
  """
219
-
220
- # ---------------------------------------------------------------------------------
221
+ # ---------------------------------------------------------------
221
222
  # checking input parameters
222
- # ---------------------------------------------------------------------------------
223
-
223
+ # ---------------------------------------------------------------
224
224
  base_ring = monic_polynomial.base_ring()
225
225
  if not monic_polynomial.is_monic():
226
226
  raise ValueError("given polynomial must be monic")
227
227
  deg = monic_polynomial.degree()
228
228
 
229
229
  from sage.structure.category_object import normalize_names
230
- self._root_names = normalize_names(deg-1, names)
230
+ self._root_names = normalize_names(deg - 1, names)
231
231
  root_names = list(self._root_names)
232
232
  verbose("Create splitting algebra to base ring %s and polynomial %s (%s %s)"
233
233
  % (base_ring, monic_polynomial, iterate, warning))
@@ -243,7 +243,7 @@ class SplittingAlgebra(PolynomialQuotientRing_domain):
243
243
  if base_ring not in Rings():
244
244
  raise TypeError("base_ring must be a ring")
245
245
  if warning:
246
- warn('Assuming %s to be an integral domain!' % base_ring)
246
+ warn(f'Assuming {base_ring} to be an integral domain!')
247
247
 
248
248
  if deg < 1:
249
249
  raise ValueError("the degree of the polynomial must positive")
@@ -255,9 +255,9 @@ class SplittingAlgebra(PolynomialQuotientRing_domain):
255
255
  if isinstance(base_ring, SplittingAlgebra):
256
256
  self._invertible_elements = base_ring._invertible_elements
257
257
 
258
- # ------------------------------------------------------------------------------------
258
+ # -----------------------------------------------------------
259
259
  # taking next root_name
260
- # ------------------------------------------------------------------------------------
260
+ # -----------------------------------------------------------
261
261
  root_name = root_names[0]
262
262
  p = monic_polynomial.change_variable_name(root_name)
263
263
  P = p.parent()
@@ -270,16 +270,34 @@ class SplittingAlgebra(PolynomialQuotientRing_domain):
270
270
  # assuming this has been checked mathematically before
271
271
  self._set_modulus_irreducible_ = True
272
272
  if warning:
273
- warn('Assuming %s to have maximal Galois group!' % (monic_polynomial))
274
- warning = False # one warning must be enough
273
+ def_pol = monic_polynomial
274
+ if isinstance(base_ring, SplittingAlgebra):
275
+ # Here we are inside a recursion. Using the splitting field
276
+ # over the fractional field of the scalar base ring we may
277
+ # find a reason to avoid the warning.
278
+ def_pol = base_ring.defining_polynomial()
279
+ F = base_ring.scalar_base_ring().fraction_field()
280
+ def_pol_f = def_pol.change_ring(F)
281
+ try:
282
+ E = def_pol_f.splitting_field('Ex')
283
+ if E.degree() == def_pol_f.degree().factorial():
284
+ # Galois group is maximal
285
+ warning = False
286
+ except NotImplementedError:
287
+ pass
288
+ if warning:
289
+ warn(f'Assuming {def_pol} to have maximal Galois group!')
290
+ warning = False # one warning must be enough
275
291
 
276
292
  verbose("P %s defined:" % (P))
277
293
 
278
294
  if deg > 2 and iterate:
279
- # ------------------------------------------------------------------------------------
295
+ # -----------------------------------------------------------
280
296
  # successive solution via recursion (on base_ring_step)
281
- # ------------------------------------------------------------------------------------
282
- base_ring_step = SplittingAlgebra(monic_polynomial, tuple(root_names), iterate=False, warning=False)
297
+ # -----------------------------------------------------------
298
+ base_ring_step = SplittingAlgebra(monic_polynomial,
299
+ tuple(root_names),
300
+ iterate=False, warning=warning)
283
301
  first_root = base_ring_step.gen()
284
302
 
285
303
  verbose("base_ring_step %s defined:" % (base_ring_step))
@@ -297,7 +315,8 @@ class SplittingAlgebra(PolynomialQuotientRing_domain):
297
315
 
298
316
  verbose("Invoking recursion with: %s" % (q,))
299
317
 
300
- SplittingAlgebra.__init__(self, q, root_names_reduces, warning=False)
318
+ SplittingAlgebra.__init__(self, q, root_names_reduces,
319
+ warning=warning)
301
320
 
302
321
  splitting_roots = base_ring_step._splitting_roots + self._splitting_roots
303
322
  coefficients_list = base_ring_step._coefficients_list + self._coefficients_list
@@ -329,10 +348,13 @@ class SplittingAlgebra(PolynomialQuotientRing_domain):
329
348
  verbose("splitting_roots: %s embedded" % (self._splitting_roots))
330
349
 
331
350
  # --------------------------------------------------------------------
332
- # try to calculate inverses of the roots. This is possible if the original polynomial
333
- # has an invertible constant term. For example let cf = [-w, v,-u, 1] that is
334
- # p = h^3 -u*h^2 + v*h -w, than u = x + y + z, v = x*y + x*z + y*z, w = x*y*z. If
335
- # w is invertible then 1/x = (v -(u-x)*x)/w, 1/y = (v -(u-y)*y)/w, 1/z = (v -(u-z)*z)/w
351
+ # try to calculate inverses of the roots. This is possible if
352
+ # the original polynomial has an invertible constant term. For
353
+ # example let cf = [-w, v,-u, 1] that is
354
+ # p = h^3 -u*h^2 + v*h -w, then
355
+ # u = x + y + z, v = x*y + x*z + y*z, w = x*y*z. If w is
356
+ # invertible then 1/x = (v -(u-x)*x)/w, 1/y = (v -(u-y)*y)/w,
357
+ # 1/z = (v -(u-z)*z)/w
336
358
  # -----------------------------------------------------------------
337
359
  # first find the polynomial with invertible constant coefficient
338
360
  # -----------------------------------------------------------------
@@ -352,18 +374,18 @@ class SplittingAlgebra(PolynomialQuotientRing_domain):
352
374
  # and the _splitting_roots are its roots we can calculate inverses
353
375
  # ------------------------------------------------------------------
354
376
  if cf0_inv is not None:
355
- deg_cf = len(cf)-1
377
+ deg_cf = len(cf) - 1
356
378
  pf = P(cf)
357
379
  for root in self._splitting_roots:
358
380
  check = self(pf)
359
381
  if not check.is_zero():
360
382
  continue
361
383
  root_inv = self.one()
362
- for pos in range(deg_cf-1):
363
- root_inv = (-1)**(pos+1) * cf[deg_cf-pos-1] - root_inv * root
384
+ for pos in range(deg_cf - 1):
385
+ root_inv = (-1)**(pos + 1) * cf[deg_cf - pos - 1] - root_inv * root
364
386
  verbose("inverse %s of root %s" % (root_inv, root))
365
387
  root_inv = (-1)**(deg_cf) * cf0_inv * root_inv
366
- self._invertible_elements.update({root:root_inv})
388
+ self._invertible_elements.update({root: root_inv})
367
389
  verbose("adding inverse %s of root %s" % (root_inv, root))
368
390
  invert_items = list(self._invertible_elements.items())
369
391
  for k, v in invert_items:
@@ -375,7 +397,7 @@ class SplittingAlgebra(PolynomialQuotientRing_domain):
375
397
  # overloaded inherited methods
376
398
  # ----------------------------------------------------------------------
377
399
  ########################################################################
378
- def __reduce__(self):
400
+ def __reduce__(self) -> tuple:
379
401
  r"""
380
402
  Used in pickling.
381
403
 
@@ -385,10 +407,10 @@ class SplittingAlgebra(PolynomialQuotientRing_domain):
385
407
  sage: L.<t, u, v, w > = LaurentPolynomialRing(ZZ); x = polygen(L)
386
408
  sage: S = SplittingAlgebra(x^4 -t*x^3 - u*x^2 - v*x + w, ('X', 'Y', 'Z'), warning=False)
387
409
  sage: S.__reduce__()
388
- (<class 'sage.algebras.splitting_algebra.SplittingAlgebra_with_category'>,
410
+ (<...SplittingAlgebra_with_category'>,
389
411
  (x^4 - t*x^3 - u*x^2 - v*x + w, ('X', 'Y', 'Z'), True, False))
390
412
  sage: S.base_ring().__reduce__()
391
- (<class 'sage.algebras.splitting_algebra.SplittingAlgebra_with_category'>,
413
+ (<...SplittingAlgebra_with_category'>,
392
414
  (Y^3 + (X - t)*Y^2 + (X^2 - t*X - u)*Y + X^3 - t*X^2 - u*X - v,
393
415
  ('Y', 'Z'),
394
416
  False,
@@ -396,15 +418,16 @@ class SplittingAlgebra(PolynomialQuotientRing_domain):
396
418
 
397
419
  sage: TestSuite(S).run()
398
420
  """
399
- defining_polynomial = self.defining_polynomial()
400
- definig_coefficients = self._coefficients_list[0]
401
- if defining_polynomial.coefficients(sparse=False) != definig_coefficients:
421
+ def_polynomial = self.defining_polynomial()
422
+ def_coefficients = self._coefficients_list[0]
423
+ if def_polynomial.coefficients(sparse=False) != def_coefficients:
402
424
  # case of factorization algebra (intermediate construction step)
403
425
  par_pol = self.cover_ring()
404
- defining_polynomial = par_pol(definig_coefficients)
405
- return self.__class__, (defining_polynomial, self._root_names, self._iterate, False)
426
+ def_polynomial = par_pol(def_coefficients)
427
+ return self.__class__, (def_polynomial, self._root_names,
428
+ self._iterate, False)
406
429
 
407
- def _repr_(self):
430
+ def _repr_(self) -> str:
408
431
  r"""
409
432
  Return a string representation of ``self``.
410
433
 
@@ -413,23 +436,26 @@ class SplittingAlgebra(PolynomialQuotientRing_domain):
413
436
  sage: from sage.algebras.splitting_algebra import SplittingAlgebra
414
437
  sage: L.<u, v> = PolynomialRing(ZZ)
415
438
  sage: t = polygen(L)
416
- sage: Spl.<S, T> = SplittingAlgebra(t^3 - (u^2-v)*t^2 + (v+u)*t - 1)
439
+ sage: Spl.<S, T> = SplittingAlgebra(t^3 - (u^2-v)*t^2 + (v+u)*t - 1, warning=False)
417
440
  sage: Spl._repr_()
418
441
  'Splitting Algebra of x^3 + (-u^2 + v)*x^2 + (u + v)*x - 1
419
442
  with roots [S, T, -T - S + u^2 - v]
420
443
  over Multivariate Polynomial Ring in u, v over Integer Ring'
421
444
  sage: Spl.base_ring() # indirect doctest
422
445
  Factorization Algebra of x^3 + (-u^2 + v)*x^2 + (u + v)*x - 1
423
- with roots [S] over Multivariate Polynomial Ring in u, v over Integer Ring
446
+ with roots [S] over Multivariate Polynomial Ring in u, v
447
+ over Integer Ring
424
448
  """
425
449
  if self.is_completely_split():
426
450
  return ('Splitting Algebra of %s with roots %s over %s'
427
- % (self.defining_polynomial(), self.splitting_roots(), self.scalar_base_ring()))
428
- else:
429
- return ('Factorization Algebra of %s with roots %s over %s'
430
- % (self.defining_polynomial(), self.splitting_roots(), self.scalar_base_ring()))
451
+ % (self.defining_polynomial(), self.splitting_roots(),
452
+ self.scalar_base_ring()))
453
+
454
+ return ('Factorization Algebra of %s with roots %s over %s'
455
+ % (self.defining_polynomial(), self.splitting_roots(),
456
+ self.scalar_base_ring()))
431
457
 
432
- def _first_ngens(self, n):
458
+ def _first_ngens(self, n) -> tuple:
433
459
  r"""
434
460
  Used by the preparser for ``R.<x> = ...``.
435
461
 
@@ -439,6 +465,9 @@ class SplittingAlgebra(PolynomialQuotientRing_domain):
439
465
  sage: L.<u, v> = PolynomialRing(ZZ)
440
466
  sage: t = polygen(L)
441
467
  sage: S.<X, Y> = SplittingAlgebra(t^3 - (u^2-v)*t^2 + (v+u)*t - 1) # indirect doctest
468
+ doctest:warning
469
+ ...
470
+ UserWarning: Assuming x^3 + (-u^2 + v)*x^2 + (u + v)*x - 1 to have maximal Galois group!
442
471
  sage: X.parent()
443
472
  Splitting Algebra of x^3 + (-u^2 + v)*x^2 + (u + v)*x - 1
444
473
  with roots [X, Y, -Y - X + u^2 - v]
@@ -447,19 +476,20 @@ class SplittingAlgebra(PolynomialQuotientRing_domain):
447
476
  (X, Y, u, v)
448
477
  """
449
478
  srts = self.splitting_roots()
450
- k = len(srts)-1
479
+ k = len(srts) - 1
451
480
  gens = srts[:k] + list(self.scalar_base_ring().gens())
452
481
  return tuple(gens[:n])
453
482
 
454
483
  def _element_constructor_(self, x):
455
484
  r"""
456
- Make sure ``x`` is a valid member of ``self``, and return the constructed element.
485
+ Make sure ``x`` is a valid member of ``self``, and return the
486
+ constructed element.
457
487
 
458
488
  TESTS::
459
489
 
460
490
  sage: from sage.algebras.splitting_algebra import SplittingAlgebra
461
491
  sage: L.<u, v, w> = LaurentPolynomialRing(ZZ); x = polygen(L)
462
- sage: S.<X, Y> = SplittingAlgebra(x^3 - u*x^2 + v*x - w)
492
+ sage: S.<X, Y> = SplittingAlgebra(x^3 - u*x^2 + v*x - w, warning=False)
463
493
  sage: S(u + v)
464
494
  u + v
465
495
  sage: S(X*Y + X)
@@ -484,6 +514,9 @@ class SplittingAlgebra(PolynomialQuotientRing_domain):
484
514
  sage: from sage.algebras.splitting_algebra import SplittingAlgebra
485
515
  sage: L.<u, v, w> = LaurentPolynomialRing(ZZ); x = polygen(L)
486
516
  sage: S = SplittingAlgebra(x^3 - u*x^2 + v*x - w, ('X', 'Y'))
517
+ doctest:warning
518
+ ...
519
+ UserWarning: Assuming x^3 - u*x^2 + v*x - w to have maximal Galois group!
487
520
  sage: P.<x, y, z> = PolynomialRing(ZZ)
488
521
  sage: F = FractionField(P)
489
522
  sage: im_gens = [F(g) for g in [y, x, x + y + z, x*y+x*z+y*z, x*y*z]]
@@ -502,23 +535,27 @@ class SplittingAlgebra(PolynomialQuotientRing_domain):
502
535
 
503
536
  all_gens = self.gens_dict_recursive()
504
537
  if len(im_gens) != len(all_gens):
505
- return super().hom(im_gens, codomain=codomain, check=check, base_map=base_map)
538
+ return super().hom(im_gens, codomain=codomain,
539
+ check=check, base_map=base_map)
506
540
 
507
541
  num_gens = len(self.gens())
508
542
  im_gens_start = [img for img in im_gens if im_gens.index(img) < num_gens]
509
543
  im_gens_end = [img for img in im_gens if im_gens.index(img) >= num_gens]
510
544
 
511
545
  if not im_gens_end:
512
- return super().hom(im_gens, codomain=codomain, check=check, base_map=base_map)
546
+ return super().hom(im_gens, codomain=codomain,
547
+ check=check, base_map=base_map)
513
548
 
514
549
  verbose('base %s im_gens_end %s codomain %s check %s base_map %s' % (base_ring, im_gens_end, codomain, check, base_map))
515
- hom_on_base_recurs = base_ring.hom(im_gens_end, codomain=codomain, check=check, base_map=base_map)
550
+ hom_on_base_recurs = base_ring.hom(im_gens_end, codomain=codomain,
551
+ check=check, base_map=base_map)
516
552
  verbose('hom_on_base_recurs %s' % (hom_on_base_recurs))
517
553
 
518
554
  cover_ring = self.cover_ring()
519
- hom_from_cover = cover_ring.hom(im_gens_start, codomain=codomain, check=check, base_map=hom_on_base_recurs)
555
+ hom_from_cover = cover_ring.hom(im_gens_start, codomain=codomain,
556
+ check=check, base_map=hom_on_base_recurs)
520
557
  lift = self.lifting_map()
521
- return hom_from_cover*lift
558
+ return hom_from_cover * lift
522
559
 
523
560
  ###################################################################
524
561
  # -----------------------------------------------------------------
@@ -532,7 +569,7 @@ class SplittingAlgebra(PolynomialQuotientRing_domain):
532
569
  # -----------------------------------------------------------------
533
570
  ###################################################################
534
571
 
535
- def is_completely_split(self):
572
+ def is_completely_split(self) -> bool:
536
573
  r"""
537
574
  Return ``True`` if the defining polynomial of ``self`` splits into
538
575
  linear factors over ``self``.
@@ -552,8 +589,10 @@ class SplittingAlgebra(PolynomialQuotientRing_domain):
552
589
  @cached_method
553
590
  def lifting_map(self):
554
591
  r"""
555
- Return a section map from ``self`` to the cover ring. It is implemented according
556
- to the same named method of :class:`~sage.rings.quotient_ring.QuotientRing_nc`.
592
+ Return a section map from ``self`` to the cover ring.
593
+
594
+ It is implemented according to the same named method of
595
+ :class:`~sage.rings.quotient_ring.QuotientRing_nc`.
557
596
 
558
597
  EXAMPLES::
559
598
 
@@ -570,7 +609,7 @@ class SplittingAlgebra(PolynomialQuotientRing_domain):
570
609
  from sage.rings.morphism import RingMap_lift
571
610
  return RingMap_lift(self, self.cover_ring())
572
611
 
573
- def splitting_roots(self):
612
+ def splitting_roots(self) -> list:
574
613
  r"""
575
614
  Return the roots of the split equation.
576
615
 
@@ -597,7 +636,8 @@ class SplittingAlgebra(PolynomialQuotientRing_domain):
597
636
  sage: S = SplittingAlgebra(x^3 - u*x^2 + v*x - w, ('X', 'Y'))
598
637
  sage: S.base_ring()
599
638
  Factorization Algebra of x^3 - u*x^2 + v*x - w with roots [X]
600
- over Multivariate Laurent Polynomial Ring in u, v, w over Integer Ring
639
+ over Multivariate Laurent Polynomial Ring in u, v, w
640
+ over Integer Ring
601
641
  sage: S.scalar_base_ring()
602
642
  Multivariate Laurent Polynomial Ring in u, v, w over Integer Ring
603
643
  """
@@ -634,20 +674,23 @@ class SplittingAlgebra(PolynomialQuotientRing_domain):
634
674
  return self._defining_polynomial
635
675
 
636
676
 
637
- # --------------------------------------------------------------------------------------------
638
- # ============================================================================================
639
- # Utility function to create the roots of a polynomial in an appropriate extension ring
640
- # ============================================================================================
641
- # --------------------------------------------------------------------------------------------
677
+ # ----------------------------------------------------------------------
678
+ # ======================================================================
679
+ # Utility function to create the roots of a polynomial in an
680
+ # appropriate extension ring
681
+ # ======================================================================
682
+ # ----------------------------------------------------------------------
642
683
 
643
- def solve_with_extension(monic_polynomial, root_names=None, var='x', flatten=False, warning=True):
684
+ def solve_with_extension(monic_polynomial, root_names=None, var='x',
685
+ flatten=False, warning=True) -> list[tuple]:
644
686
  r"""
645
- Return all roots of a monic polynomial in its base ring or in an appropriate
646
- extension ring, as far as possible.
687
+ Return all roots of a monic polynomial in its base ring or in an
688
+ appropriate extension ring, as far as possible.
647
689
 
648
690
  INPUT:
649
691
 
650
- - ``monic_polynomial`` -- the monic polynomial whose roots should be created
692
+ - ``monic_polynomial`` -- the monic polynomial whose roots
693
+ should be created
651
694
  - ``root_names`` -- names for the indeterminates needed to define the
652
695
  splitting algebra of the ``monic_polynomial`` (if necessary and possible)
653
696
  - ``var`` -- (default: ``'x'``) for the indeterminate needed to define the
@@ -674,13 +717,14 @@ def solve_with_extension(monic_polynomial, root_names=None, var='x', flatten=Fal
674
717
  sage: solve_with_extension(p)
675
718
  [(1, 2)]
676
719
 
677
- sage: cp5 = cyclotomic_polynomial(5, var='T').change_ring(UniversalCyclotomicField())
720
+ sage: U = UniversalCyclotomicField()
721
+ sage: cp5 = cyclotomic_polynomial(5, var='T').change_ring(U)
678
722
  sage: solve_with_extension(cp5)
679
723
  [(E(5), 1), (E(5)^4, 1), (E(5)^2, 1), (E(5)^3, 1)]
680
724
  sage: _[0][0].parent()
681
725
  Universal Cyclotomic Field
682
726
  """
683
- def create_roots(monic_polynomial, warning=True):
727
+ def create_roots(monic_polynomial, warning=warning):
684
728
  r"""
685
729
  This internal function creates all roots of a polynomial in an
686
730
  appropriate extension ring assuming that none of the roots is
@@ -708,10 +752,10 @@ def solve_with_extension(monic_polynomial, root_names=None, var='x', flatten=Fal
708
752
  # in this case the SplittingAlgebra is preferred
709
753
  raise NotImplementedError
710
754
 
711
- # -------------------------------------------------------------------------------------
712
- # in some cases the embedding of the base_ring in ext_field can not be obtained
713
- # as coercion
714
- # -------------------------------------------------------------------------------------
755
+ # -------------------------------------------------------------
756
+ # in some cases the embedding of the base_ring in
757
+ # ext_field can not be obtained as coercion
758
+ # -------------------------------------------------------------
715
759
  reset_coercion = False
716
760
  from sage.rings.number_field.number_field import NumberField_generic
717
761
  if isinstance(base_ring, NumberField_generic):
@@ -727,7 +771,8 @@ def solve_with_extension(monic_polynomial, root_names=None, var='x', flatten=Fal
727
771
  pol_emb = monic_polynomial.change_ring(ext_field)
728
772
  roots = pol_emb.roots()
729
773
  except NotImplementedError:
730
- ext_ring = SplittingAlgebra(monic_polynomial, name_list, warning=warning)
774
+ ext_ring = SplittingAlgebra(monic_polynomial, name_list,
775
+ warning=warning)
731
776
  verbose("splitting algebra %s defined" % (ext_ring))
732
777
  roots = [(r, 1) for r in ext_ring.splitting_roots()]
733
778
  return roots
@@ -735,7 +780,7 @@ def solve_with_extension(monic_polynomial, root_names=None, var='x', flatten=Fal
735
780
  deg_pol = monic_polynomial.degree()
736
781
  if not root_names:
737
782
  from sage.structure.category_object import normalize_names
738
- root_names = normalize_names(deg_pol-1, 'r')
783
+ root_names = normalize_names(deg_pol - 1, 'r')
739
784
  name_list = list(root_names)
740
785
  root_list = []
741
786
  try:
@@ -753,20 +798,20 @@ def solve_with_extension(monic_polynomial, root_names=None, var='x', flatten=Fal
753
798
  roots = create_roots(monic_polynomial, warning=warning)
754
799
 
755
800
  else:
756
- # ------------------------------------------------------------------
801
+ # ----------------------------------------------------------------
757
802
  # root calculation was possible but maybe some more roots in
758
803
  # an appropriate extension ring can be constructed.
759
- # ------------------------------------------------------------------
760
- num_roots = sum(m for r, m in root_list)
804
+ # ----------------------------------------------------------------
805
+ num_roots = sum(m for _, m in root_list)
761
806
  if num_roots < deg_pol:
762
807
  h = monic_polynomial.variables()[0]
763
808
  divisor = monic_polynomial.base_ring().one()
764
809
  for r, m in root_list:
765
810
  divisor *= (h - r)**m
766
- q, r = monic_polynomial.quo_rem(divisor)
811
+ q, _ = monic_polynomial.quo_rem(divisor)
767
812
  if len(name_list) > deg_pol - num_roots - 1:
768
- name_list = [name_list[i] for i in range(deg_pol - num_roots - 1)]
769
- verbose("%d root found in base ring, now solving %s" % (num_roots,q))
813
+ name_list = name_list[:deg_pol - num_roots - 1]
814
+ verbose(f"{num_roots} root found in base ring, now solving {q}")
770
815
  missing_roots = create_roots(q, warning=True)
771
816
  roots = root_list + missing_roots
772
817
  else:
@@ -774,6 +819,5 @@ def solve_with_extension(monic_polynomial, root_names=None, var='x', flatten=Fal
774
819
  verbose("all roots in base ring")
775
820
 
776
821
  if flatten:
777
- from sage.misc.flatten import flatten
778
- return flatten([[rt]*m for rt, m in roots])
822
+ return flatten_list([[rt] * m for rt, m in roots])
779
823
  return roots
@@ -12,12 +12,12 @@ AUTHORS:
12
12
  - Coerce to/from free algebra.
13
13
  """
14
14
 
15
- #*****************************************************************************
15
+ # ***************************************************************************
16
16
  # Copyright (C) 2014 Travis Scrimshaw <tscrim at ucdavis.edu>
17
17
  #
18
18
  # Distributed under the terms of the GNU General Public License (GPL)
19
- # http://www.gnu.org/licenses/
20
- #*****************************************************************************
19
+ # https://www.gnu.org/licenses/
20
+ # ***************************************************************************
21
21
 
22
22
  from sage.categories.algebras import Algebras
23
23
  from sage.categories.pushout import ConstructionFunctor
@@ -115,7 +115,7 @@ class TensorAlgebra(CombinatorialFreeModule):
115
115
  # the following is not the best option, but it's better than nothing.
116
116
  self._print_options['tensor_symbol'] = options.get('tensor_symbol', tensor.symbol)
117
117
 
118
- def _repr_(self):
118
+ def _repr_(self) -> str:
119
119
  r"""
120
120
  Return a string representation of ``self``.
121
121
 
@@ -127,7 +127,7 @@ class TensorAlgebra(CombinatorialFreeModule):
127
127
  """
128
128
  return "Tensor Algebra of {}".format(self._base_module)
129
129
 
130
- def _repr_term(self, m):
130
+ def _repr_term(self, m) -> str:
131
131
  """
132
132
  Return a string of representation of the term indexed by ``m``.
133
133
 
@@ -153,7 +153,7 @@ class TensorAlgebra(CombinatorialFreeModule):
153
153
  symb = tensor.symbol
154
154
  return symb.join(self._base_module._repr_term(k) for k,e in m._monomial for i in range(e))
155
155
 
156
- def _latex_term(self, m):
156
+ def _latex_term(self, m) -> str:
157
157
  r"""
158
158
  Return a latex representation of the term indexed by ``m``.
159
159
 
@@ -617,7 +617,7 @@ class TensorAlgebraFunctor(ConstructionFunctor):
617
617
  """
618
618
  ConstructionFunctor.__init__(self, Modules(base), Algebras(base))
619
619
 
620
- def _repr_(self):
620
+ def _repr_(self) -> str:
621
621
  """
622
622
  Return a string representation of ``self``.
623
623
 
sage/algebras/yangian.py CHANGED
@@ -251,7 +251,7 @@ class Yangian(CombinatorialFreeModule):
251
251
  sorting_key=Yangian._term_key,
252
252
  prefix=variable_name, category=category)
253
253
 
254
- def _repr_(self):
254
+ def _repr_(self) -> str:
255
255
  r"""
256
256
  Return a string representation of ``self``.
257
257
 
@@ -264,7 +264,7 @@ class Yangian(CombinatorialFreeModule):
264
264
  """
265
265
  return "Yangian of gl({}) in the {} filtration over {}".format(self._n, self._filtration, self.base_ring())
266
266
 
267
- def _latex_(self):
267
+ def _latex_(self) -> str:
268
268
  r"""
269
269
  Return a latex representation of ``self``.
270
270
 
@@ -290,7 +290,7 @@ class Yangian(CombinatorialFreeModule):
290
290
  """
291
291
  return (-len(x), x._sorted_items())
292
292
 
293
- def _repr_term(self, m):
293
+ def _repr_term(self, m) -> str:
294
294
  """
295
295
  Return a string representation of the basis element indexed by ``m``.
296
296
 
@@ -306,11 +306,11 @@ class Yangian(CombinatorialFreeModule):
306
306
  if len(m) == 0:
307
307
  return '1'
308
308
  prefix = self.prefix()
309
- return '*'.join(prefix + '({})[{},{}]'.format(r,i,j)
309
+ return '*'.join(prefix + '({})[{},{}]'.format(r, i, j)
310
310
  + ('^{}'.format(exp) if exp > 1 else '')
311
- for (r,i,j), exp in m._sorted_items())
311
+ for (r, i, j), exp in m._sorted_items())
312
312
 
313
- def _latex_term(self, m):
313
+ def _latex_term(self, m) -> str:
314
314
  r"""
315
315
  Return a `\LaTeX` representation of the basis element indexed
316
316
  by ``m``.
@@ -674,7 +674,7 @@ class YangianLevel(Yangian):
674
674
  CombinatorialFreeModule.__init__(self, base_ring, basis_keys,
675
675
  prefix=variable_name, category=category)
676
676
 
677
- def _repr_(self):
677
+ def _repr_(self) -> str:
678
678
  r"""
679
679
  Return a string representation of ``self``.
680
680
 
@@ -686,7 +686,7 @@ class YangianLevel(Yangian):
686
686
  return "Yangian of level {} of gl({}) in the {} filtration over {}".format(
687
687
  self._level, self._n, self._filtration, self.base_ring())
688
688
 
689
- def _latex_(self):
689
+ def _latex_(self) -> str:
690
690
  r"""
691
691
  Return a latex representation of ``self``.
692
692
 
@@ -697,7 +697,7 @@ class YangianLevel(Yangian):
697
697
  """
698
698
  from sage.misc.latex import latex
699
699
  return "Y_{{{}}}(\\mathfrak{{gl}}_{{{}}}, {})".format(
700
- self._level, self._n, latex(self.base_ring()))
700
+ self._level, self._n, latex(self.base_ring()))
701
701
 
702
702
  def _coerce_map_from_(self, R):
703
703
  """
@@ -899,7 +899,7 @@ class GradedYangianBase(AssociatedGradedAlgebra):
899
899
  """
900
900
  Base class for graded algebras associated to a Yangian.
901
901
  """
902
- def _repr_term(self, m):
902
+ def _repr_term(self, m) -> str:
903
903
  """
904
904
  Return a string representation of the monomial indexed by ``m``.
905
905
 
@@ -913,11 +913,11 @@ class GradedYangianBase(AssociatedGradedAlgebra):
913
913
  if len(m) == 0:
914
914
  return '1'
915
915
  prefix = self.prefix()
916
- return '*'.join(prefix + '({})[{},{}]'.format(r,i,j)
916
+ return '*'.join(prefix + '({})[{},{}]'.format(r, i, j)
917
917
  + ('^{}'.format(exp) if exp > 1 else '')
918
- for (r,i,j), exp in m._sorted_items())
918
+ for (r, i, j), exp in m._sorted_items())
919
919
 
920
- def _latex_term(self, m):
920
+ def _latex_term(self, m) -> str:
921
921
  r"""
922
922
  Return a latex representation of the monomial indexed by ``m``.
923
923
 
@@ -934,11 +934,12 @@ class GradedYangianBase(AssociatedGradedAlgebra):
934
934
  prefix = "\\overline{{{}}}".format(self._A.prefix())
935
935
 
936
936
  def term(r, i, j, exp):
937
- s = prefix + '^{{({})}}_{{{},{}}}'.format(r,i,j)
937
+ s = prefix + '^{{({})}}_{{{},{}}}'.format(r, i, j)
938
938
  if exp == 1:
939
939
  return s
940
940
  return '\\left({}\\right)^{{{}}}'.format(s, exp)
941
- return ' '.join(term(r, i, j, exp) for (r,i,j), exp in m._sorted_items())
941
+ return ' '.join(term(r, i, j, exp)
942
+ for (r, i, j), exp in m._sorted_items())
942
943
 
943
944
 
944
945
  class GradedYangianNatural(GradedYangianBase):