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/implement_derivatives_of_lazy_series' of tra…
Browse files Browse the repository at this point in the history
…c.sagemath.org:sage into t/34422/implement_functorial_composition_of_lazy_symmetric_functiosn
  • Loading branch information
mantepse committed Aug 30, 2022
2 parents 18429ef + ee35418 commit 34bb6ea
Show file tree
Hide file tree
Showing 8 changed files with 1,245 additions and 294 deletions.
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()]

17 changes: 17 additions & 0 deletions src/sage/categories/graded_algebras_with_basis.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,23 @@ def free_graded_module(self, generator_degrees, names=None):
from sage.modules.fp_graded.free_module import FreeGradedModule
return FreeGradedModule(self, generator_degrees, names=names)

def formal_series_ring(self):
r"""
Return the completion of all formal linear combinations of
``self`` with finite linear combinations in each homogeneous
degree (computed lazily).
EXAMPLES::
sage: NCSF = NonCommutativeSymmetricFunctions(QQ)
sage: S = NCSF.Complete()
sage: L = S.formal_series_ring()
sage: L
Lazy completion of Non-Commutative Symmetric Functions over
the Rational Field in the Complete basis
"""
from sage.rings.lazy_series_ring import LazyCompletionGradedAlgebra
return LazyCompletionGradedAlgebra(self)

class ElementMethods:
pass
Expand Down
14 changes: 14 additions & 0 deletions src/sage/combinat/partition.py
Original file line number Diff line number Diff line change
Expand Up @@ -1057,6 +1057,20 @@ 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 34bb6ea

Please sign in to comment.