Lecture 23: Interpolatory Quadrature

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

Numerical Integration

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

Lecture 14: Quadrature

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

Review of Calculus, cont d

NUMERICAL INTEGRATION

Lecture 20: Numerical Integration III

Lecture 19: Continuous Least Squares Approximation

DOING PHYSICS WITH MATLAB MATHEMATICAL ROUTINES

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

Numerical Analysis: Trapezoidal and Simpson s Rule

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

3.4 Numerical integration

Construction of Gauss Quadrature Rules

1 The Lagrange interpolation formula

APPROXIMATE INTEGRATION

Best Approximation. Chapter The General Case

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

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

Lecture 14 Numerical integration: advanced topics

Lecture 12: Numerical Quadrature

The Regulated and Riemann Integrals

COSC 3361 Numerical Analysis I Numerical Integration and Differentiation (III) - Gauss Quadrature and Adaptive Quadrature

Numerical Integration

Math& 152 Section Integration by Parts

Numerical quadrature based on interpolating functions: A MATLAB implementation

Chapter 5. Numerical Integration

Review of basic calculus

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

Numerical integration

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

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

1 The Riemann Integral

COT4501 Spring Homework VII

5.7 Improper Integrals

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

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

Lecture 6: Singular Integrals, Open Quadrature rules, and Gauss Quadrature

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

Theoretical foundations of Gaussian quadrature

Definite integral. Mathematics FRDIS MENDELU

6.5 Numerical Approximations of Definite Integrals

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?

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

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

1 Error Analysis of Simple Rules for Numerical Integration

Orthogonal Polynomials

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...

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

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

Math 8 Winter 2015 Applications of Integration

Riemann Sums and Riemann Integrals

Chapter 3 Polynomials

Riemann Sums and Riemann Integrals

MA 124 January 18, Derivatives are. Integrals are.

Integrals - Motivation

Matrices, Moments and Quadrature, cont d

ODE: Existence and Uniqueness of a Solution

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

Section 6.1 Definite Integral

Abstract inner product spaces

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

Calculus I-II Review Sheet

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

Chapters 4 & 5 Integrals & Applications

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

The goal of this section is to learn how to use a computer to approximate definite integrals, i.e. expressions of the form. Z b

Lecture 4: Piecewise Cubic Interpolation

Numerical Methods I Orthogonal Polynomials

THE HANKEL MATRIX METHOD FOR GAUSSIAN QUADRATURE IN 1 AND 2 DIMENSIONS

Best Approximation in the 2-norm

The Riemann Integral

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

Tangent Line and Tangent Plane Approximations of Definite Integral

Numerical Analysis. Doron Levy. Department of Mathematics Stanford University

Discrete Least-squares Approximations

Physics 116C Solution of inhomogeneous ordinary differential equations using Green s functions

Overview of Calculus I

Chapter 0. What is the Lebesgue integral about?

Chapter 1. Basic Concepts

Monte Carlo method in solving numerical integration and differential equation

Sections 5.2: The Definite Integral

Main topics for the First Midterm

Math 131. Numerical Integration Larson Section 4.6

1 Part II: Numerical Integration

The First Fundamental Theorem of Calculus. If f(x) is continuous on [a, b] and F (x) is any antiderivative. f(x) dx = F (b) F (a).

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

Distance And Velocity

Improper Integrals, and Differential Equations

Chapter 3 Solving Nonlinear Equations

UNIFORM CONVERGENCE. Contents 1. Uniform Convergence 1 2. Properties of uniform convergence 3

MAT 168: Calculus II with Analytic Geometry. James V. Lambers

Recitation 3: More Applications of the Derivative

Math 113 Exam 2 Practice

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)

f(x)dx . Show that there 1, 0 < x 1 does not exist a differentiable function g : [ 1, 1] R such that g (x) = f(x) for all

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 ),

31.2. Numerical Integration. Introduction. Prerequisites. Learning Outcomes

INTRODUCTION TO INTEGRATION

Transcription:

