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

Similar documents
COURSE Numerical integration of functions

MA2501 Numerical Methods Spring 2015

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

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

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

Jim Lambers MAT 460/560 Fall Semester Practice Final Exam

Section 6.6 Gaussian Quadrature

12.0 Properties of orthogonal polynomials

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

Romberg Integration and Gaussian Quadrature

NUMERICAL ANALYSIS PROBLEMS

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

Numerical Methods I: Numerical Integration/Quadrature

Introductory Numerical Analysis

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

Chapter 4: Interpolation and Approximation. October 28, 2005

Simpson s 1/3 Rule Simpson s 1/3 rule assumes 3 equispaced data/interpolation/integration points

OBJECTIVES Use the area under a graph to find total cost. Use rectangles to approximate the area under a graph.

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

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

LECTURE 14 NUMERICAL INTEGRATION. Find

Numerical Integration

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

Hence a root lies between 1 and 2. Since f a is negative and f(x 0 ) is positive The root lies between a and x 0 i.e. 1 and 1.

Chapter 5: Numerical Integration and Differentiation

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

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.

Numerical Analysis Preliminary Exam 10.00am 1.00pm, January 19, 2018

Midterm Review. Igor Yanovsky (Math 151A TA)

Mathematics for Engineers. Numerical mathematics

8.3 Numerical Quadrature, Continued

3. Numerical Quadrature. Where analytical abilities end...

Physics 115/242 Romberg Integration

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

Two hours. To be provided by Examinations Office: Mathematical Formula Tables. THE UNIVERSITY OF MANCHESTER. 29 May :45 11:45

Numerical Integra/on

The problems that follow illustrate the methods covered in class. They are typical of the types of problems that will be on the tests.

Scientific Computing: Numerical Integration

Numerical methods. Examples with solution

Numerical integration - I. M. Peressi - UniTS - Laurea Magistrale in Physics Laboratory of Computational Physics - Unit V

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

Mathematics Notes for Class 12 chapter 7. Integrals

Announcements. Topics: Homework:

Chapter 3: Root Finding. September 26, 2005

Differentiation and Integration

(0, 0), (1, ), (2, ), (3, ), (4, ), (5, ), (6, ).


Examination paper for TMA4125 Matematikk 4N

f(x) g(x) = [f (x)g(x) dx + f(x)g (x)dx

Math 473: Practice Problems for Test 1, Fall 2011, SOLUTIONS

A = (a + 1) 2 = a 2 + 2a + 1

Notes on floating point number, numerical computations and pitfalls

Simpson s Rule. f(x)dx = h 3 [f(x 0) + 4f(x 1 ) + f(x 2 )] h2 90 f (4) (ɛ)

MATH 1A - FINAL EXAM DELUXE - SOLUTIONS. x x x x x 2. = lim = 1 =0. 2) Then ln(y) = x 2 ln(x) 3) ln(x)

GENG2140, S2, 2012 Week 7: Curve fitting

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

Chapter 8. Exploring Polynomial Functions. Jennifer Huss

4. We accept without proofs that the following functions are differentiable: (e x ) = e x, sin x = cos x, cos x = sin x, log (x) = 1 sin x

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

Lecture : The Indefinite Integral MTH 124

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

Examination paper for TMA4215 Numerical Mathematics

MATH 104: INTRODUCTORY ANALYSIS SPRING 2008/09 PROBLEM SET 8 SOLUTIONS

APPM/MATH Problem Set 6 Solutions

Computing Integrals. Lectures INF2320 p. 1/48

Fourth Order RK-Method

We consider the problem of finding a polynomial that interpolates a given set of values:

Exam in TMA4215 December 7th 2012

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

Roots of Equations. ITCS 4133/5133: Introduction to Numerical Methods 1 Roots of Equations

April 15 Math 2335 sec 001 Spring 2014

August 20, Review of Integration & the. Fundamental Theorem of Calculus. Introduction to the Natural Logarithm.

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

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

X. Numerical Methods

