0% found this document useful (0 votes)
15 views4 pages

Mathematics PRA

The document presents a welcome presentation on Newton's forward difference interpolation formula. It introduces interpolation and extrapolation, defines forward differences, and provides the Newton's forward difference interpolation formula. It includes sample C code to implement the formula to calculate the value of a function for a given intermediate x value based on known x-y data points, by making a difference table and carrying out the interpolation. The code takes input of number of data points n, the x-y values, and an x value to interpolate for, calculates the differences and interpolates to provide the corresponding y value.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views4 pages

Mathematics PRA

The document presents a welcome presentation on Newton's forward difference interpolation formula. It introduces interpolation and extrapolation, defines forward differences, and provides the Newton's forward difference interpolation formula. It includes sample C code to implement the formula to calculate the value of a function for a given intermediate x value based on known x-y data points, by making a difference table and carrying out the interpolation. The code takes input of number of data points n, the x-y values, and an x value to interpolate for, calculates the differences and interpolates to provide the corresponding y value.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

3/26/2022

WELCOME
PRESENTATION ON NEWTON’S FORWARD DIFFERENCE
INTERPOLATION FORMULA

Interpolation is the technique of estimating a 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 as exterpolation. .
The differences y1 – y0, y2 – y1, y3 – y2, ……, yn – yn–1 when
denoted by dy0, dy1, dy2, ……, dyn–1 are respectively, called
the first forward differences. Thus the formula is given as

y= yo+ p*delta yo + p(p-1)delta2 yo/2!+ p(p-1)(p-2)delta3


yo/3!+----.

y= yo+ p*delta yo + p(p-1)delta2 yo/2!+ p(p-1)(p-2)delta3


yo/3!+----.

ABSTRACT :

1
3/26/2022

 #include<stdio.h>
 #define MAXN 100
 #define ORDER 4

 main()
 {
 float ax[MAXN+1], ay [MAXN+1], diff[MAXN+1][ORDER+1],
nr=1.0, dr=1.0,x,p,h,yp;
 int n,i,j,k;
 printf("\nEnter the value of n:\n");
 scanf("%d",&n);

Code :

 printf("\nEnter the values in form x,y:\n");


 for (i=0;i<=n;i++)
 scanf("%f %f",&ax[i],&ay[i]);
 printf("\nEnter the value of x for which the value of y is
wanted: \n");
 scanf("%f",&x);
 h=ax[1]-ax[0];

 //now making the difference table
 //calculating the 1st order of differences
 for (i=0;i<=n-1;i++)
 diff[i][1] = ay[i+1]-ay[i];

 //now calculating the second and higher order differences
 for (j=2;j<=ORDER;j++)
 for(i=0;i<=n-j;i++)
 diff[i][j] = diff[i+1][j-1] - diff[i][j-1];

2
3/26/2022

 //now finding x0
 i=0;
 while (!(ax[i]>x))
 i++;

 //now ax[i] is x0 and ay[i] is y0
 i--;
 p = (x-ax[i])/h;
 yp = ay[i];

 //now carrying out interpolation
 for (k=1;k<=ORDER;k++)
 {
 nr *=p-k+1;
 dr *=k;
 yp +=(nr/dr)*diff[i][k];
 }
 printf("\nWhen x = %6.1f, corresponding y = %6.2f\n",x,yp);
 }

OUTPUT :

3
3/26/2022

THANK YOU

Presented By:
Name : B.KeerthiPriya
Roll no : 21P61A1212
Branch : IT-A

You might also like