Section 6.6 Gaussian Quadrature

Similar documents
Integration. Topic: Trapezoidal Rule. Major: General Engineering. Author: Autar Kaw, Charlie Barker.

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

MA2501 Numerical Methods Spring 2015

8.3 Numerical Quadrature, Continued

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

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

Romberg Integration and Gaussian Quadrature

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

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

Numerical Integra/on

In numerical analysis quadrature refers to the computation of definite integrals.

COURSE Numerical integration of functions

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

Numerical Integra/on

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

X. Numerical Methods

MA6452 STATISTICS AND NUMERICAL METHODS UNIT IV NUMERICAL DIFFERENTIATION AND INTEGRATION

3. Numerical integration

Numerical Analysis Preliminary Exam 10 am to 1 pm, August 20, 2018

Jim Lambers MAT 460/560 Fall Semester Practice Final Exam

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

Numerical Methods and Computation Prof. S.R.K. Iyengar Department of Mathematics Indian Institute of Technology Delhi

5 Numerical Integration & Dierentiation

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

APPM/MATH Problem Set 6 Solutions

Exact and Approximate Numbers:

18.01 EXERCISES. Unit 3. Integration. 3A. Differentials, indefinite integration. 3A-1 Compute the differentials df(x) of the following functions.

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

6 Lecture 6b: the Euler Maclaurin formula

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

5.3 Definite Integrals and Antiderivatives

April 15 Math 2335 sec 001 Spring 2014

12.0 Properties of orthogonal polynomials

NUMERICAL INTEGRATION. By : Dewi Rachmatin

A New Integration Method Providing the Accuracy of Gauss-Legendre with Error Estimation Capability (rev.)

Differentiation and Integration

Numerical Integration exact integration is not needed to achieve the optimal convergence rate of nite element solutions ([, 9, 11], and Chapter 7). In

Ch. 03 Numerical Quadrature. Andrea Mignone Physics Department, University of Torino AA

Scientific Computing

Numerical techniques to solve equations

8.5 Taylor Polynomials and Taylor Series

Physics 200 Lecture 4. Integration. Lecture 4. Physics 200 Laboratory

Mathematics for Engineers. Numerical mathematics

Digital Wideband Integrators with Matching Phase and Arbitrarily Accurate Magnitude Response (Extended Version)

Numerical Methods I: Numerical Integration/Quadrature

Gregory's quadrature method

4.9 APPROXIMATING DEFINITE INTEGRALS

Principles of Scientific Computing Local Analysis

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.

BACHELOR OF COMPUTER APPLICATIONS (BCA) (Revised) Term-End Examination December, 2015 BCS-054 : COMPUTER ORIENTED NUMERICAL TECHNIQUES

MTH101 Calculus And Analytical Geometry Lecture Wise Questions and Answers For Final Term Exam Preparation

Math 107H Fall 2008 Course Log and Cumulative Homework List

Page 404. Lecture 22: Simple Harmonic Oscillator: Energy Basis Date Given: 2008/11/19 Date Revised: 2008/11/19

Engg. Math. II (Unit-IV) Numerical Analysis

Infinite Series. 1 Introduction. 2 General discussion on convergence

Numerical Methods. King Saud University

To find an approximate value of the integral, the idea is to replace, on each subinterval

GAUSS-LAGUERRE AND GAUSS-HERMITE QUADRATURE ON 64, 96 AND 128 NODES

Fixed point iteration and root finding

NUMERICAL COMPUTATION IN SCIENCE AND ENGINEERING

Answers to Homework 9: Numerical Integration

Scientific Computing: An Introductory Survey

Outline. 1 Interpolation. 2 Polynomial Interpolation. 3 Piecewise Polynomial Interpolation

Multistage Methods I: Runge-Kutta Methods

Pascal s Triangle on a Budget. Accuracy, Precision and Efficiency in Sparse Grids

Method of Finite Elements I

Chapter 5 - Quadrature

Practice Exam 2 (Solutions)

MATHEMATICAL FORMULAS AND INTEGRALS

PHYS-4007/5007: Computational Physics Course Lecture Notes Appendix G

In manycomputationaleconomicapplications, one must compute thede nite n

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

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

Lecture 28 The Main Sources of Error

Math 1132 Practice Exam 1 Spring 2016

x x2 2 + x3 3 x4 3. Use the divided-difference method to find a polynomial of least degree that fits the values shown: (b)

arxiv: v1 [physics.comp-ph] 22 Jul 2010

MATH 1242 FINAL EXAM Spring,

Contents. I Basic Methods 13

Quantum Mechanics-I Prof. Dr. S. Lakshmi Bala Department of Physics Indian Institute of Technology, Madras. Lecture - 21 Square-Integrable Functions

ONE - DIMENSIONAL INTEGRATION

MA 3021: Numerical Analysis I Numerical Differentiation and Integration

DIFFERENTIATION RULES

