Download presentation

Published byNatalie Shier Modified over 2 years ago

1
**Numerical Methods Lecture 14 Differentiation-Continuous Functions**

Dr. S. M. Lutful Kabir Visiting Professor, BRAC University & Professor (On-leave), BUET

2
**Forward Difference Approximation**

For a finite

3
**Forward Difference Approximation**

Figure 1 Graphical Representation of forward difference approximation of first derivative.

4
**Derive the forward difference approximation from Taylor series**

Taylor’s theorem says that if you know the value of a function ‘f’ at a point xi and all its derivatives at that point, provided the derivatives are continuous between xi and xi+1, then Substituting for convenience

5
**Derive the forward difference approximation from Taylor series (cont.)**

The term shows that the error in the approximation is of the order of Can you now derive from Taylor series the formula for backward divided difference approximation of the first derivative? It can be shown that both forward and backward divided difference approximation of the first derivative are accurate on the order of Can we get better approximation? Yes, another method to approximate the first derivative is called the Central difference approximation of the first derivative.

6
**Backward Difference Approximation of the First Derivative**

We know For a finite If is chosen as a negative number,

7
**Backward Difference Approximation of the First Derivative (continued)**

This is a backward difference approximation as you are taking a point backward from x. To find the value of at we may choose another point behind as This gives where,

8
**Backward Difference Approximation of the First Derivative (continued)**

x-Δx f(x) Figure 2 Graphical Representation of backward difference approximation of first derivative

9
**Derive the backward difference approximation from Taylor series**

Taylor’s theorem says that if you know the value of a function ‘f’ at a point xi and all its derivatives at that point, provided the derivatives are continuous between xi and xi-1, then Substituting for convenience

10
**Derive the Central difference approximation from Taylor series (cont.)**

Subtracting equation (2) from the first (1),

11
**Central Divided Difference**

Hence showing that we have obtained a more accurate formula as the error is of the order of x f(x) x-Δx x x+Δx Figure 3 Graphical Representation of central difference approximation of first derivative

12
**Example 1 The velocity of a rocket is given by where**

is given in m/s and is given in seconds. Use forward, backward and central divided difference approximation of the first derivative of to calculate the acceleration at Use a step size of Find the absolute relative true error for part (a).

13
**Comparison of FDD, BDD, CDD**

The results from the three difference approximations are given in Table 1. Table 1 Summary of a (16) using different divided difference approximations Type of Difference Approximation Forward Backward Central 30.475 28.915 29.695 2.6967 2.5584

14
**Effect of step size on the accuracy**

%Error 2 1 0.5 0.25 0.125 28.915 29.289 29.480 29.577 29.625 1.2792

15
**Finite Difference Approximation of Higher Derivatives**

One can use Taylor series to approximate a higher order derivative. For example, to approximate , the Taylor series for (3) where (4) where

16
**Finite Difference Approximation of Higher Derivatives (cont.)**

Subtracting 2 times equation (4) from equation (3) gives (5)

17
**Higher order accuracy of higher order derivatives**

The formula given by equation (5) is a forward difference approximation of 2nd derivative and has error of the order of Can we get a formula that has a better accuracy? We can get the Central difference approximation of the second derivative. The Taylor series for (6) where

18
**Higher order accuracy of higher order derivatives (cont.)**

(7) where Adding equations (6) and (7), gives

19
**Example 2 The velocity of a rocket is given by**

Use central difference approximation of second derivative of at Use a step size of

20
Program clear all; clc; t=1; delta=0.2; decrement=0.04; disp(' First Derivative') disp(' ') disp( ' Delta Actual Forw Back Central %Err_F %Err_B %Err_C') disp( ' ')

21
Program (continued) for i=1:5 F1F=(f(t+delta)-f(t))/delta; F1B=(f(t)-f(t-delta))/delta; F1C=(f(t+delta)-f(t-delta))/(2*delta); F1A=f1(t); Y(1)=delta; Y(2)=F1A; Y(3)=F1F; Y(4)=F1B; Y(5)=F1C; Y(6)=abs((F1F-F1A)*100/F1A); Y(7)=abs((F1B-F1A)*100/F1A); Y(8)=abs((F1C-F1A)*100/F1A); disp(Y); delta=delta-decrement; end

22
**Program (continued) delta=0.2; disp(' ‘); disp(' Second Derivative')**

disp( ' Delta Actual Forw Back Central %Err_F %Err_B %Err_C') disp( ' ')

23
**Program (continued) for i=1:5**

F2F=(f(t)-2*f(t+delta)+f(t+2*delta))/(delta^2); F2B=(f(t-2*delta)-2*f(t-delta)+f(t))/(delta^2); F2C=(f(t+delta)-2*f(t)+f(t-delta))/(delta^2); F2A=f2(t); Y(1)=delta; Y(2)=F2A; Y(3)=F2F; Y(4)=F2B; Y(5)=F2C; Y(6)=abs((F2F-F2A)*100/F2A); Y(7)=abs((F2B-F2A)*100/F2A); Y(8)=abs((F2C-F2A)*100/F2A); disp(Y); delta=delta-decrement; end

24
Thanks

Similar presentations

Presentation is loading. Please wait....

OK

9.3 Taylor’s Theorem: Error Analysis. 2 7 1 yes no.

9.3 Taylor’s Theorem: Error Analysis. 2 7 1 yes no.

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Seminar ppt on 5 pen pc technology Download ppt on defects of vision Ppt on green revolution in india Ppt on pi in maths what is pi Ppt on e-retailing in india Ppt on vision and mission of infosys Ppt on ideal gas law practice Ppt on ozone layer and greenhouse effect Free ppt on employee motivation Ppt on do's and don'ts of group discussion videos