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

Numerical Method Slides SHB Chapter5

This document describes numerical differentiation methods. It discusses two main situations where numerical differentiation is required: when function values are known but the function is unknown, and when the function is too complicated to differentiate analytically. It then describes three main methods: the forward difference quotient, central difference quotient, and higher order derivatives. Examples are provided to estimate derivatives of various functions and illustrate how the accuracy improves as the step size decreases. It also discusses differentiating tabulated functions using interpolation polynomials.

Uploaded by

fasyafif
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
111 views

Numerical Method Slides SHB Chapter5

This document describes numerical differentiation methods. It discusses two main situations where numerical differentiation is required: when function values are known but the function is unknown, and when the function is too complicated to differentiate analytically. It then describes three main methods: the forward difference quotient, central difference quotient, and higher order derivatives. Examples are provided to estimate derivatives of various functions and illustrate how the accuracy improves as the step size decreases. It also discusses differentiating tabulated functions using interpolation polynomials.

Uploaded by

fasyafif
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 18

Chapter 5

NUMERICAL DIFFERENTIATION

Introduction
Definition: The method of obtaining the derivative of a
function using a numerical technique.
There are two situations where numerical differentiation is
required:

1. The function values are known but the function is


unknown (called tabulated function)
2. The function to be differentiated is complicated and,
therefore, it is difficult to differentiate.

Method 1: Differencing
Continuous Functions
Method 1a: Forward Difference Quotient
Method 1b: Central Difference Quotient

Method 1c: Higher Order Derivatives

Method 1a: Forward


Difference Quotient
Consider a small increment = in . According to Taylors
theorem, for + we have:
2

+ = + + "
. 5.1
2
By rearranging the terms. We get:
+ () "

=

. 5.2

2
Thus, if is chosen to sufficiently small, () can be
approximated by:
+

=
. 5.3

called the first order forward


difference quotient.
With a truncation error of
also known as two-point
"
formula.
=
. 5.4
2

Similarly we can show that the first-order backward difference


quotient:

=
. 5.5

Example 5.1
Estimate approximate derivative of = 2 at = 1 for
= 0.2,0.1,0.05 0.01 using the first order forward difference
formula.

Solution 5.1
Step 1: Use the first order forward difference formula:
+ ()

Step 2: Replace
1 + (1)

We know that 2nd derivative of = 2 is " = 2.


Step 3:

Error

Develop table as:

0.2

2.2

22.2 =0.2

0.1

2.1

22.1 =0.1

0.05

2.05

22.05 =0.05

0.01

2.01

22.01 =0.01

Note that the


correct answer is
2.0.
The derivative
approximation
approaches the
exact value as h
is decreases.

Method 1b: Central


Difference Quotient
Note that, the first order forward difference quotient was
obtained using the linear approximation to ().

This would give large truncation errors if the functions


were of higher order.
In such cases, we can reduce truncation errors for a given
by using a quadratic approximation, rather than a linear
one.
This can be achieved by taking another term in Taylors
expansion.
+
2

= + +
2!
3

+ 1
. 5.6

Similarly,

2
3

= + 1
2!
3!

. 5.7

Subtracting equation 5.7 from equation 5.6, we obtain


3

+ = 2 +
1 + 2
. 5.8
3!
We have:
+ ( )

=
. 5.9
2
*Equation 5.9 is called the second-order central difference formula.
*This is also known as three-point formula.

Example 5.2

Repeat the exercise given in example 5.1 for the three-point


formula.
+ ( )

=
2
Solution 5.2
Step 1: By replacing : 1 =

1+ (1)
2

Step 2: Develop a table:

Error

0.2

2.0

0.1

2.0

0.05

2.0

The derivative is exact for all


values of h.
This is because, we have used
quadratic approximation for a
quadratic function.

In this method, we can also derive further higher-order derivatives by


using more points in the formula.
For example, the fire-points central difference formula:

+ 2 + 8 + 8 + ( 2)
=
12
This is a fourth-order approximation.

. 5.11

Method 1c: Higher Order


Derivatives
We can also obtain approximations to higher-order derivatives
using Taylors expansion.
To illustrate that, we derive here the formula for ()

We know that:

2
3

+ = + + +
2!
3!
and
2
3

= +
2!
3!
Adding these two expansions gives
+ + ( ) = 2 + 2

. 5.12

. 5.13

Therefore:

+ 2 + ( )
=
2

. 5.14

Thus, the approximation to second derivative is:

+ 2 + ( )
=
2

. 5.15

Example 5.3
Find approximation to second derivative of cos at = 0.75 with
= 0.01. Compare with the true value.

Solution 5.4
Step 1: =

+ 2 +()
2

Step 2: Replace = 0.75 with = 0.01


0.75 + 0.01 2 0.75 + (0.75 0.01)

0.75 =
0.012
0.7248360 2 0.7316888 + 0.7384685

0.75 =
0.0001
1.4633046 1.4633776

0.75 =
0.0001

0.75 = 0.73000

*Exact value of 0.75 = cos 0.75 = 0.73168


*Error= 0.00168

Method 2: Differentiating
Tabulated Functions
For Tabulated form
When function values are available in tabulated form, we
may approximate this function by an interpolation
polynomial () and the differentiate ().
We will use here Newtons divided difference interpolation
polynomial.
Step 1: Let us first consider the linear equation
1 = 0 + 1 ( 0 )
Step 2: The approximate derivative of the function is
given by = 1 = 1

Step 3: We know that 1 = 0 , 1 =

1 (0 )
1 0

Step 4: On substituting = 1 0 ; 1 = + ; 0 = into


previous equations, we get:

+ ()
=

Two-point forward
difference formula

Three-point forward
3 + 4 + ( + 2) difference formula

3 4 + ( 2)
=
2

Three-point backward
difference formula

Example 5.4
The table below gives the values of distance travelled by a
car at various time intervals during the initial running.
Time ()

Distance
travelled
()

10

14.5

19.5

25.5

32.0

Estimate velocity at time = 5, = 7 = 9.

Solution 5.4
Step 1: We know that velocity is given by the first derivative
of (). At = 5, we use the three-point forward difference,
3 + 4 + ( + 2)
=
2
Step 2: Then
3 10 + 4 14.5 19.5)
=
2(1)
= 4.25 /

Step 3: At = 7, we use central difference formulae


8 6
7 =
2()
7 =

25.5 14.5
2(1)

= 5.5 /
Step 4: At = 9, we use the three-point backward difference
3 9 4 8 + (7)
9 =
2
3 32 4 25.5 + 19.5
2
9 = 6.75 /

9 =

You might also like