Physics 115/242 Romberg Integration

Chapter 8: Techniques of Integration

Virtual University of Pakistan

Research Computing with Python, Lecture 7, Numerical Integration and Solving Ordinary Differential Equations

t dt Estimate the value of the integral with the trapezoidal rule. Use n = 4.

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

Spring 2012 Introduction to numerical analysis Class notes. Laurent Demanet

Some notes on Chapter 8: Polynomial and Piecewise-polynomial Interpolation

d 1 µ 2 Θ = 0. (4.1) consider first the case of m = 0 where there is no azimuthal dependence on the angle φ.

NATIONAL UNIVERSITY OF SINGAPORE PC5215 NUMERICAL RECIPES WITH APPLICATIONS. (Semester I: AY ) Time Allowed: 2 Hours

Numerical Analysis Exam with Solutions

Extrapolation in Numerical Integration. Romberg Integration

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

n = 4: 0 2( ) (4 0) ( t 2.67%) 8

Algebra I. abscissa the distance along the horizontal axis in a coordinate graph; graphs the domain.

Numerical Integration of Functions

19.4 Spline Interpolation

Transcription:

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

Most of the numerical integration methods described so far are based on a rather simple choice of evaluation points for the function f(x). Namely the points are equispaced. They are particularly suited for regularly tabulated data, such as one might measure in a laboratory, or obtain from computer software designed to produce tables. If one has the freedom to choose the points at which to evaluate f(x), a careful choice can lead to much more accuracy in evaluating the integral in question. In this case we must have an expression (formula) for the integrand f(x). We shall see that this method, called Gaussian or Gauss-Legendre integration, has one significant further advantage in many situations. In the evaluation of an integral on the interval [a, b], it is not necessary to evaluate f(x) at the endpoints, ie. at a or b, of the interval. This will prove valuable when evaluating various improper integrals, such as those with infinite limits. (So Gaussian quadrature formulas are open.) Portions adapted from http://pathfinder.scar.utoronto.ca/~dyer/csca57/book_p/node44.html

Previously we saw that the concept of Newton-Cotes quadrature was developed so that the value of the definite integral is approximated by the quadrature rule The x i are called abscissas and are selected as equally spaced points within the integration interval [a, b]. The weights, w i, are then found by integrating the polynomial which interpolates the integrand at the abscissas. The degree of precision of the resulting rule is n when n is odd and n + 1 when n is even. In the Gaussian quadrature approach to numerical integration, the abscissas and weights are selected so as to achieve the highest possible degree of precision. That means the abscissas and weights are both to be determined. Here we apply the method of undetermined coefficients like we did for some quadrature problems previously, but this time we encounter a nonlinear system to solve for the abscissas and weights.

For determining Gaussian quadrature rules with n > 1, it is to our advantage to replace the general integration interval of [a, b] with a standardized interval, the most common choice for which is [-1, 1]. With such an interval we can exploit the symmetries in the problem to simplify the solution of the nonlinear system of equations for the abscissas and weights. The conversion from the integral to an integral of the form is most easily accomplished by the change of variable The resulting relationship between the two integrals is then

The general case: Given a positive integer n, what is the largest integer k such that there exist abscissas x 1, x 2,..., x n and weights c 1, c 2,..., c n so that for every polynomial f(x) with degree k? We first consider the case n = 2. Determine the largest value of k so that there exist values x 1, x 2 and c 1, c 2 such that is true for all polynomials f(x) with degree k. We proceed by using the method of undetermined coefficients. {Notation: P k is the vector space of all polynomials of degree k or less.}

Since integration is a linear operation and P k is a vector space, we need only investigate this relation on a basis for P k. Let's take the standard basis {1, x, x 2,..., x k } for P k. This basis has k + 1 members; that is, dim(p k ) = k + 1. We look at the following cases: The expressions in (2) and (3) lead to the system of equations which is a nonlinear system with two equations in four unknowns x 1, x 2 and c 1, c 2. We suspect that such a system will have many solutions and that we should choose k so that we have a system with the same number of equations as unknowns. Since dim(p k ) = k + 1, we suspect that k + 1 = 4 = 2n, that is k = 3. Thus we will adjoin two more equations to those in (4) as follows:

We have the nonlinear system From MATLAB we have >> syms c1 c2 x1 x2; >> [Sx1,Sx2,Sc1,Sc2]=solve(c1+c2==2,c1*x1+c2*x2==0,c1*x1^2+c2*x2^2==2/3,c1*x1^3+c2*x2^3 ==0,x1,x2,c1,c2) Sx1 = Sx2 = Sc1 = Sc2 = 3^(1/2)/3-3^(1/2)/3 1 1-3^(1/2)/3 3^(1/2)/3 1 1 This tells us we have two solutions: Note the symmetry in the x-coordinates. Since we are in interval [-1, 1] we choose to use

