You are on page 1of 6

Experiment Number: 06

Experiment Name: Implementation of Newton’s Forward Interpolation Method on Python.

Objectives:

1. Understand interpolation and Newton's forward method.


2. Implement Newton's forward interpolation algorithm in Python.
3. Analyze divided differences and interpolating polynomials.
4. Visualize interpolated functions.
5. Learn error analysis in interpolation.
6. Compare Newton's method with other interpolation techniques.
7. Apply interpolation to real-world problems.
8. Test and validate implementations.
9. Optimize implementations for efficiency.

Introduction: Newton's Forward Interpolation is a numerical method used to approximate the


values of a function at points that lie between given data points. This technique is particularly
useful when the data points are equally spaced. It's a form of polynomial interpolation where a
polynomial of a certain degree is constructed to pass through the given data points. After that,
this polynomial is used to estimate the function values at intermediate points.

Newton’s forward interpolation formula:

x−x 0
p=
h
p ( p−1) 2 p ( p−1)( p−2) 3 p( p−1)( p−2)( p−3) 4 p ( p−1 )( p−2 ) … ( p
y ( x )= y 0 + p ∆ y 0 + . ∆ y0 + . ∆ y0 + . ∆ y 0+ …+
2! 3! 4! n!
Algorithm:

Step 1: Start the program

Step 2: Read n (No. of arguments)

Step 3: For i = 0 to n − 1

Read x i &y i [0]

End i

Step 4: Construct the Forward Difference Table

For j = 1 to n − 1

For i = 0 to n − 1 − j
y i [j] = y[i + 1][j − 1] − y[i][j − 1]

End i

End j

Step 5: Print the Forward Difference Table

For i = 0 to n − 1

For j = 0 to n − 1 − i

Print y i [j]

End j

Next Line

End i

Step 6: Read a (Point of Interpolation)

Step 7: Assign h = x[1] − x[0] (Step Length)

Step 8: Assign u = (a − x[0])/h

Step 9: Assign sum = y 0 [0] & p = 1.0

Step 10: For j = 1 to n − 1

p = p ∗ (u − j + 1)/j

sum = sum + p ∗ y 0 [j]

End j

Step 11: Display a & sum

Step 12: Stop


Implement Code:
Output:

Conclusion: Newton's forward interpolation method in Python offers a robust technique for
approximating functions based on provided data points. By constructing a polynomial that
accurately represents the given data, we can interpolate values at intermediate points with
considerable precision. The forward difference table simplifies the computation process,
particularly advantageous when dealing with uniformly spaced data points. This method finds
widespread application across disciplines such as engineering, science, and computer graphics,
facilitating the interpolation of values and enabling detailed data analysis. Mastery of Newton's
interpolation method in Python empowers individuals with essential skills for numerical analysis
and problem-solving endeavors, enhancing their ability to tackle real-world challenges
effectively.

You might also like