KEMBAR78
Numerical Analysis Assignment | PDF | Finite Difference | Numerical Analysis
0% found this document useful (0 votes)
12 views11 pages

Numerical Analysis Assignment

The document discusses Newton's Forward Difference Interpolation, a numerical analysis technique for estimating function values at points not explicitly given in a dataset using discrete data points. It outlines the purpose, real-life applications, derivation, and provides a mathematical problem with a solution, an algorithm, and Python code implementation. The method is particularly useful in fields like engineering, finance, and weather forecasting for approximating values based on equally spaced data.

Uploaded by

Aurora
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)
12 views11 pages

Numerical Analysis Assignment

The document discusses Newton's Forward Difference Interpolation, a numerical analysis technique for estimating function values at points not explicitly given in a dataset using discrete data points. It outlines the purpose, real-life applications, derivation, and provides a mathematical problem with a solution, an algorithm, and Python code implementation. The method is particularly useful in fields like engineering, finance, and weather forecasting for approximating values based on equally spaced data.

Uploaded by

Aurora
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/ 11

Course: Numerical Analysis

Topic: Forward Difference Interpolation

SUBMITTED TO:
Dr. Mostak Ahmed
Professor
Department of Mathematics
Jagannath University, Dhaka

SUBMITTED BY:
Name: Maisha Binte Monir
ID: B210305016
Department: Computer Science & Engineering
Session: 2021-22 (13 Batch)
Table of Contents:

Newton’s Forward Difference Interpolation 2

Purpose of Forward Difference Interpolation 2

Real Life applications of Newton’s Forward Difference Interpolation 3

Derivation of Newton’s Forward Difference Interpolation 4

Math Problem & Solution 6

Algorithm of Newton’s Forward Difference Formula 8

Python Code Implementation 9

Sample Code Input & Output 10

1
Newton’s Forward Difference Interpolation

The Newton’s Forward Difference Interpolation method is a technique used in


numerical analysis to approximate the value of a function at a given point using discrete
data points. It is based on the concept of finite differences and is particularly useful when
the given data points are equally spaced.

The Newton’s forward difference formula is given by:


�(�−1) �(�−1)(�−2) �(�−1)(�−2)...(�−�+1)
yn(x) = y0 + p ∆y0 + 2!
∆2 y 0 + 3!
∆ 3 y0 + … + �!
∆n y 0

Here x = x0 + ph and h = x1 - x0

Graphical representation of Newton’s Forward Difference Formula:

PURPOSE OF FORWARD DIFFERENCE INTERPOLATION:

● To estimate function values at points not explicitly given in a data set.


● To create a polynomial approximation of a function from known discrete data.
● To simplify calculations compared to direct polynomial interpolation methods
(like Lagrange interpolation).

2
● When a function is too complex to evaluate directly, forward difference
interpolation can approximate it based on known values.

REAL LIFE APPLICATIONS OF NEWTON’S FORWARD DIFFERENCE


INTERPOLATION:

Newton’s Forward Difference Interpolation is used in various scientific, engineering,


and computational fields where equally spaced data points need interpolation or
prediction. Below are some practical applications:

➢ Engineering and Physics:


● Thermodynamics: Used in heat transfer and fluid dynamics to
approximate temperature and pressure at intermediate points.
● Vibrations & Waves: Helps in interpolating displacement, velocity, or
acceleration in mechanical systems.
➢ Weather Forecasting:
● Used to estimate temperature, humidity, or pressure at times not directly
measured.
● Helps in analyzing climate trends based on historical data.
➢ Finance & Economics:
● Stock Market Analysis: Estimates future stock prices based on previous
trends.
● Inflation and GDP Prediction: Helps in forecasting economic indicators
using historical data.
➢ Robotics:
● Used in path planning and trajectory estimation in autonomous robots.
● Helps in motion control where data is sampled at discrete time intervals.
➢ Astronomy:
● Helps in tracking planetary orbits using past observations.
● Used in satellite navigation to interpolate missing positional data.
➢ Statistics:
● Probability Distribution & CDF Approximation
● Estimating missing data
➢ Geology:
● Terrain Modeling: Interpolates elevation data for topographic maps.
● Seismic Data Analysis: Used in earthquake prediction and underground
mapping.

3
DERIVATION OF THE FORWARD DIFFERENCE FORMULA:

We have a function y=f(x) and a set of equally spaced data points:

(x0,y0), (x1,y1), (x2,y2), …, (xn,yn)

where yi=f(xi) and h between each consecutive points is:

h = x1 - x0 = x2 - x1 = ⋯ = xn - xn-1

