Download presentation

Presentation is loading. Please wait.

Published byNatalie Shier Modified about 1 year ago

1
Numerical Methods

2
For a finite 2

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

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

5
5 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
We know For a finite If is chosen as a negative number, 6

7
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, 7

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

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

10
Derive the Central difference approximation from Taylor series (cont.) From Taylor series Subtracting equation (2) from the first (1), 10

11
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. (a)Use forward, backward and central divided difference approximation of the first derivative of to calculate the acceleration at. Use a step size of. (b)Find the absolute relative true error for part (a). 12

13
13 Comparison of FDD, BDD, CDD The results from the three difference approximations are given in Table 1. Type of Difference Approximation Forward Backward Central Table 1 Summary of a (16) using different divided difference approximations

14
%Error

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 where (3) (4) 15

16
Finite Difference Approximation of Higher Derivatives (cont.) Subtracting 2 times equation (4) from equation (3) gives (5) 16

17
Higher order accuracy of higher order derivatives The formula given by equation (5) is a forward difference approximation of 2nd derivative and has errorof 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 where (6) 17

18
Higher order accuracy of higher order derivatives (cont.) where (7) Adding equations (6) and (7), gives 18

19
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
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( ' ') 20

21
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 21

22
delta=0.2; disp(' ‘); disp(' Second Derivative') disp(' ') disp( ' Delta Actual Forw Back Central %Err_F %Err_B %Err_C') disp( ' ') 22

23
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 23

24
Thanks 24

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google