Lecture 3: Interpoltory Qudrture. Qudrture. The computtion of continuous lest squres pproximtions to f C[, b] required evlutions of the inner product f, φ j = fxφ jx dx, where φ j is polynomil bsis function for P n. Often such integrls my be difficult or impossible to evlute exctly, so our next chrge is to develop lgorithms tht pproximte such integrls quickly nd ccurtely. This field is known s qudrture, nme tht suggests the pproximtion of the re under curve by re of subtending qudrilterls..1. Interpoltory Qudrture with Prescribed Nodes. Given f C[, b], we seek pproximtions to the definite integrl fx dx. If p n P n interpoltes f t n + 1 points in [, b], then we might hope tht fx dx p n x dx. This pproch is known s interpoltory qudrture. Will such rules produce resonble estimte to the integrl? Of course, tht depends on properties of f nd the interpoltion points. When we interpolte t eqully spced points, the formuls tht result re clled Newton Cotes qudrture rules. You encountered the most bsic method for pproximting n integrl when you lerned clculus: the Riemnn integrl is motivted by pproximting the re under curve by the re of rectngles tht touch tht curve, which gives rough estimte tht becomes incresingly ccurte s the width of those rectngles shrinks. This mounts to pproximting the function f by piecewise constnt interpolnt, nd then computing the exct integrl of the interpolnt. When only one rectngle is used to pproximte the entire integrl, we hve the most simple Newton Cotes formul. This pproch cn be improved in two complementry wys: incresing the degree of the interpolting polynomil, nd reducing the width of the subintervls over which ech interpolting polynomil pplies. The first pproch leds to the trpezoid rule nd Simpson s rule; the second yields composite rules, where the integrl over [, b] is split into the sum of integrls over subintervls. In mny cses, the function f my be firly regulr over prt of the domin [, b], but then hve some region of rpid growth or oscilltion. We ultimtely seek qudrture softwre tht utomticlly detects such regions, ensuring tht sufficient function evlutions re performed there without requiring excessive effort on res where f is well-behved. Such dptive qudrture procedures, discussed briefly t the end of these notes, re essentil for prcticl problems..1.1 Trpezoid Rule. The term qudrture is used to distinguish the numericl pproximtion of definite integrl from the numericl solution of n ordinry differentil eqution, which is often clled numericl integrtion. Approximtion of double integrl is sometimes clled cubture. For more detils on the topic of interpoltory qudrture, see Süli nd Myers, Chpter 7, which hs guided mny spects of our presenttion here. 7 October 9 3-1 M. Embree, Rice University

The trpezoid rule is simple improvement over pproximting the integrl by the re of single rectngle. A liner interpolnt to f cn be constructed, requiring evlution of f t the intervl end points x = nd x = b, p 1 x = f + fb f b The integrl of p 1 pproximtes the integrl of f: fb f p 1 x dx = f + b [ ] b fb f = fx + b = b f + fb. In summry, Trpezoid Rule: fx dx b x. x dx [ 1 x ] b f + fb. The procedure behind the trpezoid rule is illustrted in the following picture, where the re pproximting the integrl is colored gry. 1 1 3.57119... trpezoid 73.53... exct 1 Error bound for the trpezoid rule. To derive n error bound, we simply integrte the interpoltion error bound developed in Lecture 11. Tht bound ensured tht for ech x [, b], there exists some ξ [, b] such tht fx p 1 x = 1 f ξx x b. Note tht ξ will vry with x, which we emphsize by writing ξx below. Integrting, we obtin fx dx p 1 x dx = 1 f ξxx x b dx 7 October 9 3- M. Embree, Rice University

= 1 f η x x b dx = 1 f η 1 3 1 b + 1 b 1 b3 = 1 1 f ηb 3 for some η [, b]. The second step follows from the men vlue theorem for integrls. We shll develop much more generl theory from which we cn derive this error bound, plus bounds for more complicted schemes, too, in Lecture 3b. Exmple: fx = e x cos x + sin x. Here we demonstrte the difference between the error for liner interpoltion of function, fx = e x cos x + sin x, between two points, x = nd x 1 = h, nd the trpezoid rule pplied to the sme intervl. Our theory predicts tht liner interpoltion will hve n Oh error s h, while the trpezoid rule hs Oh 3 error. in Liner Iterpoltion nd Associted Qudrture Error 1 1 Error 1 1 1 1 1 1 Error in Liner Interpoltion, Oh Error in Trpezoid Qudrture, Oh 3 1 1 1 Intervl width, h=b 1 3.1. Simpson s rule. We expect tht better ccurcy cn be ttined by replcing the trpezoid rule s liner interpolnt with higher degree polynomil interpolnt to f over [, b]. This will increse the number of times we must evlute f often very costly, but hopefully will significntly decrese the error. Indeed it does by n even greter mrgin thn we might expect. Simpson s rule follows from using qudrtic pproximtion tht interpoltes f t, b, nd the midpoint + b/. If we use the Newton form of the interpolnt with x =, x 1 = b, nd The men vlue theorem for integrls sttes tht if h, g C[, b] nd h does not chnge sign on [, b], then there exists some η [, b] such tht R b gtht dt = gη R b ht dt. The requirement tht h not chnge sign is essentil. For exmple, if gt = ht = t then R 1 gtht dt = R 1 1 1 t dt = /3, yet R 1 ht dt = R 1 t dt =, so for ll 1 1 η [ 1, 1], gη R 1 ht dt = R 1 gtht dt = /3. 1 1 7 October 9 3-3 M. Embree, Rice University

