This code conduct an Interpolation for a given set of data using Newton’s Interpolating Polynomials method, where the coefficients of the polynomial are calculated using Newton’s divided differences method.
- Printed Table of Interpolated Values
- Chart Compare of Interpolated Values with Given Points.
- X Axis Points
- Y Axis Points
About the Method:
Newton polynomial, named after its inventor Isaac Newton, is an interpolation polynomial for a given set of data points. The Newton polynomial is sometimes called Newton’s divided differences interpolation polynomial because the coefficients of the polynomial are calculated using Newton’s divided differences method.
Given a set of k + 1 data points
where no two xj are the same, the Newton interpolation polynomial is a linear combination of Newton basis polynomials
with the Newton basis polynomials defined as
for j > 0 and n0(x) = 1.
The coefficients are defined as
is the notation for divided differences.
Thus the Newton polynomial can be written as
Newton Forward Divided Difference Formula:
The Newton polynomial can be expressed in a simplified form when x0, x1, …, xk are arranged consecutively with equal spacing. Introducing the notation h = xi+1 – xi for each i = 0,1,…, k-1 and x = x0 + s.h, the difference x – xi can be written as (s – i).h. So the Newton polynomial becomes
This is called the Newton forward divided difference formula
Newton Backward Divided Difference Formula:
If the nodes are reordered as xk, xk-1, …, x0, the Newton polynomial becomes
If are equally spaced with and for i = 0, 1, …, k, then,
is called the Newton backward divided difference formula.
The divided differences can be written in the form of a table. For example, for a function f is to be interpolated on points x0, …, xn. Write
Then the interpolating polynomial is formed as above using the topmost entries in each column as coefficients. For example, suppose we are to construct the interpolating polynomial to f(x) = tan(x) using divided differences, at the points:
Using six digits of accuracy, we construct the table:
Thus, the interpolating polynomial is
Given more digits of accuracy in the table, the first and third coefficients will be found to be zero.
The sequence f0 such that f0(1) = 6, f0(2) = 9, f0(3) = 2 and f0(4) =5, i.e., they are 6, 9, 2, 5 from x0 = 1 to x3 = 4.
You obtain the slope of order 1 in the following way:
As we have the slopes of order 1, it’s possible to obtain the next order:
Finally, we define the slope of order 3:
Once we have the slope, we can define the consequent polynomials:
 Stetekluh, Jeff. ‘Algorithm for the Newton Form of the Interpolating Polynomial’.