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)?
Fitting a function to a polynomial
-
0Actually, it is going forever but we can approximate it by some maximum t (t for which 1-F(t)<$\epsilon$). – 2011-11-16
2 Answers
Not sure what you mean by fitting against a polynomial (normally I would say fitting the polynomial to the data). But as an answer, you can compute F(23.0079) (or any other argument you like) and take the constant polynomial of that value. Or if you're more industrious, you can evaluate at a million points and take the average of the results as value for a constant polynomial. Anyway, you're not going to do better than with a constant polynomial: any non-constant polynomial is a pretty lousy approximation of a function on the positive reals with value bounded between 0 and 1.
-
0I agree that polynomials are a poor choice to approximate a bounded nondecreasing function. A rational function (quotient of two polynomials) with a horizontal asymptotic (the two polynomials have the same degree) would seem more natural. – 2015-11-26
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).
-
0Section 5.8 of Numerical Recipes http://apps.nrbook.com/c/index.html is useful for this-obsolete versions are free. It has a discussion of why they are nice-Runge's phenomenon, spreading the error out, and truncation to lower degree are all cited. – 2011-11-16