calculus 1120
play

Calculus 1120 Dan Barbasch Oct. 2, 2012 Dan Barbasch () Calculus - PowerPoint PPT Presentation

Calculus 1120 Dan Barbasch Oct. 2, 2012 Dan Barbasch () Calculus 1120 Oct. 2, 2012 1 / 7 Numerical Integration Many integrals cannot be computed using FTC because while the definite integral exists because the function to be integrated is


  1. Calculus 1120 Dan Barbasch Oct. 2, 2012 Dan Barbasch () Calculus 1120 Oct. 2, 2012 1 / 7

  2. Numerical Integration Many integrals cannot be computed using FTC because while the definite integral exists because the function to be integrated is continuous, the antiderivative is NOT a combination of elementary functions. Question: How do you compute a logarithm table? � x dt Answer: ln x = t . Use numerical integration. 1 � x 2 e − t 2 dt . √ π Question: Compute values of Erf ( x ) = 0 This integral (function of x ) is very important for probability, especially its applications. But it is not a combination of elementary functions. Dan Barbasch () Calculus 1120 Oct. 2, 2012 2 / 7

  3. Numerical Integration GENERAL STRATEGY: � b Approximate the integral a f ( x ) dx using Riemann sums. 1 Divide the interval [ a , b ] into n equal parts, x i = a + i · ∆ x , ∆ x = b − a n . a = x 0 < x 1 < · · · < x i − 1 < x i < · · · < x n . 2 Choose a point x i − 1 < ξ i < x i in each interval. Form the sum n � f ( ξ i )∆ x i = f ( ξ 1 )∆ x 1 + · · · + f ( ξ n )∆ x n . i =1 Usually we divide the interval into n equal parts. So ∆ x i = b − a n . The sum simplifies to b − a [ f ( ξ 1 ) + · · · + f ( ξ n )] . n � b This is used as an approximation for a f ( x ) dx . Dan Barbasch () Calculus 1120 Oct. 2, 2012 2 / 7

  4. Numerical Integration Left Endpoint: ξ i = x i − 1 . ∆ x i = ∆ x = b − a n . L n ( f ) = ∆ x [ f ( ξ 1 ) + · · · + f ( ξ n )] = =∆ x [ f ( a ) + · · · + f ( a + ( i − 1)∆ x ) + · · · + f ( a + ( n − 1)∆ x )] Right Endpoint: ξ i = x i . ∆ x i = ∆ x = b − a n . R n ( f ) = ∆ x [ f ( ξ 1 ) + · · · + f ( ξ n )] = ∆ x [ f ( a + ∆ x ) + · · · + f ( a + i ∆ x ) + · · · + f ( a + n ∆ x )] Midpoint: ξ i = x i − 1 + x i . ∆ x i = ∆ x = b − a n . 2 n � ∆ x [ f ( ξ 1 ) + · · · + f ( ξ n )] = ∆ x f ( ξ i ) . i =1 Dan Barbasch () Calculus 1120 Oct. 2, 2012 2 / 7

  5. Numerical Integration � 3 1 t dt . ∆ x = 3 − 1 = 2 Example: ln 3 = n . n 1 Left Endpoint: ξ i = x i − 1 = 1 + 2( i − 1) . n � � L n ( f ) = 2 1 1 1 1 + 1 + 2 / n + · · · + 1 + 2( i − 1) / n + · · · + . 1 + 2( n − 1) / n n Right Endpoint: ξ i = x i = 1 + 2 i n . R n ( f ) = 2 � 1 1 1 � 1 + 2 / n + · · · + 1 + 2 i / n + · · · + . n 1 + n · 2 / n We will not use the midpoint formula. Dan Barbasch () Calculus 1120 Oct. 2, 2012 2 / 7

  6. Exercise Write an integral that computes ln 5 , and L n ( f ) and R n ( f ) for n = 6 . You need not compute. Write out the error estimate for arbitrary n . How many terms do you need to get an error less than 10 − 3 ? Dan Barbasch () Calculus 1120 Oct. 2, 2012 3 / 7

  7. Pictures for a decreasing function y = f ( x ) , a ≤ x ≤ b : � b The picture on the left illustrates a f ( x ) dx ≤ L n ( f ). The picture on the � b right illustrates R n ( f ) ≤ a f ( x ) dx . Exercise: Draw the pictures and write the inequalities for an increasing function. Dan Barbasch () Calculus 1120 Oct. 2, 2012 4 / 7

  8. � b Together they illustrate R n ( f ) ≤ a f ( x ) dx ≤ L n ( f ). � b The error E L ( f ) = | L n ( f ) − a f ( x ) dx | is the yellow area. The error � b E R ( f ) = | a f ( x ) dx − R n ( f ) | is the green area. They are both less than the sum of the rectanges above the orange region which add up to L n ( f ) − R n ( f ) . This is the Error Estimate E L ( f ) , E R ( f ) ≤ | L n ( f ) − R n ( f ) | Dan Barbasch () Calculus 1120 Oct. 2, 2012 4 / 7

  9. L n ( f ) − R n ( f ) = b − a ( f ( a ) − f ( b )) . n The area in yellow represents L n ( f ) − R n ( f ) . If you stack all the rectangles in the first interval, you get a rectangle of width ∆ x = b − a and height n f ( a ) − f ( b ) . The area under the secants represents T n ( f ) = 1 2 ( L n ( f ) + R n ( f )) , half the area of the full rectangles, yellow and orange. Dan Barbasch () Calculus 1120 Oct. 2, 2012 4 / 7

  10. � b � � � ≤ | L n ( f ) − R n ( f ) | � � Concave Functions. E T ( f ) = � T n ( f ) − f ( x ) dx . � � 2 a The function is the bottom of the blue region, below the secants because it is concave up. T n ( f ) is the area below the secant lines bounding the top of the blue regions. The area in blue is the error E T ( f ) . The area in orange is R n ( f ) . The sum of the triangles colored yellow and blue is L n ( f ) − R n ( f ) . It is half 2 the sum of the yellow rectanges on the previous slide. The error estimate says that the blue area is all contained in the sum of the triangles. Dan Barbasch () Calculus 1120 Oct. 2, 2012 4 / 7

  11. Estimates � b Increasing Function L n ( f ) ≤ a f ( x ) dx ≤ R n ( f ) . � b Decreasing Function R n ( f ) ≤ a f ( x ) dx ≤ L n ( f ) . Estimate for a monotone function: Error = | Value − Approximation | . � b � b � � � � E n ( f ) = a f ( x ) dx − L n ( f ) � , a f ( x ) dx − R n ( f ) � . � � � � � � E n ( f ) ≤ | R n ( f ) − L n ( f ) | = b − a | f ( b ) − f ( a ) | n For ln 3 , the error is therefore less than 2 4 n | 1 / 3 − 1 | = 3 n . Problem: Find n so that E n ( f ) ≤ 10 − 3 . 3 n ≤ 10 − 3 ( ⇒ n ≥ 1334) then certainly 4 4 Answer: We know E n ( f ) ≤ 3 n . If E n ( f ) ≤ 4 3 n ≤ 10 − 3 . The actual approximation L 1334 ( f ) or R 1334 ( f ) is a sum which is hard to compute in practice because you have to add a lot of very small numbers. Dan Barbasch () Calculus 1120 Oct. 2, 2012 5 / 7

  12. Estimates Dan Barbasch () Calculus 1120 Oct. 2, 2012 5 / 7

  13. Estimates � b � f ( x ) dx − L n ( f ) + R n ( f ) � � ≤ b − a � � | f ( b ) − f ( a ) | . � � 2 2 n � a So if we use T n ( f ) := L n ( f )+ R n ( f ) for the approximation, we can use 2 n = 1334 / 2 = 667 . L n ( f ) =∆ x [ f ( x 0 )+ f ( x 1 ) + · · · + f ( x i ) + · · · + f ( x n − 1 )] R n ( f ) =∆ x [ f ( x 1 ) + · · · + f ( x i ) + · · · + f ( x n − 1 ) + f ( x n )] T n ( f ) = b − a [ f ( x 0 ) + 2 f ( x 1 ) + · · · + 2 f ( x n − 1 ) + f ( x n )] 2 n Dan Barbasch () Calculus 1120 Oct. 2, 2012 5 / 7

  14. Trapezoidal/Simpson’s Rule The estimates from before are for functions which are monotone and concave up/down over the whole interval. If the function does not have these properties, break the integral up into smaller intervals. The left and right endpoint are instances of approximating f ( x ) by a horizontal line on each interval [ x i − 1 , x i ] . We can use other functions such as lines (Trapezoidal Rule), parabolas (Simpson’s Rule) or even higher order polynomials. The formulas are not much harder, and the error estimates hold for any functions that have derivatives. Dan Barbasch () Calculus 1120 Oct. 2, 2012 6 / 7

  15. Trapezoidal/Simpson’s Rule Trapezoidal Rule Picture: T n ( f ) = b − a [ f ( x 0 ) + 2 f ( x 1 ) + · · · + 2 f ( x n − 1 ) + f ( x n )] 2 n Error Estimate: E T , n ( f ) ≤ M ( b − a ) 3 , where M is the maximum value of 12 n 2 | f (2) ( x ) | for a ≤ x ≤ b . A worse formula, but easier to prove is E T , n ≤ b − a 2 n | f ( b ) − f ( a ) | Dan Barbasch () Calculus 1120 Oct. 2, 2012 6 / 7

  16. Trapezoidal/Simpson’s Rule The formula for the Approximation is T n ( f ) from the previous slide. In the case of f ( x ) = 1 / x and a = 1 ≤ x ≤ 3 , f (2) ( x ) = − 2 x 3 . Over the interval, | f (2) ( x ) | ≤ 2 . So | ln 3 − T n ( f ) | ≤ (3 − 1) 3 · 2 16 4 = 12 n 2 = 3 n 2 . 12 n 2 3 n 2 ≤ 10 − 3 , n ≥ 4 � Solving 4000 / 3 , we can take n ≥ 37 . Dan Barbasch () Calculus 1120 Oct. 2, 2012 6 / 7

  17. Trapezoidal/Simpson’s Rule Simpson Rule Picture: n must be even. To fit a parabola you need three points, so pairs of intervals [ x i − 1 , x i ] and [ x i , x i +1 ] . You want ax 2 + bx + c such that ax 2 i − 1 + bx i − 1 + c = f ( x i − 1 ) ax 2 i + bx i + c = f ( x i ) ax 2 i +1 + bx i +1 + c = f ( x i +1 ) If you only ask for the first two, there are too many choices, and the parabolas don’t fit tightly enough. Dan Barbasch () Calculus 1120 Oct. 2, 2012 6 / 7

  18. Trapezoidal/Simpson’s Rule Simpson Rule Picture: x i − 1 , x i , x i +1 are translated to − h , 0 , h , and y 0 , y 1 , y 2 are the values f ( x i − 1 ) , f ( x i ) , f ( x i +1 ) , and h = ∆ x = b − a n . S n ( f ) = b − a [ f ( x 0 ) + 4 f ( x 1 ) + 2 f ( x 2 ) + 4 f ( x 3 ) + · · · + 4 f ( x n − 1 ) + f ( x n )] 3 n Error Estimate: E S , n ≤ ( b − a ) 5 M where M is the maximum of | f (4) ( x ) | 180 n 4 over the interval a ≤ x ≤ b . Dan Barbasch () Calculus 1120 Oct. 2, 2012 6 / 7

  19. Error estimate for ln 3 . For the estimate of ln 3 , f (4) ( x ) = 24 x 5 . Its maximum over 1 ≤ x ≤ 3 is M = 24 . E S , n ( f ) ≤ (3 − 1) 5 · 24 = 32 · 24 64 180 n 4 = 15 n 4 . 180 n 4 64 15 n 4 ≤ 10 − 3 ⇒ n ≥ 10 . We can write the approximation ln 3 ≈ 2 � 1 1 + 4 1 1 . 2 + 2 1 1 . 4 + 4 1 1 . 6 + 2 1 1 . 8 + 4 1 2 . 0 + 30 � + 2 1 2 . 2 + 4 1 2 . 4 + 2 1 2 . 6 + 4 1 2 . 8 + 1 ≈ 1 . 09866 . 3 Another way to approximate gives ln 3 ≈ 1 . 09861 , the difference is in the 5 th decimal. Exercise: Do this for ln 5 . Dan Barbasch () Calculus 1120 Oct. 2, 2012 7 / 7

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend