TRAPEZOIDAL METHOD ERROR FORMULA Theorem Let F(X) Have Two Continuous Derivatives on the Interval a ≤ X ≤ B. Then E N(F) ≡

TRAPEZOIDAL METHOD ERROR FORMULA Theorem Let F(X) Have Two Continuous Derivatives on the Interval a ≤ X ≤ B. Then E N(F) ≡

TRAPEZOIDAL METHOD ERROR FORMULA Theorem Let f(x) have two continuous derivatives on the interval a x b.Then ≤ ≤ b 2 T h (b a) En (f) f(x) dx Tn(f)= − f00 (cn) ≡ Za − − 12 for some cn intheinterval[a, b]. Later I will say something about the proof of this re- sult, as it leads to some other useful formulas for the error. The above formula says that the error decreases in a manner that is roughly proportional to h2.Thus doubling n (and halving h) should cause the error to decrease by a factor of approximately 4. This is what we observed with a past example from the preceding section. Example. Consider evaluating 2 dx I = 2 Z0 1+x using the trapezoidal method Tn(f). How large should n be chosen in order to ensure that ET (f) 5 10 6 n ≤ × − ¯ ¯ We begin by calculating¯ ¯ the derivatives: ¯ ¯ 2x 2+6x2 f 0(x)= − 2,f00(x)= − 3 1+x2 1+x2 ³ ´ ³ ´ From a graph of f00(x), max f00(x) =2 0 x 2 ≤ ≤ ¯ ¯ ¯ ¯ Recall that b a = 2. Therefore,¯ ¯ − 2 T h (b a) E (f)= − f (cn) n − 12 00 h2 (2) h2 ET (f) 2= n ≤ 12 · 3 ¯ ¯ ¯ ¯ ¯ ¯ 2 T h (b a) E (f)= − f (cn) n − 12 00 h22 h2 ET (f) 2= n ≤ 12 · 3 ¯ ¯ ¯ ¯ We bound¯ f00 (cn¯ ) sincewedonotknowcn,and thereforewemustassumetheworstpossiblecase,that¯ ¯ ¯ ¯ which makes the error formula largest. That is what has been done above. When do we have ET (f) 5 10 6 (1) n ≤ × − ¯ ¯ To ensure this, we¯ choose¯ h so small that ¯ ¯ h2 5 10 6 3 ≤ × − This is equivalent to choosing h and n to satisfy h .003873 2 ≤ n = 516.4 h ≥ Thus n 517 will imply (1). ≥ DERIVING THE ERROR FORMULA There are two stages in deriving the error: (1) Obtain the error formula for the case of a single subinterval (n =1); (2) Use this to obtain the general error formula given earlier. For the trapezoidal method with only a single subin- terval, we have α+h h h3 f(x) dx [f(α)+f(α + h)] = f00(c) Zα − 2 −12 for some c in the interval [α, α + h]. A sketch of the derivation of this error formula is given in the problems. Recall that the general trapezoidal rule Tn(f)wasob- tained by applying the simple trapezoidal rule to a sub- division of the original interval of integration. Recall defining and writing b a h = − ,x= a + jh, j=0, 1,...,n n j xn I = f(x) dx xZ0 x1 x2 = f(x) dx + f(x) dx + ··· xZ0 xZ1 xn + f(x) dx xnZ 1 − h h I [f(x0)+f(x1)] + [f(x1)+f(x2)] ≈ 2 2 + h··· h +2 [f(xn 2)+f(xn 1)] + 2 [f(xn 1)+f(xn)] − − − Then the error b T En (f) f(x) dx Tn(f) ≡ Za − can be analyzed by adding together the errors over the subintervals [x0,x1], [x1,x2], ..., [xn 1,xn]. Recall − α+h h h3 f(x) dx [f(α)+f(α + h)] = f00(c) Zα − 2 −12 Then on [xj 1,xj], − xj h h3 f(x) dx f(xj 1)+f(xj) = f00(γj) − 2 − −12 xZj 1 h i − with xj 1 γj xj, but otherwise γj unknown. − ≤ ≤ Then combining these errors, we obtain h3 h3 ET (f)= f (γ ) f (γ ) n −12 00 1 − ···− 12 00 n This formula can be further simplified, and we will do so in two ways. Rewrite this error as 3 T h n f00(γ1)+ + f 00(γn) En (f)= ··· − 12 " n # Denote the quantity inside the brackets by ζn.This number satisfies min f00(x) ζn max f00(x) a x b ≤ ≤ a x b ≤ ≤ ≤ ≤ Since f00(x) is a continuous function (by original as- sumption),wehavethattheremustbesomenumber cn in [a, b]forwhich f00(cn)=ζn Recall also that hn = b a.Then − 3 T h n f00(γ1)+ + f 00(γn) En (f)= ··· − 12 " n # h2 (b a) = − f (cn) − 12 00 This is the error formula given on the first slide. AN ERROR ESTIMATE T We now obtain a way to estimate the error En (f). Return to the formula h3 h3 ET (f)= f (γ ) f (γ ) n −12 00 1 − ···− 12 00 n and rewrite it as h2 ET (f)= f (γ )h + + f (γ )h n −12 00 1 ··· 00 n h i The quantity f (γ )h + + f (γ )h 00 1 ··· 00 n is a Riemann sum for the integral b f00(x) dx = f0(b) f0(a) Za − By this we mean b lim f 00(γ1)h + + f00(γn)h = f00(x) dx n ··· a →∞ h i Z Thus f (γ )h + + f (γ )h f (b) f (a) 00 1 ··· 00 n ≈ 0 − 0 for larger values of n. Combining this with the earlier error formula h2 ET (f)= f (γ )h + + f (γ )h n −12 00 1 ··· 00 n h i we have h2 ET (f) f (b) f (a) ET (f) n ≈−12 0 − 0 ≡ n h i This is a computable estimate of the errore in the nu- merical integration. It is called an asymptotic error estimate. Example. Consider evaluating π eπ +1 . I(f)= ex cos xdx= = 12.070346 Z0 − 2 − In this case, f (x)=ex [cos x sin x] 0 − f (x)= 2ex sin x 00 − max f00(x) = f 00 (.75π) =14. 921 0 x π ≤ ≤ ¯ ¯ ¯ ¯ Then ¯ ¯ ¯ ¯ 2 T h (b a) E (f)= − f (cn) n − 12 00 h2π ET (f) 14.921 = 3.906h2 n ≤ 12 · ¯ ¯ ¯ ¯ Also ¯ ¯ h2 ET (f)= f (π) f (0) n −12 0 − 0 2 e h £ . ¤ = [eπ +1]=2.012h2 12 In looking at the table (in a separate file on website) for evaluating the integral I by the trapezoidal rule, T we see that the error En (f) and the error estimate T En (f) are quite close. Therefore 2 e h π I(f) Tn(f) [e +1] − ≈ 12 2 h π I(f) Tn(f)+ [e +1] ≈ 12 This last formula is called the corrected trapezoidal rule, and it is illustrated in the second table (on the separate page). We see it gives a much smaller er- ror for essentially the same amount of work; and it converges much more rapidly. In general, h2 I(f) Tn(f) f (b) f (a) − ≈−12 0 − 0 £ h2 ¤ I(f) Tn(f) f (b) f (a) ≈ − 12 0 − 0 This is the corrected trapezoidal rule£ .Itiseasyto¤ obtain from the trapezoidal rule, and in most cases, it converges more rapidly than the trapezoidal rule. SIMPSON’S RULE ERROR FORMULA Recall the general Simpson’s rule b h f(x) dx Sn(f) 3 [f(x0)+4f(x1)+2f(x2) Z a ≈ ≡ +4f(x3)+2f(x4)+ ··· +2f(xn 2)+4f(xn 1)+f(xn)] − − For its error, we have b 4 S h (b a) (4) E (f) f(x) dx Sn(f)= − f (cn) n ≡ − − 180 Za for some a cn b,withcn otherwise unknown. For ≤ ≤ an asymptotic error estimate, b 4 S h f(x) dx Sn(f) E (f) f (b) f (a) − ≈ n ≡−180 000 − 000 Za h i e DISCUSSION For Simpson’s error formula, both formulas assume that the integrand f(x) has four continuous deriva- tives on the interval [a, b]. What happens when this is not valid? We return later to this question. Both formulas also say the error should decrease by a factor of around 16 when n is doubled. Compare these results with those for the trapezoidal rule error formulas:. b 2 T h (b a) En (f) f(x) dx Tn(f)= − f00 (cn) ≡ Za − − 12 h2 ET (f) f (b) f (a) ET (f) n ≈−12 0 − 0 ≡ n h i e EXAMPLE Consider evaluating 2 dx I = 2 Z0 1+x using Simpson’s rule Sn(f). How large should n be chosen in order to ensure that ES(f) 5 10 6 n ≤ × − ¯ ¯ Beginbynotingthat¯ ¯ ¯ ¯ 4 2 (4) 5x 10x +1 f (x)=24 − 5 1+x2 max f(4)(x) = f(4)(0)³ = 24 ´ 0 x 1 ≤ ≤ ¯ ¯ ¯ ¯ Then ¯ ¯ 4 S h (b a) (4) E (f)= − f (cn) n − 180 h4 2 4h4 ES(f) · 24 = n ≤ 180 · 15 ¯ ¯ ¯ ¯ ¯ ¯ Then ES(f) 5 10 6 is true if n ≤ × − ¯ ¯ ¯ ¯ 4 ¯ ¯ 4h 5 10 6 15 ≤ × − h .0658 n ≤ 30.39 ≥ Therefore, choosing n 32 will give the desired er- ≥ ror bound. Compare this with the earlier trapezoidal example in which n 517 was needed. ≥ For the asymptotic error estimate, we have x2 1 f000(x)= 24x − 4 − 1+x2 ³ ´ h4 ES(f) f (2) f (0) n ≡−180 000 − 000 4 e h 144£ 4 ¤ = = h4 180 · 625 3125 INTEGRATING sqrt(x) Consider the numerical approximation of 1 2 sqrt(x) dx = Z0 3 In the following table, we give the errors when using both the trapezoidal and Simpson rules. T S n En Ratio En Ratio 2 6.311E 2 2.860E 2 4 2.338E − 22.70 1.012E − 22.82 8 8.536E − 32.74 3.587E − 32.83 16 3.085E − 32.77 1.268E − 32.83 32 1.108E − 32.78 4.485E − 42.83 64 3.959E − 42.80 1.586E − 42.83 128 1.410E − 42.81 5.606E − 52.83 − − The rate of convergence is slower because the func- tion f(x)=sqrt(x)isnotsufficiently differentiable on [0, 1]. Both methods converge with a rate propor- tional to h1.5.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    28 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us