Presentation is loading. Please wait.

Presentation is loading. Please wait.

Numerical Analysis Lecture 42.

Similar presentations


Presentation on theme: "Numerical Analysis Lecture 42."— Presentation transcript:

1 Numerical Analysis Lecture 42

2 Examples of Numerical Differentiation

3 The simplest formula for differentiation is

4 Let f(x)= In x and x0 = 1.8. Then the quotient
Example Let f(x)= In x and x0 = 1.8. Then the quotient is used to approximate

5 Let us see the results for h = 0.1, 0.01, and 0.001.
with error where Let us see the results for h = 0.1, 0.01, and

6 h f(1.8 + h) 0.1 0.01 0.001

7 and the error bounds are a appropriate.
Since The exact value of is and the error bounds are a appropriate.

8 The following two three point formulas become especially useful if the nodes are equally spaced, that is, when x1 = x0 + h and x2 = x0 + 2h,

9 where lies between x0 and x0 + 2h, and

10 where lies between (x0 – h) and (x0 + h).

11 Given in Table below are values for f (x) = xex.
1.8 1.9 2.0 2.1 2.2

12 Since Approximating using the various three-and five-point formulas produces the following results.

13 Three point formulas:

14 Using three point formulas
we get

15

16 Five point formula Using the five point formula with h = 0.1 (the only formula applicable):

17 The errors in the formulas are approximately
and respectively. Clearly, the five-point formula gives the superior result.

18 Consider approximating
Consider approximating for f (x) = sin x, using the values in table [ the true value is cos (0.900) = ] x sin x 0.800 0.901 0.850 0.902 0.880 0.905 0.890 0.910 0.895 0.920 0.898 0.950 0.899 1.000

19 Using the formula with different values of h gives the approximations in table given below:

20 h Approximation to Error 0.001 0.002 0.005 0.010 0.020 0.050 0.100

21 Numerical Integration
Examples of Numerical Integration

22 EXAMPLE The Trapezoidal rule for a function f on the interval [0, 2] is while Simpson’s rule for f on [0, 2] is

23 That is

24 f (x) x2 x4 1/(x + 1) sin x ex Exact value 2.667 6.400 1.099 2.958 1.416 6.389 Trapezoidal 4.000 16.000 1.333 3.326 0.909 8.389 Simpson’s 6.667 1.111 2.964 1.425 6.421

25 Use close and open formulas listed below to approximate

26 Some of the common closed Newton-Cotes formulas with their error terms are as follows:
n = 1: Trapezoidal rule where

27 n = 2: Simpson’s rule n = 3: Simpson’s rule

28 n = 4: where n = 0: Midpoint rule

29 n 1 2 3 4 Closed formulas Error Open formulas

30 Composite Numerical Integration
EXAMPLE 1 Consider approximating with an absolute error less than , using the Composite Simpson’s rule. The Composite Simpson’s rule gives

31 Since the absolute error is required to
be less than , the inequality

32 is used to determine n and h
is used to determine n and h. Computing these calculations gives n greater than or equal to 18. If n = 20, then the formula becomes

33 To be assured of this degree of accuracy using the Composite Trapezoidal rule requires that
or that Since this is many more calculations than are needed for the Composite Simpson’s rule, it is clear that it

34 would be undesirable to use the Composite Trapezoidal rule on this problem. For comparison purposes, the Composite Trapezoidal rule with n = 20 and gives

35 The exact answer is 2; so Simpson’s rule with n = 20 gave an answer well within the required error bound, whereas the Trapezoidal rule with n = 20 clearly did not.

36 An Example of Industrial applications: A company advertises that every roll of toilet paper has at least 250 sheets. The probability that there are 250 or more sheets in the toilet paper is given by

37 Approximating the above integral as
a)use single segment Trapezoidal rule to find the probability that there are 250 or more sheets. b)Find the true error, Et for part (a). C)Find the absolute relative true error for part (a).

38 , where

39 b) The exact value of the above integral cannot be found
b) The exact value of the above integral cannot be found. We assume the value obtained by adaptive numerical integration using Maple as the exact value for calculating the true error and relative true error. so the true error is

40 The absolute relative true error,
, would then be

41 Improper Integrals EXAMPLE
To approximate the values of the improper integral we will use the Composite Simpson’s rule with h = Since the fourth Taylor polynomial for ex about x = 0 is

42 We have

43 Table below lists the approximate values of
G(x) 0.00 0.25 0.50 0.75 1.00

44 Applying the Composite Simpson’s rule to G using these data gives
Hence

45 This result is accurate within the accuracy of the Composite Simpson’s rule approximation for the function G. Since on [0, 1], the error is bounded by

46 EXAMPLE To approximate the value of the improper integral we make the change of variable t = x-1 to obtain The fourth Taylor polynomial, P4(t), for sin t about 0 is

47 So we have Applying the Composite Simpson’s rule with n = 8 to the remaining integral gives which is accurate to within

48 Numerical Analysis Lecture 42


Download ppt "Numerical Analysis Lecture 42."

Similar presentations


Ads by Google