Lecture 12: Numerical Quadrature

Similar documents
Chapter 3 Solving Nonlinear Equations

Z b. f(x)dx. Yet in the above two cases we know what f(x) is. Sometimes, engineers want to calculate an area by computing I, but...

Numerical Analysis: Trapezoidal and Simpson s Rule

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

Lecture 14: Quadrature

NUMERICAL INTEGRATION

The Fundamental Theorem of Calculus

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

Math& 152 Section Integration by Parts

The Regulated and Riemann Integrals

Midpoint Approximation

Numerical Integration

1 The Riemann Integral

The Riemann Integral

Chapter 6 Notes, Larson/Hostetler 3e

Lecture 20: Numerical Integration III

APPROXIMATE INTEGRATION

Definite integral. Mathematics FRDIS MENDELU

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

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

1 Error Analysis of Simple Rules for Numerical Integration

Numerical Integration

5.7 Improper Integrals

Lecture Note 4: Numerical differentiation and integration. Xiaoqun Zhang Shanghai Jiao Tong University

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

B.Sc. in Mathematics (Ordinary)

Big idea in Calculus: approximation

DOING PHYSICS WITH MATLAB MATHEMATICAL ROUTINES

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

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

Lecture 14 Numerical integration: advanced topics

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

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

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

Numerical Integration

Definite Integrals. The area under a curve can be approximated by adding up the areas of rectangles = 1 1 +

Section 5.4 Fundamental Theorem of Calculus 2 Lectures. Dr. Abdulla Eid. College of Science. MATHS 101: Calculus 1

Review of Calculus, cont d

5.1 How do we Measure Distance Traveled given Velocity? Student Notes

1 The fundamental theorems of calculus.

Lecture 19: Continuous Least Squares Approximation

Construction of Gauss Quadrature Rules

Best Approximation. Chapter The General Case

Section 6.1 Definite Integral

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

5: The Definite Integral

Chapter 7 Notes, Stewart 8e. 7.1 Integration by Parts Trigonometric Integrals Evaluating sin m x cos n (x) dx...

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

Main topics for the First Midterm

Tangent Line and Tangent Plane Approximations of Definite Integral

AP Calculus Multiple Choice: BC Edition Solutions

Suppose we want to find the area under the parabola and above the x axis, between the lines x = 2 and x = -2.

P 3 (x) = f(0) + f (0)x + f (0) 2. x 2 + f (0) . In the problem set, you are asked to show, in general, the n th order term is a n = f (n) (0)

6.5 Numerical Approximations of Definite Integrals

Lecture 23: Interpolatory Quadrature

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

63. Representation of functions as power series Consider a power series. ( 1) n x 2n for all 1 < x < 1

7.2 Riemann Integrable Functions

Riemann Sums and Riemann Integrals

INTRODUCTION TO INTEGRATION

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

Riemann Sums and Riemann Integrals

Chapter 6. Riemann Integral

Math 131. Numerical Integration Larson Section 4.6

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

1 Part II: Numerical Integration

Lecture 1: Introduction to integration theory and bounded variation

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

Orthogonal Polynomials

Integrals - Motivation

a < a+ x < a+2 x < < a+n x = b, n A i n f(x i ) x. i=1 i=1

Week 10: Riemann integral and its properties

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

Section 6: Area, Volume, and Average Value

AB Calculus Review Sheet

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

Chapter 5. Numerical Integration

3.4 Numerical integration

MTH 122 Fall 2008 Essex County College Division of Mathematics Handout Version 10 1 October 14, 2008

Goals: Determine how to calculate the area described by a function. Define the definite integral. Explore the relationship between the definite

( ) as a fraction. Determine location of the highest

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

( ) where f ( x ) is a. AB Calculus Exam Review Sheet. A. Precalculus Type problems. Find the zeros of f ( x).

Math 100 Review Sheet

Chapter 0. What is the Lebesgue integral about?

Lecture 21: Order statistics

Math 113 Fall Final Exam Review. 2. Applications of Integration Chapter 6 including sections and section 6.8

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

Arithmetic Mean Derivative Based Midpoint Rule

Numerical integration

COT4501 Spring Homework VII

Advanced Calculus: MATH 410 Notes on Integrals and Integrability Professor David Levermore 17 October 2004

Czechoslovak Mathematical Journal, 55 (130) (2005), , Abbotsford. 1. Introduction

