Numerical Analysis: Trapezoidal and Simpson s Rule

Similar documents
NUMERICAL INTEGRATION

CMDA 4604: Intermediate Topics in Mathematical Modeling Lecture 19: Interpolation and Quadrature

Lecture 14: Quadrature

Review of Calculus, cont d

Math& 152 Section Integration by Parts

NUMERICAL INTEGRATION. The inverse process to differentiation in calculus is integration. Mathematically, integration is represented by.

Numerical Integration

P 3 (x) = f(0) + f (0)x + f (0) 2. x 2 + f (0) . In the problem set, you are asked to show, in general, the n th order term is a n = f (n) (0)

Chapter 2. Numerical Integration also called quadrature. 2.2 Trapezoidal Rule. 2.1 A basic principle Extending the Trapezoidal Rule DRAWINGS

Math 131. Numerical Integration Larson Section 4.6

63. Representation of functions as power series Consider a power series. ( 1) n x 2n for all 1 < x < 1

The Riemann Integral

Midpoint Approximation

Lecture 20: Numerical Integration III

n f(x i ) x. i=1 In section 4.2, we defined the definite integral of f from x = a to x = b as n f(x i ) x; f(x) dx = lim i=1

Definite integral. Mathematics FRDIS MENDELU

Numerical Integration

Definite integral. Mathematics FRDIS MENDELU. Simona Fišnarová (Mendel University) Definite integral MENDELU 1 / 30

different methods (left endpoint, right endpoint, midpoint, trapezoid, Simpson s).

The Regulated and Riemann Integrals

1 The Riemann Integral

Best Approximation. Chapter The General Case

Unit #9 : Definite Integral Properties; Fundamental Theorem of Calculus

DOING PHYSICS WITH MATLAB MATHEMATICAL ROUTINES

Anti-derivatives/Indefinite Integrals of Basic Functions

III. Lecture on Numerical Integration. File faclib/dattab/lecture-notes/numerical-inter03.tex /by EC, 3/14/2008 at 15:11, version 9

Lecture 19: Continuous Least Squares Approximation

Chapter 5. Numerical Integration

Z b. f(x)dx. Yet in the above two cases we know what f(x) is. Sometimes, engineers want to calculate an area by computing I, but...

Lecture 12: Numerical Quadrature

Week 10: Riemann integral and its properties

INTRODUCTION TO INTEGRATION

Discrete Least-squares Approximations

Calculus I-II Review Sheet

Math 1B, lecture 4: Error bounds for numerical methods

APPROXIMATE INTEGRATION

Overview of Calculus I

QUADRATURE is an old-fashioned word that refers to

Integrals - Motivation

Numerical Integration. 1 Introduction. 2 Midpoint Rule, Trapezoid Rule, Simpson Rule. AMSC/CMSC 460/466 T. von Petersdorff 1

We know that if f is a continuous nonnegative function on the interval [a, b], then b

LECTURE 19. Numerical Integration. Z b. is generally thought of as representing the area under the graph of fèxè between the points x = a and

Numerical Analysis. 10th ed. R L Burden, J D Faires, and A M Burden

Section 4.8. D v(t j 1 ) t. (4.8.1) j=1

Orthogonal Polynomials

. Double-angle formulas. Your answer should involve trig functions of θ, and not of 2θ. sin 2 (θ) =

Lecture 17. Integration: Gauss Quadrature. David Semeraro. University of Illinois at Urbana-Champaign. March 20, 2014

Lecture Note 4: Numerical differentiation and integration. Xiaoqun Zhang Shanghai Jiao Tong University

How can we approximate the area of a region in the plane? What is an interpretation of the area under the graph of a velocity function?

MA 124 January 18, Derivatives are. Integrals are.

Exam 2, Mathematics 4701, Section ETY6 6:05 pm 7:40 pm, March 31, 2016, IH-1105 Instructor: Attila Máté 1

THE EXISTENCE-UNIQUENESS THEOREM FOR FIRST-ORDER DIFFERENTIAL EQUATIONS.

If u = g(x) is a differentiable function whose range is an interval I and f is continuous on I, then f(g(x))g (x) dx = f(u) du

AP Calculus Multiple Choice: BC Edition Solutions

Advanced Calculus: MATH 410 Notes on Integrals and Integrability Professor David Levermore 17 October 2004

. Double-angle formulas. Your answer should involve trig functions of θ, and not of 2θ. cos(2θ) = sin(2θ) =.

