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

Similar documents
Orthogonal Polynomials

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

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

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

NUMERICAL INTEGRATION

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

Interpolation. Gaussian Quadrature. September 25, 2011

Numerical Analysis: Trapezoidal and Simpson s Rule

Numerical Integration

Construction of Gauss Quadrature Rules

Numerical integration

Numerical quadrature based on interpolating functions: A MATLAB implementation

1 The Riemann Integral

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

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

Lecture 14: Quadrature

Numerical Integration

Lecture 14 Numerical integration: advanced topics

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

Math& 152 Section Integration by Parts

COT4501 Spring Homework VII

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

Numerical Methods I Orthogonal Polynomials

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

Theoretical foundations of Gaussian quadrature

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

Definite integral. Mathematics FRDIS MENDELU

6.5 Numerical Approximations of Definite Integrals

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

3.4 Numerical integration

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

Chapter 3 Polynomials

DOING PHYSICS WITH MATLAB MATHEMATICAL ROUTINES

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

1 The Lagrange interpolation formula

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

Lecture 12: Numerical Quadrature

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

Review of Gaussian Quadrature method

Best Approximation. Chapter The General Case

Orthogonal Polynomials and Least-Squares Approximations to Functions

Discrete Least-squares Approximations

20 MATHEMATICS POLYNOMIALS

1 Probability Density Functions

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?

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

Riemann Sums and Riemann Integrals

Lecture 19: Continuous Least Squares Approximation

Lecture 23: Interpolatory Quadrature

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

Riemann Sums and Riemann Integrals

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

Review of Calculus, cont d

Lecture 20: Numerical Integration III

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

Polynomial Approximations for the Natural Logarithm and Arctangent Functions. Math 230

The Regulated and Riemann Integrals

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

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

Lecture Notes: Orthogonal Polynomials, Gaussian Quadrature, and Integral Equations

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

Abstract inner product spaces

Midpoint Approximation

Continuous Random Variables

1 Error Analysis of Simple Rules for Numerical Integration

Best Approximation in the 2-norm

Math 8 Winter 2015 Applications of Integration

Section 7.1 Integration by Substitution

Improper Integrals. Type I Improper Integrals How do we evaluate an integral such as

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

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

a < a+ x < a+2 x < < a+n x = b, n A i n f(x i ) x. i=1 i=1

CS667 Lecture 6: Monte Carlo Integration 02/10/05

APPROXIMATE INTEGRATION

INTRODUCTION TO INTEGRATION

Chapter 5. Numerical Integration

The Fundamental Theorem of Calculus. The Total Change Theorem and the Area Under a Curve.

p(x) = 3x 3 + x n 3 k=0 so the right hand side of the equality we have to show is obtained for r = b 0, s = b 1 and 2n 3 b k x k, q 2n 3 (x) =

Chapters 4 & 5 Integrals & Applications

Matrices, Moments and Quadrature, cont d

Lecture 1: Introduction to integration theory and bounded variation

Taylor Polynomial Inequalities

Lecture 3 Gaussian Probability Distribution

The Riemann Integral

B.Sc. in Mathematics (Ordinary)

CAAM 453 NUMERICAL ANALYSIS I Examination There are four questions, plus a bonus. Do not look at them until you begin the exam.

Math 113 Exam 2 Practice

Sections 5.2: The Definite Integral

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

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

Chapter 5 : Continuous Random Variables

Chapter 0. What is the Lebesgue integral about?

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

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

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

MORE FUNCTION GRAPHING; OPTIMIZATION. (Last edited October 28, 2013 at 11:09pm.)

Chapter 6 Notes, Larson/Hostetler 3e

Lab 11 Approximate Integration

Section Areas and Distances. Example 1: Suppose a car travels at a constant 50 miles per hour for 2 hours. What is the total distance traveled?

7.2 The Definite Integral

Transcription:

Lecture 17 Integrtion: Guss Qudrture Dvid Semerro University of Illinois t Urbn-Chmpign Mrch 0, 014 Dvid Semerro (NCSA) CS 57 Mrch 0, 014 1 / 9

Tody: Objectives identify the most widely used qudrture method is it chep? is it effective? how does it compre to Newton-Cotes (Trpezoid, Simpson, etc)? Mteril Section 5.4 Dvid Semerro (NCSA) CS 57 Mrch 0, 014 / 9

Qudrture up until now, our qudrture methods were of the form f (x) dx n w j f (x j ) j=0 where x j re eqully spced nodes Trpezoid: Simpson: f (x) dx b 6 f (x) dx b f () + b f (b) (b ) f () + f ( + b Similr for higher order polynomil Newton-Cotes rules ) + b 6 f (b) Dvid Semerro (NCSA) CS 57 Mrch 0, 014 / 9

