Skip to content

Commit 77f2a99

Browse files
author
Release Manager
committed
gh-39629: add magma as optional algorithm for Coxeter polynomial of posets as this is a useful alternative for those who can afford to pay for magma ### 📝 Checklist - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [x] I have created tests covering the changes. - [x] I have updated the documentation and checked the documentation preview. URL: #39629 Reported by: Frédéric Chapoton Reviewer(s): Travis Scrimshaw
2 parents 8cc3746 + 3606202 commit 77f2a99

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

src/sage/combinat/posets/posets.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4329,10 +4329,15 @@ def coxeter_transformation(self):
43294329
"""
43304330
return self._hasse_diagram.coxeter_transformation()
43314331

4332-
def coxeter_polynomial(self):
4332+
def coxeter_polynomial(self, algorithm="sage"):
43334333
"""
43344334
Return the Coxeter polynomial of the poset.
43354335
4336+
INPUT:
4337+
4338+
- ``algorithm`` -- optional (default: ``"sage"``) ;
4339+
the unique other option is ``"magma"``
4340+
43364341
OUTPUT: a polynomial in one variable
43374342
43384343
The output is the characteristic polynomial of the Coxeter
@@ -4349,11 +4354,22 @@ def coxeter_polynomial(self):
43494354
sage: p.coxeter_polynomial() # needs sage.groups sage.libs.flint
43504355
x^6 + x^5 - x^3 + x + 1
43514356
4357+
TESTS::
4358+
4359+
sage: P = posets.PentagonPoset()
4360+
sage: P.coxeter_polynomial("magma") # optional - magma
4361+
x^5 + x^4 + x + 1
4362+
43524363
.. SEEALSO::
43534364
43544365
:meth:`coxeter_transformation`, :meth:`coxeter_smith_form`
43554366
"""
4356-
return self._hasse_diagram.coxeter_transformation().charpoly()
4367+
cox_matrix = self._hasse_diagram.coxeter_transformation()
4368+
if algorithm == "magma":
4369+
from sage.interfaces.magma import magma
4370+
dense_matrix = magma(cox_matrix).Matrix()
4371+
return dense_matrix.CharacteristicPolynomial().sage()
4372+
return cox_matrix.charpoly()
43574373

43584374
def coxeter_smith_form(self, algorithm='singular'):
43594375
"""

0 commit comments

Comments
 (0)