Find formula from values

116.7k Views Asked by At

Is there any "algorithm" or steps to follow to get a formula from a table of values.

Example:

Using this values:

X                Result
1                3
2                5
3                7
4                9

I'd like to obtain:

Result = 2X+1

Edit

Maybe using excel?

Edit 2

Additional info:

It is not going to be always a polynomial and it may have several parameters (I think 2).

3

There are 3 best solutions below

8
On BEST ANSWER

The best tool for doing this is that impressive piece of software: http://www.nutonian.com/products/eureqa/

Edit: For your abovementioned very easy example, even WA will find the right formula: http://www.wolframalpha.com/input/?i=3,+5,+7,+9,...

Edit 2: Unfortunately Nutonian was bought by DataRobot and their product is no longer freely available (not even for academic use). Yet in many cases other solutions exist, see e.g. my blog post here: Symbolic Regression, Genetic Programming… or if Kepler had R.

0
On

One way to obtain the desired relationship is to use the regression analysis. In the case that you know what form of the relationship you are expecting, say you know that $f(x) = a * x + b$ it is very simple to find the parameters $a$ and $b$ (see for example). In the case that you don't know what form your formula may take, it is common to use the nonparametric regression techniques.

1
On

An easier method (assuming that the values were generated by a polynomial) would be to note that successive divided differences $\frac{y_{i+1}-y_i}{x_{i+1}-x_i}$ are constant and equal to 2; thus your function is of the form $y=2x+c$. The constant $c$ is then determined by replacing both $x$ and $y$ with appropriate values, and then solving for $c$.