Steven D'Aprano wrote: > On Tue, 04 Jul 2006 03:06:37 -0700, aliassaf wrote: > > >>Hello, >> >>If we write = x^2 and if I give to the program the values of x, it will >>going to calculate the values of y, and also for x. >> >>But it is possible ? that is if I give to the program the values of X and Y, >>it will indicate to me the relation between the two variables, in the other >>hand if I look to the program x=2 y=4, x=3 y=9 ect... it is going to show me >>that f (t)!!! > > > You are asking for curve-fitting. There is a HUGE amount of work on > curve-fitting in computer science and statistics. > > Generally, you start with some data points (x, y). You generally have some > idea of what sort of function you expect -- is it a straight line? A > curve? What sort of curve? A polynomial, an exponential, a sine curve, a > cubic spline, a Bezier curve? > > You might like to google on "least squares curve fitting" and "linear > regression". That's just two methods out of many. > > Some curve-fitting methods also estimate the error between the predicted > curve and the data points; you could then try all of the methods and pick > the one with the least error. >
The problem being that complex enough models will fit the data arbitrarily closely (i.e. over-fit). The OP should take into account any prior expectations over the type of function (as you indicate) and apply Occam's razor (find a relatively simple model that gives a reasonable fit to the data). Duncan -- http://mail.python.org/mailman/listinfo/python-list