0% found this document useful (0 votes)
106 views

9.1 Numerical Differentiation

The document discusses numerical differentiation, which refers to approximating the derivative of a function from a discrete dataset rather than an explicit formula. It describes how interpolation can be used to find approximate derivative values at points between data points. Two common approaches for numerical differentiation are the forward and backward difference formulas, which use successive differences between adjacent function values to approximate derivatives up to a desired order. Examples are provided to demonstrate applying the forward and backward difference formulas.

Uploaded by

Raging Potato
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)
106 views

9.1 Numerical Differentiation

The document discusses numerical differentiation, which refers to approximating the derivative of a function from a discrete dataset rather than an explicit formula. It describes how interpolation can be used to find approximate derivative values at points between data points. Two common approaches for numerical differentiation are the forward and backward difference formulas, which use successive differences between adjacent function values to approximate derivatives up to a desired order. Examples are provided to demonstrate applying the forward and backward difference formulas.

Uploaded by

Raging Potato
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/ 32

Numerical 

Differentiation
CH050P 
ADVANCED MATHEMATICS IN CHEMICAL ENGINEERING

FHCDeVera CH050P     NUMERICAL DIFFERENTIATION 1
Numerical Differentiation
Refers to the computation of values of the derivative of a 
function  from given values of  .
Simply put, it is the numerical approximation of derivatives.

FHCDeVera CH050P     NUMERICAL DIFFERENTIATION 2
Numerical approximation of 
derivatives
o Even if there exists an underlying function that has to be 
differentiated, only its values at a sampled data set may be 
known without knowing the function itself.

o There are some cases where it may not be obvious that an 
underlying function exists and only a discrete data set is 
available. There might still be interest in studying changes in 
the data, which are related to derivatives.

FHCDeVera CH050P     NUMERICAL DIFFERENTIATION 3
Numerical approximation of 
derivatives
o There are times in which exact formulas are available but 
they are very complicated to the point that an exact 
computation of the derivative requires a lot of function 
evaluations (very tedious!!!). 
It might be significantly simpler to approximate the 
derivative instead of computing its exact value.

FHCDeVera CH050P     NUMERICAL DIFFERENTIATION 4
Numerical approximation of 
derivatives
o When approximating solutions to ordinary (or partial) 
differential equations, solutions are typically represented as 
a discrete approximation that is defined on a grid. The 
derivatives then have to be evaluated at the grid points. 
Methods for approximating the derivatives at these points 
have to be used. These will typically make use only of values 
that are defined on a lattice. The underlying function itself 
(which in this case is the solution of the equation) is 
unknown.

FHCDeVera CH050P     NUMERICAL DIFFERENTIATION 5
Interpolation 
Means to find the (approximate) values of a function 
for an  between different x‐values  𝟎 𝟏 𝒏 at which 
the values of  are given so the values  𝟎 𝟎
𝟏 𝟏 𝒏 𝒏 may come from a 
“mathematical function” given by a formula or from an 
“empirical function” resulting from observations or 
experiments.

FHCDeVera CH050P     NUMERICAL DIFFERENTIATION 6
Interpolation in Numerical 
Differentiation
A standard idea in interpolation using numerical 
differentiation is to find a polynomial  𝒏 of degree  (or 
less) that assumes the given values, thus  𝒏 𝟎 𝟎
𝒏 𝟏 𝟏 𝒏 𝒏 𝒏.
where  𝒏 is the interpolation polynomial
𝟎 𝟏 𝒏 are the nodes

FHCDeVera CH050P     NUMERICAL DIFFERENTIATION 7
Interpolation in Numerical 
Differentiation
If  is a mathematical function,  𝒏 is the polynomial 
approximation.

IDEA: Use  𝒏 to get (approximate) values of  for  ’s 


between  𝟎 and  𝒏 (interpolation) or outside that interval 
(extrapolation).

FHCDeVera CH050P     NUMERICAL DIFFERENTIATION 8
Interpolation in Numerical 
Differentiation
Interpolation
30 0.93256
26.625 ?
25 0.87939

Extrapolation
30 0.93256
25 0.87939
23.5685 ?
FHCDeVera CH050P     NUMERICAL DIFFERENTIATION 9
Numerical Differentiation
1. Equal spacing – Newton’s Forward Difference Formula
2. Equal spacing – Newton’s Backward Difference Formula
3. Central Difference Notation

FHCDeVera CH050P     NUMERICAL DIFFERENTIATION 10
Forward Difference Formula
Application: values or functions which are regularly‐spaced
Examples: function tables, regular time interval 
measurements
If values or functions are regularly‐spaced,
𝟎 𝟏 𝟎 𝟐 𝟎 𝒏 𝟎

FHCDeVera CH050P     NUMERICAL DIFFERENTIATION 11
Forward Difference Formula
First forward difference of  at  𝒋

