• Recent Uploads

    NEWTON'S BACKWARD INTERPOLATION FORMULA IN C WITH EXPLANATION

    Backward Interpolation.Interpolation is the technique of estimating the value of a function for any intermediate value of the independent variable, while the process of computing the value of the function outside the given range is called extrapolation.




    
    
    
    

    newtons backword interpolation formula

    // C Program to interpolate using // newton backward interpolation #include <stdio.h> #include<math.h> int i,j; // Calculation of u mentioned in formula float backword(float u, int n) { float temp = u; for (i = 1; i < n; i++) temp = temp * (u + i); return temp; } // Calculating factorial of given n int fact(int n) { int f = 1; for ( i = 2; i <= n; i++) f *= i; return f; } int main() { // number u want to in int n = 5; float x[] = { 2000, 2010, 2020, 2030, 2040 }; //input float y[n][n]; y[0][0] = 654; y[1][0] = 76; y[2][0] = 83; y[3][0] = 93; y[4][0] = 105; for (i = 1; i < n; i++) { //finding table for ( j = n - 1; j >= i; j--) y[j][i] = y[j][i - 1] - y[j - 1][i - 1]; } for ( i = 0; i < n; i++) { //displlaying table for ( j = 0; j <= i; j++) printf("%f ", y[i][j] ); printf("\n"); } float value = 2035; //value of unknown //finding sum float sum = y[n - 1][0]; float u = (value - x[n - 1]) / (x[1] - x[0]); for ( i = 1; i < n; i++) { sum = sum + (backword(u, i) * y[n - 1][i]) / fact(i); } printf("\n Value at =%f is=%f ",value,sum); printf("\n"); return 0; }
    OUTPUT 




    #this progaran is running through theCODECHEF IDE