COURSE Iterative methods for solving linear systems

MA2501 Numerical Methods Spring 2015

Questions from Larson Chapter 4 Topics. 5. Evaluate

Applied Numerical Analysis (AE2220-I) R. Klees and R.P. Dwight

Stat 451 Lecture Notes Numerical Integration

CS 257: Numerical Methods

Introduction to Numerical Analysis

2.12: Derivatives of Exp/Log (cont d) and 2.15: Antiderivatives and Initial Value Problems

Numerical Analysis: Interpolation Part 1

Linear Operators and the General Solution of Elementary Linear Ordinary Differential Equations

MA 3021: Numerical Analysis I Numerical Differentiation and Integration

Fixed point iteration and root finding

Principles of Scientific Computing Local Analysis

Indian Institute of Technology Bombay

Bisection and False Position Dr. Marco A. Arocha Aug, 2014

Lecture 5: Integrals and Applications

Scientific Computing

Lecture 4: Integrals and applications

Applications of Differentiation

8.7 Taylor s Inequality Math 2300 Section 005 Calculus II. f(x) = ln(1 + x) f(0) = 0

Examination paper for TMA4130 Matematikk 4N

International Competition in Mathematics for Universtiy Students in Plovdiv, Bulgaria 1994

Homework set #7 solutions, Math 128A J. Xia

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)

Calculus I Announcements

Transcription:

COURSE 7 3. Numerical integration of functions (continuation) 3.3. The Romberg s iterative generation method The presence of derivatives in the remainder difficulties in applicability to practical problems and to computer programs. There are preferred, in this sense, the iterative quadratures. Consider the iterative generation method of a repeated formula by the Romberg s method. In the case of the trapezium formula we have Q T0 (f) = h [f(a) + f(b)], h = b a, Q T0 (f) being the first element of the sequence.

We divide the interval [a, b] in two equal parts, of length h and applying to each subinterval [a, a + h ] and [a + h, b] the trapezium formula we get Q T1 (f) = h [ ( f(a) + f a + h ) ] + f(b) 4 or Q T1 (f) = 1 Q T 0 (f) + hf ( a + h ). Dividing now each previous divisions [a, a+b ] and [a+b, b] in two equal parts, we obtain a division of the initial interval in 4 = equal parts, each of length 4 h. Applying the repeated trapezium formula, we get Q T (f) = h 8 f(a) + 3 i=1 = 1 Q T 1 (f) + h [f Continuing in an analogous manner, we get Q Tk (f) = 1 Q T k 1 (f) + h k 1 k f j=1 ( a + ih ) + f(b) (1) 4 (a + 1 ) h + f (a + 3 )] h. f ( a + j 1 ) k h, k = 1,,... ()

We obtain the sequence Q T0 (f), Q T1 (f),..., Q Tk (f),... (3) which converges to the value I = a f(x)dx. We approximate the error by Q Tn (f) Q Tn 1 (f). If we want to approximate I with error less than ε, we compute successively the elements of (3) until the first index for which Q Tn (f) being the required value. Q Tn (f) Q Tn 1 (f) ε, Similarly, one may iteratively generate the repeated Simpson s formula. Denoting by Q Sk (f) the Simpson s formula repeated k times, we have Q Sk (f) = 1 3 [ 4QTk+1 (f) Q T k (f) ], k = 0, 1,... where Q S0 (f) = h 6 [ f(a) + 4f ( a + h ) ] + f(b)

is the Simpson s quadrature formula. 3.4. Adaptive quadrature methods The repeated integration methods require equidistant nodes. There are problems where the function contains both regions with large variations and with small variations. It is needed a smaller step for the regions with large variations than for the regions with small variations in order that the error to be uniformly distributed. Such methods, which adapt the size of the step in accordance with the need, are called adaptive quadrature methods. We present the method based on the repeated Simpson s quadrature formula. Suppose we want to approximate with precision ε the integral I = a f (x) dx.

