Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 11

1.

Interpolation
In the mathematical field of numerical analysis, interpolation is a type of
estimation, a method of constructing new data points within the range of a discrete
set of known data points.
Interpolation, in mathematics, the determination or estimation of the value of f(x),
or a function of x, from certain known values of the function. If x0 < … < xn and
y0 = f(x0),…, yn = f(xn) are known, and if x0 < x < xn, then the estimated value of
f(x) is said to be an interpolation. If x < x0 or x > xn, the estimated value of f(x) is
said to be an extrapolation.

There is exactly one such interpolating polynomial of degree n or less. If the xi’s
are equally spaced, say by some factor h, then the following formula of Isaac
Newton produces a polynomial function that fits the data:f(x) = a0 + a1(x − x0)/h
+ a2(x − x0)(x − x1)/2!h2 + … + an(x − x0)⋯(x − xn − 1)/n!hn
Example :
This table gives some values of an unknown function.

Plot of the data points as given in the table.


X f(x)
0 0
1 0.8415
2 0.9093
3 0.1411
4 −0.7568
5 −0.9589
6 −0. 794
Interpolation provides a means of estimating the function at intermediate points,
such as x= 2.5

2 . Extrapolation
In mathematics, extrapolation is a type of estimation, beyond the original
observation range, the value of a variable on the basis of its relationship with
another variable.
It is similar to interpolation, which produces estimates between known
observations, but extrapolation is subject to greater uncertainty and a higher risk of
producing meaningless results.
Explanation :
Extrapolation may also mean extension of a method, assuming similar methods
will be applicable. Extrapolation may also apply to human experience to project,
extend, or expand known experience into an area not known or previously
experienced so as to arrive at a (usually conjectural) knowledge of the unknown
[1] (e.g. a driver extrapolates road conditions beyond his sight while driving). The
extrapolation method can be applied in the interior reconstruction problem.

Example illustration of the extrapolation problem, consisting of assigning a


meaningful value at the blue box, at x=7, given the red data points.
Extrapolation Formula :
Let us consider the two endpoints in a linear graph (x1, y1) and (x2, y2) where the
value of the point “x” is to be extrapolated, then the extrapolation formula is given
as
y(x)=y1+(x−x1/x2−x1) * (y2−y1)
Example :
Question:
The two given points that lie on the straight line is (1, 5) and (4, 10). Determine the
value of y at x = 5 on the straight line using a linear extrapolation method.
Solution:
Given: x1 = 1 ,y1 = 5
and x2 = 4, y2 = 10
The linear extrapolation formula is given as;
y(x)=y1+(x−x1/x2−x1) *(y2−y1)
Substitute the known values in the given formula,
y(5) = 5 +((5-1)/(4-1))(10-5)
y(5) = 5 + (4/3) (5)
y(5) = 5 + 6.65
y(5)= 11.65
Therefore y(5) = 11.65

3. Inverse interpolation
inverse interpolation is defined as the process of finding the value of the argument
corresponding to a given value of the function lying between two tabulated
functional values.
In numerical analysis, inverse quadratic interpolation is a root-finding algorithm,
meaning that it is an algorithm for solving equations of the form f(x) = 0. The idea
is to use quadratic interpolation to approximate the inverse of f. This algorithm is
rarely used on its own, but it is important because it forms part of the popular
Brent's method.
Formula :
The inverse quadratic interpolation algorithm is defined by the recurrence relation
where fk = f(xk). As can be seen from the recurrence relation, this method requires
three initial values, x0, x1 and x2.

Example:
Employ inverse interpolation using a cubic interpolating polynomial and root finding to
determine the value of x that corresponds to f(x) = 0.23 for the following data:

xi f(xi)
3 0.3333
4 0.25
5 0.2
6 0.1667

Solution:
First step: polynomial interpolation
The following points are used to generate a cubic interpolating polynomial

x0 = 3 f(x0) = 0.3333
x1 = 4 f(x1) = 0.25
x2 = 5 f(x2) = 0.2
x3 = 6 f(x3) = 0.1667
The polynomial can be generated in a number of ways including: Newton’s Divided