Thus the Gaussian quadrature rule for the case n = 2 is It can be shown that the error term is Converting this rule back to the more general integration interval [a; b] produces We replace this integral by the approximation plus the error term. 1 So we replace t by - one function evaluation and 3 1 by in the other evaluation. 3

In the error terms we need to apply the chain rule to accommodate the change of variable 4 4 4 d d dx b - a d d b - a d = = ==> = dt dx dt 2 dx dt 2 dx 4 4 5 135 * 2 = 4320 b - a Note the 2 multiplier in front of the square bracket here.

Example: Approximate ln(2) One way to approximate the value of ln(2) is to approximate the value of the integral Using the two-point Gaussian quadrature rule and noting that for this problem a = 1, b = 2 and f(x) = 1/x, we obtain the approximation Even with only two function evaluations, the absolute error in this approximation is 8.394E-4. (ln(2) 0.6931471806)

It is interesting to compare the Trapezoidal rule and the two-point Gaussian rule geometrically, for f(x) over [-1, 1]. Trap line Gaussian line The Gaussian line goes through (-η, f(-η)) and (η, f(η)). Gray is the true area under the curve. Green is the Trapezoidal area. Pink is the Gaussian area.

We can develop composite Gaussian formulas in much the same way a we did for Newton-Cotes. The idea is to divide the interval [a, b] into subintervals of equal length h = (b a)/n and denote the end points of the subintervals by x j = a + jh for j = 1, 2,, n. Apply the basic Gaussian formula on each subinterval [x j-1, x j ]. For the 2-point Gaussian rule we get where a < ξ < b.

Example: Compare the approximation of π using composite Simpson s rule and composite Gaussian 2-point formula to 4 decimal place accuracy. For this we need 6 applications (or 12 subintervals) for Simpson s rule. For the Gaussian formula 5 subintervals are needed. Name of an mfile. SIMPSON 1/3 Rule for Integration The Simpson 1/3 Rule approximation to 1/(1+x^2) over [0,1] is The value of h used is 0.083333. 7.853981600763449e-01 Multiply this by 4 to approximate π. The absolute error is 1.3284E-8 and 13 function evaluations are used. >> y = gq2 ( 'Gaussfun', 0, 1, 5 ) y = 0.785398170446358 Multiply this by 4 to approximate π. The absolute error is 2.8196E-8, which is slightly larger that that obtained by Simpson s rule. But here we use only 10 function evaluations (2 per interval). pi/4 0.785398163397448 In MATLAB

>> help gq2 gq2 approximate the definite integral of an arbitrary function using the composite two-point Gaussian quadrature rule inputs: f a b n output: y calling sequences: y = gq2 ( 'f', a, b, n ) gq2 ( 'f', a, b, n ) string containing name of m-file defining integrand lower limit of integration upper limit of integration number of uniformly sized subintervals into which integration interval is to be divided (the resulting approximation will require 2*n function evaluations) approximate value of the definite integral of f(x) over the interval a < x < b NOTE: if gq2 is called with no output arguments, the approximate value of the definite integral of f(x) over the interval a < x < b will be displayed

Note that for values of n > 2 the method of undetermined coefficients leads to nonlinear systems which are significantly more difficult. An alternate approach uses a collection of orthogonal polynomials known as the Legendre polynomials. (By orthogonal polynomials we mean that a particular integral of the product of any two different polynomials is zero.)

The simplest form of Gaussian Integration is based on the use of an optimally chosen polynomial to approximate the integrand f(x) over the interval [-1, +1]. The details of the determination of this polynomial, meaning determination of the coefficients of x in this polynomial, are beyond the scope of this presentation. The particular points at which to evaluate f(x) are the roots of the Legendre polynomials. It can be shown that the best estimate of the integral is then: where x i is a designated evaluation point, and c i is the weight of that point in the sum. If the number of points at which the function f(x) is evaluated is n, the resulting value of the integral is of the same accuracy as a simple polynomial method (such as Simpson's Rule) using about twice as many quadrature points. Thus the carefully designed choice of function evaluation points in the Gauss-Legendre form results in the same accuracy for about half the number of function evaluations, and thus at about half the computing effort.

Gaussian quadrature formulas are evaluated using abscissas and weights from a table like that included here. The choice of value of n is not always clear, and experimentation is useful to see the influence of choosing a different number of points. When choosing to use n points, we call the method an n-point Gaussian method.

Example: Consider the evaluation of the integral: whose value is 1, as we can obtain by explicit integration. Applying the 2-point Gaussian method we can calculate an approximate value for the integral. The result is 0.998473, which is pretty close to the exact value of one. The calculation is simply: While this example is quite simple, the following table of values obtained for n ranging from 2 to 10 indicates how accurate the estimate of the integral is for only a few function evaluations. The table includes a column of values obtained from Simpson's rule for the same number of function evaluations. The Gauss-Legendre result is correct to almost twice the number of digits as compared to the Simpson's rule result for the same number of function evaluations.