Now, forward differences referred by delta (Δ) are defined as follows:

1. First-order forward difference:


Δy0 = y1 - y0 ,

Δy1 = y2 - y1 ,

Δy2 = y3 - y2 and so on…

2. Second-order forward difference:


Δ2y0 = Δy1 - Δy0,

Δ2y1 = Δy2 - Δy1,

Δ2y2 = Δy3 - Δy2 and so on…

3. Third-order forward differences:


Δ3y0 = Δ2y1 - Δ2y0,

Δ3y1 = Δ2y2 - Δ2y1,

Δ3y2 = Δ2y3 − Δ2y2 and so on…

This forms a forward difference table, which we use for interpolation.

The interpolating polynomial is assumed to be:

yn(x) = a0 + a1(x−x0) + a2(x−x0)(x−x1) + ⋯ + an(x−x0)(x−x1)…(x−xn-1)

We need to determine the coefficients a0, a1, a2, …


�−�0
Now, introducing a normalized variable: p =

4
Rewriting (x−xi) in terms of p:

➢ x−x0 = ph
➢ x−x1 = (p − 1)h
➢ x−x2 = (p − 2)h …

Now, we express y(x) in terms of forward differences:

y(x) = y0 + ph.a1 + p(p − 1)h2.a2 + p(p − 1)(p − 2)h3.a3 + …

Comparing with the forward difference formula:


��0
➢ a1 =

�2 �0
➢ a2 = 2! ℎ2
�3 �0
➢ a3 = … and so on.
3! ℎ3

Substituting these values, we get:


�(�−1) 2 �(�−1)(�−2) 3 �(�−1)(�−2)...(�−�+1)
yn(x) = y0 + pΔy0 + 2!
Δ y 0+
3!
Δ y0 + …+ �!
∆n y0

which is the Newton’s Forward Difference Interpolation Formula.

5
MATH PROBLEM:

Find Solution using Newton's Forward Difference formula

x 1891 1901 1911 1921 1931

f(x) 46 66 81 93 101

Find when x = 1895?

ANS:

The value of table for x and y:

x 1891 1901 1911 1921 1931

y 46 66 81 93 101

Newton's forward difference table is:

x y ∆y ∆2y ∆3y ∆4y

1891 46

66-46 = 20

1901 66 15-20 = -5

81-66 = 15 -3-(-5) = 2

1911 81 12-15 = -3 -1-2 = -3

93-81 = 12 -4-(-3) = -1

1921 93 8-12 = -4

101-93 = 8

1931 101

The value of f(x) we want to find is x = 1895

6
h = x1 - x0 = 1901-1891 = 10
�−�0 1895 − 1891
p= ℎ
= 10
= 0.4

We know, Newton's forward difference interpolation formula is


�(�−1) 2 �(�−1)(�−2) 3 �(�−1)(�−2)(�−3)
yn(x) = y0 + pΔy0 + Δ y0 + Δ y0 + ∆ 3 y0
2! 3! 3!

0.4(0.4−1) 0.4(0.4−1)(0.4−2) 0.4(0.4−1)(0.4−2)(0.4−3)


=> y(1895) = 46 + 0.4×20 + 2
×(-5) + 6
×2 + 24
×(-3)

=> y(1895) = 46 + 8 + 0.6 + 0.128 + 0.1248


=> y(1895) = 54.8528
Solution of Newton's forward interpolation method y(1895) = 54.8528

7
ALGORITHM:

INPUT: The number of input N, data array X, data array Y, the value F at which
interpolated result is to be shown.

OUTPUT: The interpolation result.

Step 1: Read N, the arrays X[N] and Y[N] and F.

Step 2: Compute step size h = x[2] - x[1]


�−�[1]
Step 3: Compute P =

Step 4: Repeat steps 5 to 6 for j = 1 to N - 1:

Step 5: Repeat for i = 1 to N - j:

Step 6: diff_table[i][j] = diff_table[i+1][j-1] - diff_table[i][j-1]

Step 7: Set Result = Y[1]

Step 8: Set Term = 1

Step 9: For i = 1 to N - 1

Step 10: Term = Term * (P - (i-1)) / i

Step 11: Result = Result + Term * diff_table[1][i]

Step 12: Print Result.

END

8
PYTHON CODE IMPLEMENTATION:

Here, we use the same dataset for X and Y as we did in the Math problem:

9
SAMPLE INPUT & EXPECTED OUTPUT:

OUTPUT:

The output matches with the expected output of the interpolation which is 54.8528

10

You might also like