Presentation is loading. Please wait.

Presentation is loading. Please wait.

10/27/2015 1 Differentiation-Continuous Functions Computer Engineering Majors Authors: Autar Kaw, Sri Harsha Garapati.

Similar presentations


Presentation on theme: "10/27/2015 1 Differentiation-Continuous Functions Computer Engineering Majors Authors: Autar Kaw, Sri Harsha Garapati."— Presentation transcript:

1 10/27/2015 http://numericalmethods.eng.usf.edu 1 Differentiation-Continuous Functions Computer Engineering Majors Authors: Autar Kaw, Sri Harsha Garapati http://numericalmethods.eng.usf.edu Transforming Numerical Methods Education for STEM Undergraduates

2 Differentiation – Continuous Functions http://numericalmethods.eng.usf.edu http://numericalmethods.eng.usf.edu

3 3 Forward Difference Approximation For a finite

4 http://numericalmethods.eng.usf.edu4 Figure 1 Graphical Representation of forward difference approximation of first derivative. Graphical Representation Of Forward Difference Approximation

5 http://numericalmethods.eng.usf.edu 5 Example 1 There is strong evidence that the first level of processing what we see is done in the retina. It involves detecting something called edges or positions of transitions from dark to bright or bright to dark points in images. These points usually coincide with boundaries of objects. To model the edges, derivatives of functions such as need to be found. a)Use forward divided difference approximation of the first derivative of to calculate its derivative at for. Use a step size of. Also calculate the absolute relative true error. b)Repeat the procedure from part (a) with the same data except choose. Does the estimate of the derivative increase or decrease? Also calculate the relative true error.

6 http://numericalmethods.eng.usf.edu 6 Example 1 Cont. Solution:

7 http://numericalmethods.eng.usf.edu 7 Example 1 Cont. The exact value ofcan be calculated by differentiating as

8 http://numericalmethods.eng.usf.edu 8 Knowing that Example 1 Cont. we find

9 http://numericalmethods.eng.usf.edu 9 The absolute relative true error is Example 1 Cont.

10 http://numericalmethods.eng.usf.edu 10 Example 1 Cont. b)

11 http://numericalmethods.eng.usf.edu 11 Example 1 Cont.

12 http://numericalmethods.eng.usf.edu 12 The absolute relative true error is The estimate of the derivative decreased. Example 1 Cont.

13 http://numericalmethods.eng.usf.edu13 Backward Difference Approximation of the First Derivative We know For a finite, Ifis chosen as a negative number,

14 http://numericalmethods.eng.usf.edu14 Backward Difference Approximation of the First Derivative Cont. 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

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

16 http://numericalmethods.eng.usf.edu 16 Example 2 There is strong evidence that the first level of processing what we see is done in the retina. It involves detecting something called edges or positions of transitions from dark to bright or bright to dark points in images. These points usually coincide with boundaries of objects. To model the edges, derivatives of functions such as need to be found. a)Use backward divided difference approximation of the first derivative of to calculate its derivative at for. Use a step size of. Also calculate the absolute relative true error. b)Repeat the procedure from part (a) with the same data except choose. Does the estimate of the derivative increase or decrease? Also calculate the relative true error.

17 http://numericalmethods.eng.usf.edu 17 Example 2 Cont. Solution a)

18 http://numericalmethods.eng.usf.edu 18 Example 2 Cont.

19 http://numericalmethods.eng.usf.edu 19 The absolute relative true error is Example 2 Cont.

20 http://numericalmethods.eng.usf.edu 20 b) Example 2 Cont.

21 http://numericalmethods.eng.usf.edu 21 The absolute relative true error is The estimate of the derivative decreased. Example 2 Cont.

22 http://numericalmethods.eng.usf.edu22 Derive the forward difference approximation from Taylor series Taylor’s theorem says that if you know the value of a functionat a point and all its derivatives at that point, provided the derivatives are continuous betweenand, then Substituting for convenience

23 http://numericalmethods.eng.usf.edu23 Derive the forward difference approximation from Taylor series Cont. Theterm shows that the error in the approximation is of the order ofCan you now derive from Taylor series theformula forbackward divided difference approximation of the first derivative? As shown above, both forward and backward divideddifference approximation of the firstderivative are accurate on the order of Can we get better approximations? Yes, another method to approximate the first derivative is called the Central difference approximation of the first derivative.

24 http://numericalmethods.eng.usf.edu24 Derive the forward difference approximation from Taylor series Cont. From Taylor series Subtracting equation (2) from equation (1)

25 http://numericalmethods.eng.usf.edu25 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