Qudrture with Freedom! These qudrture rules hve one thing in common: they re restrictive e.g. Simpson: f (x) dx b 6 (b ) f () + f ( + b ) + b 6 f (b) Trpezoid, Simpson, etc (Newton-Cotes) re bsed on eqully spced nodes We know one thing lredy from interpoltion: eqully spced nodes result in wiggle. Wht other choice do we hve? (...recll how we fixed wiggle in interpoltion: by moving the loction of the nodes) Dvid Semerro (NCSA) CS 57 Mrch 0, 014 4 / 9

Gussin Qudrture free ourselves from eqully spced nodes combine selection of the nodes nd selection of the weights into one qudrture rule Gussin Qudrture Choose the nodes nd coefficients optimlly to mximize the degree of precision of the qudrture rule: f (x) dx n w j f (x j ) j=0 Gol Seek w j nd x j so tht the qudrture rule is exct for relly high polynomils Dvid Semerro (NCSA) CS 57 Mrch 0, 014 5 / 9

Gussin Qudrture f (x) dx n w j f (x j ) j=0 we hve n + 1 points x j [, b], x 0 < x 1 < < x n < x n b. we hve n + 1 rel coefficients w j so there re n + totl unknowns to tke cre of there were only unknowns in the cse of trpezoid ( weights) there were only unknowns in the cse of Simpson ( weights) there were only n + 1 unknowns in the cse of generl Newton-Cotes (n + 1 weights) Dvid Semerro (NCSA) CS 57 Mrch 0, 014 6 / 9

Gussin Qudrture f (x) dx n w j f (x j ) j=0 we hve n + 1 points x j [, b], x 0 < x 1 < < x n < x n b. we hve n + 1 rel coefficients w j so there re n + totl unknowns to tke cre of there were only unknowns in the cse of trpezoid ( weights) there were only unknowns in the cse of Simpson ( weights) there were only n + 1 unknowns in the cse of generl Newton-Cotes (n + 1 weights) n + unknowns (using n + 1 nodes) cn be used to exctly interpolte nd integrte polynomils of degree up to n + 1 Dvid Semerro (NCSA) CS 57 Mrch 0, 014 6 / 9

Better Nodes Exmple The first thing we do is SIMPLIFY consider the cse of n = 1 (-point) consider [, b] = [, 1] for simplicity we know how the trpezoid rule works Question: cn we possibly do better using only function evlutions? Gol: Find w 0, w 1, x 0, x 1 so tht is s ccurte s possible... f (x) dx w 0 f (x 0 ) + w 1 f (x 1 ) Dvid Semerro (NCSA) CS 57 Mrch 0, 014 7 / 9

Grphicl View Consider x + 1 dx = 4.75 1 Dvid Semerro (NCSA) CS 57 Mrch 0, 014 8 / 9

Derive... Agin, we re considering [, b] = [, 1] for simplicity: f (x) dx w 0 f (x 0 ) + w 1 f (x 1 ) Gol: find w 0, w 1, x 0, x 1 so tht the pproximtion is exct up to cubics. So try ny cubic: This implies tht: f (x) = c 0 + c 1 x + c x + c x f (x) dx = ( c0 + c 1 x + c x + c x ) dx ( = w 0 c0 + c 1 x 0 + c x 0 + c x0) + ( ) w 1 c0 + c 1 x 1 + c x 1 + c x 1 Dvid Semerro (NCSA) CS 57 Mrch 0, 014 9 / 9