Difference Interpolating Polynomials .


xl f(xl) First Second Third
3 0.3333 -0.0833 0.01665 -0.0027
4 0.25 -0.05 0.00835
5 0.2 -0.0333
6 0.1667

The result is:

f3(x) = 0.3333+(x-3)( -0.0833)+(x-3)(x-4)( 0.01665)+(x-3)(x-4)(x-5)( -0.0027)

If we simplify the above expression, we get:


f3 (x)=0.943-0.3261833x+0.0491x2 -0.00271667x3
Second step: Roots finding

The roots problem can then be developed by setting this polynomial equal to the desired value
of 0.23:
f3(x)=0.943-0.3261833x+0.0.0491x^2-0.00271667x3 =0.23
0=0.713-0.3261833x+0.0491x2 - 0.00271667x3

4. Lagrange Interpolation
In numerical analysis, Lagrange polynomials are used for polynomial interpolation. For a
given set of points (xj, yj) with no two xj values equal, the Lagrange polynomial is the
polynomial of lowest degree that assumes at each value xj the corresponding value coincide at
each point.

The polynomials {ℒ𝑛,𝑗}, 𝑗 = 0,...,𝑛, are called the Lagrange polynomials for the interpolation
points 𝑥0, 𝑥1, ..., 𝑥𝑛. They are defined by

Example :

We will use Lagrange interpolation to find the unique polynomial 𝑝3(𝑥), of degree
3 or less, that agrees with the following data:

𝑖 𝑥𝑖 𝑦𝑖
0 −1 3
1 0 −4
2 1 5
3 2 −6

In other words, we must have 𝑝3(−1) = 3, 𝑝3(0) = −4, 𝑝3(1) = 5, and 𝑝3(2) = −6.
First, we construct the Lagrange polynomials {ℒ3,𝑗(𝑥)}3𝑗=0, using the formula

.
This yields

.
By substituting 𝑥𝑖 for 𝑥 in each Lagrange polynomial ℒ3,𝑗(𝑥), for 𝑗 = 0,1,2,3, it can be
verified that

.
It follows that the Lagrange interpolating polynomial 𝑝3(𝑥) is given by

Substituting each 𝑥𝑖, for 𝑖 = 0,1,2,3, into 𝑝3(𝑥), we can verify that we obtain 𝑝3(𝑥𝑖) = 𝑦𝑖 in each
case.

5. Spline interpolation
In the mathematical field of numerical analysis, spline interpolation is a form of interpolation
where the interpolant is a special type of piecewise polynomial called a spline. Spline
interpolation is often preferred over polynomial interpolation because the interpolation error
can be made small even when using low degree polynomials for the spline.[1] Spline
interpolation avoids the problem of Runge's phenomenon, in which oscillation can occur
between points when interpolating using high degree polynomials.

Interpolation with cubic splines between eight points. Hand-drawn technical drawings were made for shipbuilding etc. using
flexible rulers that were bent to follow pre-defined points

Example :
The following table of values for function y = f x( ) is given:
x 3,0 4,5 7,0 9,0
i

yi 2,5 1,0 2,5 0,5

Construct the stated spline and with its help find the approximate values of the function

in points: z1 = 4 and z2 = 5:

linear spline
natural quadratic spline
natural cubic spline
Solution:

We calculate the steps: h1 = 4,5 - 3 = 1,5; h2 =7 - 4,5 = 2,5; h3 = 9 – 7 = 2.

a) Using the formulas for S1 we calculate consecutively coefficients a bi, i :

We enter the coefficients and get the following table:


i ai bi Linear spline S1( f x, ) from example 1a)
1 2,5 -1,0 f1 = 2,5−(x −3) when x ∈[3; 4,5]
2 1,0 0,6 f2 =1+ 0,6(x − 4,5) when x ∈[4,5; 7]
3 2,5 -1,0
f3 = 2,5−(x − 7) when x ∈[7; 9]

To calculate the approximate value of the function in point z1 = 4 with the help of the
spline we determine that it is located in the first interval and will approximate using the

formula for f1. Then f (4) ≈ f1(4) = a1+ b1 1(z − x0) = 2,5+ ( 1)(4− −3) =1,5.

Analogically f (5) ≈ f2(5) = a2 +b2 2(z − x1) =1+ 0,6(5− 4,5) =1,3 .

The graphic of the spline is shown in fig. 1 – S1 .


It is easy to ascertain that the spline is correctly determined. In the case of a linear
spline to do this we need only to check if it goes through points yi, i = 1,2,3,4 and that it is

continuous. IndeedS1(3) = f1(3) = 2,5, S1(4,5) = f2(4,5) =1 and S1(7) = f2(7) = 2,5, also:

f
f1(4,5) = + −2,5 ( 1).(4,5− = −3) 2,5 1,5 =1= f2(4,5) , 2(7) =1+ (0,6).(2,5) = +1 1,5 = 2,5

f
= 3(7) and f3(9) = 2,5+ −( 1).(9 − 7) = 2,5− =2 0,5.

b) In the case of a natural quadratic splineS2 the calculations are carried out using
recurrent formulas from the respective table. For a b ci, i, i when i = 1, 2, 3 and γ1= 0 :
i ai bi ci Quadratic spline S2( f x, ) from example 1b)

1 2,5 0,0 -0,6667 when


f1 = 2,5− 0,6667(x −3)2 x ∈[3;4,5]

2 1,0 -2,0 1,0400 f2 = −12(x − 4,5) +1,04(x − 4,5)2 when x∈[4,5;7]


3 2,5 3,2 -2,1000 f3 = 2,5 + 3,2(x − −7)2,1(x − 7)2 when x∈[7;9]
4 - -5,2 - -

The approximation of the function in the point z1 = 4 is found from

f (4) ≈ = +f1a1 b z1( 1 − x0 ) + c1(z1 − x0 )2 = 2,5 − 0,6667(4 −3)2 =1,8333.

Analogically for the other point z2 = 5 we get

2 2
f (5) ≈ f2 = a2 +b2 2(z − x1) + c2 2(z − x1) = −1 2(5− 4,5) +1,04(5− 4,5) = 0,26 .

c) Now let us also construct the cubic spline S3. For this we form the linear system for

the auxiliary coefficients li where i = 1, 2, 3, 4 and γ1=γ2 = 0 :


Fig. 1. The graphics of the resulting splines for problem 1a), 1b) and 1c).

By substituting the concrete data we get the following system:

8l2 + 2,5l3 = 9,6 .

2,5l2 + 9l3 =−9,6

Solving this system for the auxiliary coefficients we find that:

l1 = 0, l2 =1,6791, l3 =−1,5331, l4 = 0.

After substituting in the formulas we get the following table for the coefficients:
i li ai bi ci di
1 0,0000 2,5 -1,4198 0,0000 0,1866
2 1,6791 1,0 -0,1605 0,8395 -0,2141
3 -1,5331 2,5 0,0221 -0,7666 0,1278
4 0,0000 - - 0,0000 -

With the help of these coefficients the sought cubic spline is written down in the
following way:

As in the previous cases in order to get approximated values in points z1= 4 and z2 = 5

with the help of the cubic spline we make substitutions in the general formulas

depending on the interval in which the point is located. For the first point we have

f (4) ≈ f1(4) = +a1b z1( 1 − x0 ) + c1(z1 − x0 )2 + d1(z1 − x0 )3 =

2,5−1,4198.(4 −3) + 0.(4 −3)2 + 0,1866.33 =1,2668 .


For the second point - f (5) ≈ f2(5) =
a2+b2l2(z−lx1)+c22(z−x1)2+d22(z−x1)3=
2 3
1− 0,1605.(5− 4,5) + 0,8395.(5− 4,5) − 0,2141.(5− 4,5) =1,1029.

You might also like