# Fitting a function to a polynomial

I have a black box called $F(t)$ with me where I don't have any information on the exact expression of $F(t)$. But if I supply a $t\ge 0$ I will get a value of $F(t)$ from the black box as output. It is also given that $F(t)$ is non-decreasing and $0\le F(t)\le 1$. I want to fit $F(t)$ against a polynomial of the form $\sum a_{i}t^{i}$. Is there any tool for this where the degree of the polynomial is user-defined (can be very large like 100)?

-
Is this going on forever, or is there a finite time $T$ when the process ends? – Christian Blatter Nov 15 '11 at 15:45
Actually, it is going forever but we can approximate it by some maximum t (t for which 1-F(t)<$\epsilon$). – aaaaaa Nov 16 '11 at 5:37

If you collect $n$ points of data, there will be exactly one polynomial of degree $n-1$ or less that goes through those points. You can use Lagrange interpolation to find it. Choosing the points differently will give different polynomials unless your function is in fact a polynomial of degree $n-1$ or less. People often like the Chebyshev polynomials where the points are distributed as $x_k=1+\frac{1}{2}\cos\frac{(2k-1)\pi}{2n}$ (where my 1 and 1/2 are to make the interval $(0,1)$ instead of $(-1,1)$ as in the article).