MA 3021: Numerical Analysis I Numerical Differentiation and Integration

Size: px
Start display at page:

Download "MA 3021: Numerical Analysis I Numerical Differentiation and Integration"

Transcription

1 MA 3021: Numerical Analysis I Numerical Differentiation and Integration Suh-Yuh Yang ( 楊肅煜 ) Department of Mathematics, National Central University Jhongli District, Taoyuan City 32001, Taiwan syyang@math.ncu.edu.tw syyang/ Suh-Yuh Yang ( 楊肅煜 ), Math. Dept., NCU, Taiwan Differentiation and Integration 1/35

2 Introduction 1 If the values of function f are given at a few points x 0, x 1,, x n, can that information be used to estimate a derivative f (c) or an integral b a f (x)dx? 2 Taylor s Theorem: Let f C n+1 [a, b] and x 0 [a, b]. Then for every x [a, b], ξ(x) between x and x 0 such that f (x) = P n (x) + R n (x), where the n-th Taylor polynomial P n (x) is given by P n (x) = n 1 k! f (k) (x 0 )(x x 0 ) k k=0 and the remainder (error) term R n (x) is given by R n (x) = 1 (n + 1)! f (n+1) (ξ(x))(x x 0 ) n+1 (Lagrange s form). Suh-Yuh Yang ( 楊肅煜 ), Math. Dept., NCU, Taiwan Differentiation and Integration 2/35

3 Numerical differentiation 1 f f (x (x 0 ) = lim 0 +h) f (x 0 ) h 0 h, if the limit exists. Intuitively, we have f (x 0 ) f (x 0+h) f (x 0 ) h if h is small. 2 Assume that h > 0 and f C 2 [x 0, x 0 + h]. By Taylor s Theorem, f (x 0 + h) = f (x 0 ) + hf (x 0 ) + h2 2 f (ξ), for some ξ (x 0, x 0 + h). Rearranging the expansion, we obtain f (x 0 ) = 1 h ( f (x0 + h) f (x 0 ) ) h 2 f (ξ). If h 2 f (ξ) is small, then we have an approximation of f (x 0 ), f (x 0 ) 1 h ( f (x0 + h) f (x 0 ) ), called the forward-difference formula. The term h 2 f (ξ) is called the truncation error, O(h). (When h < 0, we only have to change the assumption to f C 2 [x 0 + h, x 0 ] = backward-difference formula) Suh-Yuh Yang ( 楊肅煜 ), Math. Dept., NCU, Taiwan Differentiation and Integration 3/35

4 Higher order methods 1 Assume that h > 0 and f C 3 [x 0 h, x 0 + h]. By Taylor s Theorem, we have f (x 0 + h) = f (x 0 ) + hf (x 0 ) + h2 2 f (x 0 ) + h3 6 f (ξ 1 ), f (x 0 h) = f (x 0 ) hf (x 0 ) + h2 2 f (x 0 ) h3 6 f (ξ 2 ), for some ξ 1 (x 0, x 0 + h) and ξ 2 (x 0 h, x 0 ). After subtracting and rearranging, we have f (x 0 ) = 1 2h ( f (x0 + h) f (x 0 h) ) h2 6 1 ( f (ξ 2 1 ) + f (ξ 2 ) ). 2 This is a more favorable result, because of the h 2 term in the error. Notice that, however, the presence of f in the error term. Suh-Yuh Yang ( 楊肅煜 ), Math. Dept., NCU, Taiwan Differentiation and Integration 4/35

5 The truncation error From the Intermediate Value Theorem, we have that there is a ξ (x 0 h, x 0 + h), such that Hence, Therefore f (x 0 ) = 1 2h f (ξ) = 1 2 ( f (ξ 1 ) + f (ξ 2 ) ). ( f (x0 + h) f (x 0 h) ) h2 6 f (ξ). f (x 0 ) 1 ( f (x0 + h) f (x 0 h) ), 2h which is a second-order formula, O(h 2 ). Suh-Yuh Yang ( 楊肅煜 ), Math. Dept., NCU, Taiwan Differentiation and Integration 5/35

6 Approximation of f (x 0 ) Assume that h > 0 and f C 4 [x 0 h, x 0 + h]. From Taylor s Theorem, f (x 0 + h) = f (x 0 ) + hf (x 0 ) + h2 2! f (x 0 ) + h3 3! f (3) (x 0 ) + h4 4! f (4) (ξ 1 ), f (x 0 h) = f (x 0 ) hf (x 0 ) + h2 2! f (x 0 ) h3 3! f (3) (x 0 ) + h4 4! f (4) (ξ 2 ), for some ξ 1 (x 0, x 0 + h) and ξ 2 (x 0 h, x 0 ). After sum and rearrangement, we obtain the following central difference formula for the 2nd derivative at x 0 : f (x 0 ) = 1 ( f (x0 h 2 + h) 2f (x 0 ) + f (x 0 h) ) h2 1 ( f (4) (ξ ) + f (4) (ξ 2 ) ) = 1 h 2 ( f (x0 + h) 2f (x 0 ) + f (x 0 h) ) h2 12 f (4) (ξ), where at the last equality we use the Intermediate Value Theorem again. Thus, we have a second-order approximation of f (x 0 ) f (x 0 ) 1 h 2 ( f (x0 + h) 2f (x 0 ) + f (x 0 h) ). Suh-Yuh Yang ( 楊肅煜 ), Math. Dept., NCU, Taiwan Differentiation and Integration 6/35

7 Richardson s extrapolation 1 Richardson extrapolation is a general procedure to improve accuracy. 2 Assume that f is sufficiently smooth and f (x 0 + h) = 1 k! hk f (k) 1 (x 0 ), f (x 0 h) = k! ( 1)k h k f (k) (x 0 ). k=0 k=0 After subtraction and rearrangement, we obtain f (x 0 ) = 1 ( f (x0 + h) f (x 0 h) ) 2h ( h 2 or in an abstract form 3! f (3) (x 0 ) + h4 5! f (5) (x 0 ) + h6 7! f (7) (x 0 ) + M = N(h) + ( k 2 h 2 + k 4 h 4 + k 6 h 6 + ), where M := f (x 0 ) and N(h) := ( f (x 0 + h) f (x 0 h) ) /(2h). ), Suh-Yuh Yang ( 楊肅煜 ), Math. Dept., NCU, Taiwan Differentiation and Integration 7/35

