@@ -1049,11 +1049,13 @@ def guess(self, f, n_max=100, max_dimension=10, sequence=None):
1049
1049
INFO:...:M_1: f_{4*m+3} = (-1, 2) * X_m
1050
1050
sage: S1
1051
1051
2-regular sequence 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, ...
1052
- sage: S1.mu[0], S1.mu[1], S1.left, S1.right
1053
- (
1054
- [1 0] [ 0 1]
1055
- [0 1], [-1 2], (1, 0), (0, 1)
1056
- )
1052
+ sage: S1.linear_representation()
1053
+ ((1, 0),
1054
+ Finite family {0: [1 0]
1055
+ [0 1],
1056
+ 1: [ 0 1]
1057
+ [-1 2]},
1058
+ (0, 1))
1057
1059
1058
1060
sage: from importlib import reload
1059
1061
sage: logging.shutdown(); _ = reload(logging)
@@ -1065,52 +1067,63 @@ def guess(self, f, n_max=100, max_dimension=10, sequence=None):
1065
1067
sage: S2 = Seq2.guess(s, sequence=C)
1066
1068
sage: S2
1067
1069
2-regular sequence 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, ...
1068
- sage: S2.mu[0], S2.mu[1], S2.left, S2.right
1069
- (
1070
- [1 0] [1 0]
1071
- [0 1], [1 1], (0, 1), (1, 0)
1072
- )
1070
+ sage: S2.linear_representation()
1071
+ ((0, 1),
1072
+ Finite family {0: [1 0]
1073
+ [0 1],
1074
+ 1: [1 0]
1075
+ [1 1]},
1076
+ (1, 0))
1073
1077
1074
1078
The sequence of all natural numbers::
1075
1079
1076
1080
sage: S = Seq2.guess(lambda n: n)
1077
1081
sage: S
1078
1082
2-regular sequence 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ...
1079
- sage: S.mu[0], S.mu[1], S.left, S.right
1080
- (
1081
- [2 0] [ 0 1]
1082
- [2 1], [-2 3], (1, 0), (0, 1)
1083
- )
1083
+ sage: S.linear_representation()
1084
+ ((1, 0),
1085
+ Finite family {0: [2 0]
1086
+ [2 1],
1087
+ 1: [ 0 1]
1088
+ [-2 3]},
1089
+ (0, 1))
1084
1090
1085
1091
The indicator function of the even integers::
1086
1092
1087
1093
sage: S = Seq2.guess(lambda n: ZZ(is_even(n)))
1088
1094
sage: S
1089
1095
2-regular sequence 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, ...
1090
- sage: S.mu[0], S.mu[1], S.left, S.right
1091
- (
1092
- [0 1] [0 0]
1093
- [0 1], [0 1], (1, 0), (1, 1)
1094
- )
1096
+ sage: S.linear_representation()
1097
+ ((1, 0),
1098
+ Finite family {0: [0 1]
1099
+ [0 1],
1100
+ 1: [0 0]
1101
+ [0 1]},
1102
+ (1, 1))
1095
1103
1096
1104
The indicator function of the odd integers::
1097
1105
1098
1106
sage: S = Seq2.guess(lambda n: ZZ(is_odd(n)))
1099
1107
sage: S
1100
1108
2-regular sequence 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, ...
1101
- sage: S.mu[0], S.mu[1], S.left, S.right
1102
- (
1103
- [0 0] [0 1]
1104
- [0 1], [0 1], (1, 0), (0, 1)
1105
- )
1109
+ sage: S.linear_representation()
1110
+ ((1, 0),
1111
+ Finite family {0: [0 0]
1112
+ [0 1],
1113
+ 1: [0 1]
1114
+ [0 1]},
1115
+ (0, 1))
1106
1116
1107
1117
TESTS::
1108
1118
1109
1119
sage: S = Seq2.guess(lambda n: 2, sequence=C)
1110
1120
sage: S
1111
1121
2-regular sequence 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ...
1112
- sage: S.mu[0], S.mu[1], S.left, S.right
1113
- ([1], [1], (2), (1))
1122
+ sage: S.linear_representation()
1123
+ ((2),
1124
+ Finite family {0: [1],
1125
+ 1: [1]},
1126
+ (1))
1114
1127
1115
1128
We guess some partial sums sequences::
1116
1129
@@ -1125,11 +1138,13 @@ def guess(self, f, n_max=100, max_dimension=10, sequence=None):
1125
1138
sage: G = Seq2.guess(lambda n: L[n])
1126
1139
sage: G
1127
1140
2-regular sequence 1, 3, 5, 9, 11, 15, 19, 27, 29, 33, ...
1128
- sage: G.mu[0], G.mu[1], G.left, G.right
1129
- (
1130
- [ 0 1] [3 0]
1131
- [-3 4], [3 2], (1, 0), (1, 1)
1132
- )
1141
+ sage: G.linear_representation()
1142
+ ((1, 0),
1143
+ Finite family {0: [ 0 1]
1144
+ [-3 4],
1145
+ 1: [3 0]
1146
+ [3 2]},
1147
+ (1, 1))
1133
1148
sage: G == S.partial_sums(include_n=True)
1134
1149
True
1135
1150
@@ -1147,11 +1162,15 @@ def guess(self, f, n_max=100, max_dimension=10, sequence=None):
1147
1162
sage: G = Seq3.guess(lambda n: L[n])
1148
1163
sage: G
1149
1164
3-regular sequence 1, 4, 6, 9, 18, 24, 26, 32, 36, 39, ...
1150
- sage: G.mu[0], G.mu[1], G.mu[2], G.left, G.right
1151
- (
1152
- [ 0 1] [18/5 2/5] [ 6 0]
1153
- [-6 7], [18/5 27/5], [24 2], (1, 0), (1, 1)
1154
- )
1165
+ sage: G.linear_representation()
1166
+ ((1, 0),
1167
+ Finite family {0: [ 0 1]
1168
+ [-6 7],
1169
+ 1: [18/5 2/5]
1170
+ [18/5 27/5],
1171
+ 2: [ 6 0]
1172
+ [24 2]},
1173
+ (1, 1))
1155
1174
sage: G == S.partial_sums(include_n=True)
1156
1175
True
1157
1176
"""
0 commit comments