Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Merge branch 'u/mantepse/replace_lazy_power_series_in_species_directo…
Browse files Browse the repository at this point in the history
…ry_with_the_new_lazy_taylor_series' of trac.sagemath.org:sage into t/34470/categories_of_lazy_series
  • Loading branch information
mantepse committed Sep 9, 2022
2 parents 08202bc + 6f76b00 commit ac29928
Show file tree
Hide file tree
Showing 35 changed files with 2,790 additions and 4,370 deletions.
6 changes: 6 additions & 0 deletions src/doc/en/reference/references/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4198,6 +4198,7 @@ REFERENCES:
.. [MagmaHGM] *Hypergeometric motives* in Magma,
http://magma.maths.usyd.edu.au/~watkins/papers/HGM-chapter.pdf
.. [Mar1980] Jacques Martinet, Petits discriminants des corps de
nombres, Journ. Arithm. 1980, Cambridge Univ. Press,
1982, 151--193.
Expand Down Expand Up @@ -4384,6 +4385,11 @@ REFERENCES:
*Symmetric cyclotomic Hecke algebras* J. Algebra.
**205** (1998) pp. 275-293.
.. [MM2008] Manel Maia and Miguel Méndez.
On the arithmetic product of combinatorial species.
Discrete Mathematics (2008), Volume 308, Issue 23, pp. 5407-5427,
:arxiv:`math/0503436v2`.
.. [MM2015] \J. Matherne and \G. Muller, *Computing upper cluster algebras*,
Int. Math. Res. Not. IMRN, 2015, 3121-3149.
Expand Down
34 changes: 33 additions & 1 deletion src/sage/categories/commutative_algebras.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@
# http://www.gnu.org/licenses/
#******************************************************************************

from sage.misc.cachefunc import cached_method
from sage.categories.category_with_axiom import CategoryWithAxiom_over_base_ring
from sage.categories.algebras import Algebras
from sage.categories.commutative_rings import CommutativeRings
from sage.categories.tensor import TensorProductsCategory

class CommutativeAlgebras(CategoryWithAxiom_over_base_ring):
"""
Expand All @@ -36,7 +39,7 @@ class CommutativeAlgebras(CategoryWithAxiom_over_base_ring):
True
sage: TestSuite(CommutativeAlgebras(ZZ)).run()
Todo:
.. TODO::
- product ( = Cartesian product)
- coproduct ( = tensor product over base ring)
Expand All @@ -58,3 +61,32 @@ def __contains__(self, A):
"""
return super().__contains__(A) or \
(A in Algebras(self.base_ring()) and hasattr(A, "is_commutative") and A.is_commutative())

class TensorProducts(TensorProductsCategory):
"""
The category of commutative algebras constructed by tensor product of commutative algebras.
"""

@cached_method
def extra_super_categories(self):
"""
EXAMPLES::
sage: Algebras(QQ).Commutative().TensorProducts().extra_super_categories()
[Category of commutative rings]
sage: Algebras(QQ).Commutative().TensorProducts().super_categories()
[Category of tensor products of algebras over Rational Field,
Category of commutative algebras over Rational Field]
TESTS::
sage: X = algebras.Shuffle(QQ, 'ab')
sage: Y = algebras.Shuffle(QQ, 'bc')
sage: X in Algebras(QQ).Commutative()
True
sage: T = tensor([X, Y])
sage: T in CommutativeRings()
True
"""
return [CommutativeRings()]

