Subscribe Us

Responsive Advertisement

Advertisement

18.Newton’s backward difference formula:

 

18.Newton’s backward difference formula:

by ujjal roy



#include<bits/stdc++.h>

using namespace std;

int main()

{

    cout<<"Enter Number of element ";

    int n,i,j;

    cin>>n;

    double x[n],y[n][n];

    for(i=0;i<n;i++)

    {

        cout<<"Enter x and y : ";

        cin>>x[i];

        cin>>y[i][0];

    }

    for(j=1;j<n;j++)

    {

        for(i=n-1;i>=j;i--)

        {

            y[i][j]=y[i][j-1]-y[i-1][j-1];

        }

    }

    for(i=0;i<n;i++)

    {

        cout<<x[i]<<"\t";

        for(j=0;j<=i;j++)

        {

            cout<<y[i][j]<<"\t";

        }

        cout<<endl;

    }

    return 0;

}


Post a Comment

0 Comments