Physics 115/242 Romberg Integration

Similar documents
6 Lecture 6b: the Euler Maclaurin formula

Extrapolation in Numerical Integration. Romberg Integration

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

Chapter 5: Numerical Integration and Differentiation

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

X. Numerical Methods

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

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

Numerical Analysis Exam with Solutions

Assignment 13 Assigned Mon Oct 4

Stat 451 Lecture Notes Numerical Integration

Extrapolation Methods for Approximating Arc Length and Surface Area

Virtual University of Pakistan

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

APPM/MATH Problem Set 6 Solutions

Preliminary Examination, Numerical Analysis, August 2016

MA6452 STATISTICS AND NUMERICAL METHODS UNIT IV NUMERICAL DIFFERENTIATION AND INTEGRATION

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

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)

Introduction to Algebra: The First Week

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.

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

Integration Using Tables and Summary of Techniques

CH 73 THE QUADRATIC FORMULA, PART II

2 Elementary algorithms for one-dimensional integrals

8.5 Taylor Polynomials and Taylor Series

Logarithmic, Exponential, and Other Transcendental Functions. Copyright Cengage Learning. All rights reserved.

Ma 530 Power Series II

COURSE Numerical integration of functions

NUMERICAL METHODS USING MATLAB

Numerical Analysis Solution of Algebraic Equation (non-linear equation) 1- Trial and Error. 2- Fixed point

Exact and Approximate Numbers:

Numerical Analysis. A Comprehensive Introduction. H. R. Schwarz University of Zürich Switzerland. with a contribution by

MATH 1231 MATHEMATICS 1B Calculus Section 4.4: Taylor & Power series.

Partial Fractions. June 27, In this section, we will learn to integrate another class of functions: the rational functions.

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

Designing Information Devices and Systems I Fall 2018 Lecture Notes Note Introduction to Linear Algebra the EECS Way

CS 257: Numerical Methods

Eigenvalues by row operations

Exam in TMA4215 December 7th 2012

Review for Exam 2 Ben Wang and Mark Styczynski

Designing Information Devices and Systems I Spring 2018 Lecture Notes Note Introduction to Linear Algebra the EECS Way

Jim Lambers MAT 460/560 Fall Semester Practice Final Exam

Lectures 9-10: Polynomial and piecewise polynomial interpolation

Numerical Integration

Sometimes the domains X and Z will be the same, so this might be written:

Section 6.6 Gaussian Quadrature

Math 5a Reading Assignments for Sections

Applied Linear Algebra in Geoscience Using MATLAB

Romberg Integration. MATH 375 Numerical Analysis. J. Robert Buchanan. Spring Department of Mathematics

Physics 411: Homework 3

Power series and Taylor series

Systems of Linear ODEs

CHAPTER 4. Interpolation

Mon Jan Improved acceleration models: linear and quadratic drag forces. Announcements: Warm-up Exercise:

5.5. The Substitution Rule

C3 Revision and Exam Answers: Simpson s Rule

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

you expect to encounter difficulties when trying to solve A x = b? 4. A composite quadrature rule has error associated with it in the following form

NUMERICAL METHODS FOR ENGINEERING APPLICATION

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

Romberg Rule of Integration

Notes on floating point number, numerical computations and pitfalls

Numerical differentiation

The above statement is the false product rule! The correct product rule gives g (x) = 3x 4 cos x+ 12x 3 sin x. for all angles θ.

What if the characteristic equation has complex roots?

PURE MATHEMATICS AM 27

Lecture I: Vectors, tensors, and forms in flat spacetime

Principles of Scientific Computing Local Analysis

Ph211 Summer 09 HW #4, week of 07/13 07/16. Ch6: 44, 46, 52; Ch7: 29, 41. (Knight, 2nd Ed).

Numerical Integra/on

ECE257 Numerical Methods and Scientific Computing. Ordinary Differential Equations

Algebra and functions; coordinate geometry in the (x, y) plane; sequences and series; differentiation; integration; vectors.

5. Hand in the entire exam booklet and your computer score sheet.

Physics 250 Green s functions for ordinary differential equations

EXAMPLES OF PROOFS BY INDUCTION

LINEAR ALGEBRA: NUMERICAL METHODS. Version: August 12,

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

Physics 115/242 Comparison of methods for integrating the simple harmonic oscillator.

How might we evaluate this? Suppose that, by some good luck, we knew that. x 2 5. x 2 dx 5

Math 112 Rahman. Week Taylor Series Suppose the function f has the following power series:

Math 471. Numerical methods Introduction

Numerical techniques to solve equations

GENG2140, S2, 2012 Week 7: Curve fitting

