20.4 Interpolation 567
Linear interpolation
The straight liney 1 = 1 p
1(x) 1 = 1 a
01 + 1 a
1xthrough the two
points (x
0, y
0) and (x
1, y
1), as in Figure 20.4, satisfies
the pair of linear equations
y
01 = 1 a
01 + 1 a
1x
0, y
11 = 1 a
01 + 1 a
1x
1with solution
Then
and this can be rearranged as
(20.17)
The linear interpolation formula is used to find an approximate value of a function at
a point xin the intervalx
0tox
1. The method is illustrated in the following example
for the (known) functione
x.
EXAMPLE 20.7Linear interpolation
Two points on the graph ofy 1 = 1 e
xare (to 4 decimal places in y)(x
0, y
0) 1 = 1 (0.80, 2.2255)
and(x
1, y
1) 1 = 1 (0.84, 2.3164). The linear interpolation formula (20.17) is then
Then, atx 1 = 1 0.832,
e
0.8321 ≈ 1 2.2255 1 + 1 0.0727 1 = 1 2.2982
The true value is 2.2979 (to 4 decimal places).
0 Exercise 16
When linear interpolation is used between each pair of neighbouring points we have
piecewise linear interpolation, as illustrated in Figure 20.5 for the points listed in
Table 20.4 (compare with Figures 20.6 to 20.8).
ey x
x≈=. + −.
.−.
.−.
2 2255 0 80
2 3164 2 2255
084 080
()
yy xx
yy
xx
=+−
−
−
001010()
y
yx yx
xx
yy
xx
=
−
−
−
−
01 10101010xx
a
yx yx
xx
a
yy
xx
001 101011010=
−
−
,=
−
−
...........
.......
.............................
..
...
..
...
...
..
....
..
...
..
...
...
..
.....................................................................................................................................................................................................................................................................................y
x
x
0x
1x
y
0y
1y
.
.....
.....
....
.....
.....
.....
....
.....
.....
....
.....
.....
....
......
....
.....
.....
....
.....
.....
....
.....
.....
.....
....
.....
.....
....
.....
.....
....
......
....
.....
.....
....
.....
.....
....
.....
.....
.....
....
.....
.....
....
.....
.....
....
.....
.....
.....
.....
....
.....
.....
Figure 20.4