Calculus and linear algebra for biomedical engineering Week 11: The Riemann integral and its properties

Euler, Ioachimescu and the trapezium rule. G.J.O. Jameson (Math. Gazette 96 (2012), )

Czechoslovak Mathematical Journal, 55 (130) (2005), , Abbotsford. 1. Introduction

Numerical quadrature based on interpolating functions: A MATLAB implementation

Polynomials and Division Theory

Tangent Line and Tangent Plane Approximations of Definite Integral

LECTURE. INTEGRATION AND ANTIDERIVATIVE.

Main topics for the First Midterm

7.2 Riemann Integrable Functions

SYDE 112, LECTURES 3 & 4: The Fundamental Theorem of Calculus

Numerical integration. Quentin Louveaux (ULiège - Institut Montefiore) Numerical analysis / 10

5.7 Improper Integrals

Section 6.1 Definite Integral

1 Part II: Numerical Integration

Undergraduate Research

Review of Gaussian Quadrature method

Lecture 23: Interpolatory Quadrature

Chapter 6. Riemann Integral

Review of basic calculus

1 The Lagrange interpolation formula

Section 5.4 Fundamental Theorem of Calculus 2 Lectures. Dr. Abdulla Eid. College of Science. MATHS 101: Calculus 1

6.5 Numerical Approximations of Definite Integrals

Goals: Determine how to calculate the area described by a function. Define the definite integral. Explore the relationship between the definite

Math 8 Winter 2015 Applications of Integration

Properties of Integrals, Indefinite Integrals. Goals: Definition of the Definite Integral Integral Calculations using Antiderivatives

Suppose we want to find the area under the parabola and above the x axis, between the lines x = 2 and x = -2.

Math 113 Exam 2 Practice

ACCESS TO SCIENCE, ENGINEERING AND AGRICULTURE: MATHEMATICS 1 MATH00030 SEMESTER /2019

Section 7.1 Integration by Substitution

Orthogonal Polynomials and Least-Squares Approximations to Functions

Riemann Integrals and the Fundamental Theorem of Calculus

The final exam will take place on Friday May 11th from 8am 11am in Evans room 60.

4.4 Areas, Integrals and Antiderivatives

W. We shall do so one by one, starting with I 1, and we shall do it greedily, trying

31.2. Numerical Integration. Introduction. Prerequisites. Learning Outcomes

Best Approximation in the 2-norm

Calculus II: Integrations and Series

Advanced Computational Fluid Dynamics AA215A Lecture 3 Polynomial Interpolation: Numerical Differentiation and Integration.

x = b a n x 2 e x dx. cdx = c(b a), where c is any constant. a b

1. Gauss-Jacobi quadrature and Legendre polynomials. p(t)w(t)dt, p {p(x 0 ),...p(x n )} p(t)w(t)dt = w k p(x k ),

Numerical integration

Chapter 3 Solving Nonlinear Equations

A REVIEW OF CALCULUS CONCEPTS FOR JDEP 384H. Thomas Shores Department of Mathematics University of Nebraska Spring 2007

Riemann Sums and Riemann Integrals

Transcription:

nd Simpson s

Mthemticl question we re interested in numericlly nswering How to we evlute I = f (x) dx? Clculus tells us tht if F(x) is the ntiderivtive of function f (x) on the intervl [, b], then I = f (x) dx = F (x) b = F (b) F (). Prcticlly, most integrls cnnot be evluted using this pproch. For exmple, 1 dx 1 + x 5 hs complicted ntiderivtive nd it esier to dopt numericl method to pproximte this integrl.

Integrtion: A Generl Frmework If you cnnot solve problem, then replce it with ner-by problem tht you cn solve! Our problem: Evlute I = f (x) dx. To do so, mny of the numericl schemes re bsed on replcing f (x) with some pproximte function f (x) so tht I f (x) dx = Ĩ. Exmple: f (x) could be n esy to integrte function pproximting f (x).

Integrtion: A Generl Frmework Then, the pproximtion error in this cse is E = I Ĩ = ( ) f (x) f (x) dx (b ) mx x b f (x) f (x) The inequlity bove tells us tht the pproximtion error E depends on: 1 the mximum error in the pproximting f (x) tht is mx x b f (x) f (x), nd 2 (b ), the width of the intervl. Next Gol: How to choose f (x)?