APPLICATIONS OF THE DEFINITE INTEGRAL

QUADRATURE is an old-fashioned word that refers to

. Double-angle formulas. Your answer should involve trig functions of θ, and not of 2θ. sin 2 (θ) =

Math 8 Winter 2015 Applications of Integration

Orthogonal Polynomials and Least-Squares Approximations to Functions

MATH 144: Business Calculus Final Review

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

Transcription:

Lecture 12: Numericl Qudrture J.K. Ryn@tudelft.nl WI3097TU Delft Institute of Applied Mthemtics Delft University of Technology 5 December 2012 () Numericl Qudrture 5 December 2012 1 / 46

Outline 1 Review Newton-Rphson Systems of Nonliner Equtions Riemnn integrtion 2 Errors for Riemnn integrtion 3 Newton-Cotes Qudrture () Numericl Qudrture 5 December 2012 2 / 46

Newton-Rphson method We need to determine the solution to the problem: Find x such tht f (x) = 0 Assumptions f (x) C 2 [, b] (two continuous derivtives) x is n pproximtion to the root, α. f ( x) 0 x α = ɛ is smll. () Numericl Qudrture 5 December 2012 3 / 46

Newton-Rphson method By expnding f (x) in Tylor series round x, nd plugging in x = α, we hve: 0 = f (α) = f ( x)+(α x)f ( x)+ 1 2 (α x)2 f (ξ(α)), ξ(α) (α, x). This gives us the Newton-Rphson method: α = x f ( x) f ( x) () Numericl Qudrture 5 December 2012 4 / 46

Newton-Rphson method Algorithm 1 Given α 0 2 Define α n = α n 1 f (α n 1) f (α n 1 ) 3 If α n α n 1 ɛ then STOP! α = α n. 4 Else go to Step 2. () Numericl Qudrture 5 December 2012 5 / 46

Vritions to Newton s method Secnt Method (Chord Newton) Newton-Rphson, α n = α n 1 f (α n 1) f (α n 1 ) Replce f (α n 1 ) by n pproximtion, So tht α n = α n 1 f (α n 1 ) f (α n 1) f (α n 2 ) α n 1 α n 2 f (α n 1 ) f (α n 1 ) f (α n 2 ) (α n 1 α n 2 ) This is the Secnt Method () Numericl Qudrture 5 December 2012 6 / 46

Vritions to Newton s method Method of flse position Combines the ides of Chord Newton nd Bisection methods. Given two pproximtions α 0, α 1 such tht f (α 0 )f (α 1 ) < 0 : While n N 0 If qq 1 < 0 then else q 0 = f (α 0 ) q 1 = f (α 1 ), n = 2 α = α 1 q 1 (α 1 α 0 ) q 1 q 0 q = f (α), n = n + 1 α 0 = α q 0 = q α 1 = α q 1 = q () Numericl Qudrture 5 December 2012 7 / 46

Systems of Nonliner Equtions We cn write the system of equtions f 1 (x 1, x 2, x 3,..., x n ) = 0, f 2 (x 1, x 2, x 3,..., x n ) = 0, f 3 (x 1, x 2, x 3,..., x n ) = 0, f n (x 1, x 2, x 3,..., x n ) = 0, s F(x) = 0. () Numericl Qudrture 5 December 2012 8 / 46

Systems of Nonliner Equtions The Newton-Rphson method is then x (p) = x (p 1) J 1 (x (p 1) )F(x (p 1) ) where J(x) = Jcobin = f 1 f 1 x 1 x 2 f 2 f 2 x 1 x 2 f n 1 x n 1 f n x n 1 f n 1 x n f n x n () Numericl Qudrture 5 December 2012 9 / 46

Riemnn integrtion Recll from Clculus the formul for Riemnn integrtion: 1 Define prtition, P of intervl [, b] : = x 0 < x 1 < x 2 < < x n = b, where the length of the subintervls is given by h k = x k x k 1, k 1. 2 Define scttering, T, to be set of intermedite points: x k 1 t k x k, k = 1,..., n. 3 The Riemnn sum is then given by R n (f ) = n f (t k )h k. k=1 () Numericl Qudrture 5 December 2012 10 / 46

