@@ -900,8 +900,28 @@ def _n_to_index_(self, n):
900
900
return W (n .digits (self .k ))
901
901
902
902
903
- def guess (self , f , n_max = None , d_max = None , domain = None , sequence = None ):
903
+ def guess (self , f , n_max = 100 , max_dimension = 10 , sequence = None ):
904
904
r"""
905
+ Guess a `k`-regular sequence of `(f(n))_{n\geq0}`.
906
+
907
+ INPUT:
908
+
909
+ - ``f`` -- a function (callable) which determines the sequence.
910
+ It takes nonnegative integers as an input.
911
+
912
+ - ``n_max`` -- (default: ``100``) a positive integer. The resulting
913
+ `k`-regular sequence coincides with `f` on the first ``n_max``
914
+ terms.
915
+
916
+ - ``max_dimension`` -- (default: ``10``) a positive integer specifying
917
+ the maxium dimension which is tried when guessing the sequence.
918
+
919
+ - ``sequence`` -- (default: ``None``) a `k`-regular sequence used
920
+ for bootstrapping this guessing.
921
+
922
+ OUTPUT:
923
+
924
+ A :class:`kRegularSequence`.
905
925
906
926
EXAMPLES:
907
927
@@ -1044,12 +1064,7 @@ def guess(self, f, n_max=None, d_max=None, domain=None, sequence=None):
1044
1064
from sage .modules .free_module_element import vector
1045
1065
1046
1066
k = self .k
1047
- if n_max is None :
1048
- n_max = 100
1049
- if d_max is None :
1050
- d_max = 10
1051
- if domain is None :
1052
- domain = self .base () # TODO
1067
+ domain = self .coefficients ()
1053
1068
if sequence is None :
1054
1069
mu = [[] for _ in srange (k )]
1055
1070
seq = lambda m : tuple ()
@@ -1118,7 +1133,7 @@ def include(line):
1118
1133
while to_branch :
1119
1134
line_R = to_branch .pop (0 )
1120
1135
t_R , r_R , s_R = line_R
1121
- if t_R >= d_max :
1136
+ if t_R >= max_dimension :
1122
1137
raise RuntimeError
1123
1138
1124
1139
t_L = t_R + 1
0 commit comments