#include<stdio.h>#include<math.h>int main(){float x[10],y[15][15];int n,i,j;printf("Enter n : ");scanf("%d",&n);printf("X\tY\n");for(i = 0;i<n;i++){scanf("%f %f",&x[i],&y[i][0]);}//forward difference tablefor(j=1;j<n;j++)for(i=0;i<(n-j);i++)y[i][j] = y[i+1][j-1] - y[i][j-1];printf("\n***********Forward Difference Table ***********\n");//display Forward Difference Tablefor(i=0;i<n;i++){printf("\t%.2f",x[i]);for(j=0;j<(n-i);j++)printf("\t%.2f",y[i][j]);printf("\n");}//backward difference tablefor(j=1;j<n;j++)//for j = 0 initially input is taken so we start from j=1for(i=n-1;i>(j-1);i--)y[i][j] = y[i][j-1] - y[i-1][j-1];printf("\n***********Backward Difference Table ***********\n");//display Backward Difference Tablefor(i=0;i<n;i++){printf("\t%.2f",x[i]);for(j=0;j<=i;j++)printf("\t%.2f",y[i][j]);printf("\n");}return 0;}

## Sunday, January 22, 2012

### Numerical Method: Newton’s Forward and Backward Interpolation in C/C++

### About Author

**Bibek Subedi** is currently pursuing his Masters'degree in Computer Science at the University of Nevada, Las Vegas, USA. He has more than 4 years of experience in Software Development. He loves researching in the field of Algorithms, Parallel Computing, Big Data and Distributed Systems. He is a part time blogger and a bathroom singer (:D). If you didn't understand any part of the article, you can contact him or you can leave a comment in the comment box below.

Subscribe to:
Post Comments (Atom)

its use full

ReplyDeletebut it will be more use full if u did programing for only difference table

good

ReplyDeletevery usefull