Interpolate the data set (1, 150), (3, 175), (4, 185), (6, 200), (8, 300) to estimate the amount of money Gracie may earn if she displays her items for 7 hours
Since 7 is halfway between 6 and 8, Gracie should earn an amount about halfway between 200 and 300, that is, 250 (triangular interpolation). This is the simplest interpolation, but see later.
Interpolating for 2 and 5 we get 162.5 and 192.5, that is, respectively, a difference of 12.5 (162.5-150 or 175-162.5) and 7.5 (192.5-185 or 200-192.5), while 250 is a difference of 50 from 200 and 300. So the interpolated figures fluctuate.
For a more sophisticated approach, we need to take the whole dataset and look for a formula that best fits.
One way to do this is to fit a polynomial F(x)=ax^4+bx^3+cx^2+dx+e into the five given points. This polynomial has 5 unknown coefficients, so with 5 simultaneous equations we should be able to find them. The process can be simplified slightly by taking the lowest "x" coord and using that as the zero starting point. In this case the lowest coord is 1 (hour) so we subtract 1 from the first coord of each pair to get: (0,150), (2,175), etc.
F(0)=e=150. So we have the constant 150. The next step is to subtract 150 from each of the other "y" coords so we arrive at the following set of equations:
and we already have F(0)=150=e.
We can now eliminate d from (1) and (2): 2F(3)-3F(2):
and we can eliminate d from (3) and (4): 5F(7)-7F(5):
7630a+840b+70c=400 which simplifies to (6) 763a+84b+7c=40 or 109a+12b+c=40/7
We can eliminate c between (5) and (6): 6(6)-(5):
(7) 540a+42b=275/7 or 90a+7b=275/42. So b=(275/42-90a)/7.
From (6) we have:
109a+12b+c=109a+12(275/42-90a)/7+c=40/7, so c=40/7-109a-12(275/42-90a)/7;
c=40/7-550/7+(1080/7-109)a=-510/7+317a/7=(317a-510)/7. We now have b and c in terms of a. We can continue to find d in terms of a.
From (1) d=(25-16a-8b-4c)/2=25-16a-8(275/42-90a)/7-4(317a-510)/7;
We have b, c and d in terms of a, so we can find a by substituting into an equation containing all four coefficients (but not (1), because we used it to find d). Let's pick (2) and hope we get a sensible result!
From this a=5143/2772=1.855. Therefore b=-22.919, c=78.510, d=-67.687, e=150.
This results need to be checked before we use F to find an interpolated value.
Unfortunately, this polynomial approach produces inconsistent results, and needs to be discarded.
Lagrange's method seems the obvious choice, even if it is tedious to do.
We have 5 x values which we'll symbolise as x0, x1, x2, x3, x4 and 5 function values f0, f1, f2, f3, f4.
If the function we're looking for is f(x) then:
x0=1, x1=3, x2=4, x3=6, x4=8;
f0=150, f1=175, f2=185, f3=200, f4=300.
We want x=7, so f(7) is given by:
This comes to:
-60/7+105-185+240+540/7=1600/7=228.57 (229 to the nearest whole number) compared with 250 from the simple interpolation. Read More: ...