Skip to content

Commit c198d90

Browse files
committed
fix left/right issue when bootstraping guessing
1 parent c15742d commit c198d90

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

src/sage/combinat/k_regular_sequence.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,6 +1201,23 @@ def guess(self, f, n_max=100, max_exponent=10, sequence=None):
12011201
Traceback (most recent call last):
12021202
...
12031203
RuntimeError: aborting as exponents would be larger than max_exponent=1
1204+
1205+
::
1206+
1207+
sage: R = kRegularSequenceSpace(2, QQ)
1208+
sage: one = R.one_hadamard()
1209+
sage: S = R.guess(lambda n: sum(n.bits()), sequence=one) + one
1210+
sage: T = R.guess(lambda n: n*n, sequence=S, n_max=4); T
1211+
2-regular sequence 0, 1, 4, 9, 16, 25, 36, 163/3, 64, 89, ...
1212+
sage: T.linear_representation()
1213+
((0, 0, 1),
1214+
Finite family {0: [1 0 0]
1215+
[0 1 0]
1216+
[0 0 4],
1217+
1: [ 0 1 0]
1218+
[ -1 2 0]
1219+
[13/3 -5/3 16/3]},
1220+
(1, 2, 0))
12041221
"""
12051222
import logging
12061223
logger = logging.getLogger(__name__)
@@ -1217,8 +1234,8 @@ def guess(self, f, n_max=100, max_exponent=10, sequence=None):
12171234
seq = lambda m: vector([])
12181235
else:
12191236
mu = [M.rows() for M in sequence.mu]
1220-
seq = lambda m: sequence.left * sequence._mu_of_word_(
1221-
self._n_to_index_(m))
1237+
seq = lambda m: (sequence._mu_of_word_(self._n_to_index_(m))
1238+
* sequence.right)
12221239
logger.info('including %s', sequence)
12231240

12241241
zero = domain(0)

0 commit comments

Comments
 (0)