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

Similar documents
8.3 Numerical Quadrature, Continued

Jim Lambers MAT 460/560 Fall Semester Practice Final Exam

Practice Exam 2 (Solutions)

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

Section 6.6 Gaussian Quadrature

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

Numerical Methods. King Saud University

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

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.

MA 3021: Numerical Analysis I Numerical Differentiation and Integration

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

Numerical Integration

Chapter 5: Numerical Integration and Differentiation

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

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

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

Stat 451 Lecture Notes Numerical Integration

COURSE Numerical integration of functions

Extrapolation in Numerical Integration. Romberg Integration

Numerical Integra/on

Do not turn over until you are told to do so by the Invigilator.

5 Numerical Integration & Dierentiation

Math 107H Fall 2008 Course Log and Cumulative Homework List

Differentiation and Integration

ECE257 Numerical Methods and Scientific Computing. Ordinary Differential Equations

Consider a function f we ll specify which assumptions we need to make about it in a minute. Let us reformulate the integral. 1 f(x) dx.

Consistency and Convergence

HIGHER ORDER METHODS. There are two principal means to derive higher order methods. b j f(x n j,y n j )

Euler s Method, cont d

Applied Numerical Analysis Quiz #2

Principles of Scientific Computing Local Analysis

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

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

CS 257: Numerical Methods

Fourth Order RK-Method

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

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

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

Math 578: Assignment 2

MA6452 STATISTICS AND NUMERICAL METHODS UNIT IV NUMERICAL DIFFERENTIATION AND INTEGRATION

Exam 2. Average: 85.6 Median: 87.0 Maximum: Minimum: 55.0 Standard Deviation: Numerical Methods Fall 2011 Lecture 20

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

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

Secondary Math 3 Honors - Polynomial and Polynomial Functions Test Review

Numerical Differential Equations: IVP

Notation Nodes are data points at which functional values are available or at which you wish to compute functional values At the nodes fx i

Numerical Analysis Exam with Solutions

Numerical Differentiation & Integration. Numerical Differentiation II

MA2501 Numerical Methods Spring 2015

Ordinary Differential Equations II

8.4 Integration of Rational Functions by Partial Fractions Lets use the following example as motivation: Ex: Consider I = x+5

10. e tan 1 (y) 11. sin 3 x

Fixed point iteration and root finding

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

Math Numerical Analysis

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

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

n 1 f n 1 c 1 n+1 = c 1 n $ c 1 n 1. After taking logs, this becomes

Scientific Computing: Numerical Integration

12.0 Properties of orthogonal polynomials

6 Lecture 6b: the Euler Maclaurin formula

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

Numerical Integra/on

Spring 2012 Introduction to numerical analysis Class notes. Laurent Demanet

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

Day 2 Notes: Riemann Sums In calculus, the result of f ( x)

April 15 Math 2335 sec 001 Spring 2014

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

Review Higher Order methods Multistep methods Summary HIGHER ORDER METHODS. P.V. Johnson. School of Mathematics. Semester

Physics 115/242 Romberg Integration

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

Mathematics for Engineers. Numerical mathematics

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

GENG2140, S2, 2012 Week 7: Curve fitting

Numerical Programming I (for CSE)

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

EAD 115. Numerical Solution of Engineering and Scientific Problems. David M. Rocke Department of Applied Science

Review all the activities leading to Midterm 3. Review all the problems in the previous online homework sets (8+9+10).

Midterm Review. Igor Yanovsky (Math 151A TA)

The total error in numerical differentiation

Integration of Ordinary Differential Equations

RESEARCH REPORT. The Cavalieri estimator with unequal section spacing revisited. Markus Kiderlen and Karl-Anton Dorph-Petersen

Examination paper for TMA4215 Numerical Mathematics

Fundamentals of Numerical Mathematics. Charles University Prague Faculty of Mathematics and Physics Czech Republic

Physics 584 Computational Methods

3.1 Interpolation and the Lagrange Polynomial

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

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

EXAMPLE OF ONE-STEP METHOD

LECTURE 14 NUMERICAL INTEGRATION. Find

Introductory Numerical Analysis

APPM/MATH Problem Set 6 Solutions

M.SC. PHYSICS - II YEAR

Numerical Analysis: Interpolation Part 1

Multistage Methods I: Runge-Kutta Methods

Review for Exam 2 Ben Wang and Mark Styczynski

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

Chapter 7 Polynomial Functions. Factoring Review. We will talk about 3 Types: ALWAYS FACTOR OUT FIRST! Ex 2: Factor x x + 64

SOLVED PROBLEMS ON TAYLOR AND MACLAURIN SERIES

Transcription:

Panel integration Week 12: Monday, Apr 16 Suppose we want to compute the integral b a f(x) dx In estimating a derivative, it makes sense to use a locally accurate approximation to the function around the point where the derivative is to be evaluated. But if f is at all interesting on the interval [a, b], it probably does not make sense to approximate the integral of f by integrating a quadratic interpolant. On the other hand, f may be approximated quite well by a quadratic interpolant on small subintervals, so it may make sense to define a mesh of points and to then compute a = a 0 < a 1 < a 2 <... < a n = b b a n 1 f(x) dx = i=0 f(x) dx, where the integrals on each panel [, +1 ] involves a local polynomial approximation. Let us now turn to a method to compute these panel integrals. Simpson s rule Now, suppose we do exactly the same manipulations we used to find the centered difference approximation, but aim at coming up with an integration rule. That is, given f(), f(0), and f(h), how can we estimate f(x) dx? Again, we can derive the same answer by either interpolation or by the

