Possible Duplicate:
Writing a function $f$ when $x$ and $f(x)$ are known
I'm not versed in mathematics, so you'll have to speak slowly...
If I want to fit a curve to the points,
X Y
1 0.5
2 5.0
3 0.5
4 2.5
5 5.0
6 0.5
Where would I begin? For my purposes, this needs to be a sixth-order fit...
First of all, since you have 6 points, you can only get a 5th order polynomial to fit. You need two points to define a line, 3 to define a quadratic, 4 for a cubic... n+1 for an nth-order.
The naive solution is simply to set up:
Y = A5 x^5 + A4 x^4 + A3 x^3 + A2 x^2 + A1 x + A0
For each data pair, plug in x, and generate an equation for the coefficients. You'll now have six equations in six unknowns, which is solvable, but computationally annoying if you're doing it by hand.
Example: for the second point, x=2, y=5
5 = A5 (2)^5 + A4 (2)^4 + A3 (2)^3 + A2 (2)^2 + A1 (2) + A0
and you end up with:
5 = 32 A5 + 16 A4 + 8 A3 + 4 A2 + 2 A1 + A0
Repeat for each data point, and then solve the system of equations for A0, A1, ..., A5