You are on page 1of 22

Chapter 4

Truncation Errors and Taylor Series

18/10/2020 24
18/10/2020 25
18/10/2020 26
EX:

18/10/2020 27
For n=0
Truncation error

Truncation error

Truncation error

18/10/2020 28
For n=4
Remainder

Threfore

Exact solution

18/10/2020 29
18/10/2020 30
18/10/2020 31
18/10/2020 32
Ex: Increasing number of terms

18/10/2020 33
Ex: Decreasing the step size

When h (step size) is halved the error


decreases by 1/4
Because Error is O(h2) for first order Taylor series

18/10/2020 34
Some examples of using Taylor series

1. Approximating e

2. Small angle approximations

2. Solving Ordinary differential equations (ODEs)


https://math.stackexchange.com/questions/200582/solve-the-
differential-equation-using-taylor-series-expansion

18/10/2020 35
4.1.3 Numerical Differentiation
Forward difference

Backward difference (negative value for the step size)

18/10/2020 36
Center difference

Truncation error is of order n2

More accurate compared to the others

18/10/2020 37
Real value:

FD

BD

CD

CD is the best

18/10/2020 38
Let’s see what happens if we decrease the step size

FD

BD

CD

Decreasing step size reduces error

18/10/2020 39
4.3 Total Error Truncation + Round off
Round off
Truncation error
Decrease the number of
By using smaller
computations
step size

Increases the number of


computations

18/10/2020 40
Consider CD method

(1)

If we use exact values , we will have no round-off error It’s a dream 


We’ll always have round off errors

(2)

Using eq (1,2)

18/10/2020 41
Assume we are given as the allowed round-off error
Assume we are given as the allowed truncation error

Upper bound for the error

An optimum for the step size (ℎ) can be found by

18/10/2020 42
Real value

Check your book for the MATLAB code

18/10/2020 43
18/10/2020 44
MATLAB can store a
limited number of digits,
roughly

Not a bad
estimate

18/10/2020 45

You might also like