Numerical Integration

Similar documents
Numerical integration

Construction of Gauss Quadrature Rules

3.4 Numerical integration

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

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

Orthogonal Polynomials

COT4501 Spring Homework VII

Continuous Random Variables

Lecture 19: Continuous Least Squares Approximation

Numerical Integration

Lecture 12: Numerical Quadrature

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

Theoretical foundations of Gaussian quadrature

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

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

JDEP 384H: Numerical Methods in Business

1 The Lagrange interpolation formula

Lecture 14: Quadrature

Lecture 14 Numerical integration: advanced topics

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

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

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

Chapter 5 : Continuous Random Variables

7 - Continuous random variables

Monte Carlo method in solving numerical integration and differential equation

Numerical quadrature based on interpolating functions: A MATLAB implementation

B.Sc. in Mathematics (Ordinary)

Chapter 3 Polynomials

Best Approximation. Chapter The General Case

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

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

Numerical Methods I Orthogonal Polynomials

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

Review of Gaussian Quadrature method

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

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

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

Lecture 3 Gaussian Probability Distribution

Lecture 20: Numerical Integration III

Numerical Analysis: Trapezoidal and Simpson s Rule

Discrete Least-squares Approximations

Riemann is the Mann! (But Lebesgue may besgue to differ.)

Exam 2, Mathematics 4701, Section ETY6 6:05 pm 7:40 pm, March 31, 2016, IH-1105 Instructor: Attila Máté 1

DOING PHYSICS WITH MATLAB MATHEMATICAL ROUTINES

Orthogonal Polynomials and Least-Squares Approximations to Functions

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

1 Probability Density Functions

Definite integral. Mathematics FRDIS MENDELU

Lecture 1. Functional series. Pointwise and uniform convergence.

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

The goal of this section is to learn how to use a computer to approximate definite integrals, i.e. expressions of the form. Z b

ACCESS TO SCIENCE, ENGINEERING AND AGRICULTURE: MATHEMATICS 1 MATH00030 SEMESTER /2019

Final Exam - Review MATH Spring 2017

APPROXIMATE INTEGRATION

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

Partial Derivatives. Limits. For a single variable function f (x), the limit lim

Review of Calculus, cont d

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

We divide the interval [a, b] into subintervals of equal length x = b a n

10. AREAS BETWEEN CURVES

Main topics for the First Midterm

Chapter 6 Notes, Larson/Hostetler 3e

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

Interpolation. Gaussian Quadrature. September 25, 2011

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

Integral equations, eigenvalue, function interpolation

Abstract inner product spaces

4.1. Probability Density Functions

f(a+h) f(a) x a h 0. This is the rate at which

1 The fundamental theorems of calculus.

Expectation and Variance

1 Error Analysis of Simple Rules for Numerical Integration

38 Riemann sums and existence of the definite integral.

SUMMER KNOWHOW STUDY AND LEARNING CENTRE

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

New Expansion and Infinite Series

Sections 5.2: The Definite Integral

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

Math 426: Probability Final Exam Practice

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

7. Numerical evaluation of definite integrals

Arithmetic Mean Derivative Based Midpoint Rule

MATH , Calculus 2, Fall 2018

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

We know that if f is a continuous nonnegative function on the interval [a, b], then b

Riemann Sums and Riemann Integrals

Pi evaluation. Monte Carlo integration

Chapter 5. Numerical Integration

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

different methods (left endpoint, right endpoint, midpoint, trapezoid, Simpson s).

Chapter 1: Fundamentals

Matrices, Moments and Quadrature, cont d

Solutions to Assignment #8

Riemann Sums and Riemann Integrals

Section 17.2 Line Integrals

Best Approximation in the 2-norm

Modern Methods for high-dimensional quadrature

Problem Set 9. Figure 1: Diagram. This picture is a rough sketch of the 4 parabolas that give us the area that we need to find. The equations are:

Chapter 0. What is the Lebesgue integral about?

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

Transcription:

Numericl Integrtion Wouter J. Den Hn London School of Economics c 2011 by Wouter J. Den Hn June 3, 2011

Qudrture techniques I = f (x)dx n n w i f (x i ) = w i f i i=1 i=1 Nodes: x i Weights: w i

Qudrture techniques Two versions: I = f (x)dx n w i f (x i ) i=1 Newton Cotes: equidistnt nodes & "best" choice for the weights w i Gussin Qudrture: "best" choice for both nodes nd weights

