Interpolation help fitting curve to three points

KV-1
Messages
16
Reaction score
1
Hello,

I have the following points that need to be fitted with a curve:
(1,20);(2,4);(5,3)

I'm wondering how to use the http://en.wikipedia.org/wiki/Lagrange_polynomial to do this.

If possible, can these points be fitted with a cubic function?

I tried to fit a cubic to this, but for me it's a game of guess and check which won't give me anything efficiently.
 
Physics news on Phys.org
There are infinitely many cubic polynomial equations that will go through three points, but only one quadratic (i.e. parabola). You can use example 3 as a guide in the link you provided, or write out three quadratic equations by substituting the values you have for x and y. In the end you'll have 3 equations with 3 unknowns (i.e. the coefficients of the parabola) that can be solved using substitution.
 
Last edited:
And the Lagrange polynomial formula gives that quadratic, not a cubic.

The given points are (1,20), (2,4), and (5,3).
20\frac{(x- 2)(x- 5)}{(1- 2)(1- 3)}+ 4\frac{(x- 1)(x- 5)}{(2- 1)(2- 5)}+ 3\frac{(x- 1)(x- 2)}{(5- 1)(5- 2)}
= 20\frac{(x- 2)(x- 5)}{2}+ 4\frac{(x-1)(x-5)}{-3}+ 3\frac{(x-1)(x-2)}{12}
 
HallsofIvy said:
And the Lagrange polynomial formula gives that quadratic, not a cubic.

The given points are (1,20), (2,4), and (5,3).
20\frac{(x- 2)(x- 5)}{(1- 2)(1- 3)}+ 4\frac{(x- 1)(x- 5)}{(2- 1)(2- 5)}+ 3\frac{(x- 1)(x- 2)}{(5- 1)(5- 2)}
= 20\frac{(x- 2)(x- 5)}{2}+ 4\frac{(x-1)(x-5)}{-3}+ 3\frac{(x-1)(x-2)}{12}
Hallsofivy, i think there's a mistake.. the bold one..20(x−2)(x−5)/(1−2)(1−5)+4(x−1)(x−5)/(2−1)(2−5)+3(x−1)(x−2)/(5−1)(5−2)

it is 5, not 3 right?
 
Back
Top