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

Newton's Backward Output

1) The document contains a C program to use Newton's backward interpolation formula to compute the value of f(x) for x=12.3 based on the given table of x and f(x) values. 2) The program takes the x and f(x) values as input, calculates the difference table, finds the relevant interval using backward difference formula, and outputs the value of f(12.3) as 0.3495. 3) Newton's backward interpolation formula is implemented using a for loop to calculate successive differences and apply the formula to obtain the interpolated value of the function.

Uploaded by

facto Gamer
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 views2 pages

Newton's Backward Output

1) The document contains a C program to use Newton's backward interpolation formula to compute the value of f(x) for x=12.3 based on the given table of x and f(x) values. 2) The program takes the x and f(x) values as input, calculates the difference table, finds the relevant interval using backward difference formula, and outputs the value of f(12.3) as 0.3495. 3) Newton's backward interpolation formula is implemented using a for loop to calculate successive differences and apply the formula to obtain the interpolated value of the function.

Uploaded by

facto Gamer
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/ 2

(19)

Name- Ayush Thapa


Semester-vth Sem
Session-2021
Subject- Numerical Analysis Practical
Reg. No- 0232105030184

/*............................................NEWTON'S BACKWARD METHOD...........................................*/

/*Write a programme in computer language to compute f(12.3), correct upto 6 decimal places
by using Newton's backward Interpolation formula from the following table-

x f(x)
______________

11.5 0.26969

11.6 0.33837

11.8 0.39544

11.9 0.40022

12.1 0.38332

12.4 0.32257*/

#include<stdio.h>
#define ORDER 3

int main()
{
float x[10],y[10],diff[10][ORDER+1];
float nr=1.0,dr=1.0,X,p,h,Y;
int n,i,j,k;
printf("Enter the value of n:\n ");
scanf("%d",&n);
printf("Enter the value of x and Y:\n ");

for (i=0;i<n;i++)
scanf("%f%f",&x[i],&y[i]);
printf("\n Enter the value of x:");
scanf("%f",&X);
h=x[1]-x[0];
for (i=1;i<n;i++)
diff[i][1]=y[i]-y[i-1];
for (j=2;j<=ORDER;j++)
for (i=0;i<=n-j;i++)
diff[i][j]=diff[i][j-1]-diff[i][j-1];
i=0;
while (!(x[i]>X))
i++;
i--;
(20)

p=(X-x[i])/h;
Y=y[i];
for (k=1;k<=ORDER;k++)
{
nr=nr*(p+k-1);
dr=dr*k;
Y=Y+(nr/dr)*diff[i][k];
}
printf("when x=%6.2f,y=%8.4f",X,Y);
}

/*.....................................................OUTPUT..................................................*/

Enter the value of n:


6
Enter the value of x and Y:
11.5 0.26969
11.6 0.33837
11.8 0.39544
11.9 0.40022
12.1 0.38332
12.4 0.32257

Enter the value of x:12.3


when x= 12.30,y= 0.3495
--------------------------------
Process exited after 149.7 seconds with return value 0
Press any key to continue . . .

You might also like