Chapter 5
Finite Difference Method
Introduction
● Finite differences are numerical expressions that approximate the
derivatives of functions. They are essential tools for solving problems in
numerical methods where analytical solutions are difficult to obtain, such
as in engineering applications.
● There are three main types of finite differences: forward difference,
backward difference, and central difference. Each one approximates the
derivative of a function, but in slightly different ways.
Chapter 5
Finite Difference Method
Numerical Differentiation of Continuous Functions - First Derivative
Knowing the value of ’x’ at which you want to find the derivative of f(x), we
choose a finite value of ’h’ to find the value of f′(x). To estimate the value of f′
(x), one such approximation is suggested as follows:
Chapter 5
Finite Difference Method
Numerical Differentiation of Continuous Functions - First Derivative
Forward Difference Approximation of the First Derivative
For a Finite h,
The above is the forward divided
difference approximation of the first
derivative. It is called forward
because you are taking a point ahead
of ‘x’
Graphical representation of forward
difference approximation of first derivative.
Chapter 5
Finite Difference Method
Numerical Differentiation of Continuous Functions - First Derivative
Forward Difference Approximation of the First Derivative
Example-1
a) use the forward difference approximation of the first derivative of v(t) to
calculate the acceleration. Use a step size of h=2 s.
b) find the exact value of the acceleration of the rocket.
c) calculate the absolute relative true error for part (b).
Chapter 5
Finite Difference Method
Numerical Differentiation of Continuous Functions - First Derivative
Forward Difference Approximation of the First Derivative
Solution (a)
Hence
Chapter 5
Finite Difference Method
Numerical Differentiation of Continuous Functions - First Derivative
Forward Difference Approximation of the First Derivative
Solution (b)
Chapter 5
Finite Difference Method
Numerical Differentiation of Continuous Functions - First Derivative
Forward Difference Approximation of the First Derivative
Solution (b)
Chapter 5
Finite Difference Method
Numerical Differentiation of Continuous Functions - First Derivative
Forward Difference Approximation of the First Derivative
Solution (c)
Chapter 5
Finite Difference Method
Introduction
2. Backward Difference
The backward difference approximates the derivative by looking at the
function value at a point and at the previous point.
Figure 2: Graphical representation of backward
difference approximation of the first derivative.
Chapter 5
Finite Difference Method
Numerical Differentiation of Continuous Functions - First Derivative
Backward Difference Approximation of the First Derivative
Example-2
The velocity of a rocket is given by
(a) Use the backward difference approximation of the first derivative of v(t) to
calculate the acceleration at t=16 s. Use a step size of h=2 s.
(b) Find the absolute relative true error for part (a).
Chapter 5
Finite Difference Method
Numerical Differentiation of Continuous Functions - First Derivative
Backward Difference Approximation of the First Derivative
Solution (a)
Chapter 5
Finite Difference Method
Numerical Differentiation of Continuous Functions - First Derivative
Backward Difference Approximation of the First Derivative
Solution (b)
Chapter 5
Finite Difference Method
Numerical Differentiation of Continuous Functions - First Derivative
Central Divided Difference Approximation of the First Derivative
The central difference provides a more accurate approximation of the derivative
by using the points on both sides of the current point. It takes the average of
the forward and backward differences.
Chapter 5
Finite Difference Method
Numerical Differentiation of Continuous Functions - First Derivative
Central Divided Difference Approximation of the First Derivative
If we took a point forward and backward of ’x’ by
a distance of ’h’, then the slope of the secant line
(Rise/Run) as shown in Figure, and
approximating it as the first derivative of the
function at h,
Graphical representation of
central difference approximation
of first derivative.
Chapter 5
Finite Difference Method
Numerical Differentiation of Continuous Functions - First Derivative
Central Divided Difference Approximation of the First Derivative
Example-3
The velocity of a rocket is given by
(a) Use the central difference approximation of the first derivative of v(t) to
calculate the acceleration at t=16 s. Use a step size of h=2 s.
(b) Find the absolute relative true error for part (a).
Chapter 5
Finite Difference Method
Numerical Differentiation of Continuous Functions - First Derivative
Central Divided Difference Approximation of the First Derivative
Solution (a)
Chapter 5
Finite Difference Method
Numerical Differentiation of Continuous Functions - First Derivative
Central Divided Difference Approximation of the First Derivative
Solution (b)
Chapter 5
Finite Difference Method
Difference Table
Difference tables are a systematic way of organizing data to compute finite
differences, which are used in interpolation and numerical methods to
approximate derivatives. They are particularly helpful when dealing with
equally spaced data points. By constructing a difference table, you can easily
calculate successive differences and use them for interpolation, estimating
function values, or solving numerical problems.
Chapter 5
Finite Difference Method
Construction of Difference Table
Let’s go step by step through how to construct a difference table. We’ll use a
simple example where you have a set of equally spaced data points
and you want to compute the finite differences of these values.
Step 1: Organizing the Data
Start by arranging the data points into two columns. The first column
contains the x-values (which are equally spaced), and the second column
contains the corresponding function values f(x). The difference table will
grow from this basic setup.
Chapter 5
Finite Difference Method
Construction of Difference Table
Chapter 5
Finite Difference Method
Construction of Difference Table
Step 2: First Order Differences (Forward Differences)
The first-order difference is calculated by subtracting consecutive function
values. This difference gives you an approximation of the rate of change between
successive points.
For each xi, compute the forward difference between the current and next
function values.
The new
column
contains the
first-order
forward
differences.
Chapter 5
Finite Difference Method
Construction of Difference Table
Step 3: Second Order Differences
The second-order differences are computed by taking the difference of the first-
order differences.
The second-order differences give insight into the rate of change of the first-
order differences. The new column contains the second-order forward
differences.
Chapter 5
Finite Difference Method
Construction of Difference Table
Step 4: Higher-Order Differences
You can continue calculating higher-order differences in a similar manner. For
example, third-order differences are calculated as:
Each new column in the table corresponds to the next-order difference.
Chapter 5
Finite Difference Method
Construction of Difference Table
Example:
Let’s consider an example where we have 4 data points: x=1,2,3,4 and
the corresponding f(x)=1,8,27,64, Construct the difference table:
Chapter 5
Finite Difference Method
Construction of Difference Table
Example: For x=1, 2, 3, 4, f(x) = 1, 8, 27, 64
First-order differences:
Second-order
differences:differences:
Third-order
Chapter 5
Finite Difference Method
First Derivative (Using Forward Difference Formula)
Let’s consider an example where we have 4 data points: x=1,2,3,4 and the
corresponding f(x)=1,8,27,64
The step size, h, between consecutive x-values is constant: h=2−1=1
Chapter 5
Finite Difference Method
First Derivative (Using Forward Difference Formula)
Chapter 5
Finite Difference Method
Numerical Differentiation of Continuous Functions - Second Derivative
One can use the Taylor series to approximate a higher-order derivative. As an
illustration, here we derive the central difference approximation of the second
derivative of a function f(x) .
Chapter 5
Finite Difference Method
Numerical Differentiation of Continuous Functions - Second Derivative
Chapter 5
Finite Difference Method
Numerical Differentiation of Continuous Functions - Second Derivative
The velocity of a rocket is given by
(a) Use the central difference approximation of the second derivative of v(t) to
calculate the jerk at t=16 s. Use a step size of h=2 s.
(b) Calculate the exact value of the jerk at t=16 s.
Chapter 5
Finite Difference Method
Numerical Differentiation of Continuous Functions - Second Derivative
(a) The second derivative of velocity with respect to time is called jerk. The
second-order approximation of jerk then is
Chapter 5
Finite Difference Method
Numerical Differentiation of Continuous Functions - Second Derivative
Chapter 5
Finite Difference Method
Numerical Differentiation of Continuous Functions - Second Derivative
(b) The exact value of j(16) can be calculated by performing two successive
differentiations of
Chapter 5
Finite Difference Method
Numerical Differentiation of Continuous Functions - Second Derivative
Chapter 5
Finite Difference Method
Numerical Differentiation of Continuous Functions - Second Derivative
Knowing that
we get
Hence
Chapter 5
Finite Difference Method
Numerical Differentiation of Continuous Functions - Second Derivative
Error Analysis of Finite Difference Approximations
The finite difference formulas we develop in previous lessons for the first
and second derivatives of a function are approximate, as they have a
truncation error.
Look at the example from the previous lessons, which asked to find the
value of the acceleration (first derivative) at t=16s using a step size of h=2s
by forward, backward, and central divided difference formulas. The velocity
of a rocket was given by
Chapter 5
Finite Difference Method
Numerical Differentiation of Continuous Functions - Second Derivative
Error Analysis of Finite Difference Approximations
The results, along with the relative approximate true errors from the three
difference approximations, are given in Table 1.
Chapter 5
Finite Difference Method
Chapter 5
Finite Difference Method
Chapter 5
Finite Difference Method
Chapter 5
Finite Difference Method
Chapter 5
Finite Difference Method
Chapter 5
Finite Difference Method