𝒋 𝒋 𝟏 𝒋
Second forward difference of  at  𝒋
𝟐
𝒋 𝒋 𝟏 𝒋
kth forward difference of  at  𝒋
𝒌 𝒌 𝟏 𝒌 𝟏
𝒋 𝒋 𝟏 𝒋 where 

FHCDeVera CH050P     NUMERICAL DIFFERENTIATION 12
Forward Difference Formula
If there is regular spacing,
𝟏 𝒌
𝟎 𝒌 𝒌!𝒉𝒌 𝟎

Method of solution,
Define      𝟎
𝒙 𝒙𝟎
Then         𝟎 𝒉
𝟏 since  𝟏 𝟎

FHCDeVera CH050P     NUMERICAL DIFFERENTIATION 13
Forward Difference Formula
With the foregoing and Newton’s divided difference 
interpolation formula,
𝒏 𝒔 𝒙 𝒙𝟎
𝒏 𝒔 𝟎 𝟎 𝟎 𝒉
𝒓 𝒓 𝟏 𝟐 𝒓 𝒓 𝟏 … 𝒓 𝒏 𝟏 𝒏
𝟎 𝟎 𝟐! 𝟎 𝒏! 𝟎

where binomial coefficients in the first line are defined by
𝒓 𝒓 𝟏 𝒓 𝟐 … 𝒓 𝒔 𝟏
(s>0, integer)
𝒔!

FHCDeVera CH050P     NUMERICAL DIFFERENTIATION 14
Forward Difference Formula
Example: Compute the value of  up to 6D using 
Newton’s Forward Difference Formula and the values given 
below.
Approx True  % abs 
𝒋𝒇 𝒙𝒋 𝒇𝒋 = ? ∆𝒇𝒋 ∆𝟐 𝒇𝒋 ∆𝟑 𝒇𝒋
value value error
0 0.5
1 0.6
2 0.7
3 0.8
FHCDeVera CH050P     NUMERICAL DIFFERENTIATION 15
Forward Difference Formula
𝟐 𝟑 Approx True  % abs 
𝒋𝒇 𝒙𝒋 𝒇𝒋 = ? ∆𝒇𝒋 ∆ 𝒇𝒋 ∆ 𝒇𝒋
value value error
0 0.5 1.127626
0.057839
1 0.6 1.185465 0.011865
0.069704 0.000697 1.160941
2 0.7 1.255169 0.012562
0.082266
3 0.8 1.337435
FHCDeVera CH050P     NUMERICAL DIFFERENTIATION 16
Forward Difference Formula
Solving for r,
𝟎

Approximating  ,

FHCDeVera CH050P     NUMERICAL DIFFERENTIATION 17
Forward Difference Formula
𝟐 𝟑 Approx True  % abs 
𝒋𝒇 𝒙𝒋 𝒇𝒋 = ? ∆𝒇𝒋 ∆ 𝒇𝒋 ∆ 𝒇𝒋
value value error
0 0.5 1.127626
0.057839
1 0.6 1.185465 0.011865
0.069704 0.000697 1.1609441.1609410.00026
2 0.7 1.255169 0.012562
0.082266 Answer exact up to 5D
3 0.8 1.337435
FHCDeVera CH050P     NUMERICAL DIFFERENTIATION 18
Backward Difference Approximation
Employs backward‐sloping differences
The difference table is the same as in Newton’s Forward 
Difference (same numbers or entries are in the same 
position).
There is a change in the running script.
A second name and notation for differences is introduced.

FHCDeVera CH050P     NUMERICAL DIFFERENTIATION 19
Backward Difference Formula
First backward difference of  at  𝒋

𝒋 𝒋 𝒋 𝟏
Second backward difference of  at  𝒋
𝟐
𝒋 𝒋 𝒋 𝟏
kth backward difference of  at  𝒋
𝒌 𝒌 𝟏 𝒌 𝟏
𝒋 𝒋 𝒋 𝟏 where 

FHCDeVera CH050P     NUMERICAL DIFFERENTIATION 20
Backward Difference Formula
Newton’s Backward Difference Interpolation Formula,
𝒏
𝒔
𝒏 𝟎
𝒔 𝟎
𝒓 𝒓 𝟏 𝟐 𝒓 𝒓 𝟏 … 𝒓 𝒏 𝟏 𝒏
𝟎 𝟎 𝟐! 𝟎 𝒏! 𝟎

𝒙 𝒙𝟎
𝟎 𝒉