method of undetermined coefficients. Let s use interpolation first: f(x) dx = w = w 0 = w + = p(x) dx [f()l (x) + f(0)l 0 (x) + f(h)l h (x)] dx =w f() + w 0 f(0) + w + f(h), L (x) dx = h/3 L 0 (x) dx = 4h/3 L h (x) dx = h/3. What about the method of undetermined coefficients? integrating a Taylor expansion of f about 0: f(x) dx = 2 [ f(0)h + f (0)h 3 /6 + f (4) (0)h 5 /120 + O(h 7 ) ] Let s start by We want to match terms in this Taylor expansion to the terms in the Taylor expansion of a linear combination of f(), f(0), and f(h): I(h) =c f() + c 0 f(0) + c + f(h) =(c + c 0 + c + )f(0) + (c + c )f (0)h + (c + + c )f (0)h 2 /2 + (c + c )f (3) (0)h 3 /6 + (c + + c )f (4) (0)h 4 /24 + O(h 5 ) If we match the constant, linear, and quadratic terms between the two expansions, we have c + c 0 + c + = 2h c + c = 0 c + + c = 2h/3 Solving gives us c + = c = h/3 and c 0 = 4h/3, and f(x) dx I(h) = O(h 5 ).

A brief digression on changing variables How do I get from a rule on the domain [, h] to a rule on the domain [, +1 ]? Define h = (+1 )/2 and +1/2 = (+1 + )/2. Then we can define x = +1/2 + z, and since dx/dz = 1, the change of variables formula gives f(x) dx = f(+1/2 + z) dz. For example, Simpson s rule on the interval [, +1 ] is f(x) dx = b a 6 Newton-Cotes rules [ f(ai ) + 4f(+1/2 ) + f(+1 ) ]. Simpson s rule is a member of the family of Newton-Cotes rules based on interpolation over a uniform mesh. The first three Newton-Cotes rules are 1. Midpoint: f(x) dx 2hf(0) 2. Trapezoidal: f(x) dx h [f() + f(h)] 3. Simpson s: f(x) dx h/3 [f() + 4f(0) + f(h)] The midpoint and trapezoidal rules have order O(h 3 ) per panel, and Simpson s rule has O(h 5 ) per panel. If the panel sizes are fixed, we generally have O(1/h) panels to cover the domain [a, b], so the absolute error in approximating an integral by composite midpoint or trapezoidal integration is O(h 2 ), and the error for composite Simpson s rule is O(h 4 ). In general, n-point Newton-Cotes rules exactly integrate polynomials of degree n 1 if n is even, degree n if n is odd (the degree of polynomial we integrate exactly is called the degree of the quadrature rule). Newton-Cotes rules with more than three or four points are uncommon in practice; for n 11, the Newton-Cotes rules always have at least one negative weight, and cancellation causes problems in finite precision. Instead, Newton-Cotes rules are usually used in panel integration schemes, often with adaptive panel sizes based on local error estimates.

Error estimates We have already seen one approach to writing a formula for the error in a quadrature rule: Taylor expand everything in sight, and get a formula involving high-order derivatives of f. Unfortunately, we may not always have easy access to bounds on the derivatives of f. In practice, we would therefore usually estimate the error by comparing the results of two integration rules with different errors over a panel. For example, on [, h], let us write the integral, the midpoint rule, and the trapezoidal rule as I[f] = Q M [f] = 2hf(0) f(x) dx = 2hf(0) + f (0)h 3 /3 + O(h 5 ) Q T [f] = h [f() + f(h)] = 2hf(0) + f (0)h 3 + O(h 5 ). The error in the midpoint rule and the trapezoidal rule are thus Q M [f] I[f] = f (0)h 3 /3 + O(h 5 ) Q T [f] I[f] = 2f (0)h 3 /3 + O(h 5 ). The error in the trapezoidal rule is thus about twice the size of the error in the midpoint rule. Moreover, we can estimate Q M [f] I[f] even if we don t have direct access to the integral I[f]: Q M [f] I[f] = (Q M [f] Q T [f])/3 + O(h 5 ). Note that this suggests we could get a more accurate formula by correcting Q M [f] with our estimate of the error: But note that I[f] = Q M [f] (Q M [f] Q T [f])/3 + O(h 5 ). Q M [f] (Q M [f] Q T [f])/3 = h [f() + 4f(0) + f(h)], 3 which is just Simpson s rule.

Degree of an integration rule Suppose we write I h [f] = Q h [f] = h 0 f(x) dx n w j f(hx j ) j=1 We have in mind that the quadrature rule Q h [f] is supposed to approximate I h [f]. What we want to show now is that we can analyze the quality of that approximation just based on whether or not Q h [x m ] = I h [x m ] for small values of m. Suppose Q h [f] has degree d; that means that Q h [f] integrates polynomials of degree d exactly. Using Taylor s theorem with remainder, we can write f(x) = p(x) + f (d+1) (ξ) (d + 1)! xd+1, where p is a degree d polynomial (the degree d Taylor approximation). Suppose f (d+1) < M; then we have I h [f p] M d (d + 2)! hd+2 = O(h d+2 ) and Therefore Q h [f p] n M d w j (d + 1)! hd+2 = O(h d+2 ). j=1 I h [f] Q h [f] = I h [f p] Q h [p f] I h [f p] + Q h [f p] = O(h d+2 ). This tells us that the local truncation error (the error per panel) of a degree d integration rule is O(h d+2 ); in a composite rule where there are O(h 1 ) panels, we have a total error of O(h d+1 ).