an introduction to finite difference calculus

32
1 Chapter 3 An Introduction to Finite Difference Calculus First Session Contents: 1) Approximation of Derivatives 2) Order Symbols 3) High-Order Derivatives 4) Richardson Extrapolation

Upload: others

Post on 14-Apr-2022

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: An Introduction to Finite Difference Calculus

1

Chapter 3

An Introduction to

Finite Difference Calculus

First Session Contents:

1) Approximation of Derivatives

2) Order Symbols

3) High-Order Derivatives

4) Richardson Extrapolation

Page 2: An Introduction to Finite Difference Calculus

2

Discretization of Computational Domain

Page 3: An Introduction to Finite Difference Calculus

3

Taylor Series Expansion

Brook Taylor

Born: August 18, 1685

Municipal Borough of Edmonton

Died: November 30, 1731

London, United Kingdom

Education: St John's College, Cambridge,

University of Cambridge

Brook Taylor was an English mathematician who is best known

for Taylor's theorem and the Taylor series

Page 4: An Introduction to Finite Difference Calculus

4

Taylor Series Expansion

If a function 𝑓(𝑥) is infinitely differentiable at 𝑥 = 𝑥0, we can express:

To find the coefficients, initially, we put 𝑥 = 𝑥0:

Taking the first derivative gives:

So,

Page 5: An Introduction to Finite Difference Calculus

5

Taylor Series Expansion

Similarly, we take derivative again:

Putting 𝑥 = 𝑥0 results in:

In this way, we may conclude:

Eventually, we can write Taylor Series Expansion of 𝑓(𝑥) at 𝑥 = 𝑥0 as:

where

Page 6: An Introduction to Finite Difference Calculus

6

Taylor Series Expansion

Now, we can write Taylor Series Expansion for other functions.

since

So, we have:

As Taylor Series Expansion of sin(𝑥) and cos(𝑥) at 𝑥 = 𝑥0.

Page 7: An Introduction to Finite Difference Calculus

7

Taylor Series Expansion

Also, we already know

So, the its Taylor Series Expansion is:

To give another example, recall that:

Hence:

Page 8: An Introduction to Finite Difference Calculus

8

Order Symbols

Instead of saying that sin(𝑥) tends to zero at the same rate that 𝑥 tends to zero,

we say:

In general:

If

Big “Oh”

as

as

and

as

Page 9: An Introduction to Finite Difference Calculus

9

Order Symbols

For example:

Other examples for 𝑥 → 0

as

since

Page 10: An Introduction to Finite Difference Calculus

10

Finite Difference Calculus

Let’s write Taylor Series Expansion for 𝑓(𝑥 + ℎ) at 𝑥

So,

Collecting all terms of 𝑂 ℎ :

Let’s re-write based on index notation:

Finite Difference Truncation Error

Forward Difference

Page 11: An Introduction to Finite Difference Calculus

11

Finite Difference Calculus

Defining “Forward Difference” Operator:

We have:

NOTE:

Truncation error is the difference between the derivative and its finite difference

Approximation.

For the “Forward Difference”:

Truncation Error

as

Limited

Page 12: An Introduction to Finite Difference Calculus

12

Finite Difference Calculus

Similarly for 𝒇(𝒙 − 𝒉) at P we have

So,

Collecting all terms of 𝑂 ℎ :

Let’s re-write based on index notation:

Finite Difference Truncation Error

Backward Difference

Page 13: An Introduction to Finite Difference Calculus

13

Finite Difference Calculus

Defining “Backward Difference” Operator:

We have:

Truncation Error

Page 14: An Introduction to Finite Difference Calculus

14

Finite Difference Calculus

Let’s re-write both Taylor Series Expansion at P

So,

We may write 𝑓′(𝑥) explicitely:

Finite Difference Truncation Error

Page 15: An Introduction to Finite Difference Calculus

15

Finite Difference Calculus

Finite Difference Truncation Error

Central Difference

Collecting all terms of 𝑂 ℎ2 :

Based on index notation we have:

Page 16: An Introduction to Finite Difference Calculus

