Skip to content

Commit 90e4ed5

Browse files
committed
doctests
1 parent 9818d94 commit 90e4ed5

File tree

1 file changed

+17
-30
lines changed

1 file changed

+17
-30
lines changed

src/sage/combinat/k_regular_sequence.py

Lines changed: 17 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -992,61 +992,48 @@ def guess(self, f, n_max=None, d_max=None, domain=None, sequence=None):
992992
sage: S.mu[0], S.mu[1], S.left, S.right
993993
([1], [1], (2), (1))
994994
995-
::
995+
We guess some partial sums sequences::
996996
997997
sage: S = Seq2((Matrix([1]), Matrix([2])), vector([1]), vector([1]))
998998
sage: S
999+
2-regular sequence 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, ...
9991000
sage: from itertools import islice
10001001
sage: L = []; ps = 0
10011002
sage: for s in islice(S, 110):
10021003
....: ps += s
10031004
....: L.append(ps)
10041005
sage: G = Seq2.guess(lambda n: L[n])
10051006
sage: G
1007+
2-regular sequence 1, 3, 5, 9, 11, 15, 19, 27, 29, 33, ...
10061008
sage: G.mu[0], G.mu[1], G.left, G.right
1007-
1008-
::
1009-
1010-
sage: S = Seq2((Matrix([1]), Matrix([3])), vector([1]), vector([1]))
1011-
sage: S
1012-
sage: from itertools import islice
1013-
sage: L = []; ps = 0
1014-
sage: for s in islice(S, 110):
1015-
....: ps += s
1016-
....: L.append(ps)
1017-
sage: G = Seq2.guess(lambda n: L[n])
1018-
sage: G
1019-
sage: G.mu[0], G.mu[1], G.left, G.right
1020-
1021-
::
1022-
1023-
sage: S = Seq2((Matrix([2]), Matrix([3])), vector([1]), vector([1]))
1024-
sage: S
1025-
sage: from itertools import islice
1026-
sage: L = []; ps = 0
1027-
sage: for s in islice(S, 110):
1028-
....: ps += s
1029-
....: L.append(ps)
1030-
sage: G = Seq2.guess(lambda n: L[n])
1031-
sage: G
1032-
sage: G.mu[0], G.mu[1], G.left, G.right
1033-
sage: H = G.minimized()
1034-
sage: H.mu[0], H.mu[1], H.left, H.right
1009+
(
1010+
[ 0 1] [3 0]
1011+
[-3 4], [3 2], (1, 0), (1, 1)
1012+
)
1013+
sage: G == S.partial_sums(include_n=True)
1014+
True
10351015
10361016
::
10371017
10381018
sage: Seq3 = kRegularSequenceSpace(3, QQ)
10391019
sage: S = Seq3((Matrix([1]), Matrix([3]), Matrix([2])), vector([1]), vector([1]))
10401020
sage: S
1021+
3-regular sequence 1, 3, 2, 3, 9, 6, 2, 6, 4, 3, ...
10411022
sage: from itertools import islice
10421023
sage: L = []; ps = 0
10431024
sage: for s in islice(S, 110):
10441025
....: ps += s
10451026
....: L.append(ps)
10461027
sage: G = Seq3.guess(lambda n: L[n])
10471028
sage: G
1029+
3-regular sequence 1, 4, 6, 9, 18, 24, 26, 32, 36, 39, ...
10481030
sage: G.mu[0], G.mu[1], G.mu[2], G.left, G.right
1049-
1031+
(
1032+
[ 0 1] [18/5 2/5] [ 6 0]
1033+
[-6 7], [18/5 27/5], [24 2], (1, 0), (1, 1)
1034+
)
1035+
sage: G == S.partial_sums(include_n=True)
1036+
True
10501037
"""
10511038
import logging
10521039
logger = logging.getLogger(__name__)

0 commit comments

Comments
 (0)