@@ -238,7 +238,7 @@ def _repr_(self):
238
238
preview = 10 )
239
239
240
240
@cached_method
241
- def __getitem__ (self , n , ** kwds ):
241
+ def coefficient_of_n (self , n , ** kwds ):
242
242
r"""
243
243
Return the `n`-th entry of this sequence.
244
244
@@ -256,6 +256,11 @@ def __getitem__(self, n, **kwds):
256
256
sage: S[7]
257
257
3
258
258
259
+ This is equivalent to::
260
+
261
+ sage: S.coefficient_of_n(7)
262
+ 3
263
+
259
264
TESTS::
260
265
261
266
sage: S[-1]
@@ -279,6 +284,8 @@ def __getitem__(self, n, **kwds):
279
284
"""
280
285
return self .coefficient_of_word (self .parent ()._n_to_index_ (n ), ** kwds )
281
286
287
+ __getitem__ = coefficient_of_n
288
+
282
289
def __iter__ (self ):
283
290
r"""
284
291
Return an iterator over the coefficients of this sequence.
@@ -521,7 +528,7 @@ def subsequence(self, a, b):
521
528
522
529
zero_M = self .mu [0 ].parent ().zero ()
523
530
zero_R = self .right .parent ().zero ()
524
- # Let v(n) = self.__getitem__ (n, multiply_left=False)
531
+ # Let v(n) = self.coefficient_of_n (n, multiply_left=False)
525
532
rule = {}
526
533
# We will construct `kernel` and `rule` in such a way that for all
527
534
# c in `kernel`,
@@ -557,7 +564,7 @@ def matrix_row(r, c):
557
564
b .get (c , 0 ) * self .left
558
565
for c in kernel )),
559
566
vector (chain .from_iterable (
560
- (self .__getitem__ (c , multiply_left = False ) if c >= 0 else zero_R )
567
+ (self .coefficient_of_n (c , multiply_left = False ) if c >= 0 else zero_R )
561
568
for c in kernel )))
562
569
563
570
return result
@@ -1265,8 +1272,7 @@ def guess(self, f, n_verify=100, max_exponent=10, sequence=None):
1265
1272
seq = lambda m : vector ([])
1266
1273
else :
1267
1274
mu = [M .rows () for M in sequence .mu ]
1268
- seq = lambda m : (sequence ._mu_of_word_ (self ._n_to_index_ (m ))
1269
- * sequence .right )
1275
+ seq = lambda m : sequence .coefficient_of_n (m , multiply_left = False )
1270
1276
logger .info ('including %s' , sequence )
1271
1277
1272
1278
zero = domain (0 )
0 commit comments