@@ -992,61 +992,48 @@ def guess(self, f, n_max=None, d_max=None, domain=None, sequence=None):
992
992
sage: S.mu[0], S.mu[1], S.left, S.right
993
993
([1], [1], (2), (1))
994
994
995
- ::
995
+ We guess some partial sums sequences ::
996
996
997
997
sage: S = Seq2((Matrix([1]), Matrix([2])), vector([1]), vector([1]))
998
998
sage: S
999
+ 2-regular sequence 1, 2, 2, 4, 2, 4, 4, 8, 2, 4, ...
999
1000
sage: from itertools import islice
1000
1001
sage: L = []; ps = 0
1001
1002
sage: for s in islice(S, 110):
1002
1003
....: ps += s
1003
1004
....: L.append(ps)
1004
1005
sage: G = Seq2.guess(lambda n: L[n])
1005
1006
sage: G
1007
+ 2-regular sequence 1, 3, 5, 9, 11, 15, 19, 27, 29, 33, ...
1006
1008
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
1035
1015
1036
1016
::
1037
1017
1038
1018
sage: Seq3 = kRegularSequenceSpace(3, QQ)
1039
1019
sage: S = Seq3((Matrix([1]), Matrix([3]), Matrix([2])), vector([1]), vector([1]))
1040
1020
sage: S
1021
+ 3-regular sequence 1, 3, 2, 3, 9, 6, 2, 6, 4, 3, ...
1041
1022
sage: from itertools import islice
1042
1023
sage: L = []; ps = 0
1043
1024
sage: for s in islice(S, 110):
1044
1025
....: ps += s
1045
1026
....: L.append(ps)
1046
1027
sage: G = Seq3.guess(lambda n: L[n])
1047
1028
sage: G
1029
+ 3-regular sequence 1, 4, 6, 9, 18, 24, 26, 32, 36, 39, ...
1048
1030
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
1050
1037
"""
1051
1038
import logging
1052
1039
logger = logging .getLogger (__name__ )
0 commit comments