The document contains programs written in C for three interpolation methods:
1) Newton forward interpolation method which calculates forward difference tables for a given data set.
2) Newton backward interpolation method which calculates backward difference tables.
3) Lagrange interpolation method which displays interpolation tables and calculates the y value for a given x using Lagrange polynomials.
The document contains programs written in C for three interpolation methods:
1) Newton forward interpolation method which calculates forward difference tables for a given data set.
2) Newton backward interpolation method which calculates backward difference tables.
3) Lagrange interpolation method which displays interpolation tables and calculates the y value for a given x using Lagrange polynomials.
The document contains programs written in C for three interpolation methods:
1) Newton forward interpolation method which calculates forward difference tables for a given data set.
2) Newton backward interpolation method which calculates backward difference tables.
3) Lagrange interpolation method which displays interpolation tables and calculates the y value for a given x using Lagrange polynomials.
The document contains programs written in C for three interpolation methods:
1) Newton forward interpolation method which calculates forward difference tables for a given data set.
2) Newton backward interpolation method which calculates backward difference tables.
3) Lagrange interpolation method which displays interpolation tables and calculates the y value for a given x using Lagrange polynomials.
AMAN 20151170 2101968 Problem Statement:- write a program in c for Newton Backward interpolation method for given table Program:- #include<stdio.h> #include<conio.h> int main() { float x[20], y[20][20]; int i,j, n; printf("Enter number of data?\n"); scanf("%d", &n); printf("Enter data:\n"); for(i = 0; i < n ; i++) { printf("x[%d]=", i); scanf("%f", &x[i]); printf("y[%d]=", i); scanf("%f", &y[i][0]); } for(i = 1; i < n; i++)
AMAN 20151170 2101968 Problem Statement:- write a program in c for lagrange interpolation method by displaying different table for the given interval Program:- #include<stdio.h> int main() { float x[100],y[100],s=1,t=1,k=0,a; int i,n,j,d=1; printf("\n enter the number of the terms of the table: "); scanf("%d",&n); printf("\n enter the respective values of the variables x and y:"); for(i=0;i<n;i++) { scanf("%f",&x[i]); scanf("%f",&y[i]); } printf("\n\n the table you entered is as follows: \n\n"); for(i=0;i<n;i++) { printf("%0.3f\t%0.3f",x[i],y[i]); printf("\n");
BCA SEMESTER-03 CBNST
AMAN 20151170 2101968 } do { printf("\n\n\n enter the value of the x to find the respective value of y\n\n\n"); scanf("%f",&a); for(i=0;i<n;i++) { s=1; t=1; for(j=0;j<n;j++) { if(j!=i) { s=s*(a-x[j]); t=t*(x[i]-x[j]); }} k=k+((s/t)*y[i]); } printf("\n\n the respective value of the variable y is: %f",k); printf("\n\n do you want to continue? press 1 to continue otherwise press any key to exit= "); scanf("%f",&d); } while(d==1); }