16

Higher-Order Derivatives

Let’s take a look at these two Taylor Series:

So, we have:

× (−𝟐)

Solving for 𝑓′′(𝑥) yields:

or

Page 17: An Introduction to Finite Difference Calculus

17

Higher-Order Derivatives

Recall:

So,

Therefore, we can write forward difference for 𝑓′′(𝑥) in operator notation

Similarly, backward difference for 𝑓′′(𝑥) in operator notation would be:

Page 18: An Introduction to Finite Difference Calculus

18

Higher-Order Forward and Backward Difference

Recall:

Solving for 𝑓′ 𝑥 gives:

Simplifying of this equation results in:

or:

Page 19: An Introduction to Finite Difference Calculus

19

Forward Difference O(h)

Backward Difference O(h)

Central Difference O(h2)

Finite Difference Discretization

Page 20: An Introduction to Finite Difference Calculus

20

Forward Difference O(h)

Backward Difference O(h)

Central Difference O(h4)

Finite Difference Discretization

Page 21: An Introduction to Finite Difference Calculus

21

Example1

If 𝑓 𝑥 = 𝑒𝑥 find 𝑓′(1) using forward difference, choosing ℎ = 0.1

Using Central Difference:

Forward Difference

Central Difference

Exact Forward Difference Central

Difference

Value 2.718282 2.85844 2.72282

Relative Error - 5.15% 0.17%

Page 22: An Introduction to Finite Difference Calculus

22

Example1

Now, let’s choose ℎ = 0.05

Exact value at 𝑥 = 1 Slope of line in 𝑓′-ℎ2 coordinate system is:

So, we can find exact value of 𝑓′ x = 1 :

Page 23: An Introduction to Finite Difference Calculus

23

Example2

If 𝑓 𝑥 = sin(𝑥) find 𝑓′(1) using central difference, choosing ℎ = 0.2

Let’s choose ℎ = 0.1

Let’s choose ℎ = 0.05

Page 24: An Introduction to Finite Difference Calculus

24

Example2

The exact answer is:

Using the method introduced in previous example:

Which gives:

Page 25: An Introduction to Finite Difference Calculus

25

Example3

Consider 𝑓 𝑥 = sin(10𝜋𝑥), find 𝑓′ 0 by choosing ℎ = 0.2

The exact answer is:

So,

Forward Difference

Central Difference

Page 26: An Introduction to Finite Difference Calculus

26

Example3

Consider 𝑓 𝑥 = sin(10𝜋𝑥), find 𝑓′ 0 by choosing ℎ = 0.2

The exact answer is:

So,

Forward Difference

Central Difference

Problem?

𝑇 = ℎ

Page 27: An Introduction to Finite Difference Calculus

27

Richardson Extrapolation

Born: October 11, 1881

Died: September 30, 1953

Newcastle upon Tyne, United Kingdom

Kilmun, United Kingdom

Is it possible to obtain the exact

solution from numerical solution?

He was an English mathematician, physicist, meteorologist, psychologist and

pacifist who pioneered modern mathematical techniques of weather forecasting.

Lewis Fry Richardson

Question

Education: Bootham School, Newcastle University, King's

College, Cambridge, University of London,

Durham University

Page 28: An Introduction to Finite Difference Calculus

28

xo x0+h x0+2h x0+nh

yn

xo

x0+h

x0+2h x0+2nh

y2n

Page 29: An Introduction to Finite Difference Calculus

29

Richardson Extrapolation

Analytical

Solution

Numerical

Solution T.E.

∝ is constant

xo

x0+h

x0+2h x0+nh

yn

xo

x0+h/2

x0+2(h/2) x0+2n(h/2)

y2n

Page 30: An Introduction to Finite Difference Calculus

30

Richardson Extrapolation

Regardless of terms, C can be obtained as

By Replacing, C in

we have

Consequently, the error for step size of h/2 can be determined as

Page 31: An Introduction to Finite Difference Calculus

31

Richardson Extrapolation Second order approximation

Higher order approximation

Page 32: An Introduction to Finite Difference Calculus

32