x = + b/, we obtin p x = f + fb f b x + f f1 + b + fb b x x b. Simpson s rule then pproximtes the integrl of f with the integrl of p : p x dx = p 1 x dx + f f1 + b + fb b x x b dx = b f + fb + f f1 + b + fb b 3 b = b f + f 1 + b + fb, where we hve used the fct tht the first two terms of p re identicl to the liner pproximtion p 1 used bove for the trpezoid rule. In summry: Simpson s Rule: fx dx b f + f 1 + b + fb. The picture below shows n ppliction of Simpson s rule on [, b] = [, 1]. 1 1 7.91331... Simpson 73.53... exct 1 Error bound for Simpson s rule. Simpson s rule enjoys remrkble feture: though it only pproximtes f by qudrtic, it integrtes ny cubic polynomil exctly! One cn verify this by directly pplying Simpson s rule to generic cubic polynomil. In Lecture 3b, we shll derive the tools to compute n error bound for Simpson s rule: fx dx p x dx = 1 9 b 5 5 f η It turns out tht Newton Cotes formuls bsed on pproximting f by n even-degree polynomil lwys exctly integrte polynomils one degree higher. 7 October 9 3- M. Embree, Rice University

for some η [, b]. We emphsize tht lthough Simpson s rule is exct for cubics, the interpolting polynomil we integrte relly is qudrtic. Though this should be cler from the discussion bove, you might find it helpful to see this grphiclly. Both plots below show cubic function f solid line nd its qudrtic interpolnt dshed line. On the left, the re under f is colored gry its re is the integrl we wish to compute. On the right, the re under the interpolnt is colored gry. Accounting re below the x xis s negtive, both integrls give n identicl vlue. It is remrkble tht this is the cse for ll cubics. 3.5 3.5 3 3.5.5 1.5 1.5 1 1.5.5.5.5 1 1 1.5 1 1 1.5 1 1 exct integrl Simpson s rule.1.3 Clenshw Curtis qudrture. To get fster convergence for fixed number of function evlutions, one might wish to increse the degree of the pproximting polynomil still further, then integrte tht high-degree polynomil. As we lerned in our study of polynomil interpoltion, the success of such n pproch depends significntly on the choice of the interpoltion points. For exmple, we would not expect to get n ccurte nswer by integrting high degree polynomil tht interpoltes Runge s function fx = x + 1 1 over uniformly spced points on [ 5, 5]. One expects to get better results by integrting the interpolnt to f t Chebyshev points. This procedure is known s Clenshw Curtis qudrture. The formuls get bit intricte, but the results re fntstic if f is smooth e.g., nlytic in region of the complex plne contining [, b]..1. Composite rules. As n lterntive to integrting high-degree polynomil, one cn pursue simpler pproch tht is often very effective: Brek the intervl [, b] into subintervls, nd pply the trpezoid rule or Simpson s rule on ech subintervl. Applying the trpezoid rule gives fx dx = n xj x j 1 fx dx n x j x j 1 fx j 1 + fx j. The stndrd implementtion ssumes tht f is evluted t uniformly spced points between See L. N. Trefethen, Is Guss Qudrture Better thn Clenshw Curtis?, SIAM Review 5 7 7. 7 October 9 3-5 M. Embree, Rice University

