Skip to content

Commit 5bb357a

Browse files
author
Release Manager
committed
sagemathgh-36029: k-regular sequences: boundedness <!-- ^^^^^ Please provide a concise, informative and self-explanatory title. Don't put issue numbers in there, do this in the PR body below. For example, instead of "Fixes sagemath#1234" use "Introduce new method to calculate 1+1" --> <!-- Describe your changes here in detail --> Implements an algorithm to check for boundedness of k-regular sequences. See issue sagemath#22964. (Coding and reviewing already happend on trac (see sagemath#22964) and the branch was ready but never merged due to a trivial issue. Now the current develop (10.1.beta8) has been merged in to avoid conflicts the upcoming sagemath#36011 (where a renaming took place; set as depedency now). ### 📝 Checklist - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [x] I have created tests covering the changes. - [x] I have updated the documentation accordingly. ### ⌛ Dependencies - sagemath#36011: Experimental warning removed in class used in this PR and class was renamed. URL: sagemath#36029 Reported by: Daniel Krenn Reviewer(s): cheuberg, Daniel Krenn, Gabriel Lipnik
2 parents b8f98e7 + 69dfac1 commit 5bb357a

File tree

5 files changed

+663
-0
lines changed

5 files changed

+663
-0
lines changed

src/doc/en/reference/combinat/module_list.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ Comprehensive Module List
207207
sage/combinat/ranker
208208
sage/combinat/recognizable_series
209209
sage/combinat/regular_sequence
210+
sage/combinat/regular_sequence_bounded
210211
sage/combinat/restricted_growth
211212
sage/combinat/ribbon
212213
sage/combinat/ribbon_shaped_tableau

src/doc/en/reference/references/index.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5100,6 +5100,11 @@ REFERENCES:
51005100
.. [MS1977] \F. J. MacWilliams, N. J. A. Sloane, *The Theory of Error-Correcting
51015101
Codes*, North-Holland, Amsterdam, 1977
51025102
5103+
.. [MS1977a] Arnaldo Mandel, Imre Simon,
5104+
*On Finite Semigroups of Matrices*,
5105+
Theoretical Computer Science 5 (101-111),
5106+
North-Holland Publishing Company
5107+
51035108
.. [MS1994] \P. Martin and H. Saleur.
51045109
*The blob algebra and the periodic Temperley-Lieb algebra*.
51055110
Lett. Math. Phys., **30** (1994), no. 3. pp. 189-206.

