[net.ai] Best fitting curve

ee171bbr@sdccsu3.UUCP (VINDICATOR) (06/24/84)

Given three points, what is the equation
of the best fit curve. (how does one
go about solving this?)

also, what is knuth's cocubic equation
and would that solve my problem?


John F.

leichter@yale-comix.UUCP (Jerry Leichter) (06/25/84)

The notion of a "best fitting curve" through some points has no inherent
meaning.  You have to specify what kinds of curves you are willing to allow,
what kind of constraints you want to put on them, and what kind of measurement
of "fit" you are interested in.

Given n points in the plane, in general there is a unique (n-1)st degree poly-
nomial that passes through those points.  (Hence, there are infinitely many
nth degree polynomials, one for every other point in the plane that you can
consider to be an (n+1)st point.)  Such a polynomial is "best" in the sense
that it has 0 error at every point specified.  It is almost certainly not
what you would want for fitting data; it will generally oscillate between
your data points and will have uncontrollable behavior outside the range in
which your data points occur - i.e., the curve will not look at all "smooth"
to the eye.  Even if you want a curve that "looks good", you can use a
cubic (or higher-order) spline curve.  This is a curve defined by fitting
together polynomials; you take the first 4 points in order, pass a cubic
through them, take the last two and the next one, pick a cubic through those
that has the same derivative at the 4th point as the first cubic, etc...
(There are many other ways to choose spline curves.  This particular method
passes through all the points; in some cases, "smoothness" of some sort may
be more important than actually touching the points, so some kinds of splines
don't even pass through the given data points.  All spline curves are piece-
wise defined polynomials; there is no simple algebraic formula that defines
them; rather, there is a series of such formulas, one for each range of input
values.)

If the goal of "best fit" is to produce good interpolated values for a function,
rather than a curve that "looks" like it is determined by the points, all sorts
of other techniques exist.  For example, a Chebyshev approximation will have
the least maximum error (assuming a model in which you are approximating some
known, complex function by choosing some representative points on it and
an approximating polynomial.)  However, least maximum error is not the same
as least average absolute error, or least RMS error, or...

So, in summary:  If you give me three points, I can write down pretty much
ANY function and find some way to defend it's being the "best fit" to the
three given points.  You will have to specify your goals more precisely.
							-- Jerry
					decvax!yale-comix!leichter leichter@yale

mark@umcp-cs.UUCP (06/26/84)

Give three points, the best fitting curve is a plane.

More seriously, doesn't the answer to this question depend upon
what sort of equations one is willing to consider?
-- 
Spoken: Mark Weiser 	ARPA:	mark@maryland
CSNet:	mark@umcp-cs 	UUCP:	{seismo,allegra}!umcp-cs!mark