Skip to content

special case for principal specialization of order 1 #40243

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/sage/combinat/sf/elementary.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,12 @@
sage: e.zero().principal_specialization(3)
0
"""
if n == 1:
R = self.base_ring()
mc = self.monomial_coefficients(copy=False).items()
return R.sum(c for partition, c in mc

Check warning on line 400 in src/sage/combinat/sf/elementary.py

View check run for this annotation

Codecov / codecov/patch

src/sage/combinat/sf/elementary.py#L398-L400

Added lines #L398 - L400 were not covered by tests
if not partition or partition[0] == 1)

from sage.combinat.q_analogues import q_binomial

def get_variable(ring, name):
Expand Down
3 changes: 3 additions & 0 deletions src/sage/combinat/sf/homogeneous.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,9 @@
sage: s = x.principal_specialization(3); s
0
"""
if n == 1:
return self.base_ring().sum(self.coefficients(sort=False))

Check warning on line 308 in src/sage/combinat/sf/homogeneous.py

View check run for this annotation

Codecov / codecov/patch

src/sage/combinat/sf/homogeneous.py#L308

Added line #L308 was not covered by tests

from sage.combinat.q_analogues import q_binomial

def get_variable(ring, name):
Expand Down
6 changes: 6 additions & 0 deletions src/sage/combinat/sf/monomial.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,12 @@
sage: m.zero().principal_specialization(3)
0
"""
if n == 1:
R = self.base_ring()
mc = self.monomial_coefficients(copy=False).items()
return R.sum(c for partition, c in mc

Check warning on line 404 in src/sage/combinat/sf/monomial.py

View check run for this annotation

Codecov / codecov/patch

src/sage/combinat/sf/monomial.py#L402-L404

Added lines #L402 - L404 were not covered by tests
if len(partition) <= 1)

if q == 1:
if n == infinity:
raise ValueError("the stable principal specialization at q=1 is not defined")
Expand Down
12 changes: 6 additions & 6 deletions src/sage/combinat/sf/powersum.py
Original file line number Diff line number Diff line change
Expand Up @@ -797,6 +797,9 @@
sage: p.zero().principal_specialization(3)
0
"""
if n == 1:
return self.base_ring().sum(self.coefficients(sort=False))

Check warning on line 801 in src/sage/combinat/sf/powersum.py

View check run for this annotation

Codecov / codecov/patch

src/sage/combinat/sf/powersum.py#L801

Added line #L801 was not covered by tests

def get_variable(ring, name):
try:
ring(name)
Expand Down Expand Up @@ -926,12 +929,9 @@
t = get_variable(self.base_ring(), 't')

def f(partition):
n = 0
for part in partition:
if part != 1:
return 0
n += 1
return t**n
if partition and partition[0] != 1:
return 0
return t**len(partition)

return self.parent()._apply_module_morphism(self, f, t.parent())

Expand Down
6 changes: 6 additions & 0 deletions src/sage/combinat/sf/schur.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,12 @@
sage: s.zero().principal_specialization(3)
0
"""
if n == 1:
R = self.base_ring()
mc = self.monomial_coefficients(copy=False).items()
return R.sum(c for partition, c in mc

Check warning on line 691 in src/sage/combinat/sf/schur.py

View check run for this annotation

Codecov / codecov/patch

src/sage/combinat/sf/schur.py#L689-L691

Added lines #L689 - L691 were not covered by tests
if len(partition) <= 1)

def get_variable(ring, name):
try:
ring(name)
Expand Down
Loading