fonction in python
Steven D'Aprano
steve at REMOVETHIScyber.com.au
Tue Jul 4 10:57:47 EDT 2006
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.
--
Steven.
More information about the Python-list
mailing list