26 http://numericalmethods.eng.usf.e du 26 Example 3 There is strong evidence that the first level of processing what we see is done in the retina. It involves detecting something called edges or positions of transitions from dark to bright or bright to dark points in images. These points usually coincide with boundaries of objects. To model the edges, derivatives of functions such as need to be found. a)Use central divided difference approximation of the first derivative of to calculate its derivative at for. Use a step size of. Also calculate the absolute relative true error. b)Repeat the procedure from part (a) with the same data except choose. Does the estimate of the derivative increase or decrease? Also calculate the relative true error.

27 http://numericalmethods.eng.usf.e du 27 Example 3 cont. Solution a)

28 http://numericalmethods.eng.usf.e du 28 Example 3 cont.

29 http://numericalmethods.eng.usf.e du 29 Example 3 cont. The absolute relative true error is

30 http://numericalmethods.eng.usf.e du 30 Example 3 cont. b)

31 http://numericalmethods.eng.usf.e du 31 Example 3 cont. The absolute relative true error is The results from the three difference approximations are given in Table 1.

32 http://numericalmethods.eng.usf.e du 32 Comparision Type of Difference Approximation Forward Backward Central 0.23291 0.23572 0.23431 0.59761 0.60241 0.0024000 0.11821 0.11893 0.11857 0.29940 0.30060 6.0000 Table 1 Summary of using different divided difference approximations

33 http://numericalmethods.eng.usf.edu33 Finding the value of the derivative within a prespecified tolerance In real life, one would not know the exact value of the derivative – so how would one know how accurately they have found the value of the derivative. A simple way would be to start with a step size and keep on halving the step size and keep on halving the step size until the absolute relative approximate error is within a pre-specified tolerance. Take the example of findingfor at using the backward divided difference scheme.

34 2 1 0.5 0.25 0.125 28.915 29.289 29.480 29.577 29.625 1.2792 0.64787 0.32604 0.16355 http://numericalmethods.eng.usf.edu34 Finding the value of the derivative within a prespecified tolerance Cont. Given in Table 2 are the values obtained using the backward difference approximation method and the corresponding absolute relative approximate errors. Table 2 First derivative approximations and relative errors for different Δt values of backward difference scheme

35 http://numericalmethods.eng.usf.edu35 Finding the value of the derivative within a prespecified tolerance Cont. From the above table, one can see that the absolute relative approximate error decreases as the step size is reduced. At the absolute relative approximate error is 0.16355%, meaning that at least 2 significant digits are correct in the answer.

36 http://numericalmethods.eng.usf.edu36 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

37 http://numericalmethods.eng.usf.edu37 Finite Difference Approximation of Higher Derivatives Cont. Subtracting 2 times equation (4) from equation (3) gives (5)

38 http://numericalmethods.eng.usf.edu38 Example 4 The velocity of a rocket is given by Use forward difference approximation of the second derivative of to calculate the jerk at. Use a step size of.

39 http://numericalmethods.eng.usf.edu39 Example 4 Cont. Solution

40 http://numericalmethods.eng.usf.edu40 Example 4 Cont.

41 http://numericalmethods.eng.usf.edu41 Example 4 Cont. The exact value ofcan be calculated by differentiating twice as and

42 http://numericalmethods.eng.usf.edu42 Example 4 Cont. Knowing that and

43 http://numericalmethods.eng.usf.edu43 Example 4 Cont. The absolute relative true error is Similarly it can be shown that

44 http://numericalmethods.eng.usf.edu44 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. 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)

45 http://numericalmethods.eng.usf.edu45 Higher order accuracy of higher order derivatives Cont. where (7) Adding equations (6) and (7), gives

46 http://numericalmethods.eng.usf.edu46 Example 5 The velocity of a rocket is given by Use central difference approximation of second derivative of to calculate the jerk at. Use a step size of.

47 http://numericalmethods.eng.usf.edu47 Example 5 Cont. Solution

48 http://numericalmethods.eng.usf.edu48 Example 5 Cont.

49 http://numericalmethods.eng.usf.edu49 Example 5 Cont. The absolute relative true error is

50 Additional Resources For all resources on this topic such as digital audiovisual lectures, primers, textbook chapters, multiple-choice tests, worksheets in MATLAB, MATHEMATICA, MathCad and MAPLE, blogs, related physical problems, please visit http://numericalmethods.eng.usf.edu/topics/continuous_02 dif.html

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


Download ppt "10/27/2015 1 Differentiation-Continuous Functions Computer Engineering Majors Authors: Autar Kaw, Sri Harsha Garapati."

Similar presentations


Ads by Google