Download The Trapezoidal Rule Composite Form-Numerical Analysis-Lecture Handouts and more Lecture notes Mathematical Methods for Numerical Analysis and Optimization in PDF only on Docsity! Numerical Analysis –MTH603 VU © Copyright Virtual University of Pakistan 1 The Trapezoidal Rule (Composite Form) The Newton-Cotes formula is based on approximating y = f (x) between (x0, y0) and (x1, y1)by a straight line, thus forming a trapezium, is called trapezoidal rule. In order to evaluate the definite integral ( ) b a I f x dx= ∫ we divide the interval [a, b] into n sub-intervals, each of size h = (b – a)/n and denote the sub-intervals by [x0, x1], [x1, x2], …, [xn-1, xn], such that x0 = a and xn = b and xk = x0 + kh, k = 1, 2, …, n – 1. Thus, we can write the above definite integral as a sum. Therefore, 1 2 0 0 1 1 ( ) ( ) ( ) ( )n n n x x x x x x x x I f x dx f x dx f x dx f x dx − = = + + +∫ ∫ ∫ ∫ The area under the curve in each sub-interval is approximated by a trapezium. The integral I, which represents an area between the curve y = f (x), the x-axis and the ordinates at x = x0 and x = xn is obtained by adding all the trapezoidal areas in each sub- interval. Now, using the trapezoidal rule into equation: 1 0 3 0 0 1 1 0 1( ) Error ( ) ( )2 2 x x h hf x dx c y c y y y y ξ′′= + + = + −∫ We get 0 3 3 0 1 1 1 2 2 3 1 ( ) ( ) ( ) ( ) ( ) 2 2 2 12 ( ) ( ) 2 12 nx x n n n h h h hI f x dx y y y y y y h hy y y ξ ξ ξ− ′′ ′′= = + − + + − ′′+ + + − ∫ Where xk-1< ξ < xk, for k = 1, 2, …, n – 1. Thus, we arrive at the result 0 0 1 2 1( ) ( 2 2 2 )2 nx n n nx hf x dx y y y y y E−= + + + + + +∫ Where the error term En is given by 3 1 2[ ( ) ( ) ( )]12n n hE y y yξ ξ ξ′′ ′′ ′′= − + + + Equation represents the trapezoidal rule over [x0, xn], which is also called the composite form of the trapezoidal rule. The error term given by Equation: 3 1 2[ ( ) ( ) ( )]12n n hE y y yξ ξ ξ′′ ′′ ′′= − + + + is called the global error. docsity.com Numerical Analysis –MTH603 VU © Copyright Virtual University of Pakistan 2 However, if we assume that ( )y x′′ is continuous over [x0, xn] then there exists some ξ in [x0, xn] such that xn = x0 + nh and 3 20[ ( )] ( ) 12 12 n n x xhE ny h yξ ξ−′′ ′′= − = − Then the global error can be conveniently written as O(h 2 ). Simpson’s Rules (Composite Forms) In deriving equation. , 2 0 5 ( ) 0 0 1 1 2 2 0 1 2( ) Error ( 4 ) ( )3 90 x iv x h hf x dx x y x y x y y y y y ξ= + + + = + + −∫ The Simpson’s 1/3 rule, we have used two sub-intervals of equal width. In order to get a composite formula, we shall divide the interval of integration [a, b] Into an even number of sub- intervals say 2N, each of width (b – a)/2N, thereby we have x0 = a, x1, …, x2N = b and xk =x0 +kh, k = 1,2, … (2N – 1). Thus, the definite integral I can be written as 2 4 2 0 2 2 2 ( ) ( ) ( ) ( )N N b x x x a x x x I f x dx f x dx f x dx f x dx − = = + + +∫ ∫ ∫ ∫ Applying Simpson’s 1/3 rule as in equation 2 0 5 ( ) 0 0 1 1 2 2 0 1 2( ) Error ( 4 ) ( )3 90 x iv x h hf x dx x y x y x y y y y y ξ= + + + = + + −∫ to each of the integrals on the right-hand side of the above equation, we obtain 0 1 2 2 3 4[( 4 ) ( 4 )3 hI y y y y y y= + + + + + + 5 ( )2 2 2 1 2 ( 4 )] ( )90 iv N N N Ny y y h y ξ− −+ + + − That is 2 0 0 1 3 2 1 2 4 2 2 2( ) [ 4( ) 2( ) ] Error term3 Nx N N Nx hf x dx y y y y y y y y− −= + + + + + + + + + +∫ This formula is called composite Simpson’s 1/3 rule. The error term E, which is also called global error, is given by 5 ( ) 4 ( )2 0( ) ( ) 90 180 iv ivNx xNE h y h yξ ξ−= − = − for some ξ in [x0, x2N]. Thus, in Simpson’s 1/3 rule, the global error is of O(h 4 ). Similarly in deriving composite Simpson’s 3/8 rule, we divide the interval of integration into n sub-intervals, where n is divisible by 3, and applying the integration formula docsity.com