0% found this document useful (0 votes)
10K views

Newton Backward Interpolation

The document describes Newton backward interpolation. It involves declaring variables, reading data points x and y, calculating the step size h, and then using a backward loop to calculate interpolated values f and d based on the given point f. The algorithm uses nested loops to iteratively calculate interpolated values by subtracting adjacent y values, multiplying a running product p by ratios, and adding to the running sum d.

Uploaded by

Befzz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10K views

Newton Backward Interpolation

The document describes Newton backward interpolation. It involves declaring variables, reading data points x and y, calculating the step size h, and then using a backward loop to calculate interpolated values f and d based on the given point f. The algorithm uses nested loops to iteratively calculate interpolated values by subtracting adjacent y values, multiplying a running product p by ratios, and adding to the running sum d.

Uploaded by

Befzz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Newton Backward Interpolation

Aim: To implement Newton backward interpolation.


Algorithm
Step 1: Start the program
Step 2: Declare x[20], y[20], f, s, d, h, p as float data type and i, j, k, n as integer data type
Step 3: Read the record n and read the elements of x & y using for loop
Step 4: Calculate h = x[2] x[1]
Step 5: Read the point which is going to be searched
Step 6: Calculate: s = (f x[n]/h), d = y[n], p = 1
Step 7: Using for loop calculate f and d
a) y[j] = y[j] y[j-1]
b) p = p * (s* k -1)/k
c) d = d + p * y[n]
Step 8: print f and d
Step 9: Stop the program

Flowchart
Start

float x[20], y[20], f, s, d, h, p


int i, j ,k, n
read n
False

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


read x[i]

False

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


read y[i]

h = x[2] x[1]

read f
s = f(x[n])/h
d = y[n]
p=1
False

for(i = n, k = 1;i >= 1, k < n, i--, k++)

y[j] =y[j] y[j-1]


p = p * (s + k 1)/k
d = d + p * y[n]

print f, d
Stop

False

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

Program
#include<stdio.h>
#include<conio.h>
#include<math.h>
#include<stdlib.h>
main()
{
float x[20],y[20],f,s,d,h,p;
int j,i,k,n;
clrscr();
printf ("*\n"); //(57 *s)
printf ("*\t\tBackward Interpoaltion\t\t\t*\n");
printf ("*\n\n"); //(57 *s)
printf("How many record you will be enter:");
scanf("%d",&n);
printf("enter the value of x: \n\n");
for(i=1;i<=n;i++)
{
scanf("%f",&x[i]);
}
printf("enter the value of y: \n\n");
for(i=1;i<=n;i++)
{
scanf("%f",&y[i]);
}
h=x[2]-x[1];
printf("enter the searching point f:");
scanf("%f",&f);
s=(f-x[n])/h;
d=y[n];
p=1;
for(i=n,k=1;i>=1,k<n;i--,k++)
{
for(j=n;j>=1;j--)
{
y[j]=y[j]-y[j-1];
}
p=p*(s+k-1)/k;
d=d+p*y[n];
}
printf("\n*//(25 *s)THE RESULT*//(24 *s)\n");
printf("for f=%f ,ans is=%f",f,d);
getch();
return 0;
}

Output

You might also like