2tdt 1 y = t2 + C y = which implies C = 1 and the solution is y = 1

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

Completion Date: Monday February 11, 2008

Math 1 Unit 1 EOC Review

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

1 Introduction; Integration by Parts

7.1 Indefinite Integrals Calculus

Numerical Methods. King Saud University

Newton-Raphson. Relies on the Taylor expansion f(x + δ) = f(x) + δ f (x) + ½ δ 2 f (x) +..

LS.2 Homogeneous Linear Systems with Constant Coefficients

Introductory Numerical Analysis

In this section again we shall assume that the matrix A is m m, real and symmetric.

1 Solutions to selected problems

CHALLENGE! (0) = 5. Construct a polynomial with the following behavior at x = 0:

Final Examination. CS 205A: Mathematical Methods for Robotics, Vision, and Graphics (Spring 2016), Stanford University

Math 1526 Excel Lab 2 Summer 2012

Transcription:

Physics 5/242 Romberg Integration Peter Young In this handout we will see how, starting from the trapezium rule, we can obtain much more accurate values for the integral by repeatedly eliminating the leading contribution to the error This is known as Romberg integration As already discussed in class, the trapezium rule is a simple numerical approximation to the integral I = b a f(x)dx () For reasons that will become clear later we will write the trapezium rule for n intervals as I (0) n, ie where I (0) n T n = h [ 2 f 0 +f +f 2 + +f n + 2 f n], (2) h = b a n (3) is the width of one interval, f i f(x i ) with x i = x 0 + ih, and x 0 = a,x n = b We have seen in class that, for small h, the error is proportional to h 2 It turns out that if one writes an expression for the error as a power series in h then only even powers of h appear (assuming that the integrand doesn t have any singularities) In other words I = I (0) n +Ah 2 +Bh 4 +Ch 6 +, (4) where A,B,C, are numbers which are related to derivatives of f(x) at the endpoints (which of course we don t know in the numerics) We already showed that the leading error in the trapezium rule is of order h 2, ie there is no term linear in h Equation (4), with explicit expressions for A, B, C,, is called the Euler-Maclaurin formula Derivations, which are moderately complicated and involve Bernoulli polynomials, are given in some of the more advanced books, and from a Google search I found derivations on the web at http://enwikipediaorg/wiki/euler-maclaurin formula and http://planetmathorg/encyclopedia/proofofeulermaclaurinsummationformulahtml

2 A someone different derivation which avoids Bernoulli polynomials is given by Howie Haber in his notes for Physics 6A: http://scippucscedu/ haber/ph6a/esumpdf Here, we don t need the expressions for A,B,C, etc just the result that only even powers of h arise in Eq (4) I feel there should be a simple derivation of just this, but I haven t been able to find one To obtain a more accurate estimate for I we will eliminate the leading contribution to the error in Eq (4), the term of order h 2, by taking n to be even and determining the trapezium rule for intervals as well as for n intervals Since the width of one interval is now 2h we have I (0) = 2h[ 2 f 0 +f 2 +f 4 +f n 2 + 2 f n] (5) The error in this expression is of the same form as Eq (4) but with h replaced by 2h, ie I = I (0) +A(2h)2 +B(2h) 4 +C(2h) 6 + (6) We can eliminate the leading contribution to the error by subtracting 4 times Eq (4) from Eq (6) Dividing by 3 we get Hence we obtain the estimate I () n, where I = 4I(0) n I (0) 4Bh 4 20Ch 6 + (7) 3 From Eq (7) this is related to the exact value of the integral I by I n () = 4I(0) n I (0) (8) 3 where B = 4B and C = 20C I = I () n +B h 4 +C h 6 +, (9) From Eqs(2), (5) and (8) we find that I () n is given in terms of the function values by I () n = h 3 [f 0 +4f +2f 2 +4f 3 +2f 4 + 2f n 2 +4f n +f n ], (0) which is just Simpson s rule for n intervals, ie I () n S n ()

