/****************************************** NEWTON'S BACKWARD INTERPOLATION http://native-code.blogspot.com ******************************************/ #include<stdio.h> #include<conio.h> #define MAX 20 void main() { float xn,yn; float x[MAX],y[MAX],bd[MAX][MAX]; float h,l,s, y_inp,p,fact; int i,n,j,k; p=fact=1.0F; clrscr(); //-------------------------- printf("\nEnter the total number of pairs:"); scanf("%d",&n); printf("\n\nEnter the table"); printf("\nX\tY\n"); for(i=0;i<n;i++) { scanf("%f",(x+i)); scanf("%f",(y+i)); } //-------------------------- printf("\nEnter the value of X at which to find Y:"); scanf("%f",&l); //-------------------------- xn=x[n-1]; yn=y[n-1]; h=x[1]-x[0]; s=(l-xn)/h; //-------------------------- // BD TABLE for(i=1;i<n;i++) bd[n-i][0]=y[n-i]-y[n-i-1]; for(j=1;j<n-1;j++) // 1 to n-1 { for(i=1;i<n-j;i++) bd[n-i][j]=(bd[n-i][j-1])-(bd[n-i-1][j-1]); } //-------------------------- y_inp=yn; for(k=1;k<n;k++) { p=p*(s+k-1); fact = fact*k; y_inp=y_inp+(p/fact)*bd[n-1][k-1]; } printf("\n\n\nResult by Newton's Backward interpolation formula :%.3f",y_inp); getch(); } // end of main /* http://native-code.blogspot.com */
How can you implement Newton's Backward interpolation in C programming ?
January 14, 2014
Related Posts:
- Push And Pop In Stack Using Linked List In C
- How To Push Or Pops Elements From A Stack Using Array In C
- Runge-Kutta method Using C++
- How can you implement Trapezoidal Rule in numerical integration?
- How can you implement Simpson's 1/3 Rule by numerical integration?
- How can you implement Newton Raphson method in C programming?
- How can you implement Newton's Forward Interpolation in C programming ?
- C program to print 1 to 100 except 60 to 70.
- Binary Search Tree Creation And Traversal Using Recursion Technique In C
- Show Inorder And Preorder Traversal Of A Tree Using C
Post a Comment