Polynomil Approximtions to f (x) Gol Choose n pproximtion f (x) to f (x) tht is esily integrble nd good pproximtion to f (x). Two nturl cndidtes: 1 Tylor polynomils pproximting f (x). One cvet: We need f (x) to hve derivtives t to exist of higher order to improve the pproximtion! 2 Interpolting polynomils pproximting f (x).

Exmple Exmple Consider evluting I = 1 e x2 dx Use the Tylor expnsion to pproximte f (x) = e x2. Tht is, f (x) = 1 + t + t2 2! + + tn n! + t n+1 (n + 1)! ec, t = x 2, }{{} reminder term R n(x) where c is n unknown number between nd t = x 2.

Solution Solution: I = + 1 1 Tking n = 3, we hve (1 + x 2 + x 4 x 2(n+1) (n + 1)! ec dx. 2! + + x 2n n! ) dx I = 1 + 1 3 + 1 1 + 1 + E = 1.4571 + E, 42 where E = 1 x 2(n+1) (n+1)! ec dx nd we need bound on this reminder term. < E e 24 1 x 8 dx = e 216 =.126.

Using Interpolting Polynomils In spite of the simplicity of the bove exmple, it is generlly more difficult to do numericl integrtion by constructing Tylor polynomil pproximtions thn by constructing polynomil interpoltes. Thus, we construct the function f (x) s the polynomil interpolting f (x) such tht f (x) dx f (x) dx. Cse I: Use liner interpolting polynomil p 1 (x) pproximting f (x) t two points. We pick nd b.

Using Liner Interpolting Polynomils f (x) = p 1 (x) where Thus, p 1 (x) = (b x)f () + (x )f (b). b f (x) dx p 1 (x) dx (b x)f () + (x )f (b) dx b [ ] f () + f (b) T 1 (f ) = b 2

Definition ( ) The integrtion rule f (x) dx b [ ] f () + f (b) = T 1 (f ) 2 is clled the trpezoidl rule.

Exmple using Exmple Evlute π/2 sin x dx using the trpezoidl rule. π/2 sin x dx π 4 [ ] sin + sin(π/2) = π/4.785. Since we know the true vlue I = π/2 sin x dx = cos(π/2) + cos() = 1, π/2 sin x dx T 1 (f ) = 1.785 =.215.

How to improve the ccurcy of the integrtion rule? An intuitive solution is to improve the ccurcy of f (x) by pplying the rule on smller subintervls of [, b] insted of pplying it to the originl intervl [, b] tht is pply it to integrls of f (x) on smller subintervls. For exmple, let c = +b 2 then, f (x) dx = c c 2 = h 2 f (x) dx + c [ f () + f (c) f (x) dx [ f () + 2f (c) + f (b) ] + b c 2 ] T 2 (f ), [ ] f (c) + f (b) where h = b 2.

Testing on the previous exmple Exmple Evlute I = π/2 sin x dx using the three point trpezoidl rule. Compute the pproximtion error I T 2 (f ). Plese use the Fundmentl theorem of clculus to directly clculte I. π/2 π/2 sin x dx π 8 [ ] sin + 2 sin(π/4) + sin(π/2).9481. sin x dx T 2 (f ) 1.9481 =.519.

Generl T n (f ) 1 We sw the trpezoidl rule T 1 (f ) for 2 points nd b. 2 The rule T 2 (f ) for 3 points involves three equidistnt points:, +b 2 nd b. 3 We observed the improvement in the ccurcy of T 2 (f ) over T 1 (f ) so inspired by this, we would like to pply this rule to n + 1 eqully spced points = x < x 1 < x 2 x n = b with the spce between ny two points being denoted by h tht is h = x i+1 x i, i =,, n.

Generl T n (f ) Definition [ 1 I h 2 f () + f (x 1) + f (x n 1 ) + f (b) ] T n (f ) 2 1 The subscript n refers to the number of subintervls being used; 2 the points x, x 1, x n re clled the numericl integrtion node points.

Performnce of T n (f ) f (x) = sin x we wnt to pproximte I = π/2 f (x) dx using the trpezoidl rule T n (f ) n T n (f ) I T n (f ) Rtio 1.785 2.15e-1 2.948 5.18e-2 4.13 4.987 1.29e-2 4.3 8.997 3.21e-3 4.1 16.999 8.3e-4 4. Note tht the errors re decresing by constnt fctor of 4. Why do we lwys double n?

How to improve the ccurcy of the integrtion rule? An intuitive solution is to improve the ccurcy of f (x) by using better interpolting polynomil sy qudrtic polynomil p 2 (x) insted. Let c = +b 2 nd h = b 2 then, the qudrtic polynomil is (x c)(x b) (x )(x b) p 2 (x) = f () + ( c)( b) (c )(c b) f (c) (x )(x c) + (b )(b c) f (b). f (x) dx = h 3 This is clled Simpson s rule. p 2 (x) dx [ ] f () + 4f (c) + f (b) S 2 (f ).

Simpson s rule pplied to the previous exmple Exmple Evlute π/2 sin x dx using the Simpson s rule. π/2 sin x dx π/2 [ ] sin + 4 sin(π/4) + sin(π/2) 3 1.227 π/2 sin x dx S 2 (f ) =.228.

Generl Simpson s S n (f ) Definition I h [ (f () + 4f (x1 ) + 2f (x 2 ) ) + 4f (x 3 ) + 2f (x 4 ) + 4f (x 5 ) 3 ] 4f (x n 1 ) + f (b) S n (f )

Performnce of S n (f ) For f (x) = sin x we wnt to pproximte I = π/2 f (x) dx using the Simpson s rule S n (f ) n S n (f ) I S n (f ) Rtio 2 1.227-2.28e-3 4 1.13-1.35e-4 16.94 8 1. -8.3e-6 16.22 16 1. -5.17e-7 16.6

Error Formuls: Theorem Let f (x) hve two continuous derivtives on [, b]. Then, E T n (f ) = f (x) dx T n (f ) = h2 (b ) f (c n ), 12 where c n lies in [, b]. The error decys in mnner proportionl to h 2. Thus doubling n (nd hlving h) should cuse the error to decrese by fctor of pproximtely 4. This is wht we observed with pst exmple.

Exmple Exmple Consider the tsk of evluting I = 2 dx 1 + x 2 using the trpezoidl rule T n (f ). How lrge should n be chosen in order to ensure tht E T n (f ) 5 1 6?

Exmple Proof. We begin by clculting the derivtives involved: f (x) = it is esy to check tht 2x (1 + x 2 ) 2, f 2 + 6x 2 (x) = (1 + x 2 ) 3, mx f (x) = 2 x 2 thus, En T (f ) = h2 (b ) f (c n ) 12 2h2 12 2 = h2 3. We bound f (c n ) since we do not know the exct vlue of c n nd hence, we must ssume the worst possible vlue of c n tht mkes the error formul the lrgest.

Proof Proof. When do we hve E T n (f ) 5 1 6? We need to choose h so smll tht h 2 3 5 1 6 which is possible if h.3873 (verify!). This is equivlent to choosing n = b h = 2 h 516.4. Thus, n 517 will mke the error smller thn 5 1 6.

Error Formuls: Simpson s Theorem Let f (x) hve four continuous derivtives on [, b]. Then, E S n (f ) = f (x) dx S n (f ) = h4 (b ) f (4) (c n ), 18 where c n lies in [, b]. The error decys in mnner proportionl to h 4. Thus doubling n should cuse the error to decrese by fctor of pproximtely 16. This is wht we observed with pst exmple.

Exmple Exmple Consider the tsk of evluting I = 2 dx 1 + x 2 using the Simpson s rule T n (f ). How lrge should n be chosen in order to ensure tht E S n (f ) 5 1 6?

Proof Proof. We compute the fourth derivtive f (4) (x) = 24 5x 4 1x 2 + 1 (1 + x 2 ) 5 mx f (4) (x) = f (4) () = 24. x 1 Thus, En S (f ) = h4 (b ) f (4) (c n ) 18 h4 2 4h4 24 = 18 15 5 1 6 provided h.658 or n 3.39, thus choosing n 32 will give the desired error bound. Compre with the trpezoidl rule: n 517!

One more exmple Consider the ppliction of trpezoidl rule to pproximte 1 x dx n En T (f ) Rtio En S (f ) Rtio 2 6.311e-2 2.86e-2 4 2.338e-2 2.7 1.12e-2 2.82 8 8.536e-3 2.77 3.587e-3 2.83 16 3.85e-3 2.78 1.268e-4 2.83 32 1.18e-3 2.8 4.485e-4 2.83 Observe tht the rte of convergence is slower since f (x) = x is not sufficiently differentible on [, 1]. Both converge t rte proportionl to h 1.5.