First step: we apply the Simpson s formula for x 0 = a, x 1 = a+ h, x = b, with h = b a. a f (x) dx = b a 6 ( f(a) + 4f(a + h ) + f(b) ) (b a)5 880 f (4) (ξ) = := S (a, b) h5 90 f (4) (ξ) It may be proved that the error of approximating I by S ( a, a + h ) + S ( a + h, b), h = b a, is 15 times smaller than the expression S (a, b) S ( a, a + h ) S ( a + h, b ). Hence, if (4) S (a, b) S ( a, a + h ) S ( a + h, b ) < 15ε, then (5) a f (x) dx S ( a, a + h ) S ( a + h, b ) < ε. When (5) does not hold, the procedure is applied individually on [a, (a+ b)/] and [(a + b)/, b] in order to determine if the approx. of the integral on each two subintervals is performed with error ε/. If yes,

the sum of these two approx. offer an approx. of I with precision ε. If on a subinterval it is not obtained the error ε/, then we divide that subinterval and we analyze if the approx. on the resulted two subintervals has precision ε/4, and so on. This procedure of halfing is continued until the corresponding error is attained on each subinterval.

Algorithm: (the idea: divide and conquer ) function I=adquad(a,b,er) I1=Simpson(a,b) I=Simpson(a, a+b )+Simpson(a+b,b) if I1-I <15*er I=I return else end I=adquad(a, a+b,er )+adquad(a+b,b,er ) Remark 1 For example, for evaluating the integral 3 100 1 x sin 10 x dx with ε = 10 4, repeated Simpson formula requires 177 function evaluations, nearly twice as many as adaptive quadrature.

3.5. General quadrature formulas Using the interpolation formulas, there are obtained a large variety of quadrature formulas. In the case of some concrete applications, the choosing of the quadrature formula is made according to the information about the function f. A general quadrature formula is given by: a f(x)dx = m k=0 j I k A kj f (j) (x k ) + R(f), For example, if we know only the values of f (a) and f(b),