Riemnn integrtion Rectngle rule Recll tht b f (x) dx = lim n R n(f ) = lim n n f (t k )h k. k=1 where h = h k = b n. To obtin the Rectngle rule, we tke t k to be n endpoint of the subintervl. Tht is, t k = x k 1 (left endpoint) OR t k = x k (right endpoint). Then I R = h n f (x k 1 ) OR I R = h k=1 n f (x k ). k=1 () Numericl Qudrture 5 December 2012 11 / 46

Riemnn integrtion Midpoint rule For the Midpoint rule, we tke t k to be the midpoint of the subintervls: t k = 1 2 (x k 1 + x k ). The Midpoint rule is then n I M = h f (t k ). k=1 () Numericl Qudrture 5 December 2012 12 / 46

Riemnn integrtion Errors The errors for these methods re Rectngle rule: b first order method. Midpoint rule: b which is second order. f (x) dx I R 1 2 M 1(b )h, f (x) dx I M 1 24 M 2(b )h 2, But! Don t forget there is lso rounding error. () Numericl Qudrture 5 December 2012 13 / 46

Riemnn integrtion Errors Wht is the totl ffect of the errors? Let ˆf (x) = f (x) + ɛ(x) be the perturbed exct solution. Then b b (f (x) ˆf (x)) dx f (x) ˆf (x) dx ɛ mx (b ). () Numericl Qudrture 5 December 2012 14 / 46

