C Program For Newton’s Forward Interpolation

Newton’s forward interpolation is a polynomial interpolation that depends on the initial value and degrees of Newton’s forward operator. The degree of polynomial fitted is one less than the number of data points. This type of interpolation is only used for equally spaced data points.

Newton’s Forward Interpolation Formula

Newton's Forward Interpolation Formula

Newton’s Forward Interpolation Example

Find Solution using Newton’s Forward Difference formula

xf(x)
189146
190166
191181
192193
1931101

x = 1895

Solution:
The value of the table for x and y

x18911901191119211931
y46668193101

Newton’s forward difference table is

xyΔyΔ2yΔ3yΔ4y
189146
20
190166-5
152
191181-3-3
12-1
192193-4
8
1931101

C Program

 //Newton's Forward Interpolation
 //This code is written by Souvik Ghosh
 #include<stdio.h>
 #include<conio.h>
 #include<math.h>
 void main(){
     float h,f,p,d,s;
     int i,j,n;
     printf("Enter the value of n (number of terms you want to enter): ");
     scanf("%d",&n);
     float x[n],y[n];
     printf("Enter the elements of x\n");
    for(i=1;i<=n;i++){
        scanf("%f",&x[i]);
    }
    printf("Enter the elements of y\n");
    for(i=1;i<=n;i++){
      scanf("%f",&y[i]);

    }
    h=x[2]-x[1];
    printf("Please enter the value of x for which you want to print y: ");
    scanf("%f",&f);
    p=1;
    d=y[1];
    s=(f-x[1])/h;
    for(int i=1;i<=n-1;i++){
        for(int j=1;j<=(n-i);j++){
            y[j]=y[j+1]-y[j];

        }
        p=p*(s-i+1)/i;
        d=d+p*y[1];

    }
    printf("For the value of x(%f) the value of y is %0.4f",f,d);




 }




Output Terminal

Newton's Forward Interpolation Output

Related Posts

Artificial Intelligence Suggestions

Unlock Success in Your MAKAUT Semester Exam with These Empowering Artificial Intelligence Suggestions! Elevate Your Learning Experience and Excel with Confidence.

Mixed Signal Design Suggestions

Unlock Success in Your MAKAUT Semester Exam with These Empowering Mixed Signal Design Suggestions! Elevate Your Learning Experience and Excel with Confidence.

Fiber Optic Communication Suggestions

Unlock Success in Your MAKAUT Semester Exam with These Empowering Fiber Optic Communication Suggestions! Elevate Your Learning Experience and Excel with Confidence.

Cyber Security Suggestions

Unlock Success in Your MAKAUT Semester Exam with These Empowering Cyber Security Suggestions! Elevate Your Learning Experience and Excel with Confidence.

MAKAUT 7th Semester Examination Questions – 2023

Mobile Communication and Networks (PE-EC701C) Neural Network and Fuzzy Logic Control (PE-EC702C/PEROB701B) Principles of Management (HS-HU701)

CSS Cheatsheet

Transform your web design game with my CSS cheatsheet! Master the art of styling, dive into essential properties and selectors, and create visually stunning websites effortlessly. Whether…

Leave a Reply

Your email address will not be published. Required fields are marked *