16 changes: 5 additions & 11 deletions src/sage/categories/highest_weight_crystals.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,14 +322,9 @@ def q_dimension(self, q=None, prec=None, use_product=False):
1 + q + 2*q^2 + 2*q^3 + 4*q^4 + 5*q^5 + 7*q^6
+ 9*q^7 + 13*q^8 + 16*q^9 + O(q^10)
sage: qdim = C.q_dimension(); qdim
1 + q + 2*q^2 + 2*q^3 + 4*q^4 + 5*q^5 + 7*q^6
+ 9*q^7 + 13*q^8 + 16*q^9 + 22*q^10 + O(x^11)
sage: qdim.compute_coefficients(15)
sage: qdim
1 + q + 2*q^2 + 2*q^3 + 4*q^4 + 5*q^5 + 7*q^6
+ 9*q^7 + 13*q^8 + 16*q^9 + 22*q^10 + 27*q^11
+ 36*q^12 + 44*q^13 + 57*q^14 + 70*q^15 + O(x^16)
1 + q + 2*q^2 + 2*q^3 + 4*q^4 + 5*q^5 + 7*q^6 + O(q^7)
sage: qdim[:16]
[1, 1, 2, 2, 4, 5, 7, 9, 13, 16, 22, 27, 36, 44, 57, 70]
"""
from sage.rings.integer_ring import ZZ
WLR = self.weight_lattice_realization()
Expand Down Expand Up @@ -375,22 +370,21 @@ def iter_by_deg(gens):
elif prec is None:
# If we're here, we may not be a finite crystal.
# In fact, we're probably infinite.
from sage.combinat.species.series import LazyPowerSeriesRing
from sage.rings.lazy_series_ring import LazyPowerSeriesRing
if q is None:
P = LazyPowerSeriesRing(ZZ, names='q')
else:
P = q.parent()
if not isinstance(P, LazyPowerSeriesRing):
raise TypeError("the parent of q must be a lazy power series ring")
ret = P(iter_by_deg(mg))
ret.compute_coefficients(10)
return ret

from sage.rings.power_series_ring import PowerSeriesRing, PowerSeriesRing_generic
if q is None:
q = PowerSeriesRing(ZZ, 'q', default_prec=prec).gen(0)
P = q.parent()
ret = P.sum(c * q**deg for deg,c in enumerate(iter_by_deg(mg)))
ret = P.sum(c * q**deg for deg, c in enumerate(iter_by_deg(mg)))
if ret.degree() == max_deg and isinstance(P, PowerSeriesRing_generic):
ret = P(ret, prec)
return ret
Expand Down
16 changes: 13 additions & 3 deletions src/sage/categories/sets_with_grading.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,21 @@ def generating_series(self):
Non negative integers
sage: N.generating_series()
1/(-z + 1)
sage: Permutations().generating_series()
1 + z + 2*z^2 + 6*z^3 + 24*z^4 + 120*z^5 + 720*z^6 + O(z^7)
.. TODO::
- Very likely, this should always return a lazy power series.
"""
from sage.combinat.species.series import LazyPowerSeriesRing
from sage.sets.non_negative_integers import NonNegativeIntegers
from sage.rings.lazy_series_ring import LazyPowerSeriesRing
from sage.rings.integer_ring import ZZ
R = LazyPowerSeriesRing(ZZ)
R(self.graded_component(grade).cardinality() for grade in self.grading_set())
if isinstance(self.grading_set(), NonNegativeIntegers):
R = LazyPowerSeriesRing(ZZ, names="z")
return R(lambda n: self.graded_component(n).cardinality())
raise NotImplementedError

# TODO:
# * asymptotic behavior: we need an object for asymptotic behavior and
Expand Down
13 changes: 13 additions & 0 deletions src/sage/combinat/partition.py
Original file line number Diff line number Diff line change
Expand Up @@ -1057,6 +1057,19 @@ def __truediv__(self, p):

return SkewPartition([self[:], p])

def stretch(self, k):
"""
Return the partition obtained by multiplying each part with the
given number.
EXAMPLES::
sage: p = Partition([4,2,2,1,1])
sage: p.stretch(3)
[12, 6, 6, 3, 3]
"""
return _Partitions([k * p for p in self])

def power(self, k):
r"""
Return the cycle type of the `k`-th power of any permutation
Expand Down
4 changes: 2 additions & 2 deletions src/sage/combinat/sf/powersum.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,8 @@ def frobenius(self, n):
:meth:`~sage.combinat.sf.sfa.SymmetricFunctionAlgebra_generic_Element.plethysm`
"""
dct = {Partition([n * i for i in lam]): coeff
for (lam, coeff) in self.monomial_coefficients().items()}
dct = {lam.stretch(n): coeff
for lam, coeff in self.monomial_coefficients().items()}
return self.parent()._from_dict(dct)

adams_operation = frobenius
Expand Down
Loading

0 comments on commit ac29928

Please sign in to comment.