using the Birkhoff interpolation formula f(x) = (x b)f (a) + f(b) + (R 1 f)(x) we obtain the quadrature formula with a f(x)dx = A 0f (a) + A 1 f(b) + R 1 (f), A 0 = A 01 = A 1 = A 10 = a a b) (x b)dx = (a dx = b a.

3.6. Quadrature formulas of Gauss type All the previous rules can be written in the form a f(x)dx = m k=1 A k f(x k ) + R m (f), (6) where the coefficients A k, k = 1,..., m, do not depend on the function f. We have picked the nodes x k, k = 1,..., m equispaced and have then calculated the coefficients A k, k = 1,..., m. This guarantees that the rule is exact for polynomials of degree m. It is possible to make such a rule exact for polynomials of degree m 1, by choosing also the nodes appropriately. This is the basic idea of the gaussian rules. Let f : [a, b] R be an integrable function and w : [a, b] R + a weight function, integrable on [a, b].

Definition A formula of the following form a w(x)f(x)dx = m k=1 A k f(x k ) + R m (f) (7) is called a quadrature formula of Gauss type or with maximum degree of exactness if the coefficients A k and the nodes x k, k = 1,..., m are determined such that the formula has the maximum degree of exactness. Remark 3 The coefficients and the nodes are determined such that to minimize the error, to produce exact result for the largest class of polynomials. A k and x k, k = 1,..., m from (7) are m unknown parameters m equations obtained such that the formula (7) is exact for any polynomial degree at most m 1. It is often possible to rewrite the integral a g(x)dx as a w(x)f(x)dx, where w(x) is a nonnegative integrable function, and f(x) = g(x) w(x) is smooth, or it is possible to consider the simple choice w(x) = 1.

For the general case, consider e k (x) = x k ; k = 0,..., m 1 and obtain the system s.t. R m (e k ) = 0 : with m k=1 m k=1.. ṁ k=1 A k e 0 (x k ) = a w(x)e 0 (x) dx A k e 1 (x k ) = a w(x)e 1 (x) dx A k e m 1 (x k ) = a w(x)e m 1 (x) dx A 1 + A +... + A m = µ 0 A 1 x 1 + A x +... + A m x m = µ 1... A 1 x m 1 1 + A x m 1 +... + A m x m 1 m = µ m 1 µ k = a w(x)xk dx. As, the system (8) is difficult to solve, there have been found other ways to find the unknown parameters. (8)

If w(x) = 1 (this case was studied by Gauss), then the nodes are the roots of Legendre orthogonal polynomial u(x) = m! (m)! [(x a)m (x b) m ] (m) and for finding the coefficients we use the first m equations from the system (8). For example, for m =, the interval [ 1, 1] and w(x) = 1, we get the system A 1 + A = 1 1 dx = A 1 x 1 + A x = 1 1 xdx = 0 A 1 x 1 + A x = 1 1 x dx = 3 A 1 x 3 1 + A x 3 = 1 1 x 3 dx = 0 with solution A 1 = A = 1 and x 1 = 3 3, x = fomula 1 1 f(x)dx f( 3 3 ) + f( 3 3 ). (9) 3 3, which gives the

This formula has degree of precision 3, i.e., it gives exact result for every polynomial of the 3 rd degree or less. Remark 4 The resulting rules look more complicated than the interpolatory rules. Both nodes and weights for gaussian rules are, in general, irrational numbers. But, on a computer, it usually makes no difference whether one evaluates a function at x = 3 or at x = 1/ 3. Once the nodes and weights of such a rule are stored, these rules are as easily used as the trapezium rule or Simpson s rule. At the same time, these gaussian rules are usually much more accurate when compared with the last ones on the basis of number of function values used. Example 5 Consider m = 1 and obtain the following Gauss type quadrature formula a f(x)dx = A 1f(x 1 ) + R 1 (f).

The system (8) becomes A 1 = a dx = b a A 1 x 1 = a xdx = b a. The unique solution of this system is A 1 = b a, x 1 = a+b. The same result is obtained considering x 1 the root of the Legendre polynomial of the first degree, u(x) = 1 [(x a)(x b)] = x a + b.

The Gauss type quadrature formula with one node is ( ) a + b f(x)dx = (b a)f + R 1 (f), a with (b a)3 R 1 (f) = f (ξ), ξ [a, b] 4 which is called the rectangle quadrature rule (also called the midpoint rule). The repeated rectangle (midpoint) quadrature formula is a f(x)dx = b a n R n (f) = n i=1 f(x i ) + R n (f), (b a)3 4n f (ξ), ξ [a, b] with x 1 = a + b a n, x i = x 1 + (i 1) b a n, i =,..., n.

We have R n (f) (b a)3 4n M f, with M f = max x [a,b] f (x). Remark 6 There is another rectangle rule: f(x)dx = (b a)f (a) + R(f), with a R(f) = (b a) f (ξ), ξ [a, b].

Romberg s algorithm for the rectangle (midpoint) quadrature formula. Applying successively the rectangle formula on [a, b], we get Q D0 (f) = (b a)f(x 1 ), x 1 = a + b Q D1 (f) = 1 3 Q D 0 (f) + b a 3 [f(x ) + f (x 3 )], x = a + b a 6, x 3 = b b a 6. Continuing in an analogous manner, we obtain the sequence Q D0 (f), Q D1 (f),..., Q Dk (f),... (10) which converges to the value I of the integral a f(x)dx. If we want to approximate the integral I with error less than ε, we compute successively the elements of (10) until the first index for which Q Dm (f) being the required value. Q Dm (f) Q Dm 1 (f) ε,

The algorithm for generating the elements of the sequence (10) is: I. Let h := b a,h 1 := h,x 1 : a + h 1 and Q D0 (f) := hf(x 1 ). II. For k := 1,,... do h := h 3,h 1 := h 1 3,h := 4h 1,h 3 := h 1, m := 3 k 1,x 1 := a + h 1 ; for i = 1,..., m 1,do x i := x i 1 + h, x i+1 := x i + h 3 ; x m := x m 1 + h and Q Dk (f) = 1 3 Q D k 1 (f) + h m i=1 f(x i ), (for k = 1(m = 1)the generation of x i,x i+1 is missing). Example 7 Approximate ln, with ε = 10, using the repeated rectangle (midpoint) method.

Solution. We have f(x)dx = b a a n so f(x) = 1 x ln = b a n and we get R n (f) = f(a + b a n ) + n i=1 f(x i ) + R n (f), (b a)3 4n f (ξ), ξ [a, b]. ln = n i= 1 dx x, f(a + b a n We have f(x) = 1 x, f (x) = 1 x, f (x) = ξ [1, ] so it follows a + (i 1)b n ) + (b a)3 4n f (ξ) x 3, and f (ξ), for R n (f) 1 4n < 10 1n > 100 n = 3.

Therefore, ln 1 3 1 1 + 1 6 + 1 1 + 1 6 + 1 3 + 1 1 + 1 6 + 3 = 1 3 ( 6 7 + 6 9 + 6 11 ) = 0.6897 (real value is 0.693...) Example 8 For m =, the Gauss type quadrature formula is a f(x)dx = A 1f(x 1 ) + A f(x ) + R (f). The corresponding Legendre polynomial is u(x) = 4! [ (x a) (x b) ] = x (a + b)x + 1 6 (a + b + 4ab),

with the roots x 1 = a + b x = a + b (b a) 3, 6 (b a) 3 +. 6 For finding A 1 and A we use the first two equations: { A1 + A = b a A 1 x 1 + A x = (b a )/. We get A 1 = A = (b a)/, so the Gauss type quadrature formula with two nodes is f(x)dx = b a [ ( a + b f a b a ) ( a + b 3 + f 6 + b a )] 3 +R (f). 6 Remark 9 a) The coefficients A k, k = 1,..., m of a Gauss type formula are positive.

b) The coefficients A k, k = 1,..., m and the roots of the Legendre polynomials can be found in tables, for a = 1, b = 1. For example, for m = and m = 3 : m nodes coefficients 0.577 1 0.577 1 3 0.774 0.555 0 0.888 0.774 0.555 c) For different weight functions, tables are available for both the nodes and the coefficients. Example 10 Approximate 1 1 e x cos xdx using a Gauss type quadrature formula for m = 3. Sol. 1 1 ex cos xdx 0.55e 0.77 cos 0.77 + 0.88 cos 0 + 0.55e 0.77 cos( 0.77) = 1.9333904

