Question: Given a sample formula `'y=2x+1`' we can get y when we know x with a defined '`function`', for example in python 

```
def y(x):   return 2*x + 1

x :   1    2    3     4     5     ...
y :   3    5    7     9     11    ...

```

Can I do it reversed? Given data samples and get the approximate formula?

```
x :   1.001    2.12    3.1     4.001     5.021     ...
y :   3.002    5.23    7.2     9.002     11.32    . ..

```

Of course, it is easily to draw all points by coordinates and link those points to get approximate formula then guess the result when people to solve this, but how do it by programming? 

Any keywords can search or libs can use?

Thank you.

=====

Many thanks for everyone. After searching a bit with information you shared, it is a BIGG...G area without a simple solution -\_-!.

Technically, I realized what I need should be "`polynomial fitting`" given the difference of `Polynomial regression/ Polynomial interpolation/ polynomial approximation`......

I will give the credit to Gerard, and again, thanks all for your help.

Answer: 
Here i would say the problem looks more like [polynomial interpolation](http://en.wikipedia.org/wiki/Polynomial_interpolation)
In python you have many libs dealing with that, for example high level [scipy.interpolate](http://docs.scipy.org/doc/scipy-0.14.0/reference/interpolate.html)
or you can do it "by hand" like [these examples](http://nbviewer.ipython.org/gist/rjleveque/8798427)

In any case, you will need some maths !
Probably you need NumPy and SciPy packages. For example, see `Linear Regression` docs for SciPy: <http://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.stats.linregress.html>