Presentation is loading. Please wait.

Presentation is loading. Please wait.

Differentiation – Continuous Functions. Forward Difference Approximation 2 f  x  Δx   f  x  Δx lim Δx  0 f  x   For a finite 'Δx' (we can not.

Similar presentations


Presentation on theme: "Differentiation – Continuous Functions. Forward Difference Approximation 2 f  x  Δx   f  x  Δx lim Δx  0 f  x   For a finite 'Δx' (we can not."— Presentation transcript:

1 Differentiation – Continuous Functions

2 Forward Difference Approximation 2 f  x  Δx   f  x  Δx lim Δx  0 f  x   For a finite 'Δx' (we can not use in this scheme Δx approaches 0) f  x   f  x   x   f  x   x

3 f(x) xx+Δx Figure 1 Graphical Representation of forward difference approximation of first derivative. 3 Graphical Representation Of Forward Difference Approximation

4 Example 1 The velocity of a rocket is given by 4 4 4   14  10   9.8t,0  t  30 14  10  2100t  t   2000 ln  where ' ν' is given in m/s and 't' is given in seconds. a)Use forward difference approximation of the first derivative of ν  t  to calculate the acceleration a(t) at t  16s. Use a step size of Δt  2s. b)Find the exact value of the acceleration a(t) of the rocket. c)Calculate the absolute relative true error for part (b).

5 Example 1 Cont. Solution i 5http://numericalmethods.eng.usf.edu i tt a  t    t    t  i1i1 t i  16 Δt  2 t i  1  t i   t  16  2  18 a  16    18    16  2 FDD approximation rule

6 Example 1 Cont. 9.8  18  6http://numericalmethods.eng.usf.edu 1818 4 4      14  10  2100 14  10  18   2000 ln   453.02m/s 9.8  16  4     14  10 4  2100  16  14  10  16   2000 ln    392.07m/s Hence a  16    18    16  2

7 Example 1 Cont.  453.02  392.07 2  30.474m/s 2 can be calculated by differentiating 4   14  10 4  2100t    t   2000 ln  1410   9.8t as a  t   d  ν  t   dt 7http://numericalmethods.eng.usf.edu b)The exact value of a  16 

8 Example 1 Cont. Knowing that d  ln  t    1 dtt andand 2    dt  t  t d  1    1 4 4    9.8    14  10     14  10 4 4 4    102100   2100tdt14  10 t  d  a  t   2000  14 2 4   2100   9.8       14  10 4 11      2000   14  10  2100t   14  10 4  2100t   200  3t 8http://numericalmethods.eng.usf.edu   4040  29.4t

9 Example 1 Cont. a  16    4040  29.4  16   200  3  16   29.674m/s 2 The absolute relative true error is True Value t  True Value - Approximate Value x100  29.674 9http://numericalmethods.eng.usf.edu  29.674  30.474 x100  2.6967%

10 Backward Difference Approximation of the First Derivative We know f  x  Δx   f  x  Δx lim Δx  0 f  x   For a finite 'Δx', f  x   f  x   x   f  x   x If 'Δx' is chosen as a negative number, xx f  x   f  x   x   f  x  ΔxΔx 10http://numericalmethods.eng.usf.edu f  x   f  x  Δx  

11 Backward Difference Approximation of the First Derivative Cont. Thisisabackwarddifferenceapproximationasyouaretakingapoint backward from x. To find the value of f  x  at x  x i, we may choose another x (i- 1) point 'Δx' behind x as.This gives i xx f  x   f  x i   f  x i  1  x i  x i  1 11http://numericalmethods.eng.usf.edu  f  x i   f  x i  1  xi1xi1 where Δx  x i

12 x x-Δx x f(x)f(x) 12http://numericalmethods.eng.usf.edu Figure 2 Graphical Representation of backward difference approximation of first derivative Backward Difference Approximation of the First Derivative Cont.

13 Example 2 The velocity of a rocket is given by 4 13http://numericalmethods.eng.usf.edu 4   14  10   9.8t,0  t  30 14  10  2100t  t   2000 ln  where ' ν' is given in m/s and 't' is given in seconds. a)Use backward difference approximation of the first derivative of ν  t  to calculate the acceleration at t  16 s. Use a step size of Δt  2s. b)Find the absolute relative true error for part (a).