nd b, x j = + jh for j =,..., n nd h = b /n, giving the following fmous formultion: Composite Trpezoid: fx dx h n 1 f + f + jh + fb. Of course, one cn redily djust this rule to cope with irregulrly spced points. The error in the composite trpezoid rule cn be derived by summing up the error in ech ppliction of the trpezoid rule: fx dx h n 1 f + f + jh + fb = n 1 1 f η j x j x j 1 3 = h3 1 n f η j for η j [x j 1, x j ]. We cn simplify these f terms by noting tht 1 n n f η j is the verge of n vlues of f evluted t points in the intervl [, b]. Nturlly, this verge cnnot exceed the mximum or minimum vlue tht f ssumes on [, b], so there exist points ξ 1, ξ [, b] such tht f ξ 1 1 n n f η j f ξ. Thus the intermedite vlue theorem gurntees the existence of some η [, b] such tht f η = 1 n n f η j. The composite trpezoid error bound thus simplifies to fx dx h n 1 f + f + jh + fb = h 1 b f η. This error nlysis hs n importnt consequence: the error for the composite trpezoid rule is only Oh, not the Oh 3 we sw for the usul trpezoid rule in which cse b = h since n = 1. Similr nlysis cn be performed to derive the composite Simpson s rule. We now must ensure tht n is even, since ech intervl on which we pply the stndrd Simpson s rule hs width h. Simple lgebr leds to the formul Composite Simpson: fx dx h n/ f + 3 n/ 1 f+j 1h + f+jh + fb. Derivtion of the error formul for the composite Simpson s rule follows the sme strtegy s the nlysis of the composite trpezoid rule. One obtins fx dx h n/ f + 3 n/ 1 f + j 1h + f + jh + fb = h 1 b f η 7 October 9 3- M. Embree, Rice University

for some η [, b]. The illustrtions below compre the composite trpezoid nd Simpson s rules for the sme number of function evlutions. One cn see tht Simpson s rule, in this typicl cse, gives the better ccurcy. 1 1 73.335... composite trpezoid 73.53... exct 1 1 73.5751... composite Simpson 73.53... exct 1 1 Next we present MATLAB script implementing the composite trpezoid rule; Simpson s rule is strightforwrd modifiction tht is left s n exercise. To get the stndrd not composite trpezoid rule, cll trpezoid with N=1. function intf = trpezoidf,, b, N % Composite trpezoid rule to pproximte the integrl of f from to b. % Uses N+1 function evlutions N>1; h=b-/n. h = b-/n; intf = ; intf = fevlf,+fevlf,b/; for :N-1 intf = intf + fevlf,+j*h; end intf = intf*h; Puse moment for reflection. Suppose you re willing to evlute f fixed number of times. How cn you get the most bng for your buck? If f is smooth, rule bsed on high-order interpolnt such s Clenshw Curtis qudrture, or the Gussin qudrture rules we will present in few lectures re likely to give the best result. If f is not smooth e.g., with kinks, discontinuous derivtives, etc., then robust composite rule would be good option. A fmous specil cse: If the function f is sufficiently smooth nd is periodic with period b, then the trpezoid rule converges exponentilly. Adptive Qudrture. If f is continuous, we cn ttin rbitrrily high ccurcy with composite rules by tking the spcing between function evlutions, h, to be sufficiently smll. This might 7 October 9 3-7 M. Embree, Rice University

be necessry to resolve regions of rpid growth or oscilltion in f. If such regions only mke up smll proportion of the domin [, b], then uniformly reducing h over the entire intervl will be unnecessrily expensive. One wnts to concentrte function evlutions in the region where the function is the most ornery. Robust qudrture softwre djusts the vlue of h loclly to hndle such regions. To lern more bout such techniques, which re not foolproof, see W. Gnder nd W. Gutschi, Adptive qudrture revisited, BIT 11. MATLAB s qudrture routines. The MATLAB qudrture routine qud implements n dptive composite Simpson s rule. A different qudrture routine, qudl, uses Gussin qudrture, which we shll tlk bout few clsses from now. The following illustrtions show MATLAB s dptive qudrture rule t work. On the left, we hve function tht vries smoothly over most of the domin, but oscilltes wildly over 1% the region of interest. The plot on the right is histogrm of the number of function evlutions used by MATLAB s qud. Clerly, this routine uses mny more function evlutions in the region where the function oscilltes most rpidly qud identified this region itself; the user only supplies the region of integrtion [, b]. f x 1 1 x number of evlutions of fx 35 3 5 15 1 5 1 x This pper criticizes the routines qud nd qud tht were included in MATLAB version 5. In light of this nlysis MATLAB improved its softwre, essentilly incorporting the two routines suggested in this pper in version s the routines qud nd qudl. 7 October 9 3- M. Embree, Rice University