FHCDeVera CH050P     NUMERICAL DIFFERENTIATION 21
Backward Difference Formula
Example: Compute the value of  up to 6D using 
Newton’s Backward Difference Formula and the values 
given below.
Approx True  % abs 
𝒋𝒃 𝒙𝒋 𝒇𝒋 = ? 𝛁𝒇𝒋 𝛁 𝟐 𝒇𝒋 𝛁 𝟑 𝒇𝒋
value value error
‐3 0.5
‐2 0.6
‐1 0.7
0 0.8
FHCDeVera CH050P     NUMERICAL DIFFERENTIATION 22
Backward Difference Formula
𝟐 𝟑 Approx True  % abs 
𝒋𝒃 𝒙𝒋 𝒇𝒋 = ? 𝛁𝒇𝒋 𝛁 𝒇𝒋 𝛁 𝒇𝒋
value value error
‐3 0.5 1.127626
0.057839
‐2 0.6 1.185465 0.011865
0.069704 0.000697 1.160941
‐1 0.7 1.255169 0.012562
0.082266
0 0.8 1.337435
FHCDeVera CH050P     NUMERICAL DIFFERENTIATION 23
Backward Difference Formula
Solving for r,
𝟎

Approximating  ,

FHCDeVera CH050P     NUMERICAL DIFFERENTIATION 24
Backward Difference Formula
𝟐 𝟑 Approx True  % abs 
𝒋𝒃 𝒙𝒋 𝒇𝒋 = ? 𝛁𝒇𝒋 𝛁 𝒇𝒋 𝛁 𝒇𝒋
value value error
‐3 0.5 1.127626
0.057839
‐2 0.6 1.185465 0.011865
0.069704 0.000697 1.160944 1.1609410.00026
‐1 0.7 1.255169 0.012562
0.082266 Answer exact up to 5D
0 0.8 1.337435
FHCDeVera CH050P     NUMERICAL DIFFERENTIATION 25
Central Difference Notation
The first central difference of  at  𝒋

𝒋 𝒋 𝟏𝟐 𝒋 𝟏𝟐

kth central difference of  at  𝒋


𝒌 𝒌 𝟏 𝒌 𝟏
𝒋 𝒋 𝟏
𝟐 𝒋 𝟏𝟐 where 

FHCDeVera CH050P     NUMERICAL DIFFERENTIATION 26
Central Difference Notation
Approx True  % abs 
𝒋𝒄 𝒙𝒋 𝒇𝒋 = ? 𝜹𝒇𝒋 𝜹𝟐 𝒇𝒋 𝜹𝟑 𝒇𝒋
value value error
‐1 𝒙 𝟏 𝒇 𝟏
𝜹𝒇 𝟏
𝟐
0 𝒙𝟎 𝒇𝟎 𝜹𝟐 𝒇𝟎
𝜹𝒇𝟏 𝜹𝟑 𝒇𝟏
𝟐 𝟐
1 𝒙𝟏 𝒇𝟏 𝜹𝟐 𝒇𝟏
𝜹𝒇𝟑
𝟐
2 𝒙𝟐 𝒇𝟐
Central Difference Notation
Central differences
o Are used in numerical differentiation, differential 
equations and centered interpolation formulas;
o These formulas use function values “symmetrically” 
located on both sides of the interpolation point x;
o Such values are available near the middle of a given table, 
where centered interpolation formulas tend to give better 
result than those of Newton’s formulas, which do not have 
that symmetry property.
FHCDeVera CH050P     NUMERICAL DIFFERENTIATION 28
Exercise
Compute a 7D value of the Bessel function of the first kind of 
order n,  𝟎 , for  from the four values in the 
following table using (a) Newton’s Forward Difference Formula 
and (b) Newton’s Backward Difference Formula.  Use the 
formula for  𝟎 up to  (show the formula for   𝟎 up 
to  ).
𝟏 𝒎 𝒙𝟐𝒎
𝟎 𝒎 𝟎 𝟐𝟐𝒎 𝒎! 𝟐
𝒙𝟐 𝒙𝟒 𝒙𝟔
𝟐𝟐 𝟏! 𝟐 𝟐𝟒 𝟐! 𝟐 𝟐𝟔 𝟑! 𝟐

FHCDeVera CH050P     NUMERICAL DIFFERENTIATION 29
Exercise
𝟐 𝟐 𝟑 𝟑 Approx True  % abs 
𝒋𝒇/𝒃 𝒙𝒋 𝑱𝟎 𝒙 ∆/𝛁𝑱𝟎 𝒙 ∆ /𝛁 𝑱𝟎 𝒙 ∆ /𝛁 𝑱𝟎 𝒙
value value error
0/‐3 1.7

1/‐2 1.8

2/‐1 1.9

3/0 2.0
FHCDeVera CH050P     NUMERICAL DIFFERENTIATION 30
Bessel Functions
For further appreciation of Bessel functions, you can read 
the resource given below.
http://sces.phys.utk.edu/~moreo/mm08/niedzilla.pdf

FHCDeVera CH050P     NUMERICAL DIFFERENTIATION 31
End of Lecture 9.1

FHCDeVera CH050P     NUMERICAL DIFFERENTIATION 32

You might also like