src/sage/combinat/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ py.install_sources(
8787
'ranker.py',
8888
'recognizable_series.py',
8989
'regular_sequence.py',
90+
'regular_sequence_bounded.py',
9091
'restricted_growth.py',
9192
'ribbon.py',
9293
'ribbon_shaped_tableau.py',

src/sage/combinat/regular_sequence.py

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1279,6 +1279,118 @@ def partial_sums(self, include_n=False):
12791279

12801280
return result
12811281

1282+
@cached_method
1283+
def is_bounded(self):
1284+
r"""
1285+
Return whether this `k`-regular sequence is bounded.
1286+
1287+
EXAMPLES:
1288+
1289+
Thue--Morse Sequence::
1290+
1291+
sage: Seq2 = RegularSequenceRing(2, ZZ)
1292+
sage: TM = Seq2([Matrix([[1, 0], [0, 1]]), Matrix([[0, 1], [1, 0]])],
1293+
....: left=vector([1, 0]), right=vector([0, 1]))
1294+
sage: TM.is_bounded()
1295+
True
1296+
1297+
Binary Sum of Digits::
1298+
1299+
sage: SD = Seq2([Matrix([[1, 0], [0, 1]]), Matrix([[0, -1], [1, 2]])],
1300+
....: left=vector([0, 1]), right=vector([1, 0]))
1301+
sage: SD.is_bounded()
1302+
False
1303+
1304+
Sequence of All Natural Numbers::
1305+
1306+
sage: N = Seq2([Matrix([[2, 0], [2, 1]]), Matrix([[0, 1], [-2, 3]])],
1307+
....: left=vector([1, 0]), right=vector([0, 1]))
1308+
sage: N.is_bounded()
1309+
False
1310+
1311+
Indicator Function of Even Integers::
1312+
1313+
sage: E = Seq2([Matrix([[0, 1], [0, 1]]), Matrix([[0, 0], [0, 1]])],
1314+
....: left=vector([1, 0]), right=vector([1, 1]))
1315+
sage: E.is_bounded()
1316+
True
1317+
1318+
Indicator Function of Odd Integers::
1319+
1320+
sage: O = Seq2([Matrix([[0, 0], [0, 1]]), Matrix([[0, 1], [0, 1]])],
1321+
....: left=vector([1, 0]), right=vector([0, 1]))
1322+
sage: O.is_bounded()
1323+
True
1324+
1325+
Number of Odd Entries in Pascal's Triangle::
1326+
1327+
sage: U = Seq2([Matrix([[3, 0], [6, 1]]), Matrix([[0, 1], [-6, 5]])],
1328+
....: left=vector([1, 0]), right=vector([0, 1]))
1329+
sage: U.is_bounded()
1330+
False
1331+
1332+
Counting '10' in the Binary Representation::
1333+
1334+
sage: C = Seq2([Matrix([[0, 1, 0, 0], [0, 0, 0, 1],
1335+
....: [-1, 0, 1, 1], [0, 0, 0, 1]]),
1336+
....: Matrix([[0, 0, 1, 0], [0, 1, 0, 0],
1337+
....: [0, 0, 1, 0], [-1, 0, 1, 1]])],
1338+
....: left=vector([1, 0, 0, 0]),
1339+
....: right=vector([0, 0, 1, 0]))
1340+
sage: C.is_bounded()
1341+
False
1342+
1343+
Numbers Starting with '10'::
1344+
1345+
sage: D = Seq2([Matrix([[0, 1, 0, 0], [0, 0, 1, 0],
1346+
....: [0, -2, 3, 0], [0, -2, 2, 1]]),
1347+
....: Matrix([[2, 0, 0, 0], [0, 0, 0, 1],
1348+
....: [0, 2, 0, 1], [0, -2, 0, 3]])],
1349+
....: left=vector([1, 0, 0, 0]),
1350+
....: right=vector([2, 2, 2, 5]))
1351+
sage: D.is_bounded()
1352+
False
1353+
1354+
Signum Function::
1355+
1356+
sage: S = Seq2([Matrix([[1, 0], [0, 1]]), Matrix([[0, 1], [0, 1]])],
1357+
....: left=vector([1, 0]), right=vector([0, 1]))
1358+
sage: S.is_bounded()
1359+
True
1360+
1361+
Number of Digits from the Right to the First '1'::
1362+
1363+
sage: S = Seq2([Matrix([[0, 1, 0], [-1, 2, 0], [0, 0, 1]]),
1364+
....: Matrix([[0, 0, 1], [0, 0, 2], [0, 0, 1]])],
1365+
....: left=vector([1, 0, 0]), right=vector([0, 0, 1]))
1366+
sage: S.is_bounded()
1367+
False
1368+
1369+
.. SEEALSO::
1370+
1371+
:mod:`boundedness of k-regular sequences <sage.combinat.regular_sequence_bounded>`
1372+
1373+
TESTS::
1374+
1375+
sage: S = Seq2((Matrix([[0, 1, 0], [0, 0, 1], [-1, 2, 0]]),
1376+
....: Matrix([[-1, 0, 0], [-3/4, -1/4, 3/4], [-1/4, 1/4, -3/4]])),
1377+
....: left=vector([1, 0, 0]), right=vector([-4, -4, -4]))
1378+
sage: S.is_bounded()
1379+
False
1380+
1381+
::
1382+
1383+
sage: S = Seq2((Matrix([[1, 0], [1, 0]]), Matrix([[0, 1],[1, 0]])),
1384+
....: left = vector([1, 1]), right = vector([1, 0]),
1385+
....: allow_degenerated_sequence=True)
1386+
sage: S.is_degenerated()
1387+
True
1388+
sage: S.is_bounded()
1389+
True
1390+
"""
1391+
from sage.combinat.regular_sequence_bounded import regular_sequence_is_bounded
1392+
return regular_sequence_is_bounded(self)
1393+
12821394

12831395
def _pickle_RegularSequenceRing(k, coefficients, category):
12841396
r"""

0 commit comments

Comments
 (0)