3 Hence the first level of error elimination in Romberg integration gives Simpson s rule However, the higher levels of error elimination that we discuss next will not produce familiar approximations If n is a multiple of 4, we can clearly repeat the trick of eliminating the leading contribution to the error, which is now the B h 4 term in Eq (9), by forming the appropriate linear combination of I n () and I () Hence the second level of error extrapolation gives I(2) n where I n (2) = 6I() n I () 5, (2) which has an error of order h 6 In general, if n is a multiple of 2 k we can form iteratively a sequence of higher order approximations, I (k) n, where n = 4k I n (k ) 4 k I (k) for k =,2,3,, which have an error of order h 2k+2 I (k ), (3) Romberg integration is a convenient way of carrying out this procedure of successively eliminating terms in the expression for the error One proceeds as follows Start with interval and compute I (0) Then do two intervals and compute I(0) 2 from which I () 2 can be determined using Eq (8) Then double the number of intervals again to 4 and calculate I (0) 4, from which I() 4 can be obtained using Eq (8), and hence I (2) 4 obtained from Eq (2) The sequence of quantities thus obtained can be conveniently represented as a table, T n S n n k 0 2 3 I (0) 2 I (0) 2 I () 2 4 I (0) 4 I () 4 I (2) 4 8 I (0) 8 I () 8 I (2) 8 I (3) 8 Note quite true; the next level, I (2) n in Eq (2), is sometimes called Bode s rule (see Numerical Recipes Sec 4), which is a Newton-Cotes formula with 5 points In Newton-Cotes formulae one fits a polynomial of order n = N through N equally spaced points and integrates the polynomial For n = this gives the trapezoidal rule, for n = 2 it gives Simpson s rule, and for n = 4 it gives Bode s rule Newton-Cotes formulae for larger n are not very useful (for example some of the coefficients are negative for n 8 which enhances roundoff errors), and do not correspond to higher order Romberg approximations

4 Recall that n is the number of intervals used in the trapezium rule, and k is the number of levels of error elimination The left hand column of estimates for the integral, labeled 0, contains results for the trapezium rule determined by evaluating the function at appropriate points Each subsequent column is obtained, not from any more function evaluations, but rather by manipulating the data in the column to the left of it These columns contain results for a higher order approximation so, for example, the k = column is Simpson s rule Note that the function values obtained for the trapezium rule with n intervals also occur in the trapezium rule for 2n intervals, and so would not be recomputed, in a well written code when evaluating T 2n ( I (0) 2n ) The number of number of intervals is given by n = 2 k and the most accurate result is generally the one with the most error extrapolations, ie the diagonal entry I (k) 2 k We therefore define successive Romberg estimates by R k = I (k) 2 k (4) If the desired accuracy is ǫ then, as an empirical rule, we keep doubling the number of intervals until R k R k < ǫ, (5) and take R k to be the estimate for the integral I Frequently the error, I R k, turns out to be much smaller than ǫ As an example consider I = 2 dx = /2 (6) x2 Using Romberg integration I obtain the following table of values (remember the k = 0 column contains the results of the trapezium rule and the k = column has the results of Simpson s rule) n k = 0 2 3 4 5 062500000000 2 053472222222 050462962963 4 05089937647 050047649 0500368028 8 050227085033 050002987904 05000040302 05000092259 6 0500569703 05000094339 05000000802 05000000833 05000000086 32 05004238459 05000002275 05000000037 05000000000 050000000003 050000000002 As stated above, for a given value of n (ie for a given number of function evaluations), the most accurate value is for the largest value of k, ie the diagonal entry These are the successive Romberg estimates R k, which in the present example are

5 FIG : Error in the integral 2 dx/x, using trapezium rule, Simpson s rule and Romberg integration the number of intervals is 2 k with k = 0,,2,,6, and h = (b a)/n (= /n here) k R k R k R k 0 062500000000 050462962963 02037037037 2 0500368028 00044928935 3 05000092259 00003488769 4 05000000086 000000973 5 050000000002 00000000084 If we had wanted an accuracy of ǫ = 0 5 we would have stopped at k = 4 since R 4 R 3 = 9 0 6 (< 0 5 ), whereas R 4 R 3 = 3 0 4 (> 0 5 ) The resulting value of 05000000086

6 is indeed /2 to 5 decimal places In fact it differs from the exact result by about 0 8, quite a lot smaller than the desired accuracy Figure shows the errors for the trapezium rule, Simpson s rule, and Romberg integration graphically (one more iteration has been done than in the table) The dashed lines indicate the leading error for the trapezium rule and Simpson s rule h2 2 (f (b) f (a)) = 7 48 h2, (7) h4 80 (f (b) f (a)) = 3 240 h4 (8) From Fig and these expressions for the error, we deduce that to reach a precision of 0 4, close to machine accuracy with double precision, Romberg integration needs 64 intervals, while Simpson s rule would need about 900 intervals, and the trapezium rule would need no less than 38 0 6 intervals There is clearly a major gain in efficiency in using methods which are higher order than the trapezium rule, such as Simpson s rule and especially Romberg integration All in all, Romberg integration is a powerful but quite simple method, which I recommend for general use for integration of a smooth function For a given number of intervals, it is much more accurate than the trapezium rule, and quite a bit more accurate than Simpson s rule, but does not need any more function evaluations