Interpolation. Solved Problems
Interpolation. Solved Problems
Until now, whenever we studied a problem in which a function appeared, it was given to us...
correctly an expression of the form f(x), or the necessary data to establish it.
This allowed us to conduct a study on its characteristics and behavior, and use it
in the resolution of a problem.
The inverse situation will now be presented, that is, given a series of points:
find a real function of a real variable that verifies all those values and also allows:
Calculate the corresponding value at an intermediate point of the ones we have, in such a way
that the result adjusts with the least possible error to the experiment carried out, or to the values
from the function (depending on the source of the data table). This operation is called interpo-
lotion.
Study whether the obtained function fits the expected results outside the interval in the
that the given values of x are found. This process is called extrapolation.
Extrapolate: To find the value of a magnitude for values that are outside of the
interval in which that magnitude has been measured.
The need to raise such a problem arises from the following fact: in most cases, the
norms that govern human behavior, the evolution of nature, etc., do not come des-
written by a specific and known formula. Normally, we only have a series that is more or
menos amplia de valores recogidos de una forma experimental, que nos darán la pauta de su
behavior; from them we can deduce, with a more or less controlled error, data not
included in the study.
Interpolation error
The interpolation error is the difference, in absolute value, between the value of the given function f
and the one who takes the interpolating function g.
P(x) ax b
What is the expression of the linear function? f(x) ax Its graph is a straight line.
y 1 ax b1
y 2 ax2 b
whose equations are obtained by imposing the condition that f(x) passes through P (x1 , y1 1 )y
P2(x 2, y 2) .
Example: Find the equation of the line that passes through the points A(1,13) and B(3,5). Calculate-
the interpolation values when x 2 y x 4.
13 a 1 b a 4
5 a 3 b b 17
x 2 y 4 2 17 9
x 4 y 4 4 17 1
Example: Knowing that log10 1 and log100 2, hall, by linear interpolation, log7 and
log90. Through the calculator, determine the error made.
1
a
1 10a b 90 1 8
y x
2 100a b 8 90 9
b
9
Parax 7obtains 0'966. Parax 90 is obtained 1'888.
Example: The price of the electricity bill based on the number of kilowatt-hours used
is approximately given by a linear function p(k) ak where to re-
presents the price of the kWh
from successive years of 1987 we have extracted the following table of consumption in kW-h and
price of the receipt in pesetas (excluding VAT):
k 84 61
p(k) 1850 1593
Find the price of the kw-h and the costs of power and equipment.
It is then deduced that the price of the kWh in 1987 was 11.17 pts and the expenses of
power and equipment were 912 points.
When it comes to interpolating a single value between two given values from a function table, it is
much faster and easier to use the method of the rule of three.
Let's suppose we have the values P (x 11, y 1 )yP2 (x 2, y 2We wish to find the value
the corresponding interpolation axi.
y I y1 d i x1 xi x2
Example: Knowing that log200 2'301030 and log202 2'305351, calculate log201 for
linear interpolation (log denotes the logarithm to base 10).
2'305351 2'301030 d
d 0.002161
202 200 201 200
The true value is log201 2'303196. The error is on the order of a few millionths.
more (rounded sixth digit).
Example: At a certain university, the number of students enrolled in the course 82-
In 83 it was 10,400 and in the 87-88 course it was 13,200. Estimate approximately.
how many enrolled in the 84-85 course.
13.200 10.400 d
d 1120
87 82 84 82
Therefore, we estimate that in the 84-85 school year there were: 10,400 1.120 11,520 students.
Quadratic interpolation
It is called quadratic interpolation when performed with three known points, and not
aligned1(x 1,and1),P2(x 2a,nd2) and P3(x 3an,d3), are adjusted using the parabola that passes through
they.
The polynomial that fits those points is of the form P(x) ax2 bx c, also known as
with the name of quadratic function, whose graph is a parabola.
y 3 ax bx3 c
2
3
whose equations are obtained by imposing the condition that P(x) passes through P, P2yP13 .
A parabola always passes through three non-collinear points. Therefore, this system will be consistent.
determined. If the points were aligned, the unknown "a" (dex coefficient2 I would take the
zero value: the parabola would degenerate into a line.
Example: Find the corresponding quadratic interpolation function for the values:
x 1 3 4 5
y 4 9 ? 18
1
a
To pass through (1, 4), it is given 4=a+b+c 2
1
Passing through (3, 9) one has 9 = 9a + 3b + c b
2
By passing through (5, 18) it is obtained 18 = 25a + 5b + c c 3
1 1
The equation of the parabola is y x 2 x 3
2 2
Example: Given the table of the function f(x), find the error.x 1 2 3 4
committed when calculating f (4) by the in- f(x)35 62
quadratic interpolation using the other values
from the table.
19
a
By passing through (1, 3) it is obtained c+b+a=3 2
73
To pass through (2, 5) it is had 5 = 4a + 2b + c b
2
To pass through (3, 6) it has 6 = 9a + 3b + c c 30
19 73
Six 4 f(x) · 4 2 · 4 30 f(4) 36
2 2
The mistake made is e 2 36 38. Such a great mistake must lead us to the con-
conclusion that the interpolation, in this case, is not correct.
In practice, the initial expression of the interpolating polynomial that passes through the points
(x 1 , y 1 ),(x2, y 2),(x3,and3)............,(x n, y n)
Well, the system obtained by substituting (x, y) with the known values is very simple to re-
solver y, therefore, the coefficients a, b, c, ..., r are easily obtained.
This will always be possible, since if P(x) a n1x n1 a n 2x n 2. ............ a 2x 2 a 1x a o
it is a polynomial, when dividing P(x) by (x x 1we would obtain P(x) Q 1(x)(x x 1) a.
Next, when dividing Q1(x)for(x x 2we would obtain Q1(x) Q 2(x)(x x 2) bcon
what P(x) Q (x)2 (x x )b (x x2 )a Q (x) (x1 x )(x x )2b(x x ) a, etc.
2 1 1
Note that in both cases the polynomial is of degree. 1, one less than the number of
data. The n coefficients are different in each of the expressions.
It is common that, after having the interpolating polynomial corresponding to n points, one
get a new point x, y n1 n1 If it is then 1 polynomial that passes through the points first
points, the new polynomial will be:
By substituting the coordinates of the new point, an equation is obtained from which the
value of k.
Example: From a function we know three points(( 3, 5), (1, y(3,11). What can we
to say the value of that function when x 0? And when? 10?
The interpolating polynomial will be of second degree. Its generic expression is:
a 5
5 a b ( 3 3) c ( 3 3)(3
3
1 a b ( 1 3) c ( 1 3)(1 b
2
11 a b ( 3 3) c ( 3 3) (3
15
c
12
3 15
y 5 (x 3) (x 3)(x
2 12
13
Six 0 y(0)
4
527
Six 10 y(10)
4
527
The value it is likely to resemble little the value of the function at point 10,
4
Well, it is the result of a very distant extrapolation.
Example: Find the interpolating polynomial generated by the points (2,1),(3,7),( 1 ,4)
y(5,0).
If once the interpolating polynomial is calculated we are given a new point (8, 211),
obtain the interpolating polynomial again taking advantage of the one we already have
a 1
1 a b 6
7 a b 7
c
4 a 3b 12c 4
0 a 3b 6c 36d 59
d
72
7 59
y 1 6(x 2) (x 2)(x 3) (x 2)(x 3)(x 1)
4 72
The new interpolating polynomial including the point (8,211) will be:
Now we calculate k so that this 4th degree polynomial passes through the point
(8,211).
In the magazine Tiempo (8/2/88), the following graph appeared showing the profits in
millions of pesetas for the exports of the company Codorniu between 1983 and 1987.
3000 2900
2500
2100
2000
1600
1500 1300
1100
1000
500
0
1983 1984 1985 1986 1987
Given the growth, it is presumable that the function expressing the number of millions of
pesetas per export depending on the time elapsed is a parabola. The request is:
a) Determine the equation of that parabola taking as variable t the years 1, 3, and 5
1 1983,3 1985, 5 1987.
b) Compare the theoretical data that results for years 2 and 4 with the actual data provided.
through the table.
Assuming that the points (1,1100), (3,1600), and (5,2900) satisfy its equation, we obtain
the system:
1100 a b c a 100
1600 9a 3b c b 150
2900 25a 5b c c 1150
The theoretical function that approximates these data is y 100t2 150t 1150
b) Sit it is obtained and 1250, and it's ready 4 the result is y 2150.
Problem 2
The number of tourists who visited Spain between 1970 and 1985 followed the following
trend:
a) Find the forecast for 1988 based on the linear function of the last segment 1980-1985.
b) Make the same forecast with the 2nd degree interpolation polynomial from the
data from 1975 and 1985.
a) The most convenient thing is to make an appropriate table, using the year 70 as the starting point in time.
This is how it turns out:
0 5 10 15 18
24'1 30'1 38'1 43'2 ?
For the requested linear interpolation, we need to find a linear expression that takes the values
data for 10 and 15. The most convenient thing is to put:
38'1 a a 38.1
43.2 a 5b b 1'02
The linear expression takes the form L(x) 38'1 1'02(x 10)
The expression that results is C(x) 38'1 1'02(x 10) 0'058(x 10)(x 15), therefore:
Problem 3
1
Calculate the second-degree polynomial P(x) such that P(0) P(1) 0y such that p(x) dx0 1 .
P(0) 0 c 0
P(1) 0 a b 0
1
x3 x2 a b
1
0
ax bx dx
2
a
3
b
2
3 2
1
0
a b 0
a 6
a b P(x) 6 x 2 6x
1 b 6
3 2
Problem 4
x 1 2'5 4 5
f(x)21 8 30
a 2
2 a b 2
1 a 1.5b 8
c
8 a 3b 4.5c 3
30 a 4b 10c 10d 14
d
15
Thus:
8 14
p(x) 2 2(x (x1)(x 2.5) (x1)(x 2'5)(x4)
3 15
8 14 4
p(3) 2 4 2 0.5 2 0.5 (
3 15 15
Problem 5
The expense on photocopies in an office is given by the following data during the three
first months of the year. Obtain the interpolating polynomial and deduce the photocopying expenses
likely for the month of April.
We call 1 to the month of January, 2 to the month of February, 3 to the month of March and 4 to the month of April.
1 2 3 4
1100 1500 1550 ?
Since we are given three data points, we need to think of a parabola. The polynomial we are looking for...
we can comfortably put in the form:
1100 1 a 1100
1500 a b b 400 P(x) 1100 400(x 175(x 1)(x2)
1550 a 2b 2c c 175
Find 150 using the second degree interpolating polynomial of the function.
f(x) the points x1 121, x2 144 and x3 169.
f(121) 11
f(x) x f(144) 12
f(169) 13
a 11
11 a
1
12 a 23b b
23
13 a 54b 1200c
1
c
13800
P(150) 12'2482
With the calculator we have 150 12'2474, therefore we have obtained a good approximation.
Problem 7
The different contractions of a spring (in mm), depending on the applied loads
(in kp), are given in the following table:
Load(x) 5 10 15 20 25
Contract. (and) 49 105 172 253 352
The interpolating polynomial will be: P(x) a b(x 5) c(x 5)(x 15)
Substituting we have:
49 a a 49
172 a 10b b 12'3 p(x) 49 12'3(x 5) 0'285(x 5)(x 15)
352 a 20b 200c c 0'285
Problem 8
The number of calories per Spaniard per day, during the period 1962-1987, followed this trend:
a) Find the forecast for 1990 based on the linear function of the last two years.
b) Make the same prediction with the 2nd degree interpolation polynomial based on the
data from 1970 to 1987.
a) If we take the year 1962 as the starting point of time, the resulting data table is:
Year 0 8 18 25
Miles de calorías2'76 2'87 3'32 3'49
2.87 a a 2.87
3'32 a 10b b 0.045
3'49 a 17b 119c c 0'0012
Problem 9
y 1'71828x 1 y 1'71828x 1
e 0'7 2'01375271
y ex
The error made is
Problem 10
The following data corresponds to the evolution of the population in Madrid. The population-
Census data is obtained for the years that are multiples of 5, and the rest according to the data.
officials of births and deaths (births, deaths, transfers, etc.):
Years
The interpolating polynomial will be of the type:
0 2,620,797 h.
5 3,120,941 h.
10 3,228,057 h. P(x) a b(x 0) c(x 0)(x 5) d(x 0)(x 5)(x 10)
15 3,357,903 hours.
The data differs significantly from the table because the most reliable data corresponds
They give more weight to the census years and less reliable to the immediately preceding ones.
Problem 11
A projectile is launched, and after describing a parabolic trajectory, it falls 2.4 km from its starting point.
of launch. Find the equation of its trajectory knowing that it reaches a maximum height
maximum of 180 m.
The points to consider for interpolation are (0,0), (1.2,0.180), and (2.4,0)
0 a a 0
0'180 a 1'2b b 0'15
0 a 2'4b 2'88c c 0 .125
Problem 12
A businessman has obtained the following profits, in millions of pesetas, in the last 5
years
b) Obtain, from the parabola, the earnings corresponding to the years 1986 and 1988 and
compare with those given to you in the table.
c) Extrapolate to obtain the profits that are expected to be achieved in the year 1990.
1700 a a 1700
2200 a 2b b 250
3500 a 4b 8c c 100
Problem 13
0 a a 0
0.5 a 30b b 0.0166667
0.7071 a 45b 675c c 0 .00006355568
sen15° 0'25975