Approximating/Fitting a function to points

  • Thread starter Thread starter thomas49th
  • Start date Start date
  • Tags Tags
    Function Points
thomas49th
Messages
645
Reaction score
0
Hi, given a function of x, where x increases in uniform increments (ie x goes 1, 2, 3) and y culmalatively increases in the domain x>0, what methods are there to fit a function it to? I want to know method/algorithm that can fit a line/curve to it. So given these points

(1,4)
(2,5)
(3,2)
(4,7)
(5,1)
(6,1)

I want a Cartesian equation (y= function of x) that can accurately plot a curve through these points - like how a taylor series can be used to approximate functions, but I want to be able to produce a function, or approximate one without. I know that the more disperse the points are from each other the higher the degree of the polynomial (if a polynomial method is used)

Thanks
Thomas
 
Physics news on Phys.org
thomas49th said:
Hi, given a function of x, where x increases in uniform increments (ie x goes 1, 2, 3) and y culmalatively increases in the domain x>0, what methods are there to fit a function it to? I want to know method/algorithm that can fit a line/curve to it. So given these points

(1,4)
(2,5)
(3,2)
(4,7)
(5,1)
(6,1)

I want a Cartesian equation (y= function of x) that can accurately plot a curve through these points -
There are infinite possibilities.

like how a taylor series can be used to approximate functions, but I want to be able to produce a function,
You can not determine a unique taylor series unless you have infinite days (i.e. know every derivative. However, you can do a polynormial fit for the form:

y=a+bx+cx^2+ex^3+fx^4+gx^5

For each point, you plug in a value for y and x and you end up with six equations and six unknowns. This is a type of bilinear fit and more generally:

y=a_1f_1(x)+...+a_nf_n(x)

where the functions f_1(z)..f(n) are independent over the points (x_1,y_1),...,(x_n,y_n).

It is generally not a good idea to fit a lot of points with a higher order polynomial because the fit can be real wavy (noisy). For interpolation, piece wise fits are preferred. Also if you are trying to discover any relationship between the points, it is better to have more data, then unknowns. You won't fit the points exactly but if the data was given at random there would be less variance in your estimates. When you are trying to fit more data then you have unknowns you decide on some optimization criteria like minimum mean squared error.
 
Generally speaking, you try to guess the behavior of the trend from the source. Common choices include exponentials, logarithms, polynomials, and rationals. Trig functions, too. Just play around. Unless you have some clue as to what the function should look like, you can come up with functions that hit all of those points, that hit some of them, and that are pretty close, ad infinitum.
 
Prove $$\int\limits_0^{\sqrt2/4}\frac{1}{\sqrt{x-x^2}}\arcsin\sqrt{\frac{(x-1)\left(x-1+x\sqrt{9-16x}\right)}{1-2x}} \, \mathrm dx = \frac{\pi^2}{8}.$$ Let $$I = \int\limits_0^{\sqrt 2 / 4}\frac{1}{\sqrt{x-x^2}}\arcsin\sqrt{\frac{(x-1)\left(x-1+x\sqrt{9-16x}\right)}{1-2x}} \, \mathrm dx. \tag{1}$$ The representation integral of ##\arcsin## is $$\arcsin u = \int\limits_{0}^{1} \frac{\mathrm dt}{\sqrt{1-t^2}}, \qquad 0 \leqslant u \leqslant 1.$$ Plugging identity above into ##(1)## with ##u...
Back
Top