Derive... f (x) dx = ( c0 + c 1 x + c x + c x ) dx ( = w 0 c0 + c 1 x 0 + c x 0 + c x0) + ( ) w 1 c0 + c 1 x 1 + c x 1 + c x 1 Rerrnge into constnt, liner, qudrtic, nd cubic terms: ) 1 c 0 (w 0 + w 1 dx c (w 0 x 0 + w 1 x 1 x dx ) ) 1 + c 1 (w 0 x 0 + w 1 x 1 x dx + ( ) 1 + c w 0 x 0 + w 1 x 1 x dx = 0 Since c 0, c 1, c nd c re rbitrry, then their coefficients must ll be zero. Dvid Semerro (NCSA) CS 57 Mrch 0, 014 10 / 9

Derive... This implies: w 0 + w 1 = w 0 x 0 + w 1 x 1 = Some lgebr leds to: dx = w 0 x 0 + w 1 x 1 = x dx = x dx = 0 w 0 x 0 + w 1 x 1 = x dx = 0 Therefore: w 0 = 1 w 1 = 1 x 0 = x 1 = ( ) ( ) f (x) dx f + f Dvid Semerro (NCSA) CS 57 Mrch 0, 014 11 / 9

Over nother intervl? ( ) ( ) f (x) dx f + f f (x) dx? integrting over [, b] insted of [, 1] needs trnsformtion: chnge of vribles wnt t = c 1 x + c 0 with t = t x = nd t = 1 t x = b let t = b x b+ b (verify) let x = b t + b+ then dx = b dt Dvid Semerro (NCSA) CS 57 Mrch 0, 014 1 / 9

Over nother intervl? f (x) dx? let x = b t + b+ then dx = b dt f (x) dx = now use the qudrture formul over [, 1] ( ) (b )t + b + b f dt note: using two points, n = 1, gve us exct integrtion for polynomils of degree less *1+1 = nd less. Dvid Semerro (NCSA) CS 57 Mrch 0, 014 1 / 9

Over nother intervl? Previous exmple... 1 x + 1 dx = 4.75 1 f (x)dx = 1 [ 1 f ( ) t + f dt ( ) + + f ( )] where x = +t Dvid Semerro (NCSA) CS 57 Mrch 0, 014 14 / 9

Over nother intervl? Evluting... 1 [ x + 1 dx 1 f [ ( 1 f 1 x + 1 dx ( + 9 + 6 ) ) + f + f ( ( 9 6 )] )] 1 [f (1.788651) + f (1.115)] 1 [6.78 +.77787] = 4.749885 where f (x) = x + 1 Dvid Semerro (NCSA) CS 57 Mrch 0, 014 15 / 9

Extending Guss Qudrture we need more to mke this work for more thn two points A sensible qudrture rule for the intervl [, 1] bsed on 1 node would use the node x = 0. This is root of φ(x) = x Notice: ± 1 re the roots of φ(x) = x 1 generl φ(x)? Dvid Semerro (NCSA) CS 57 Mrch 0, 014 16 / 9

Guss Qudrture Theorem Krl Friedrich Guss proved the following result: Let q(x) be nontrivil polynomil of degree n + 1 such tht x k q(x)dx = 0 (0 k n) nd let x 0, x 1,..., x n be the zeros of q(x). Then f (x)dx n A i f (x i ), A i = i=0 l i (x)dx will be exct for ll polynomils of degree t most n + 1. Dvid Semerro (NCSA) CS 57 Mrch 0, 014 17 / 9

Sketch of Proof Let f (x) be polynomil of degree n + 1. Then we cn write f (x) = p(x)q(x) + r(x), where p(x) nd r(x) re of degree t most n (This is bsiclly dividing f by q with reminder r). Then by the hypothesis, p(x)q(x)dx = 0. Further, f (x i ) = p(x i )q(x i ) + r(x i ) = r(x i ). Thus, f (x)dx = r(x)dx n f (x i ) i=0 l i (x)dx But this is exct becuse r(x) is (t most) degree n polynomil. Thus, we need to find the polynomils q(x). Dvid Semerro (NCSA) CS 57 Mrch 0, 014 18 / 9

Orthogonl Polynomils Orthogonlity of Functions Two functions g(x) nd h(x) re orthogonl on [, b] if g(x)h(x) dx = 0 so the nodes we re using re roots of orthogonl polynomils these re the Legendre Polynomils Dvid Semerro (NCSA) CS 57 Mrch 0, 014 19 / 9

Legendre Polynomils given on the exm φ 0 = 1 φ 1 = x φ = x 1 φ = 5x x. In generl: φ n (x) = n 1 n xφ n (x) n 1 n φ n (x) Dvid Semerro (NCSA) CS 57 Mrch 0, 014 0 / 9

1 0.75 0.5 0.5 1-0.75-0.5-0.5 0 0.5 0.5 0.75 1-0.5-0.5-0.75-1 Notes on Legendre Roots The Legendre Polynomils re orthogonl (nice!) The Legendre Polynomils increse in polynomils order (like monomils) The Legendre Polynomils don t suffer from poor conditioning (unlike monomils) The Legendre Polynomils don t hve closed form expression (recursion reltion is needed) The roots of the Legendre Polynomils re the nodes for Gussin Qudrture (GL nodes) Dvid Semerro (NCSA) CS 57 Mrch 0, 014 1 / 9

Qudrture Nodes (see) Often listed in tbles Weights determined by extension of bove Roots re symmetric in [, 1] Exmple: 1 if(n==0) x = 0; w = ; if(n==1) 4 x(1) = -1/sqrt(); x() = -x(1); 5 w(1) = 1; w() = w(1); 6 if(n==) 7 x(1) = -sqrt(/5); x() = 0; x() = -x(1); 8 w(1) = 5/9; w() = 8/9; w() = w(1); 9 if(n==) 10 x(1) = -0.861161159405; x(4) = -x(1); 11 x() = -0.998104584856; x() = -x(); 1 w(1) = 0.4785484517454; w(4) = w(1); 1 w() = 0.6514515486546; w() = w(); 14 if(n==4) 15 x(1) = -0.90617984598664; x(5) = -x(1); 16 x() = -0.584691010568; x(4) = -x(); 17 x() = 0; 18 w(1) = 0.696885056189; w(5) = w(1); 19 w() = 0.4786867049966; w(4) = w(); 0 w() = 0.568888888888889; 1 if(n==5) x(1) = -0.9469514015; x(6) = -x(1); x() = -0.661098646665; x(5) = -x(); 4 x() = -0.861918608197; x(4) = -x(); 5 w(1) = 0.17144979170; w(6) = w(1); 6 w() = 0.607615704819; w(5) = w(); 7 w() = 0.467919457691; w(4) = w(); Dvid Semerro (NCSA) CS 57 Mrch 0, 014 / 9

View of Nodes Order 1.0000 1.0000 Order 0.5556 0.8889 0.5556 Order 4 0.479 0.651 0.651 0.479 Order 5 0.69 0.4786 0.5689 0.4786 0.69 Order 6 0.171 0.608 0.4679 0.4679 0.608 0.171-1 -0.5 0 0.5 1 Dvid Semerro (NCSA) CS 57 Mrch 0, 014 / 9

Theory The connection between the roots of the Legendre polynomils nd exct integrtion of polynomils is estblished by the following theorem. Theorem Suppose tht x 0, x 1,..., x n re roots of the nth Legendre polynomil P n (x) nd tht for ech i = 0, 1,..., n the numbers w i re defined by w i = n j = 0 j i x x 1 j dx = l i (x) dx x i x j Then f (x)dx = n w i f (x i ), where f (x) is ny polynomil of degree less or equl to n + 1. i=0 Dvid Semerro (NCSA) CS 57 Mrch 0, 014 4 / 9

Do not!!!! When evluting qudrture rule f (x)dx = n w i f (x i ). i=0 do not generte the nodes nd weights ech time. Use lookup tble... Dvid Semerro (NCSA) CS 57 Mrch 0, 014 5 / 9

Exmple.5 Approximte x ln x dx using Gussin qudrture with n = 1. 1 ( 1 ) ( ) Solution As derived erlier we wnt to use f (x) dx f + f From erlier we know tht we re interested in.5 ( ) (1.5 1)t + (1.5 + 1) 1.5 1 f (x) dx = f dt 1 Therefore, we re looking for the integrl of 1 1 ( ) x + 5 f dx = 1 ( ) ( ) x + 5 x + 5 ln dx 4 4 4 4 4 Using Gussin qudrture, our numericl integrtion becomes: ( ) ( ) ( ) ( ) 1 + 5 + 5 + 5 + 5 ln + ln = 0.19687 4 4 4 4 4 Dvid Semerro (NCSA) CS 57 Mrch 0, 014 6 / 9

Exmple Approximte 0 x e x dx using Gussin qudrture with n = 1. Solution We gin wnt to convert our limits of integrtion to -1 to 1. Using the sme process s the erlier exmple, we get: 0 x e x dx = 1 ( ) t + 1 e (t+1)/ dt. Using the Gussin roots we get: ( 1 x e x dx 1 + 1 0 ) ( e ( +1)/ + + 1 ) e ( +1)/ = 0.1594104 Dvid Semerro (NCSA) CS 57 Mrch 0, 014 7 / 9

Numericl Question How does n point Guss qudrture compre with n point Newton-Cotes... Dvid Semerro (NCSA) CS 57 Mrch 0, 014 8 / 9

Exmples with Python... Exmple int guss.py: bse routine for Guss qudrture Exmple int guss test.py: integrte 5 0 xe x dx with 1 1 subintervl, incresing number of nodes nodes, increses number of intervls (pnels) Result: fewer totl evlutions in GL qudrture with 1 subintervl nd mny nodes versus nodes nd mny subpnels. Also more ccurte. Dvid Semerro (NCSA) CS 57 Mrch 0, 014 9 / 9