For the problem, as stated, I understand that you have an
unconstrained sequence of 100 numbers and that you require a method to
guess the pattern which generated that sequence. You are about to be
disappointed.
Given a finite sequence of numbers there exists a trivial algorithm to
reproduce that sequence? place the sequence of numbers into a vector
and iterate over that vector. I suspect this is not the kind of
solution you envisioned.
I suspect you are thinking of numeric sequences of the kind you
frequently see in intelligence tests where there is a trivial
generation rule ? such as for the sequence 1,1,2,3,5,8,13? where each
number is the sum of the previous two. If you constrain your problem
by only requiring solutions fitting a finite set of known types of
sequence then we can find algorithms to test for a fit for those
specific cases. In the general case, where the sequence of numbers
you wish to handle are unconstrained, this is not computable ? i.e.
you will find no algorithm that given a finite sequence of numbers
will return the most simple function to generate the sequence. The
?Online Encyclopedia of integer sequences? (referred to by
lticket-ga) takes the opposite approach? it knows about many common
sequences and tried to identify the sequence you entered as ?similar?
to one it has seen before (I presume using offsets and scaling) It
is important to note that this will only reverse-engineer a very small
proportion of the possible sequences.
If you are looking to predict trends (for example if the sequence of
numbers represented stock prices for example) then thinking of the
sequence suggests that a statistical model is what you really want?
statisticians spend most of their time looking at random data and
using trial and error to try and find simple models which are good
approximations to their sample data. There are no short cuts.
If this is a real problem (as opposed to a mental exercise) then you
need to re-think the problem definition ? you need to bring to bear
more facts that can be assumed about the specific numeric sequences
you wish to analyse? |