I don't understand what is polynomial fitting.
Can anyone explain to me how to fit a curve to given points?

- 75,051

- 9,344
-
2If you google for "polynomial fitting" you will find at least a couple of rather informative results. (In particular, after reading at least the wikipedia page it should be clear that one does not "fit a polynomial", so that your third line does not make sense) – Mariano Suárez-Álvarez Oct 18 '10 at 14:47
-
Thank you! So can I say "how to fit a curve"? – rubik Oct 18 '10 at 16:01
-
More properly, "how to fit a curve to given points". – J. M. ain't a mathematician Oct 18 '10 at 16:10
-
Ok, I've edited! – rubik Oct 18 '10 at 16:22
-
1Seriously, edited just for removing thanks? Things certainly have changed since I was away... – J. M. ain't a mathematician Mar 23 '13 at 16:30
-
2@J.M. Well said. Nice to see you back. – Rudy the Reindeer Mar 23 '13 at 16:48
-
@J.M., good to see you active! Some people don't realize that we are a polite community... ;) – Asaf Karagila Mar 25 '13 at 13:56
-
@Asaf, well, I'm back-ish... I would still not be able to post everyday, but at least I'm back in the city. – J. M. ain't a mathematician Apr 02 '13 at 13:13
-
@J.M. I hope that you didn't have to perform a daring escape from a prison built underground from the bones of your ancestors, with only lye to eat and hot water to drink. – Asaf Karagila Apr 02 '13 at 13:33
1 Answers
There are two concepts frequently conflated: interpolation and fitting. I'll discuss both since you don't seem to know what you really want.
Let's say you have a set of $n$ points
$$(x_i,y_i)\qquad i=1\dots n$$
Interpolation is the problem of finding the (unique) polynomial $p(x)$ that passes through all your given points (under the assumption that no two points have the same abscissa), i.e. $p(x_i)=y_i \qquad i=1\dots n$. Your resulting polynomial is of degree $n-1$. The usual techniques for finding the interpolating polynomial are the methods of Lagrange, Newton, and Neville-Aitken.
Fitting on the other hand assumes your data is contaminated with error, and you want the polynomial that is the "best approximation" to your data. Here polynomial interpolation does not make much sense since you do not want your function to be reproducing the inherent errors in your data as well. Least-squares is a common technique: it finds the polynomial $f(x)$ such that the quantity
$$\sum_{j=1}^{n}\left(f(x_i)-y_i\right)^2$$
which measures the departure of your polynomial from the ordinates is minimized (here the assumption is that your abscissas are error-free, and the error in your ordinates is normally distributed). The degree of $f(x)$ can be (and is often) less than $n$. A number of techniques for this are used as well: there's the normal equations, and then there are special matrix decompositions that can be used to efficiently solve this problem.

- 75,051
-
-
+1 Wonderful explanation! I think now I have understood what is polynomial fitting! I'd vote you if I could! – rubik Oct 18 '10 at 16:14