Monte Crlo techniques pseudo: implemetble version of true Monte Crlo qusi: looks like Monte Crlo, but is something different nme should hve been chosen better

Power Newton-Cotes: With n nodes you get exct nswer if f is (n 1) th -order polynomil ccurte nswer f is close to n th -order polynomil Gussin: With n nodes you get exct nswer if f is (2n 1) th -order polynomil ccurte nswer f is close to (2n 1) th -order polynomil

Power (Pseudo) Monte Crlo: ccurcy requires lots of drws Qusi Monte Crlo: definitely better thn (pseudo) Monte Crlo nd will dominte qudrture methods for higher-dimensionl problems

Ide behind Newton-Cotes function vlues t n nodes = you cn fit (n 1) th -order polynomil & integrte the pproximting polynomil f (x)dx P 2 (x)dx It turns out tht this cn be stndrdized see Section "extr" for derivtion

Simpson for one intervl (3 nodes) f (x)dx ( 1 3 f 0 + 4 3 f 1 + 1 ) 3 f 2 h

Simpson for multiple intervls (n+1 nodes) = ( 1 f (x)dx 3 f 0 + 4 3 f 1 + 1 ) 3 f 2 h ( 1 + 3 f 2 + 4 3 f 3 + 1 ) 3 f 4 h + ( 1 + 3 f n 2 + 4 3 f n 1 + 1 ) 3 f n h ( 1 3 f 0 + 4 3 f 1 + 2 3 f 2 + 4 3 f 3 + 2 3 f 4 + 2 3 f n 2 + 4 3 f n 1 + 1 ) 3 f n h

Gussin qudrture Could we do better? Tht is, get better ccurcy with sme mount of nodes? Answer: Yes, if you re smrt bout choosing the nodes This is Gussin qudrture

Guss-Legendre qudrture Let [, b] be [ 1, 1] cn lwys be ccomplished by scling Qudrture 1 1 f (x)dx n ω i f (ζ i ). i=1 Gol: Get exct nswer if f (x) is polynomil of order 2n 1 Tht is with 5 nodes you get exct nswer even if f (x) is 9 th -order polynomil

Implementing Guss-Legendre qudrture Get n nodes nd n weights from computer progrm ζ i, i = 1,, n, ω i, i = 1,, n Clculte the function vlues t the n nodes, f i i = 1,, n Answer is equl to Anybody could do this n ω i f i i=1 How does the computer get the nodes nd weights?

2n equtions for nodes nd weights To get right nswer for f (x) = 1 1 1 1dx = To get right nswer for f (x) = x 1 1 xdx = To get right nswer for f (x) = x 2 n ω i 1 i=1 n ω i ζ i i=1 etc 1 1 x 2 dx = n ω i ζ 2 i i=1

2n equtions for nodes nd weights To get right nswer for f (x) = x j for j = 0,, 2n 1 1 1 x j dx = n ω i ζ j i j = 0, 1,, 2n 1 i=1 This is system of 2n equtions in 2n unknowns.

Wht hs been ccomplished so fr? By construction we get right nswer for f (x) = 1, f (x) = x,, f (x) = x 2n 1 But this is enough to get right nswer for ny polynomil of order 2n 1 2n 1 f (x) = i x i i=0 Why?

Guss-Hermite Qudrture Suppose we wnt to pproximte f (x)e x2 dx with n ω i f (ζ i ) i=1 The function e x2 is the weighting function, it is not used in the pproximtion but is cptured by the ω i coeffi cients

Guss-Hermite Qudrture We cn use the sme procedure to find the weights nd the nodes, tht is we solve them from the system: x j e x2 dx = n ω i ζ j i for j = 0, 1,, 2n 1 i=1 Note tht e ζ2 i is not on the right-hnd side

Implementing Guss-Hermite Qudrture Get n nodes, ζ i, i = 1,, n, nd n weights, ω i, i = 1,, n, from computer progrm Clculte the function vlues t the n nodes, f i i = 1,, n Answer is equl to n ω i f i i=1

