Free Shipping Across India | Pay Cash On Delivery | Call: 08030860796 (Mon - Sat)

search lense
Call Us :08030860796Let us call you

//C++ program for newton backward interpolation formula

//program for newton backward interpolation formula
#include
#include
#include
#define maxn 100
#define order 4
void main()
{
float ax[maxn+1],ay[maxn+1],diff[maxn+1][order+1],nr=1,dr=1,x,p,h,yp;
int n,i,j,k;
clrscr();
cout<<"enter the value of n\n";
cin>>n;
cout<<"enter the values in form x,y\n";
for(i=1;i<=n;i++)
{cin>>ax[i]>>ay[i];}
cout<<"enter the value of x for which value of y is wanted\n";
cin>>x;
h=ax[2]-ax[1];
for(i=n;i>=1;i--)
{diff[i][1]=ay[i]-ay[i-1];}
for(j=2;j<=order;j++)
{
for(i=n;i>j;i--)
{diff[i][j]=diff[i][j-1]-diff[i-1][j-1];}
}
i=n;
p=(x-ax[i])/h;
yp=ay[i];
for(k=1;k<=order;k++)
{
nr*=p+k-1;
dr*=k;
yp+=(nr/dr)*diff[i][k];
}
cout<<"when x = "<c program for implementing COLOR MODEL
  • C Program for creation of adjacency matrix
  • Formula for maximizing the CAT score
  • C Program for traversing a graph through BFS and DFS
  • //C++ Program for newton forward interpolation formula
  • C Program for addition and deletion of nodes and edges in a…
  • Was this article useful?

    Post your Comment