14 Example 2 Cont. tt 14http://numericalmethods.eng.usf.edu Solution a  t    t i    t i  1  t i  16 Δt  2 t i  1  t i   t  16  2  14 a  16    16    14  2

15 Example 2 Cont. 9.8  16  1616 4 4      14  10  2100 14  10  16   2000 ln   392.07m/s 9.8  14  1414 4 4      14  10  2100 14  10  14   2000 ln   334.24m/s a  16    16    14  2  392.07  334.24 15http://numericalmethods.eng.usf.edu 2  28.915m/s 2

16 Example 2 Cont. 29.674 16http://numericalmethods.eng.usf.edu t  29.674  28.915 x100   2.5584% from Example 1 is The exact value of the acceleration at t  16 s a  16   29.674m/s 2 The absolute relative true error is

17 Central Divided Difference Hence showing that we have obtained a more accurate formula as the error is of the order of 0Δx2.0Δx2. x f(x)f(x) x-Δxx-Δxxx+Δxxx+Δx Figure 3 Graphical Representation of central difference approximation of first derivative 17http://numericalmethods.eng.usf.edu

18 Example 3 The velocity of a rocket is given by 4 18http://numericalmethods.eng.usf.edu 4   14  10   9.8t,0  t  30 14  10  2100t  t   2000 ln  where ' ν' is given in m/s and 't' is given in seconds. (a)Use central divided difference approximation of the first derivative of ν  t  to calculate the acceleration at t  16s. Use a step size of Δt  2s. (b)Find the absolute relative true error for part (a).

19 Example 3 cont. Solution a  t   2t2t i1i1i1i1  t    t  i t i  16 a  16    18    14  4 19http://numericalmethods.eng.usf.edu 2  2   18    14    t  2 t i  1  t i   t  16  2  18 t i  1  t i   t  16  2  14

20 Example 3 cont.  9.8  18  1818 4 4      14  10  2100 14  10 18  2000 ln   453.02m/s  9.8  14  1414 4 4       210014  10  14   2000 ln   334.24m/s a  16    18    14  4  453.02  334.24 20http://numericalmethods.eng.usf.edu 4  29.694m/s 2

21 Example 3 cont. 29.674 21http://numericalmethods.eng.usf.edu  29.674  29.694  100  t  0.069157% The exact value of the acceleration at t  16 s from Example 1 is a  16   29.674m/s 2 The absolute relative true error is

22 Comparision 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 a  16   m / s 2   t % Forward Backward Central 30.475 28.915 29.695 2.6967 2.5584 0.069157 22http://numericalmethods.eng.usf.edu

23 Finite Difference Approximation of Higher Derivatives One can use Taylor series to approximate a higher order derivative. For example, to approximate f  x , the Taylor series for 32 3!3!2!2!  2Δx    2Δx2Δx f  x  ii f  x i  2   f  x i   f  x i  2Δx   where x i  2  x i  2Δx 3 23http://numericalmethods.eng.usf.edu 2 3!3!2!2! fx fx  fx fx  ii x x  xx f  x i  1   f  x i   f  x i   x   where  x i  Δx xi1xi1

24 Finite Difference Approximation of Higher Derivatives Cont. Subtracting 2 times equation (4) from equation (3) gives f  x i  2   2 f  x i  1    f  x i   f  x i  Δx   f   x i  Δx   23  f  x    f  x  f  x   i i i ΔxΔx f  x   2 f  x Δx2Δx2 i1i1i2i2 i 24http://numericalmethods.eng.usf.edu i Δx2Δx2  0Δx 0Δx   f  x  f  x   2 f  x f  x   i1i1i2i2 (5)(5)

25 Example 4 The velocity of a rocket is given by 4 25http://numericalmethods.eng.usf.edu 4   14  10   9.8t,0  t  30 14  10  2100t  t   2000 ln  νt νt  Use forward difference approximation of the second derivative of to calculate the jerk at t  16s. Use a step size of Δt  2s.

26 Example 4 Cont. Solution i 26http://numericalmethods.eng.usf.edu i t 2t 2 j  t   i1i1i2i2    t   t   2  t 2222 j  16    20   2  18    16  t i  16  t  2 t i  1  t i   t  16  2  18 t i  2  t i  2   t   16  2  2   20

