Newton’s Backward Interpolation
Source Code:
Write a program in C to find 𝒚 at 𝒙 = 𝟒. 𝟓 using Newton’s Backward Difference Method with data:
x: 1, 2, 3, 4, 5
y: 1, 8, 27, 64, 125
#include <stdio.h>
#include <conio.h>
int main() {
clrscr();
double y[5] = {1, 8, 27, 64, 125}, h = 1, xp = 4.5, u, yp;
double d[5][5];
int i, j;
for (i = 0; i < 5; i++)
d[i][0] = y[i];
for (j = 1; j < 5; j++)
for (i = 4; i >= j; i--)
d[i][j] = d[i][j - 1] - d[i - 1][j - 1];
u = (xp - 5) / h;
yp = y[4]
+ u * d[4][1]
+ u * (u + 1) * d[4][2] / 2.0
+ u * (u + 1) * (u + 2) * d[4][3] / 6.0
+ u * (u + 1) * (u + 2) * (u + 3) * d[4][4] / 24.0;
printf("\n\n\ty(%.1f) = %.2f\n", xp, yp);
getch();
return 0;
}
Output

