Consider the following code:
g = Table[Sign[StieltjesGamma[n]], {n, 0, 30}];
s = FindSequenceFunction[g];
The result is a certain DifferenceRoot
object (too long to include here), which essentially solves the recurrence relation
$$
a_{n+1}=a_n
$$
with "initial conditions" $a_i=g_i$. In other words, the DifferenceRoot
is actually storing the first 30 elements of g
as initial conditions, and predicting the rest to be a constant sequence:
$$
s_i=\begin{cases}g_i & i\in[1,30]\\ 1 & i>30\end{cases}
$$
This is obviously cheating: you could do the same thing to any sequence, that is, store all the known elements as initial conditions to an arbitrary recurrence relation, and predict the rest using that recurrence relation. Such a prediction would be meaningless. Is this behaviour of FindSequenceFunction
a bug?
Note that in this case there is no known closed-form expression for g
, so s
should be returned unevaluated. In fact, that's what I expected to get; the DifferenceRoot
object was certainly a surprise. In any case, there is nothing special about the Stieltjes constants: the sequence g
can be replaced with any random sequence of integers, such as
SeedRandom[1]
g = RandomChoice[{-1, 1}, 30];
which has the same behaviour: FindSequenceFunction
returns a DifferenceRoot
object that stores the elements of g
as initial conditions to an (arbitrarily chosen?) recurrence relation.
bug
one though... $\endgroup$FindSequenceFunction
can predict any element of the sequence, can't it? Or am I missing something ? $\endgroup$s
suggests. $\endgroup$FindSequenceFunction
makes no claim at being predictive. You may be right it is a useless result, but not a bug. $\endgroup$