(Exact value is 1.933414.) Absolute error is <3. 10 5. The integral a f(x)dx for an arbitrary interval [a, b] could be transfomed in an integral on [ 1, 1] using the change of variable t = x a b x = 1 [(b a)t + a + b]. b a The Gauss type quadrature formulas may be applied on the following way: ( ) 1 (b a)t + (b + a) (b a) f(x)dx = f dt. (11) a 1 Example 11 Consider the integral 3 1 (x 6 x sin(x))dx = 317.344466. a) Compare the result obtained for Newton-Cotes type formula with m = 1 and the gaussian formula for m = ; b) Compare the result obtained for Newton-Cotes type formula with m = and the gaussian formula for m = 3.

Sol. a) Each formula needs evaluations of the function f(x) = x 6 x sin(x). We have Trapezium formula (m = 1) : [f(1) + f(3)] = 731.605440; and a Gauss type formula for m =, using (11): 3 1 1 (x6 x sin(x))dx = ((t + 1 )6 (t + ) sin((t + )))dt f( 0.577 + ) + f(0.577 + ) = 306.8199344 b) Each formula needs 3 evaluations of the function. We have Simpson s F. (m = ) : 1 3 [f(1) + 4f() + f(3)] = 333.3; and a Gauss type formula for m = 3, using (11): 3 1 1 (x6 x sin(x))dx = ((t + 1 )6 (t + ) sin((t + )))dt 0.55f( 0.77 + ) + 0.88f() + 0.55f(0.77 + ) = 317.641516