Riemnn integrtion Errors Consider the rectngle rule, I R (f ) = h n f (x k ). k=1 In this cse, the error is b (f (x) ˆf (x)) dx b f (x) dx I R (f ) + I R (f ) I R (ˆf ) }{{}}{{} Rounding error Approximtion error 1 n 2 M 1(b )h + h f (x k ) ˆf (x k ) }{{} k=1 ɛ(x k ) () Numericl Qudrture 5 December 2012 15 / 46

Riemnn integrtion Errors The totl error is given by b (f (x) ˆf (x)) dx 1 2 M 1(b )h + h n ɛ(x k ) k=1 If we ssume ɛ(x) ɛ mx, then b (f (x) ˆf (x)) dx 1 n 2 M 1(b )h + h ɛ mx k=1 So tht b 1 2 M 1(b )h + }{{} hn ɛ mx =(b ) ( ) 1 (f (x) ˆf (x)) dx 2 M 1h + ɛ mx (b ) () Numericl Qudrture 5 December 2012 16 / 46

Qudrture Errors Remember: The pproximtion errors should dominte. 1 2 M 1h > ɛ mx h > 2 M 1 ɛ mx () Numericl Qudrture 5 December 2012 17 / 46

Qudrture Errors Assume Exct Approximte Exct f (x) ˆf (x) f (x) ɛ. Recll, the reltive error is given by b = f (x) dx b b f (x) dx ˆf (x) dx b f (x) dx b f (x) dx ɛ = Reltive error. () Numericl Qudrture 5 December 2012 18 / 46

Qudrture Errors Definition (Condition number) For numericl qudrture, the condition number is given by K I = b f (x) dx b f (x) dx. If K I >> 1, then the problem is ill-posed. () Numericl Qudrture 5 December 2012 19 / 46

Qudrture Exmple: Condition Number Exmple The profits or losses per dy of cr mnufcturer depend on the seson. Assume the following profit formuls for the first nd third qurters: w spr (t) = 0.01 + sin(π(t 1/2)), t [0, 1], w fll (t) = 0.01 + sin(π(t + 1/2)). Totl first qurter profit is given by 1 0 w spr (t) dt. Is this well-posed problem? Wht re the first nd third qurter profits if we use the rectngle rule with n = 50? () Numericl Qudrture 5 December 2012 20 / 46

Qudrture Exmple: Condition Number To find out if the problem is well-posed, we need to find the condition number: K I = 1 0 1 w spr(t) dt 0 w spr(t) dt where 1 0 w spr (t) dt = 1 (0.01 + sin(π(t 1/2))) dt 0 = 0.01t 1 0 1 π cos(π(t 1/2)) = 0.01 () Numericl Qudrture 5 December 2012 21 / 46

Qudrture Exmple: Condition Number 1 0 1 w spr (t) dt = = 0.01 + sin(π(t 1/2)) dt 0 1/2 0 1 + (0.01 + sin(π(t 1/2))) dt (0.01 + sin(π(t 1/2))) dt 1/2 ( = 0.01 + 1 ) ( + 0.01 + 1 ) π π =0.02 + 2 π 0.6566 () Numericl Qudrture 5 December 2012 22 / 46

Qudrture Exmple: Condition Number The condition number is then K I = 1 0 1 w spr(t) dt 0 w spr(t) dt = 0.6466 0.01 65.66 Lrge condition number so ill-posed. If we use the rectngle rule with n = 50, w spr = 0.01 w fll = 0.03. Probbly need bigger n. () Numericl Qudrture 5 December 2012 23 / 46

Newton-Cotes Qudrture Let us look t nother method for evluting b f (x) dx. Ide: Replce f (x) by n pproximtion nd then integrte. b f (x) dx b p(x) dx. For exmple, using liner interpolnt, we cn replce f (x) by p 1 (x) : (b x)f () + (x )f (b) p 1 (x) =. b () Numericl Qudrture 5 December 2012 24 / 46

Newton-Cotes Qudrture Then we hve the Trpezoidl rule over one domin: T 1 (f ) = b where x 1 = nd x 2 = b. p 1 (x) dx = 1 (b )(f () + f (b)). 2 () Numericl Qudrture 5 December 2012 25 / 46

Newton-Cotes Qudrture However, we cn obtin better pproximtion by breking the intervl [, b] into smller subintervls. () Numericl Qudrture 5 December 2012 26 / 46

Newton-Cotes Qudrture Define n to be the number of subintervls nd h = b n. Define the nodes to be x j = + jh, j = 0, 1,..., n. Then I(f ) = b f (x) dx = x1 x 0 f (x) dx + + n = k=1 xn 1 xk x2 x n 2 f (x) dx + x k 1 f (x) dx. x 1 f (x) dx + xn x n 1 x3 x 2 f (x) dx f (x) dx () Numericl Qudrture 5 December 2012 27 / 46

Newton-Cotes Qudrture We then use liner interpoltion for ech integrl: xk x k 1 f (x) dx x k x k 1 (f (x k 1 ) + f (x k )) = h 2 2 (f (x k 1) + f (x k )). So tht I(f ) = b f (x) dx = = n k=1 n k=1 xk x k 1 f (x) dx h 2 (f (x k 1) + f (x k )) T (f )= h n 1 2 (f (x 0) + f (x n )) + h k=1 f (x k ) which is the Trpezoidl Rule. () Numericl Qudrture 5 December 2012 28 / 46

Newton-Cotes Qudrture The error is given by b f (x) dx T (f ) (b ) h 2 f (ξ). 12 Rectngle rule is O(h). Trpezoidl rule is O(h 2 ). But require the sme mount of work, but the Trpezoidl rule is higher order. () Numericl Qudrture 5 December 2012 29 / 46

Newton-Cotes Qudrture Exmple Evlute 4 0 dx 1 + x 2 using the trpezoidl rule with two subintervls. Compre it to the exct solution. () Numericl Qudrture 5 December 2012 30 / 46

Newton-Cotes Qudrture The exct solution is given by 4 0 dx 1 + x 2 = 2 0 dx 1 + x 2 + 4 = tn 1 (4) 1.3258 2 dx 1 + x 2 () Numericl Qudrture 5 December 2012 31 / 46

Newton-Cotes Qudrture Now, let us evlute the integrl using the Trpezoidl rule with n = 2. Then Then = 0, b = 4, h = 4 0 2 = 2. x 0 = = 0, x 1 = x 0 + h = 2, x 2 = b = 4. () Numericl Qudrture 5 December 2012 32 / 46

Newton-Cotes Qudrture Then T (f ) = h n 1 2 (f (x 0) + f (x n )) + h k=1 = h 2 (f (x 0) + f (x 2 )) + hf (x 1 ) f (x k ) = 2 2 ( 1 1 + 0 2 + 1 1 + 4 2 ) + 2 1 1 + 2 2 = 1 + 1 17 + 2 5 = 124 85 1.4588 () Numericl Qudrture 5 December 2012 33 / 46

Newton-Cotes Qudrture The error is bounded by b f (x) dx T (f ) (b ) h 2 f (ξ) 12 ξ [0,4] 4 12 22 mx 16 12 2 = 8 3 2(3ξ 2 1) (1 + x 2 ) 3 }{{} = 2 t ξ=0 The ctul error is b f (x) dx T (f ) n=1 = tn 1 (4) 1.4588 = 0.1330 () Numericl Qudrture 5 December 2012 34 / 46

Qudrture Summry There re two pproches to pproximting b f (x) dx Approximting the entire intervl using the ide of re under curve: Riemnn integrtion: Rectngle nd Midpoint rule Approximting f (x) using liner interpoltion nd then integrting Trpezoidl rule. () Numericl Qudrture 5 December 2012 35 / 46

Qudrture Exmple Exmple We wnt to determine the integrl 1 1 ((10x) 3 + 0.001) dx. 1 The reltive rounding error in the function vlues is less thn ɛ. Determine the reltive error in the integrl due to rounding errors. 2 Use the composite midpoint rule s the numericl qudrture method nd ɛ < 10 8. Give resonble vlue for the step size, h. () Numericl Qudrture 5 December 2012 36 / 46

Qudrture Exmple 1. Reltive error due to rounding errors. In this exmple, = 1, b = 1, nd f (x) = (10x) 3 + 0.001. Assume f (x) ˆf (x) f (x) ɛ. Then, the reltive error is b f (x) dx b ˆf (x) dx b b f (x) dx b f (x) ˆf (x) dx b f (x) dx f (x) dx ɛ b f (x) dx = Kɛ () Numericl Qudrture 5 December 2012 37 / 46

Qudrture Exmple Reltive error = Kɛ where K = b f (x) dx b f (x) dx. This is just the condition number. Let us determine the vlue of K. () Numericl Qudrture 5 December 2012 38 / 46

Qudrture Exmple First, the numertor: b 1 f (x) dx = = (10x) 3 + 0.001 dx 1 0.01 1 + 1 ((10x) 3 + 0.001) dx 0.01 = ( 1 4 103 x 4 + 0.001x =500 ((10x) 3 + 0.001) dx ) 0.01 1 ( ) 1 1 + 4 103 x 4 + 0.001x 0.0 () Numericl Qudrture 5 December 2012 39 / 46

Qudrture Exmple Now, the denomintor: b f (x) dx = 1 ((10x) 3 + 0.001) dx 1 ( 1 1 = 4 103 x 4 + 0.001x) =0.002 1 () Numericl Qudrture 5 December 2012 40 / 46

Qudrture Exmple Therefore, the reltive error is given by b f (x) dx b ˆf (x) dx b b f (x) dx f (x) ˆf (x) dx b f (x) dx = Kɛ = 500 0.002 ɛ = 2.5 105 ɛ We cn see from the condition number tht this problem is ill-posed. () Numericl Qudrture 5 December 2012 41 / 46

Qudrture Exmple 2. Determining the step size. Let the rounding error be given by ɛ < 10 8. We need for the pproximtion error to be less thn the rounding error where f (x) ˆf (x) f (x) ɛ. Therefore the bsolute error is given through 1 1 1 f (x) dx ˆf (x) dx 1 1 f (x) dx ˆf (x) dx 1 ɛ 1 1 f (x) dx () Numericl Qudrture 5 December 2012 42 / 46

Qudrture Exmple So tht the roundoff error is 1 1 1 f (x) dx ˆf (x) dx 1 1 ɛ (10x) 3 + 0.001 dx 1 500ɛ = 2.00 10 4 if ɛ = 4 10 8. () Numericl Qudrture 5 December 2012 43 / 46

Qudrture Exmple The pproximtion error is given by where M = b 24 h2 M mx f (x) = mx 6000x. x [ 1,1] x [ 1,1] Thus, the pproximtion error is bounded by 1 f (x) dx I M (f ) 2 24 h2 6000 = 500h 2. 1 () Numericl Qudrture 5 December 2012 44 / 46

Qudrture Exmple We need to choose the step size, h, so tht the pproximtion error is less thn the rounding error: 500h 2 < 500ɛ h < ɛ = 6.32 10 4 if ɛ = 4 10 8. () Numericl Qudrture 5 December 2012 45 / 46

Mteril ddressed 1 Review Newton-Rphson Systems of Nonliner Equtions Riemnn integrtion 2 Errors for Riemnn integrtion 3 Newton-Cotes Qudrture Mteril in book: Chpter 4 Useful exercises: Ch4: 1-5 () Numericl Qudrture 5 December 2012 46 / 46