8 Richardson s extrapolation (cont d ) 1 In general, suppose that M = N(h) + ( k 1 h + k 2 h 2 + k 3 h 3 + ) (1) M N(h) = O(h) M = N( 2 h ) + k 1 h 2 + k h2 ) 2 ( 2( + h2 ) 3 k3 + (2) 2 (2) (1) M = 2N( h 2 ) N(h) + k ( h h2) ( + k h h3) + Define N 1 (h) := N(h) and N 2 (h) := N 1 ( h {N 2 ) + 1 ( h 2 ) N 1(h). M = N 2 (h) k 2 2 h 2 3k 3 4 h3 (3) M N 2 (h) = O(h 2 ). 2 This formula is the first step in Richardson extrapolation. It shows that a simple combination of N 1 (h) and N 1 ( h 2 ) furnishes an estimate of M with an accuracy of O(h 2 ). Suh-Yuh Yang ( 楊肅煜 ), Math. Dept., NCU, Taiwan Differentiation and Integration 8/35

9 Richardson s extrapolation (cont d ) From (3), we have M = N 2 ( h 2 ) k 2 8 h2 3k 3 32 h3 (4). 4 (4) (3) 3M = 4N 2 ( h 2 ) N 2(h) + 3k 3 8 h3 + M = N 2 ( h 2 ) + 1 { N 2 ( h 3 2 ) N 2(h)) + 3k 3 8 h3 + Define N 3 (h) = N 2 ( h 2 ) {N 2( h 2 ) N 2(h). M N 3 (h) = O(h 3 ). Suh-Yuh Yang ( 楊肅煜 ), Math. Dept., NCU, Taiwan Differentiation and Integration 9/35

10 Richardson s extrapolation (cont d ) Using the techniques, we have N 4 (h) = N 3 ( h 2 ) M N 4 (h) = O(h 4 ), N 5 (h) = N 4 ( h 2 ) M N 5 (h) = O(h 5 ), m 1 In general, if M = N 1 (h) +. j=1 { N 3 ( h 2 ) N 3(h), { N 4 ( h 2 ) N 4(h), k j h j + O(h m ) then for j = 2, 3,, m, N j (h) = N j 1 ( h 2 ) + 1 { 2 j 1 N j 1 ( h 1 2 ) N j 1(h), M = N j (h) + O(h j ). Suh-Yuh Yang ( 楊肅煜 ), Math. Dept., NCU, Taiwan Differentiation and Integration 10/35

11 Example f (x 0 ) = 1 ( f (x0 + h) f (x 0 h) ) 1 2h 6 h2 f (3) (x 0 ) h4 f (5) (x 0 ) f (x 0 ) = N 1 (h) + O(h 2 ) f (x 0 ) = N 1 (h) 1 6 h2 f (3) (x 0 ) h4 f (5) (x 0 ) f (x 0 ) = N 1 ( h 2 ) 1 24 h2 f (3) (x 0 ) h4 f (5) (x 0 ) 4f (x 0 ) = 4N 1 ( h 2 ) 1 6 h2 f (3) (x 0 ) h4 f (5) (x 0 ) 3f (x 0 ) = 4N 1 ( h 2 ) N 1(h) h4 f (5) (x 0 ) f (x 0 ) = N 1 ( h 2 ) + 1 { N1 ( h 3 2 ) N 1(h) h4 f (5) (x 0 ) f (x 0 ) := N 2 (h) + O(h 4 ) Suh-Yuh Yang ( 楊肅煜 ), Math. Dept., NCU, Taiwan Differentiation and Integration 11/35

12 Differentiation via polynomial interpolation 1 Suppose that f C 2 [a, b], x 0 (a, b) and x 1 := x 0 + h [a, b]. Then ξ(x) [a, b] such that f (x) = x x 1 f (x x 0 0 ) + x x 0 f (x x 1 x 1 x 1 ) + f (ξ(x)) 0 2! = x x 0 h h If D xf (ξ(x)) 2! + D xf (ξ(x)) 2! f (x 0 ) + x x 0 h (x x 0 )(x x 1 ) f (x 0 + h) + f (ξ(x)) (x x 0 )(x x 0 h) 2! exists = f (x) = 1 h f (x 0) + 1 h f (x 0 + h) 2 We have f (x 0 ) = f (x 0 + h) f (x 0 ) h (x x 0 )(x x 0 h) + 2(x x 0) h f (ξ(x)). 2! h 2! f (ξ(x 0 )) f (x 0 ) f (x 0 + h) f (x 0 ), with error bound h h 2 max f (x). x [a,b] h > 0 : the forward-difference formula h < 0 : the backward-difference formula Suh-Yuh Yang ( 楊肅煜 ), Math. Dept., NCU, Taiwan Differentiation and Integration 12/35

13 General case Suppose that x 0, x 1,, x n I distinct & f C n+1 (I). Then f (x) = n k=0 f (x k )L k (x) + f (n+1) (ξ(x)) (x x (n + 0 )(x x 1)! 1 ) (x x n ), where ξ(x) I. { f (n+1) (ξ(x)) If D x exists = f (x) = (n + 1)! n f (x k )L k (x) k=0 { f (n+1) (ξ(x)) +D x (x x (n + 0 )(x x 1)! 1 ) (x x n ) + f (n+1) (ξ(x)) { D x (x x0 )(x x (n + 1)! 1 ) (x x n ). = f (x j ) = n f (x k )L k (x j) + f (n+1) (ξ(x j )) n (n + 1)! (x j x k ). k=0 k=0,k =j We obtain an (n + 1)-point formula. Suh-Yuh Yang ( 楊肅煜 ), Math. Dept., NCU, Taiwan Differentiation and Integration 13/35

14 Three point formula: x 0, x 1, x 2 L 0 (x) = (x x 1)(x x 2 ) (x 0 x 1 )(x 0 x 2 ) L 0 (x) = (x x 2) + (x x 1 ) (x 0 x 1 )(x 0 x 2 ) 2x x = 1 x 2 (x 0 x 1 )(x 0 x 2 ), L 1 (x) = (x x 0)(x x 2 ) (x 1 x 0 )(x 1 x 2 ) L 1 (x) = 2x x 0 x 2 (x 1 x 0 )(x 1 x 2 ), L 2 (x) = (x x 0)(x x 1 ) (x 2 x 0 )(x 2 x 1 ) L 2 (x) = 2x x 0 x 1 (x 2 x 0 )(x 2 x 1 ). = f (x j ) = 2x j x 1 x 2 (x 0 x 1 )(x 0 x 2 ) f (x 0) + 2x j x 0 x 2 (x 1 x 0 )(x 1 x 2 ) f (x 1) + 2x j x 0 x 1 (x 2 x 0 )(x 2 x 1 ) f (x 2) + f (3) (ξ j ) 2 3! (x j x k ), k=0,k =j where ξ j := ξ(x j ). Suh-Yuh Yang ( 楊肅煜 ), Math. Dept., NCU, Taiwan Differentiation and Integration 14/35

15 Equal spaced: x 0, x 1 = x 0 + h, x 2 = x 0 + 2h f (x 0 ) = 1 { 3 h 2 f (x 0) + 2f (x 0 + h) 1 2 f (x 0 + 2h) h2 f (3) (ξ 0 ), f (x 0 + h) = 1 { 1 h 2 f (x 0) f (x 0 + 2h) 1 6 h2 f (3) (ξ 1 ), f (x 0 + 2h) = 1 { 1 h 2 f (x 0) 2f (x 0 + h) f (x 0 + 2h) h2 f (3) (ξ 2 ). = f (x 0 ) = 1 { 3f (x 0 ) + 4f (x 0 + h) f (x 0 + 2h) + 1 2h 3 h2 f (3) (ξ 0 ), ( ) f (x 0 ) = 1 { f (x 0 h) + f (x 0 + h) 1 2h 6 h2 f (3) (ξ 1 ), f (x 0 ) = 1 { f (x 0 2h) 4f (x 0 h) + 3f (x 0 ) + 1 2h 3 h2 f (3) (ξ 2 ). ( ) ( ) and ( ) are essentially the same! (h > 0 or h < 0, respectively) Suh-Yuh Yang ( 楊肅煜 ), Math. Dept., NCU, Taiwan Differentiation and Integration 15/35

16 Three-point and five-point formulas 1 Three-point formula: f (x 0 ) = 1 { 3f (x 0 ) + 4f (x 0 + h) f (x 0 + 2h) + 1 2h 3 h2 f (3) (ξ 0 ), for some ξ 0 between x 0 and x 0 + 2h, f (x 0 ) = 1 { f (x 0 + h) f (x 0 h) 1 2h 6 h2 f (3) (ξ 1 ), for some ξ 1 between x 0 h and x 0 + h. 2 Five-point formula: f 1 { (x 0 ) = f (x 0 2h) 8f (x 0 h) + 8f (x 0 + h) f (x 0 + 2h) 12h f (x 0 ) = + h4 30 f (5) (ξ), for some ξ between x 0 2h and x 0 + 2h, ( ) 1 { 25f (x 0 ) + 48f (x 0 + h) 36f (x 0 + 2h) 12h +16f (x 0 + 3h) 3f (x 0 + 4h) + (h 4 /5)f (5) (ξ), for some ξ between x 0 and x 0 + 4h. Suh-Yuh Yang ( 楊肅煜 ), Math. Dept., NCU, Taiwan Differentiation and Integration 16/35

17 Use Taylor s Theorem + extrapolation to derive ( ) f (x 0 + h) = f (x 0 ) + hf (x 0 ) + h2 2! f (x 0 ) + h3 3! f (3) (x 0 ) + h4 4! f (4) (x 0 ) + h5 120 f (5) (ξ 1 f (x 0 h) = f (x 0 ) hf (x 0 ) + h2 2! f (x 0 ) h3 3! f (3) (x 0 ) + h4 4! f (4) (x 0 ) h5 120 f (5) (ξ 2 where ξ 1 between x 0 and x 0 + h, ξ 2 between x 0 and x 0 h. f (x 0 + h) f (x 0 h) = 2hf (x 0 ) + h3 3 f (x 0 ) + h5 120 { f (5) (ξ 1 ) + f (5) (ξ 2 ) { f (x 0 ) = 1 2h f (x 0 + h) f (x 0 h) h2 6 f (x 0 ) 120 h4 f (5) ( ξ), (Eqn1) Replacing h by 2h, we have { f (x 0 ) = 1 4h f (x 0 + 2h) f (x 0 2h) 4h2 6 f (x 0 ) 16h4 120 f (5) ( ξ), (Eqn2) where ξ between x 0 h and x 0 + h, ξ between x 0 2h and x 0 + 2h., Suh-Yuh Yang ( 楊肅煜 ), Math. Dept., NCU, Taiwan Differentiation and Integration 17/35

18 Use Taylor s Theorem + extrapolation to derive ( ) (cont d ) 4 (Eqn1) (Eqn2) = 3f (x 0 ) = 2 h { f (x 0 + h) f (x 0 h) 1 { f (x 0 + 2h) f (x 0 2h) h4 4h 30 f (5) ( ξ) + 2h4 15 f (5) ( ξ). If f C 5 [x 0 2h, x + 2h], h > 0, then we have 4h 4 30 f (5) ( ξ) h4 30 f (5) ( ξ) = h4 30 {4f (5) ( ξ) f (5) ( ξ) = h4 30 3f (5) (ξ). (why?) Therefore, we have f (x 0 ) = 1 { f (x 0 2h) 8f (x 0 h) + 8f (x 0 + h) f (x 0 + 2h) + h4 12h 30 f (5) (ξ), for some ξ [x 0 2h, x 0 + 2h]. Suh-Yuh Yang ( 楊肅煜 ), Math. Dept., NCU, Taiwan Differentiation and Integration 18/35

19 Homework The forward-difference formula can be expressed as f (x 0 ) = 1 h { f (x 0 + h) f (x 0 ) h 2 f (x 0 ) h2 6 f (x 0 ) + O(h 3 ). Use extrapolation to derive an O(h 3 ) formula for f (x 0 ). Suh-Yuh Yang ( 楊肅煜 ), Math. Dept., NCU, Taiwan Differentiation and Integration 19/35

20 Numerical integration Numerical quadrature: b a f (x)dx n i=0 a i f (x i ). Let x 0, x 1,, x n [a, b] be n + 1 distinct nodes. Let P n (x) = n i=0 f (x i )L i (x) be the nth Lagrange polynomial. Then b a f (x)dx = := b a n i=0 n i=0 b f f (x i )L i (x)dx + (n+1) (ξ(x)) a (n + 1)! a i f (x i ) + E(f ), n i=0 (x x i )dx where a i = b a L i (x)dx. Suh-Yuh Yang ( 楊肅煜 ), Math. Dept., NCU, Taiwan Differentiation and Integration 20/35

21 Trapezoidal rule Let x 0 = a, x 1 = b, h = b a. Then b a f (x)dx = x 1 { x x1 x 0 x 0 x f (x 1 0 ) + x x 0 x 1 x 0 f (x 1 ) dx + 1 x1 2 x f (ξ(x))(x 0 x 0 )(x x 1 )dx ( ) (x x1 ) 2 2(x 0 x 1 ) f (x 0) + (x x 0) 2 x1 2(x 1 x 0 ) f (x 1) + f (ξ) x 2 0 for some ξ (x 0, x 1 ) = = 1 2 (x 1 x 0 )f (x 1 ) 1 2 (x 0 x 1 )f (x 0 ) f (ξ) = 1 2 (x 1 x 0 )(f (x 0 ) + f (x 1 )) f (ξ)( 1 6 )(x 1 x 0 ) 3 = h 2 { f (x 0 ) + f (x 1 ) 1 12 h3 f (ξ). x1 x 0 (x x 0 )(x x 1 )dx, ( ) x 3 3 (x 0+x 1 )x 2 x1 2 + x 0 x 1 x x 0 If f (x) is a polynomial with degree(f ) 1, then the Trapezoidal Rule gives exact result! Suh-Yuh Yang ( 楊肅煜 ), Math. Dept., NCU, Taiwan Differentiation and Integration 21/35

22 Simpson s rule Let x 0 = a, x 1 = a + h, x 2 = b, h = (b a)/2. Then b a f (x)dx = x2 { (x x1 )(x x 2 ) x 0 (x 0 x 1 )(x 0 x 2 ) f (x 0) + (x x 0)(x x 2 ) (x 1 x 0 )(x 1 x 2 ) f (x 1) + (x x 0)(x x 1 ) (x 2 x 0 )(x 2 x 1 ) f (x 2) dx + x2 x 0 = O(h 4 ) error term. f (3) (ξ(x)) (x x 0 )(x x 3! 1 )(x x 2 )dx Suh-Yuh Yang ( 楊肅煜 ), Math. Dept., NCU, Taiwan Differentiation and Integration 22/35

23 Alternative approach: Taylor s Theorem Let x [x 0, x 2 ]. Then ξ(x) (x 0, x 2 ) such that f (x) = f (x 1 ) + f (x 1 )(x x 1 ) + f (x 1 ) 2 (x x 1 ) 2 + f (x 1 ) 6 (x x 1 ) 3 + f (4) (ξ(x)) 24 (x x 1 ) 4. = ( x 2 x f (x)dx 0 = f (x 1 )(x x 1 ) + f (x 1 ) 2 (x x 1 ) 2 + f (x 1 ) x2 x 0 6 (x x 1 ) 3 + f (x 1 ) 24 (x x 1 ) 4) x 2 f (4) (ξ(x))(x x 1 ) 4 dx x2 x f (4) (ξ(x))(x 0 x 1 ) 4 dx = f (4) (ξ 1 ) 24 x2 x 0 = f (4) (ξ 1 ) 24 5 (x x 1) 5 x 2 x 0 x2 x 0 (x x 1 ) 4 dx x 0, for some ξ 1 (x 0, x 2 ). f (x)dx = 2hf (x 1 ) + h3 3 f (x 1 ) + f (4) (ξ 1 ) 2h Suh-Yuh Yang ( 楊肅煜 ), Math. Dept., NCU, Taiwan Differentiation and Integration 23/35

24 Simpson s rule/degree of precision x2 x 0 f (x)dx = 2hf (x 1 ) + h3 3 = h 3 { 1 ( ) h 2 f (x 0 ) 2f (x 1 ) + f (x 2 ) h2 12 f (4) (ξ 2 ) + f (4) (ξ 1 ) h 5 60 ( ) f (x 0 ) + 4f (x 1 ) + f (x 2 ) h5 = h ( f (x 0 ) + 4f (x 3 1 ) + f (x 2 ) for some ξ (x 0, x 2 ). { 1 3 f (4) (ξ 2 ) 1 5 f (4) (ξ 1 ) 12 ) h5 90 f (4) (ξ), Definition: The degree of accuracy (precision) of a quadrature formula is the largest positive integer n such that the formula is exact for x k, k = 0, 1,, n. Note: Trapezoidal rule: degree of precision = 1; Simpson s rule: degree of precision = 3. Suh-Yuh Yang ( 楊肅煜 ), Math. Dept., NCU, Taiwan Differentiation and Integration 24/35

25 Midpoint rule Consider the smooth function f on [a, b]. Let x 0 = a+b 2. 1 Intuition: b b f (x)dx f (x 0 )dx = f (x 0 )(b a) = f ( a + b )(b a). a a 2 2 Based on Taylor s Theorem: b a f (x)dx b a f (x 0) + f (x 0 )(x x 0 )dx = f ( a+b 2 )(b a) + f (x 0 ) 2 (x a+b b 2 )2 = f ( a+b 2 )(b a) + 0. a f (x) ( f (x 0 ) + f (x 0 )(x x 0 ) ) = f (ξ(x)) 2! (x x 0 ) 2. = b a+b a f (x)dx f ( 2 )(b a) = b f (ξ(x)) a 2! (x x 0 ) 2 dx = f (ξ) 2! b a (x x 0) 2 dx = f (ξ) (b a) = f (ξ) 24 (b a)3, ξ (a, b). Suh-Yuh Yang ( 楊肅煜 ), Math. Dept., NCU, Taiwan Differentiation and Integration 25/35

26 Composite numerical integration 1 Large integration interval = large h = inaccurate; small h = high-degree polynomial = inaccurate. 2 Example: Using Simpson s rule with h = 2, we have 4 0 e x dx 2 3 (e0 + 4e 2 + e 4 ) = (exact value = ) Composite Simpson s rule: (h = 1) e x dx = e x dx + e x dx (e0 + 4e 1 + e 2 ) (e2 + 4e 3 + e 4 ) = (h = 1/2) 4 0 e x dx = 1 0 e x dx e x dx 1 6 (e0 + 4e 1/2 + e 1 ) (e3 + 4e e 4 ) = Suh-Yuh Yang ( 楊肅煜 ), Math. Dept., NCU, Taiwan Differentiation and Integration 26/35

27 Composite Simpson s rule Let n be an even integer. Divide [a, b] into n subintervals. Let h = b a n b a n/2 h = j=1{ 3 = h 3 = h 3 and x j = a + jh for j = 0, 1,, n. Then n/2 x2j f (x)dx = f (x)dx j=1 x 2j 2 ( ) f (x 2j 2 ) + 4f (x 2j 1 ) + f (x 2j ) h5 90 f (4) (ξ j ) { f (x 0 ) + 4f (x 1 ) + f (x 2 ) + f (x 2 ) + 4f (x 3 ) + f (x 4 ) + + f (x n ) h5 n/2 90 { n/2 1 f (x 0 ) + 2 j=1 j=1 f (4) (ξ j ) n/2 f (x 2j ) + 4 j=1 f (x 2j 1 ) + f (x n ) h5 n/2 90 j=1 f (4) (ξ j ). Suh-Yuh Yang ( 楊肅煜 ), Math. Dept., NCU, Taiwan Differentiation and Integration 27/35

28 Composite Simpson s rule (cont d) If f C 4 [a, b] then min x [a,b] f (4) (x) f (4) (ξ j ) max x [a,b] f (4) (x). = n 2 min f (4) n/2 (x) x [a,b] j=1 = min f (4) (x) 2 n/2 x [a,b] n j=1 f (4) (ξ j ) n 2 max x [a,b] f (4) (x). f (4) (ξ j ) max x [a,b] f (4) (x). By the Intermediate Value Theorem, µ (a, b) such that f (4) (µ) = 2 n/2 n f (4) (ξ j ) = h5 n/2 90 f (4) (ξ j ) = h5 n 180 f (4) (µ). j=1 j=1 h = b a n n = b a h h5 90 n/2 j=1 f (4) (ξ j ) = h5 (b a) f (4) (µ) = 180h (b a) 180 h4 f (4) (µ). Suh-Yuh Yang ( 楊肅煜 ), Math. Dept., NCU, Taiwan Differentiation and Integration 28/35

29 Composite rules 1 Composite Simpson s rule: Let n be an even integer, h = b a n, x 0 = a < x 1 < < x n = b and x j = a + jh. If f C 4 [a, b] then µ (a, b) such that b f (x)dx = h a 3 { n/2 1 f (x 0 ) + 2 j=1 n/2 f (x 2j ) + 4 j=1 (b a) f (x 2j 1 ) + f (x n ) 180 h4 f (4) (µ). 2 Composite trapezoidal rule: Let h = b a n, x 0 = a < x 1 < < x n = b and x j = a + jh. If f C 2 [a, b] then µ (a, b) such that b f (x)dx = h { a 2 f (x 0 ) + 2 n 1 j=1 f (x j ) + f (x n ) (b a) h 2 f (µ) Composite midpoint rule: Let n be an even integer, h = b a n+2, x 1 = a < x 0 < x 1 < < x n < x n+1 = b and x j = a + (j + 1)h. If f C 2 [a, b] then µ (a, b) such that b a n/2 f (x)dx = 2h f (x 2j ) + j=0 (b a) h 2 f (µ). 6 Suh-Yuh Yang ( 楊肅煜 ), Math. Dept., NCU, Taiwan Differentiation and Integration 29/35

30 Gaussian quadrature 1 Degree of precision + use values of function at equally spaced points, e.g. the trapezoidal rule. 2 Gaussian quadrature: b a f (x)dx n i=1 c i f (x i ), where c i R and x i [a, b] for i = 1, 2,, n = 2n parameters to choose. The greatest degree of precision 2n 1. 3 Example: Let [a, b] = [ 1, 1] and n = 2. We want to determine c 1, c 2 R, x 1, x 2 [ 1, 1] such that 1 1 f (x)dx c 1 f (x 1 ) + c 2 f (x 2 ) and gives exact value whenever f (x) is a polynomial with degree(f ) 3(= 2n 1). gives exact value when f (x) = 1, x, x 2, x 3. Suh-Yuh Yang ( 楊肅煜 ), Math. Dept., NCU, Taiwan Differentiation and Integration 30/35

31 Example (cont d) 2 = 1 1 1dx = c 1f (x 1 ) + c 2 f (x 2 ) = c 1 + c 2 (f (x) = 1), 0 = 1 1 xdx = c 1f (x 1 ) + c 2 f (x 2 ) = c 1 x 1 + c 2 x 2 (f (x) = x), 2 3 = 1 1 x2 dx = c 1 f (x 1 ) + c 2 f (x 2 ) = c 1 x c 2x 2 2 (f (x) = x 2 ), 0 = 1 1 x3 dx = c 1 f (x 1 ) + c 2 f (x 2 ) = c 1 x c 2x 3 2 (f (x) = x 3 ). = c 1 + c 2 = 2, c 1 x 1 + c 2 x 2 = 0, c 1 x c 2x 2 2 = 2 3, c 1x c 2x 3 2 = 0. = c 1 = 1, c 2 = 1, x 1 = 3 3, x 2 = = f (x)dx 1 f ( ) + 1 f ( 3 ). 1 This formula has degree of precision 3. Suh-Yuh Yang ( 楊肅煜 ), Math. Dept., NCU, Taiwan Differentiation and Integration 31/35

32 Legendre polynomials (Chapter 8) Some Legendre polynomials are given by p 0 (x) = 1, p 1 (x) = x, p 2 (x) = x 2 1 3, p 3 (x) = x x, p 4(x) = x x , For each n, p n (x) is a polynomial of degree n. 1 p(x)p n (x)dx = 0 whenever p(x) is a polynomial of degree 1 n 1. The roots of p n (x) are distinct, lie in ( 1, 1), have a symmetry with respect to 0. e.g., p 2 (x) = x has roots 3 3 and 3 3. Suh-Yuh Yang ( 楊肅煜 ), Math. Dept., NCU, Taiwan Differentiation and Integration 32/35

33 Theorem Suppose that x 1, x 2,, x n are the roots of the nth Legendre polynomial p n (x). For i = 1, 2,, n, c i := ( 1 x xj 1 n j=1,j =i x i x )dx. j If p(x) is a polynomial and degree(p(x)) < 2n. Then 1 1 p(x)dx = n i=1 c ip(x i ). Proof: Let R(x) be a polynomial and degree(r(x)) n 1. Let x 1, x 2,, x n ( be the roots of the nth ) Legendre polynomial p n (x). Then R(x) = n i=1 n x x j j=1,j =i x i x R(x j i ) + nth derivative of R(x) ( ) = n i=1 n x x j j=1,j =i x i x R(x j i ) R(x)dx = ( ) 1 1 n i=1 n x x j ( j=1,j =i x i x R(x j i ) dx = n ) 1 i=1 1 n j=1,j =i R(x i ) = n i=1 c ir(x i ). x x j x i x j dx Suh-Yuh Yang ( 楊肅煜 ), Math. Dept., NCU, Taiwan Differentiation and Integration 33/35

34 Proof (con d) Let p(x) be a polynomial with degree(p(x)) 2n 1. Then p(x) = Q(x)p n (x) + R(x) for some Q(x) and R(x) with degree(q(x)) n 1 and degree(r(x)) n 1. degree(q(x)) n Q(x)p n (x)dx = 0. x i is a root of p n (x) for i = 1, 2,, n p(x i ) = Q(x i )p n (x i ) + R(x i ) = R(x i ). 1 1 ( ) = p(x)dx = Q(x)p n (x) + R(x) dx = 1 n i=1 = c i R(x i ) = 1 n i=1 This completes the proof. c i p(x i ). 1 1 R(x)dx Suh-Yuh Yang ( 楊肅煜 ), Math. Dept., NCU, Taiwan Differentiation and Integration 34/35

35 Concluding remarks Change of variables: b a f (x)dx 1 1 f (t)dt. t = 2x a b x = 1 ( ) (b a)t + a + b. b a 2 b 1 ( 1 { ) b a f (x)dx = f (b a)t + a + b 2 2 dt. a Example: e x2 dx = 1 1 ( ) 2 e 12 (0.5t+2.5) dt = 1 1 e (t+5)2 16 dt. 4 1 Suh-Yuh Yang ( 楊肅煜 ), Math. Dept., NCU, Taiwan Differentiation and Integration 35/35

Jim Lambers MAT 460/560 Fall Semester Practice Final Exam

Jim Lambers MAT 460/560 Fall Semester Practice Final Exam Jim Lambers MAT 460/560 Fall Semester 2009-10 Practice Final Exam 1. Let f(x) = sin 2x + cos 2x. (a) Write down the 2nd Taylor polynomial P 2 (x) of f(x) centered around x 0 = 0. (b) Write down the corresponding

More information

MA 8019: Numerical Analysis I Solution of Nonlinear Equations

MA 8019: Numerical Analysis I Solution of Nonlinear Equations MA 8019: Numerical Analysis I Solution of Nonlinear Equations Suh-Yuh Yang ( 楊肅煜 ) Department of Mathematics, National Central University Jhongli District, Taoyuan City 32001, Taiwan syyang@math.ncu.edu.tw

More information

Bindel, Spring 2012 Intro to Scientific Computing (CS 3220) Week 12: Monday, Apr 16. f(x) dx,

Bindel, Spring 2012 Intro to Scientific Computing (CS 3220) Week 12: Monday, Apr 16. f(x) dx, Panel integration Week 12: Monday, Apr 16 Suppose we want to compute the integral b a f(x) dx In estimating a derivative, it makes sense to use a locally accurate approximation to the function around the

More information

Numerical Methods. King Saud University

Numerical Methods. King Saud University Numerical Methods King Saud University Aims In this lecture, we will... find the approximate solutions of derivative (first- and second-order) and antiderivative (definite integral only). Numerical Differentiation

More information

3.1 Interpolation and the Lagrange Polynomial

3.1 Interpolation and the Lagrange Polynomial MATH 4073 Chapter 3 Interpolation and Polynomial Approximation Fall 2003 1 Consider a sample x x 0 x 1 x n y y 0 y 1 y n. Can we get a function out of discrete data above that gives a reasonable estimate

More information

Differentiation and Integration

Differentiation and Integration Differentiation and Integration (Lectures on Numerical Analysis for Economists II) Jesús Fernández-Villaverde 1 and Pablo Guerrón 2 February 12, 2018 1 University of Pennsylvania 2 Boston College Motivation

More information

Consistency and Convergence

Consistency and Convergence Jim Lambers MAT 77 Fall Semester 010-11 Lecture 0 Notes These notes correspond to Sections 1.3, 1.4 and 1.5 in the text. Consistency and Convergence We have learned that the numerical solution obtained

More information

CS 450 Numerical Analysis. Chapter 8: Numerical Integration and Differentiation

CS 450 Numerical Analysis. Chapter 8: Numerical Integration and Differentiation Lecture slides based on the textbook Scientific Computing: An Introductory Survey by Michael T. Heath, copyright c 2018 by the Society for Industrial and Applied Mathematics. http://www.siam.org/books/cl80

More information

MA2501 Numerical Methods Spring 2015

MA2501 Numerical Methods Spring 2015 Norwegian University of Science and Technology Department of Mathematics MA5 Numerical Methods Spring 5 Solutions to exercise set 9 Find approximate values of the following integrals using the adaptive

More information

Romberg Integration. MATH 375 Numerical Analysis. J. Robert Buchanan. Spring Department of Mathematics

Romberg Integration. MATH 375 Numerical Analysis. J. Robert Buchanan. Spring Department of Mathematics Romberg Integration MATH 375 Numerical Analysis J. Robert Buchanan Department of Mathematics Spring 019 Objectives and Background In this lesson we will learn to obtain high accuracy approximations to

More information

Romberg Integration and Gaussian Quadrature

Romberg Integration and Gaussian Quadrature Romberg Integration and Gaussian Quadrature P. Sam Johnson October 17, 014 P. Sam Johnson (NITK) Romberg Integration and Gaussian Quadrature October 17, 014 1 / 19 Overview We discuss two methods for integration.

More information

NUMERICAL METHODS. x n+1 = 2x n x 2 n. In particular: which of them gives faster convergence, and why? [Work to four decimal places.

NUMERICAL METHODS. x n+1 = 2x n x 2 n. In particular: which of them gives faster convergence, and why? [Work to four decimal places. NUMERICAL METHODS 1. Rearranging the equation x 3 =.5 gives the iterative formula x n+1 = g(x n ), where g(x) = (2x 2 ) 1. (a) Starting with x = 1, compute the x n up to n = 6, and describe what is happening.

More information

Numerical Integra/on

Numerical Integra/on Numerical Integra/on Applica/ons The Trapezoidal Rule is a technique to approximate the definite integral where For 1 st order: f(a) f(b) a b Error Es/mate of Trapezoidal Rule Truncation error: From Newton-Gregory

More information

(x x 0 )(x x 1 )... (x x n ) (x x 0 ) + y 0.

(x x 0 )(x x 1 )... (x x n ) (x x 0 ) + y 0. > 5. Numerical Integration Review of Interpolation Find p n (x) with p n (x j ) = y j, j = 0, 1,,..., n. Solution: p n (x) = y 0 l 0 (x) + y 1 l 1 (x) +... + y n l n (x), l k (x) = n j=1,j k Theorem Let

More information

Chapter 5: Numerical Integration and Differentiation

Chapter 5: Numerical Integration and Differentiation Chapter 5: Numerical Integration and Differentiation PART I: Numerical Integration Newton-Cotes Integration Formulas The idea of Newton-Cotes formulas is to replace a complicated function or tabulated

More information

(f(x) P 3 (x)) dx. (a) The Lagrange formula for the error is given by

(f(x) P 3 (x)) dx. (a) The Lagrange formula for the error is given by 1. QUESTION (a) Given a nth degree Taylor polynomial P n (x) of a function f(x), expanded about x = x 0, write down the Lagrange formula for the truncation error, carefully defining all its elements. How

More information

Interpolation and the Lagrange Polynomial

Interpolation and the Lagrange Polynomial Interpolation and the Lagrange Polynomial MATH 375 J. Robert Buchanan Department of Mathematics Fall 2013 Introduction We often choose polynomials to approximate other classes of functions. Theorem (Weierstrass

More information

you expect to encounter difficulties when trying to solve A x = b? 4. A composite quadrature rule has error associated with it in the following form

you expect to encounter difficulties when trying to solve A x = b? 4. A composite quadrature rule has error associated with it in the following form Qualifying exam for numerical analysis (Spring 2017) Show your work for full credit. If you are unable to solve some part, attempt the subsequent parts. 1. Consider the following finite difference: f (0)

More information

Practice Exam 2 (Solutions)

Practice Exam 2 (Solutions) Math 5, Fall 7 Practice Exam (Solutions). Using the points f(x), f(x h) and f(x + h) we want to derive an approximation f (x) a f(x) + a f(x h) + a f(x + h). (a) Write the linear system that you must solve

More information

Scientific Computing: Numerical Integration

Scientific Computing: Numerical Integration Scientific Computing: Numerical Integration Aleksandar Donev Courant Institute, NYU 1 donev@courant.nyu.edu 1 Course MATH-GA.2043 or CSCI-GA.2112, Fall 2015 Nov 5th, 2015 A. Donev (Courant Institute) Lecture

More information

Introductory Numerical Analysis

Introductory Numerical Analysis Introductory Numerical Analysis Lecture Notes December 16, 017 Contents 1 Introduction to 1 11 Floating Point Numbers 1 1 Computational Errors 13 Algorithm 3 14 Calculus Review 3 Root Finding 5 1 Bisection

More information

Integration, differentiation, and root finding. Phys 420/580 Lecture 7

Integration, differentiation, and root finding. Phys 420/580 Lecture 7 Integration, differentiation, and root finding Phys 420/580 Lecture 7 Numerical integration Compute an approximation to the definite integral I = b Find area under the curve in the interval Trapezoid Rule:

More information

Lecture Note 3: Interpolation and Polynomial Approximation. Xiaoqun Zhang Shanghai Jiao Tong University

Lecture Note 3: Interpolation and Polynomial Approximation. Xiaoqun Zhang Shanghai Jiao Tong University Lecture Note 3: Interpolation and Polynomial Approximation Xiaoqun Zhang Shanghai Jiao Tong University Last updated: October 10, 2015 2 Contents 1.1 Introduction................................ 3 1.1.1

More information

Lecture Note 3: Polynomial Interpolation. Xiaoqun Zhang Shanghai Jiao Tong University

Lecture Note 3: Polynomial Interpolation. Xiaoqun Zhang Shanghai Jiao Tong University Lecture Note 3: Polynomial Interpolation Xiaoqun Zhang Shanghai Jiao Tong University Last updated: October 24, 2013 1.1 Introduction We first look at some examples. Lookup table for f(x) = 2 π x 0 e x2

More information

Fixed point iteration and root finding

Fixed point iteration and root finding Fixed point iteration and root finding The sign function is defined as x > 0 sign(x) = 0 x = 0 x < 0. It can be evaluated via an iteration which is useful for some problems. One such iteration is given

More information

Euler s Method, cont d

Euler s Method, cont d Jim Lambers MAT 461/561 Spring Semester 009-10 Lecture 3 Notes These notes correspond to Sections 5. and 5.4 in the text. Euler s Method, cont d We conclude our discussion of Euler s method with an example

More information

Chap. 19: Numerical Differentiation

Chap. 19: Numerical Differentiation Chap. 19: Numerical Differentiation Differentiation Definition of difference: y x f x x i x f x i As x is approaching zero, the difference becomes a derivative: dy dx lim x 0 f x i x f x i x 2 High-Accuracy

More information

Interpolation & Polynomial Approximation. Hermite Interpolation I

Interpolation & Polynomial Approximation. Hermite Interpolation I Interpolation & Polynomial Approximation Hermite Interpolation I Numerical Analysis (th Edition) R L Burden & J D Faires Beamer Presentation Slides prepared by John Carroll Dublin City University c 2011

More information

Numerical Methods. Aaron Naiman Jerusalem College of Technology naiman

Numerical Methods. Aaron Naiman Jerusalem College of Technology  naiman Numerical Methods Aaron Naiman Jerusalem College of Technology naiman@jct.ac.il http://jct.ac.il/ naiman based on: Numerical Mathematics and Computing by Cheney & Kincaid, c 1994 Brooks/Cole Publishing

More information

8.3 Numerical Quadrature, Continued

8.3 Numerical Quadrature, Continued 8.3 Numerical Quadrature, Continued Ulrich Hoensch Friday, October 31, 008 Newton-Cotes Quadrature General Idea: to approximate the integral I (f ) of a function f : [a, b] R, use equally spaced nodes

More information

Mathematics for Engineers. Numerical mathematics

Mathematics for Engineers. Numerical mathematics Mathematics for Engineers Numerical mathematics Integers Determine the largest representable integer with the intmax command. intmax ans = int32 2147483647 2147483647+1 ans = 2.1475e+09 Remark The set

More information

Polynomial Interpolation with n + 1 nodes

Polynomial Interpolation with n + 1 nodes Polynomial Interpolation with n + 1 nodes Given n + 1 distinct points (x 0, f (x 0 )), (x 1, f (x 1 )),, (x n, f (x n )), Interpolating polynomial of degree n P(x) = f (x 0 )L 0 (x) + f (x 1 )L 1 (x) +

More information

COURSE Numerical integration of functions

COURSE Numerical integration of functions COURSE 6 3. Numerical integration of functions The need: for evaluating definite integrals of functions that has no explicit antiderivatives or whose antiderivatives are not easy to obtain. Let f : [a,

More information

COURSE Numerical integration of functions (continuation) 3.3. The Romberg s iterative generation method

COURSE Numerical integration of functions (continuation) 3.3. The Romberg s iterative generation method COURSE 7 3. Numerical integration of functions (continuation) 3.3. The Romberg s iterative generation method The presence of derivatives in the remainder difficulties in applicability to practical problems

More information

Math Numerical Analysis

Math Numerical Analysis Math 541 - Numerical Analysis Joseph M. Mahaffy, jmahaffy@mail.sdsu.edu Department of Mathematics and Statistics Dynamical Systems Group Computational Sciences Research Center San Diego State University

More information

Lecture 4: Numerical solution of ordinary differential equations

Lecture 4: Numerical solution of ordinary differential equations Lecture 4: Numerical solution of ordinary differential equations Department of Mathematics, ETH Zürich General explicit one-step method: Consistency; Stability; Convergence. High-order methods: Taylor

More information

Numerical Methods. Aaron Naiman Jerusalem College of Technology naiman

Numerical Methods. Aaron Naiman Jerusalem College of Technology   naiman Numerical Methods Aaron Naiman Jerusalem College of Technology naiman@math.jct.ac.il http://math.jct.ac.il/ naiman based on: Numerical Mathematics and Computing by Cheney & Kincaid, c 1994 Brooks/Cole

More information

12.0 Properties of orthogonal polynomials

12.0 Properties of orthogonal polynomials 12.0 Properties of orthogonal polynomials In this section we study orthogonal polynomials to use them for the construction of quadrature formulas investigate projections on polynomial spaces and their

More information

Power Series Solutions to the Legendre Equation

Power Series Solutions to the Legendre Equation Power Series Solutions to the Legendre Equation Department of Mathematics IIT Guwahati The Legendre equation The equation (1 x 2 )y 2xy + α(α + 1)y = 0, (1) where α is any real constant, is called Legendre

More information

Extrapolation in Numerical Integration. Romberg Integration

Extrapolation in Numerical Integration. Romberg Integration Extrapolation in Numerical Integration Romberg Integration Matthew Battaglia Joshua Berge Sara Case Yoobin Ji Jimu Ryoo Noah Wichrowski Introduction Extrapolation: the process of estimating beyond the

More information

Answers to Homework 9: Numerical Integration

Answers to Homework 9: Numerical Integration Math 8A Spring Handout # Sergey Fomel April 3, Answers to Homework 9: Numerical Integration. a) Suppose that the function f x) = + x ) is known at three points: x =, x =, and x 3 =. Interpolate the function

More information

Review. Numerical Methods Lecture 22. Prof. Jinbo Bi CSE, UConn

Review. Numerical Methods Lecture 22. Prof. Jinbo Bi CSE, UConn Review Taylor Series and Error Analysis Roots of Equations Linear Algebraic Equations Optimization Numerical Differentiation and Integration Ordinary Differential Equations Partial Differential Equations

More information

APPM/MATH Problem Set 6 Solutions

APPM/MATH Problem Set 6 Solutions APPM/MATH 460 Problem Set 6 Solutions This assignment is due by 4pm on Wednesday, November 6th You may either turn it in to me in class or in the box outside my office door (ECOT ) Minimal credit will

More information

Hermite Interpolation

Hermite Interpolation Jim Lambers MAT 77 Fall Semester 010-11 Lecture Notes These notes correspond to Sections 4 and 5 in the text Hermite Interpolation Suppose that the interpolation points are perturbed so that two neighboring

More information

(0, 0), (1, ), (2, ), (3, ), (4, ), (5, ), (6, ).

(0, 0), (1, ), (2, ), (3, ), (4, ), (5, ), (6, ). 1 Interpolation: The method of constructing new data points within the range of a finite set of known data points That is if (x i, y i ), i = 1, N are known, with y i the dependent variable and x i [x

More information

n 1 f n 1 c 1 n+1 = c 1 n $ c 1 n 1. After taking logs, this becomes

n 1 f n 1 c 1 n+1 = c 1 n $ c 1 n 1. After taking logs, this becomes Root finding: 1 a The points {x n+1, }, {x n, f n }, {x n 1, f n 1 } should be co-linear Say they lie on the line x + y = This gives the relations x n+1 + = x n +f n = x n 1 +f n 1 = Eliminating α and

More information

Department of Applied Mathematics and Theoretical Physics. AMA 204 Numerical analysis. Exam Winter 2004

Department of Applied Mathematics and Theoretical Physics. AMA 204 Numerical analysis. Exam Winter 2004 Department of Applied Mathematics and Theoretical Physics AMA 204 Numerical analysis Exam Winter 2004 The best six answers will be credited All questions carry equal marks Answer all parts of each question

More information

Numerical integration and differentiation. Unit IV. Numerical Integration and Differentiation. Plan of attack. Numerical integration.

Numerical integration and differentiation. Unit IV. Numerical Integration and Differentiation. Plan of attack. Numerical integration. Unit IV Numerical Integration and Differentiation Numerical integration and differentiation quadrature classical formulas for equally spaced nodes improper integrals Gaussian quadrature and orthogonal

More information

5 Numerical Integration & Dierentiation

5 Numerical Integration & Dierentiation 5 Numerical Integration & Dierentiation Department of Mathematics & Statistics ASU Outline of Chapter 5 1 The Trapezoidal and Simpson Rules 2 Error Formulas 3 Gaussian Numerical Integration 4 Numerical

More information

Trapezoidal Rule, n = 1, x 0 = a, x 1 = b, h = b a. f (x)dx = h 2 (f (x 0) + f (x 1 )) h3

Trapezoidal Rule, n = 1, x 0 = a, x 1 = b, h = b a. f (x)dx = h 2 (f (x 0) + f (x 1 )) h3 Trpezoidl Rule, n = 1, x 0 =, x 1 = b, h = b f (x)dx = h 2 (f (x 0) + f (x 1 )) h3 12 f (ξ). Simpson s Rule: n = 3, x 0 =, x 1 = +b 2, x 2 = b, h = b 2. Qudrture Rule, double node t x 1 P 3 (x)dx = f (x

More information

Notation Nodes are data points at which functional values are available or at which you wish to compute functional values At the nodes fx i

Notation Nodes are data points at which functional values are available or at which you wish to compute functional values At the nodes fx i LECTURE 6 NUMERICAL DIFFERENTIATION To find discrete approximations to differentiation (since computers can only deal with functional values at discrete points) Uses of numerical differentiation To represent

More information

April 15 Math 2335 sec 001 Spring 2014

April 15 Math 2335 sec 001 Spring 2014 April 15 Math 2335 sec 001 Spring 2014 Trapezoid and Simpson s Rules I(f ) = b a f (x) dx Trapezoid Rule: If [a, b] is divided into n equally spaced subintervals of length h = (b a)/n, then I(f ) T n (f

More information

Math 578: Assignment 2

Math 578: Assignment 2 Math 578: Assignment 2 13. Determine whether the natural cubic spline that interpolates the table is or is not the x 0 1 2 3 y 1 1 0 10 function 1 + x x 3 x [0, 1] f(x) = 1 2(x 1) 3(x 1) 2 + 4(x 1) 3 x

More information

Approximation theory

Approximation theory Approximation theory Xiaojing Ye, Math & Stat, Georgia State University Spring 2019 Numerical Analysis II Xiaojing Ye, Math & Stat, Georgia State University 1 1 1.3 6 8.8 2 3.5 7 10.1 Least 3squares 4.2

More information

Outline. 1 Numerical Integration. 2 Numerical Differentiation. 3 Richardson Extrapolation

Outline. 1 Numerical Integration. 2 Numerical Differentiation. 3 Richardson Extrapolation Outline Numerical Integration Numerical Differentiation Numerical Integration Numerical Differentiation 3 Michael T. Heath Scientific Computing / 6 Main Ideas Quadrature based on polynomial interpolation:

More information

Section 6.6 Gaussian Quadrature

Section 6.6 Gaussian Quadrature Section 6.6 Gaussian Quadrature Key Terms: Method of undetermined coefficients Nonlinear systems Gaussian quadrature Error Legendre polynomials Inner product Adapted from http://pathfinder.scar.utoronto.ca/~dyer/csca57/book_p/node44.html

More information

Spring 2012 Introduction to numerical analysis Class notes. Laurent Demanet

Spring 2012 Introduction to numerical analysis Class notes. Laurent Demanet 18.330 Spring 2012 Introduction to numerical analysis Class notes Laurent Demanet Draft April 25, 2014 2 Preface Good additional references are Burden and Faires, Introduction to numerical analysis Suli

More information

Gregory's quadrature method

Gregory's quadrature method Gregory's quadrature method Gregory's method is among the very first quadrature formulas ever described in the literature, dating back to James Gregory (638-675). It seems to have been highly regarded

More information

Fourth Order RK-Method

Fourth Order RK-Method Fourth Order RK-Method The most commonly used method is Runge-Kutta fourth order method. The fourth order RK-method is y i+1 = y i + 1 6 (k 1 + 2k 2 + 2k 3 + k 4 ), Ordinary Differential Equations (ODE)

More information

Numerical Integration (Quadrature) Another application for our interpolation tools!

Numerical Integration (Quadrature) Another application for our interpolation tools! Numerical Integration (Quadrature) Another application for our interpolation tools! Integration: Area under a curve Curve = data or function Integrating data Finite number of data points spacing specified

More information

Chapter 3 Interpolation and Polynomial Approximation

Chapter 3 Interpolation and Polynomial Approximation Chapter 3 Interpolation and Polynomial Approximation Per-Olof Persson persson@berkeley.edu Department of Mathematics University of California, Berkeley Math 128A Numerical Analysis Polynomial Interpolation

More information

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University Part 1 Chapter 4 Roundoff and Truncation Errors PowerPoints organized by Dr. Michael R. Gustafson II, Duke University All images copyright The McGraw-Hill Companies, Inc. Permission required for reproduction

More information

MATH 590: Meshfree Methods

MATH 590: Meshfree Methods MATH 590: Meshfree Methods Chapter 14: The Power Function and Native Space Error Estimates Greg Fasshauer Department of Applied Mathematics Illinois Institute of Technology Fall 2010 fasshauer@iit.edu

More information

ECE257 Numerical Methods and Scientific Computing. Ordinary Differential Equations

ECE257 Numerical Methods and Scientific Computing. Ordinary Differential Equations ECE257 Numerical Methods and Scientific Computing Ordinary Differential Equations Today s s class: Stiffness Multistep Methods Stiff Equations Stiffness occurs in a problem where two or more independent

More information

HIGHER ORDER METHODS. There are two principal means to derive higher order methods. b j f(x n j,y n j )

HIGHER ORDER METHODS. There are two principal means to derive higher order methods. b j f(x n j,y n j ) HIGHER ORDER METHODS There are two principal means to derive higher order methods y n+1 = p j=0 a j y n j + h p j= 1 b j f(x n j,y n j ) (a) Method of Undetermined Coefficients (b) Numerical Integration

More information

Math 1310 Section 4.1: Polynomial Functions and Their Graphs. A polynomial function is a function of the form ...

Math 1310 Section 4.1: Polynomial Functions and Their Graphs. A polynomial function is a function of the form ... Math 1310 Section 4.1: Polynomial Functions and Their Graphs A polynomial function is a function of the form... where 0,,,, are real numbers and n is a whole number. The degree of the polynomial function

More information

Spring 2012 Introduction to numerical analysis Class notes. Laurent Demanet

Spring 2012 Introduction to numerical analysis Class notes. Laurent Demanet 18.330 Spring 2012 Introduction to numerical analysis Class notes Laurent Demanet Draft February 28, 2012 2 Preface Good additional references are Burden and Faires, Introduction to numerical analysis

More information

Math 112 Rahman. Week Taylor Series Suppose the function f has the following power series:

Math 112 Rahman. Week Taylor Series Suppose the function f has the following power series: Math Rahman Week 0.8-0.0 Taylor Series Suppose the function f has the following power series: fx) c 0 + c x a) + c x a) + c 3 x a) 3 + c n x a) n. ) Can we figure out what the coefficients are? Yes, yes

More information

Numerical Integration

Numerical Integration Numerical Integration Sanzheng Qiao Department of Computing and Software McMaster University February, 2014 Outline 1 Introduction 2 Rectangle Rule 3 Trapezoid Rule 4 Error Estimates 5 Simpson s Rule 6

More information

Homework and Computer Problems for Math*2130 (W17).

Homework and Computer Problems for Math*2130 (W17). Homework and Computer Problems for Math*2130 (W17). MARCUS R. GARVIE 1 December 21, 2016 1 Department of Mathematics & Statistics, University of Guelph NOTES: These questions are a bare minimum. You should

More information

Homework set #7 solutions, Math 128A J. Xia

Homework set #7 solutions, Math 128A J. Xia Homework set #7 solutions, Math 18A J. Xia Sec 4.4: 1a, a, 3a, 7abc, 17 1a. Compute by hand or use a program. Matlab code for the Composite Trapezoidal rule: function integral = cmptrap(a,b,n,f) h = (b-a)/n;

More information

EXAMPLE OF ONE-STEP METHOD

EXAMPLE OF ONE-STEP METHOD EXAMPLE OF ONE-STEP METHOD Consider solving y = y cos x, y(0) = 1 Imagine writing a Taylor series for the solution Y (x), say initially about x = 0. Then Y (h) = Y (0) + hy (0) + h2 2 Y (0) + h3 6 Y (0)

More information

Do not turn over until you are told to do so by the Invigilator.

Do not turn over until you are told to do so by the Invigilator. UNIVERSITY OF EAST ANGLIA School of Mathematics Main Series UG Examination 216 17 INTRODUCTION TO NUMERICAL ANALYSIS MTHE612B Time allowed: 3 Hours Attempt QUESTIONS 1 and 2, and THREE other questions.

More information

Fall 2014 MAT 375 Numerical Methods. Numerical Differentiation (Chapter 9)

Fall 2014 MAT 375 Numerical Methods. Numerical Differentiation (Chapter 9) Fall 2014 MAT 375 Numerical Metods (Capter 9) Idea: Definition of te derivative at x Obviuos approximation: f (x) = lim 0 f (x + ) f (x) f (x) f (x + ) f (x) forward-difference formula? ow good is tis

More information

Interpolation and Approximation

Interpolation and Approximation Interpolation and Approximation The Basic Problem: Approximate a continuous function f(x), by a polynomial p(x), over [a, b]. f(x) may only be known in tabular form. f(x) may be expensive to compute. Definition:

More information

Principles of Scientific Computing Local Analysis

Principles of Scientific Computing Local Analysis Principles of Scientific Computing Local Analysis David Bindel and Jonathan Goodman last revised January 2009, printed February 25, 2009 1 Among the most common computational tasks are differentiation,

More information

Interpolation Theory

Interpolation Theory Numerical Analysis Massoud Malek Interpolation Theory The concept of interpolation is to select a function P (x) from a given class of functions in such a way that the graph of y P (x) passes through the

More information

Applied Math for Engineers

Applied Math for Engineers Applied Math for Engineers Ming Zhong Lecture 15 March 28, 2018 Ming Zhong (JHU) AMS Spring 2018 1 / 28 Recap Table of Contents 1 Recap 2 Numerical ODEs: Single Step Methods 3 Multistep Methods 4 Method

More information

Power Series Solutions to the Legendre Equation

Power Series Solutions to the Legendre Equation Department of Mathematics IIT Guwahati The Legendre equation The equation (1 x 2 )y 2xy + α(α + 1)y = 0, (1) where α is any real constant, is called Legendre s equation. When α Z +, the equation has polynomial

More information

CS 257: Numerical Methods

CS 257: Numerical Methods CS 57: Numerical Methods Final Exam Study Guide Version 1.00 Created by Charles Feng http://www.fenguin.net CS 57: Numerical Methods Final Exam Study Guide 1 Contents 1 Introductory Matter 3 1.1 Calculus

More information

Multistage Methods I: Runge-Kutta Methods

Multistage Methods I: Runge-Kutta Methods Multistage Methods I: Runge-Kutta Methods Varun Shankar January, 0 Introduction Previously, we saw that explicit multistep methods (AB methods) have shrinking stability regions as their orders are increased.

More information

Monte Carlo Methods for Statistical Inference: Variance Reduction Techniques

Monte Carlo Methods for Statistical Inference: Variance Reduction Techniques Monte Carlo Methods for Statistical Inference: Variance Reduction Techniques Hung Chen hchen@math.ntu.edu.tw Department of Mathematics National Taiwan University 3rd March 2004 Meet at NS 104 On Wednesday

More information

MAT137 Calculus! Lecture 45

MAT137 Calculus! Lecture 45 official website http://uoft.me/mat137 MAT137 Calculus! Lecture 45 Today: Taylor Polynomials Taylor Series Next: Taylor Series Power Series Definition (Power Series) A power series is a series of the form

More information

LECTURE 16 GAUSS QUADRATURE In general for Newton-Cotes (equispaced interpolation points/ data points/ integration points/ nodes).

LECTURE 16 GAUSS QUADRATURE In general for Newton-Cotes (equispaced interpolation points/ data points/ integration points/ nodes). CE 025 - Lecture 6 LECTURE 6 GAUSS QUADRATURE In general for ewton-cotes (equispaced interpolation points/ data points/ integration points/ nodes). x E x S fx dx hw' o f o + w' f + + w' f + E 84 f 0 f

More information

TABLE OF CONTENTS INTRODUCTION, APPROXIMATION & ERRORS 1. Chapter Introduction to numerical methods 1 Multiple-choice test 7 Problem set 9

TABLE OF CONTENTS INTRODUCTION, APPROXIMATION & ERRORS 1. Chapter Introduction to numerical methods 1 Multiple-choice test 7 Problem set 9 TABLE OF CONTENTS INTRODUCTION, APPROXIMATION & ERRORS 1 Chapter 01.01 Introduction to numerical methods 1 Multiple-choice test 7 Problem set 9 Chapter 01.02 Measuring errors 11 True error 11 Relative

More information

Review of Power Series

Review of Power Series Review of Power Series MATH 365 Ordinary Differential Equations J. Robert Buchanan Department of Mathematics Fall 2018 Introduction In addition to the techniques we have studied so far, we may use power

More information

Ordinary Differential Equations II

Ordinary Differential Equations II Ordinary Differential Equations II CS 205A: Mathematical Methods for Robotics, Vision, and Graphics Justin Solomon CS 205A: Mathematical Methods Ordinary Differential Equations II 1 / 29 Almost Done! No

More information

Exam 2. Average: 85.6 Median: 87.0 Maximum: Minimum: 55.0 Standard Deviation: Numerical Methods Fall 2011 Lecture 20

Exam 2. Average: 85.6 Median: 87.0 Maximum: Minimum: 55.0 Standard Deviation: Numerical Methods Fall 2011 Lecture 20 Exam 2 Average: 85.6 Median: 87.0 Maximum: 100.0 Minimum: 55.0 Standard Deviation: 10.42 Fall 2011 1 Today s class Multiple Variable Linear Regression Polynomial Interpolation Lagrange Interpolation Newton

More information

On the positivity of linear weights in WENO approximations. Abstract

On the positivity of linear weights in WENO approximations. Abstract On the positivity of linear weights in WENO approximations Yuanyuan Liu, Chi-Wang Shu and Mengping Zhang 3 Abstract High order accurate weighted essentially non-oscillatory (WENO) schemes have been used

More information

Applied Numerical Analysis Quiz #2

Applied Numerical Analysis Quiz #2 Applied Numerical Analysis Quiz #2 Modules 3 and 4 Name: Student number: DO NOT OPEN UNTIL ASKED Instructions: Make sure you have a machine-readable answer form. Write your name and student number in the

More information

Numerical Analysis Solution of Algebraic Equation (non-linear equation) 1- Trial and Error. 2- Fixed point

Numerical Analysis Solution of Algebraic Equation (non-linear equation) 1- Trial and Error. 2- Fixed point Numerical Analysis Solution of Algebraic Equation (non-linear equation) 1- Trial and Error In this method we assume initial value of x, and substitute in the equation. Then modify x and continue till we

More information

Numerical Analysis: Interpolation Part 1

Numerical Analysis: Interpolation Part 1 Numerical Analysis: Interpolation Part 1 Computer Science, Ben-Gurion University (slides based mostly on Prof. Ben-Shahar s notes) 2018/2019, Fall Semester BGU CS Interpolation (ver. 1.00) AY 2018/2019,

More information

2tdt 1 y = t2 + C y = which implies C = 1 and the solution is y = 1

2tdt 1 y = t2 + C y = which implies C = 1 and the solution is y = 1 Lectures - Week 11 General First Order ODEs & Numerical Methods for IVPs In general, nonlinear problems are much more difficult to solve than linear ones. Unfortunately many phenomena exhibit nonlinear

More information

Examination paper for TMA4215 Numerical Mathematics

Examination paper for TMA4215 Numerical Mathematics Department of Mathematical Sciences Examination paper for TMA425 Numerical Mathematics Academic contact during examination: Trond Kvamsdal Phone: 93058702 Examination date: 6th of December 207 Examination

More information

Numerical Analysis Preliminary Exam 10.00am 1.00pm, January 19, 2018

Numerical Analysis Preliminary Exam 10.00am 1.00pm, January 19, 2018 Numerical Analysis Preliminary Exam 0.00am.00pm, January 9, 208 Instructions. You have three hours to complete this exam. Submit solutions to four (and no more) of the following six problems. Please start

More information

MATH 1014 Tutorial Notes 8

MATH 1014 Tutorial Notes 8 MATH4 Calculus II (8 Spring) Topics covered in tutorial 8:. Numerical integration. Approximation integration What you need to know: Midpoint rule & its error Trapezoid rule & its error Simpson s rule &

More information

INTERPOLATION. and y i = cos x i, i = 0, 1, 2 This gives us the three points. Now find a quadratic polynomial. p(x) = a 0 + a 1 x + a 2 x 2.

INTERPOLATION. and y i = cos x i, i = 0, 1, 2 This gives us the three points. Now find a quadratic polynomial. p(x) = a 0 + a 1 x + a 2 x 2. INTERPOLATION Interpolation is a process of finding a formula (often a polynomial) whose graph will pass through a given set of points (x, y). As an example, consider defining and x 0 = 0, x 1 = π/4, x

More information

AN OVERVIEW. Numerical Methods for ODE Initial Value Problems. 1. One-step methods (Taylor series, Runge-Kutta)

AN OVERVIEW. Numerical Methods for ODE Initial Value Problems. 1. One-step methods (Taylor series, Runge-Kutta) AN OVERVIEW Numerical Methods for ODE Initial Value Problems 1. One-step methods (Taylor series, Runge-Kutta) 2. Multistep methods (Predictor-Corrector, Adams methods) Both of these types of methods are

More information

Integration of Ordinary Differential Equations

Integration of Ordinary Differential Equations Integration of Ordinary Differential Equations Com S 477/577 Nov 7, 00 1 Introduction The solution of differential equations is an important problem that arises in a host of areas. Many differential equations

More information

LECTURE 14 NUMERICAL INTEGRATION. Find

LECTURE 14 NUMERICAL INTEGRATION. Find LECTURE 14 NUMERCAL NTEGRATON Find b a fxdx or b a vx ux fx ydy dx Often integration is required. However te form of fx may be suc tat analytical integration would be very difficult or impossible. Use

More information