Professional Documents
Culture Documents
Interpolation: Example
Interpolation: Example
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.
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.
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
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
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:
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 .
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)
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
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