Expecttion of Normlly distributed vrible How to clculte E [h(y)] with y N(µ, σ 2 ) Tht is, we hve to clculte ) 1 σ (y µ)2 h(y) exp ( 2π 2σ 2 dy Unfortuntely, this does not exctly fit the Hermite weighting function, but chnge in vrible will do the trick

Chnge of vribles If y = φ(x) then g(y)dy = φ 1 (b) φ 1 () g(φ(x))φ (x)dx Note the Jcobin is dded

Chnge of vribles The trnsformtion we use here is x = y µ σ 2 or y = σ 2x + µ

Chnge of vribles E [h(y)] = 1 σ 2π ) (y µ)2 h(y) exp ( 2σ 2 dy = 1 ( σ 2π h( 2σx + µ) exp x 2) σ 2dx = 1 h( ( 2σx + µ) exp x 2) dx π

Wht to do in prctice? Obtins n Guss-Hermite qudrture weights nd nodes using numericl lgorithm. Clculte the pproximtion using E [h(y)] n i=1 1 ω GH π i ( ) h 2σζ GH i + µ Do not forget to divide by π! Is this mzingly simple or wht?

Extr mteril Derivtion Simpson formul Monte Crlo integrtion

Lgrnge interpoltion Let L i (x) = (x x 0) (x x i 1 )(x x i+1 ) (x x n ) (x i x 0 ) (x i x i 1 )(x i x i+1 ) (x i x n ) f (x) f 0 L 0 (x) + + f n L n (x). Wht is the right-hnd side? Do I hve perfect fit t the n + 1 nodes?

Simpson: 2nd-order Newton-Cotes x 0 =, x 1 = ( + b)/2, x 2 = b, or x 1 = x 0 + h, x 2 = x 0 + 2h Using the Lgrnge wy of writing the 2 nd -order polynomil, we get f (x)dx f 0 L 0 (x) + f 1 L 1 (x) + f 2 L 2 (x) = f 0 L 0 (x)dx + f 1 L 1 (x)dx + f 2 L 2 (x)dx

Amzing lgebr Why mzing? L 0 (x)dx = 1 3 h L 1 (x)dx = 4 3 h L 2 (x)dx = 1 3 h formul only depends on h, not on vlues x i nd f i Combining gives f (x)dx P 2 (x)dx = ( 1 3 f 0 + 4 3 f 1 + 1 ) 3 f 2 h.

True nd pseudo Monte Crlo To clculte n expecttion Let x be rndom vrible with CDF F(x) Monte Crlo integrtion: h(x)df(x) T t=1 h(x t), T Use rndom number genertor to implement this in prctice

True nd pseudo Monte Crlo Wht if integrl is not n expecttion h(x)dx = (b ) h(x)f b (x)dx, where f b is the density of rndom vrible with uniform distribution over [, b], tht is, f b = (b ) 1. Thus, one could pproximte the integrl with h(x)dx (b ) T t=1 h(x t), T where x t is generted using rndom number genertor for vrible tht is uniform on [, b].

Qusi Monte Crlo Monte Crlo integrtion hs very slow convergence properties In higher dimensionl problems, however, it does better thn qudrture (it seems to void the curse of dimensionlity) But why? Pseudo MC is simply deterministic wy to go through the stte spce Qusi MC tkes tht ide nd improves upon it

Qusi Monte Crlo Ide: Fill the spce in n effi cient wy Equidistributed series: A sclr sequence {x t } T t=1 is equidistributed over [, b] iff T b b lim T T f (x t ) = f (x)dx t=1 for ll Riemn-integrble f (x). Equidistributed tkes the plce of uniform

Qusi Monte Crlo. Exmples ξ, 2ξ, 3ξ, 4ξ, is equidistributed modulo 1 for ny irrtionl number ξ. 1 The sequence of prime numbers multiplied by n irrtionl number (2ξ, 3ξ, 5ξ, 7ξ, ) 1 Frc(x) (or x Modulo 1) mens tht we subtrct the lrgest integer tht is less thn x. For exmple, frc(3.564) = 0.564.

Multidimensionl For d-dimensionl problem, n equidistributed sequence {x t } T t=1 D Rd stisfies T µ(d) lim T T f (x t ) = f (x)dx, t=1 D where µ(d) is the Lebesque mesure of D.

Multidimensionl equidistributed vectors Exmples for the d-dimensionl unit hypercube: Weyl: x t = (t p 1, t p 2,, t p d ) modulo 1, where p i is the i th positive prime number. Neiderreiter: x t = (t2 1/(d+1), t2 2/(d+1),, t2 d/(d+1) ) modulo 1

References Den Hn, W.J., Numericl Integrtion Most text books on numericl methods will hve chpter on this topic