27 Example 4 Cont. 9.8  20  4 4      14  10  2100  20  14  10  20   2000 ln   517.35m/s 9.8  18  1818 4 4      14  10  2100 14  10  18   2000 ln   453.02m / s 9.8  16  27http://numericalmethods.eng.usf.edu 1616 4 4      14  10  2100 14  10  16   2000 ln   392.07m/s

28 Example 4 Cont. j  16   517.35  2  453.02   392.07 4  0.84515m/s 3 The exact value of j16j16 can be calculated by differentiating 4 28http://numericalmethods.eng.usf.edu 4    9.8t  14  10  2100t 14  10  t   2000 ln  twice as a  t   d  ν  t   dt and j  t   d  a  t   dt

29 Example 4 Cont. Knowing that d  ln  t    1 dtt and t 2t 2 dt   t   d  1    1 4 4    9.8    14  10     14  10 4 4 4    102100   2100tdt14  10 t  d  a  t   2000  14  200  3t   4040  29.4t 2 29http://numericalmethods.eng.usf.edu 4   2100   9.8       14  10 4   1 1    2000    14  10  2100t   14  10 4  2100t 

30 Example 4 Cont. 18000 dt  j  t   d  a  t   (  200  3t) 2 18000 [  200  3(16)] 2 j  16    0.77909m/s 3 The absolute relative true error is 0.77909 30http://numericalmethods.eng.usf.edu  0.77909  0.84515  100  t  8.4797 % Similarly it can be shown that

31 Higher order accuracy of higher order derivatives The formula given by equation (5) is a forward difference approximation of the second derivative and has the error of the order of  Δx . 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 4 31http://numericalmethods.eng.usf.edu 32 4!4!3!3!2!2! fx fx  fx fx  fx fx  iii x x   xx xx f  x   f  x   f  x   x  i  1i i where  x i  Δx xi1xi1 (6)(6)

32 Higher order accuracy of higher order derivatives Cont. 432 4!4!3!3!2!2! fx fx  fx fx  fx fx  iii i x x   xx xx f  x   f  x   f  x   x  i1 ii1 i where x i  1  x i  Δx (7)(7) Adding equations (6) and (7), gives 4 2   Δx  12 ii x fxx fx   2 f  x i   f  x  Δ  f   f  xi1xi1xi1xi1 12 2  x  Δx  i i   f x 2 f x  f xf f x 2 f x  f xf f  x   ii1Δx2ii1Δx2 i1i1 2 32http://numericalmethods.eng.usf.edu Δx2Δx2 i i  0Δx 0Δx f x  2 f x   f xf x  2 f x   f x f  x   i1i1i1i1

33 Example 5 The velocity of a rocket is given by 4 33http://numericalmethods.eng.usf.edu 4   14  10   9.8t,0  t  30 14  10  2100t  t   2000 ln  Use central difference approximation of second derivative of ν  t  to calculate the jerk at t  16s. Use a step size of Δt  2s.

34 Example 5 Cont. Solution 1 34http://numericalmethods.eng.usf.edu i t 2t 2 a  t   i i  i1i1 t    t   t   2  i t i  16 2222 j  16    18   2  16    14   t  2 t i  1  t i   t  16  2  18 t i  1  t i   t  16  2  14

35 Example 5 Cont.  9.8  18  1818 4 4      14  10  2100 14  10  18   2000 ln   453.02m/s 9.8  16  1616 4 4      14  10  2100 14  10  16   2000 ln   392.07m/s 9.8  14  35http://numericalmethods.eng.usf.edu 1414 4 4      14  10  2100 14  10  14   2000 ln   334.24m/s

36 Example 5 Cont. 2222 j  16    18   2  16    14  4 453.02  2  392.07   334.24  0.77908 36http://numericalmethods.eng.usf.edu  0.77908  0.78  100  t  0.77969m/s 3 The absolute relative true error is  0.077992%

37 THE END http://numericalmethods.eng.usf.edu


Download ppt "Differentiation – Continuous Functions. Forward Difference Approximation 2 f  x  Δx   f  x  Δx lim Δx  0 f  x   For a finite 'Δx' (we can not."

Similar presentations


Ads by Google