Numerical Methods -- Interpolation -- Module 2
Index
- Interpolation and it's methods.
- 1. Newton's Forward and Backward interpolation methods.
- The Newton forward interpolation polynomial is written as
- The Newton backward interpolation polynomial is given by
- The Lagrange Interpolation Formula
- 3. Newton's Divided Difference interpolation
Interpolation and it's methods.
In numerical analysis, interpolation is a method of estimating values within a range of known data points, essentially finding new data points based on the values of a function at a limited number of points.
-
The Problem:
You have a set of data points (x, y) representing a function, but you need to estimate the function's value at a point that lies between the known data points.
-
The Solution:
Interpolation uses the known data points to construct a simpler function (like a polynomial or spline) that passes through those points, and then uses this simpler function to estimate the value at the desired point.
Methods of Interpolation
Depending on the interval between the data points, there are different interpolation methods.
Equal Intervals
1. Newton's Forward and Backward interpolation methods.
Let's try to understand these methods with an example.
https://www.youtube.com/watch?v=Aw6LvaPtESE&list=PLU6SqdYcYsfLrTna7UuaVfGZYkNo0cpVC&index=5
So we have these values given for a 10 year interval.
We will start by tabulating these values.
We set the intervals to x and it's values list to f(x).
x | f(x) | ||
---|---|---|---|
1891 | 46 | ||
1901 | 66 | ||
1911 | 81 | ||
1921 | 93 | ||
1931 | 101 |
The gaps between the cells are intentional, as you will see below.
Now we set the next column to
x | f(x) | ||||
---|---|---|---|---|---|
1891 | 46 | ||||
20 | |||||
1901 | 66 | ||||
15 | |||||
1911 | 81 | ||||
12 | |||||
1921 | 93 | ||||
8 | |||||
1931 | 101 |
Now we find the value of
So between 1891 and 1901 the value will be given by
Then between 1901 and 1911 it will be
And between 1921 and 1911 it will be
And between 1921 and 1931 it will be
Now we will populate the values of the other columns similarly
x | f(x) | ||||
---|---|---|---|---|---|
1891 | 46 | ||||
20 | |||||
1901 | 66 | -5 | |||
15 | 2 | ||||
1911 | 81 | -3 | -3 | ||
12 | -1 | ||||
1921 | 93 | -4 | |||
8 | |||||
1931 | 101 |
This can keep going on as long as we would like but it's better to stop at
Now there are two formulae for Newton's Interpolation
The Newton forward interpolation polynomial is written as:
where - Step Size (h):
-
Since the nodes are equally spaced,
. -
Parameter p:
-
Defined as:
-
And :
The Newton backward interpolation polynomial is given by:
Parameter p:
-
For backward interpolation, we define:
Which one to use and when?
That will depend on the given question.
We have been asked to estimate the population between 1895 to 1925
x | f(x) | ||||
---|---|---|---|---|---|
1891 | 46 | ||||
20 | |||||
1901 | 66 | -5 | |||
15 | 2 | ||||
1911 | 81 | -3 | -3 | ||
12 | -1 | ||||
1921 | 93 | -4 | |||
8 | |||||
1931 | 101 |
So in this case we need to use Newton's forward interpolation formula as our range lies between 1891 and 1901.
So we will be using this formula:
Here
Now we need to find
Since we are using forward interpolation we use :
Here
and
So
And for the first part of the formula we have
So $$P(1895) = 46 + 0.4 \times 20 + \frac{0.4(0.4-1)}{2!} \times (-5) + \frac{0.4(0.4-1)(0.4-2)}{3!} \times 2$$
Now for the population of 1925.
We refer to our table again.
x | f(x) | ||||
---|---|---|---|---|---|
1891 | 46 | ||||
20 | |||||
1901 | 66 | -5 | |||
15 | 2 | ||||
1911 | 81 | -3 | -3 | ||
12 | -1 | ||||
1921 | 93 | -4 | |||
8 | |||||
1931 | 101 |
We will use Newton's backward interpolation this time as the range lies towards the end of the table.
So $$p = \frac{1925-1931}{10} = -0.6$$
Therefore according to the Newton's Backward interpolation formula
or we can round to 96 to match with the video
So we have the population in the years 1895 and 1925 as
Let's try out another example
Note that instead of fixed values we have been given ranges for
So we will construct the table in this way.
Ways (x) | Frequency (f(x)) | |||
---|---|---|---|---|
Below 10 | 9 | |||
39 - 9 = 30 | ||||
Below 20 | 30 + 9 = 39 | 35 - 30 = 5 | ||
74 - 39 = 35 | 7-5 = 2 | |||
Below 30 | 39 + 35 = 74 | 42 - 35 = 7 | ||
116 - 74 = 42 | ||||
Below 40 | 74 + 42 = 116 | |||
The reason we added up the values in
And after that it's just like before, we find the difference to fill up the rest of the columns
Now since we have an interval of 10, so
And we are asked to find
The table represents the cumulative frequency up to wage (not the wage itself)
So if we want to find the number of men getting between wages rupees 10 and 15, we need a number greater than
So
So our
So we will use Newton's Forward Interpolation formula here
So
Now it's just plain old calculation.
Solving that we should get
Now this is not the final answer yet as we need to find the number of men getting wages between rupees 10 and 15, and since we are given the cumulative frequency and not fixed values, we need to do :
to effectively find the number of men getting wages between rupees 15 and 10.
So that will be
Unequal Intervals
2. Lagrange's Interpolation for Unequal intervals
Lagrange’s Interpolation is a versatile polynomial interpolation method that works well even when the data points are not equally spaced. Unlike Newton's formulas, it does not require the data to have equal intervals, and it directly constructs the polynomial that exactly fits the given points
The Lagrange Interpolation Formula
Given a set of n+1 data points:
the Lagrange interpolation polynomial
where the Lagrange basis polynomial
Key Points:
-
Basis Polynomials:
Eachis constructed to be 1 at and 0 at all other data points (for ). This ensures that when you sum up all terms, for each . -
Unequal Intervals:
The formula works for any set of distinct-values, so the spacing between the values does not need to be uniform. Each denominator adjusts for the actual differences between the points.
Looks quite complicated no? Let's solve this using an example then.
https://www.youtube.com/watch?v=zdyUwzOm1zw&list=PLU6SqdYcYsfLrTna7UuaVfGZYkNo0cpVC&index=4
The first example of this video deals with Lagrange's Interpolation however the second version deals with Newton's divided interpolation.
So first off we start with this table
For creating the Lagrange basis polynomial we follow a trick:
So we create pairs first :
So we first "hide" the first
And now we put the "hidden" number in place of
Then we multiply it times it's
Similarly we construct the other Lagrange polynomials as well :
We hide
And for
And for
Now we solve them and add the polynomials
Now, for
Final Answer
Let's try another example
Let's create the pairings of the data first.
So, $$L_0 \ = \ \frac{(x-0)(x-2)(x-3)}{(-1-0)(-1-2)(-1-3)} \ \times -8 \ = \ \frac{2(x-0)(x-2)(x-3)}{3}$$
For
Now in a similar manner, we can find the values of
3. Newton's Divided Difference interpolation
Newton’s Divided Difference formula is used to find a polynomial that passes through a given set of points:
It builds the interpolating polynomial in a way that doesn’t require equally spaced x-values — unlike Newton’s Forward/Backward Difference, which assumes the x-values are evenly spaced.
Building the difference table.
Unlike Newton's forward and backward interpolation which use the same difference table, the divided difference has a different type of table.
The process uses a table, and it’s all about recursive differences.
For each pair of values, you compute:
First-order divided difference:
Each new term:
-
adds another factor of
, -
and multiplies it by the corresponding divided difference.
💡 Why is it Efficient?
-
You can add new points without re-computing the whole polynomial.
-
It doesn't assume any uniformity in x-values.
-
Computationally lighter than solving a whole system of linear equations (like with Lagrange).
Example 1.
https://www.youtube.com/watch?v=zdyUwzOm1zw&list=PLU6SqdYcYsfLrTna7UuaVfGZYkNo0cpVC&index=4
So we have the first example from the Lagrange's Interpolation problem.
Let's start with building the table :
5 | 12 | |||
6 | 13 | |||
9 | 14 | |||
11 | 16 |
Now we can simply apply the values from the table in the formula as
Now, for
So we get the same answer using Newton's divided difference method as well.