Elements of Numerical Integration

Slides:



Advertisements
Similar presentations
Numerical Integration
Advertisements

ES 240: Scientific and Engineering Computation. Chapter 17: Numerical IntegrationIntegration  Definition –Total area within a region –In mathematical.
1 Chapter 5 Numerical Integration. 2 A Review of the Definite Integral.
Numerical Integration
Newton-Cotes Integration Formula
CHAPTER 4 THE DEFINITE INTEGRAL.
CISE-301: Numerical Methods Topic 1: Introduction to Numerical Methods and Taylor Series Lectures 1-4: KFUPM.
NUMERICAL DIFFERENTIATION The derivative of f (x) at x 0 is: An approximation to this is: for small values of h. Forward Difference Formula.
CISE301_Topic7KFUPM1 SE301: Numerical Methods Topic 7 Numerical Integration Lecture KFUPM Read Chapter 21, Section 1 Read Chapter 22, Sections 2-3.
Numerical Integration Formulas
The Islamic University of Gaza Faculty of Engineering Civil Engineering Department Numerical Analysis ECIV 3306 Chapter 21 Newton-Cotes Integration Formula.
Integrals 5.
Chapter 4 Numerical Differentiation and Integration 1/16 Given x 0, approximate f ’(x 0 ). h xfhxf xf h )()( lim)('    x0x0 x1x1 h x1x1 x0x0.
1 NUMERICAL INTEGRATION Motivation: Most such integrals cannot be evaluated explicitly. Many others it is often faster to integrate them numerically rather.
1 Chapter 5 Numerical Integration. 2 A Review of the Definite Integral.
3. Numerical integration (Numerical quadrature) .
Lecture 19 - Numerical Integration CVEN 302 July 22, 2002.
1 Chapter 7 NUMERICAL INTEGRATION. 2 PRELIMINARIES We use numerical integration when the function f(x) may not be integrable in closed form or even in.
1 Numerical Analysis Lecture 12 Numerical Integration Dr. Nader Okasha.
Numerical Differential & Integration. Introduction If a function f(x) is defined as an expression, its derivative or integral is determined using analytical.
4.6 Numerical Integration -Trapezoidal Rule -Simpson’s Rule
Chapters 5 and 6: Numerical Integration
Chapter 7 – Techniques of Integration
4.6 Numerical Integration. The Trapezoidal Rule One method to approximate a definite integral is to use n trapezoids.
1 Numerical Integration Section Why Numerical Integration? Let’s say we want to evaluate the following definite integral:
MA2213 Lecture 4 Numerical Integration. Introduction Definition is the limit of Riemann sums I(f)
 Finding area of polygonal regions can be accomplished using area formulas for rectangles and triangles.  Finding area bounded by a curve is more challenging.
CISE-301: Numerical Methods Topic 1: Introduction to Numerical Methods and Taylor Series Lectures 1-4: KFUPM CISE301_Topic1.
Integration Copyright © Cengage Learning. All rights reserved.
The Trapezoidal Rule Some elementary functions simply do not have antiderivatives that are elementary functions. For example, there is no elementary function.
Section 5.9 Approximate Integration Practice HW from Stewart Textbook (not to hand in) p. 421 # 3 – 15 odd.
Chap. 11 Numerical Differentiation and Integration
Numerical Integration
6. Numerical Integration 6.1 Definition of numerical integration. 6.2 Reasons to use numerical integration. 6.3 Formulas of numerical Integration. 6.4.
Integration 4 Copyright © Cengage Learning. All rights reserved.
The purpose of Chapter 5 is to develop the basic principles of numerical integration Usefule Words integrate, integral 积分(的), integration 积分(法), quadrature.
Lesson 7-7 Numerical Approximations of Integrals -- What we do when we can’t integrate a function Riemann Sums Trapezoidal Rule.
Sec 21: Generalizations of the Euler Method Consider a differential equation n = 10 estimate x = 0.5 n = 10 estimate x =50 Initial Value Problem Euler.
SE301_Topic 6Al-Amer20051 SE301:Numerical Methods Topic 6 Numerical Integration Dr. Samir Al-Amer Term 053.
Clicker Question 1 What is ? (Hint: u-sub) – A. ln(x – 2) + C – B. x – x 2 + C – C. x + ln(x – 2) + C – D. x + 2 ln(x – 2) + C – E. 1 / (x – 2) 2 + C.
Copyright © Cengage Learning. All rights reserved. 7 Techniques of Integration.
Approximating Antiderivatives. Can we integrate all continuous functions? Most of the functions that we have been dealing with are what are called elementary.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Chapter 20 Numerical Integration of Functions.
Numerical Integration
NUMERICAL DIFFERENTIATION Forward Difference Formula
Part 6 - Chapter 21.
Chapter 7 Numerical Differentiation and Integration
Approximate Integration
Clicker Question 1 What is ? A. x tan(x2) + C
Midpoint and Trapezoidal Rules
Numerical Analysis Lecture 42.
5.5 Trapezoidal Rule.
Copyright © Cengage Learning. All rights reserved.
Numerical Integration Formulas
Approximating Definite Integrals. Left Hand Riemann Sums.
Approximating Definite Integrals. Left Hand Riemann Sums.
The LaGrange Error Estimate
Calculus for ENGR2130 Lesson 2 Anti-Derivative or Integration
Chapter 7 Numerical Differentiation and Integration
Copyright © Cengage Learning. All rights reserved.
Composite Numerical Integration
4.3 Elements of Numerical Integration
Elements of Numerical Integration
Copyright © Cengage Learning. All rights reserved.
SKTN 2393 Numerical Methods for Nuclear Engineers
Numerical Integration
CPE 332 Computer Engineering Mathematics II
Numerical Integration
Elements of Numerical Integration
Presentation transcript:

Elements of Numerical Integration Sec:4.3 Elements of Numerical Integration

Sec:4.3 Elements of Numerical Integration How to integrate a definite integral of a function that has no explicit antiderivative or whose antiderivative is not easy to obtain. 𝒂 𝒃 𝒇 𝒙 𝒅𝒙

Sec:4.3 Elements of Numerical Integration The Trapezoidal Rule 𝑎 𝑏 𝑓 𝑥 𝑑𝑥 = 𝒉 𝟐 𝒇 𝒙 𝟎 +𝒇 𝒙 𝟏 − 𝒉 𝟑 𝟏𝟐 𝒇 ′′ 𝝃 ℎ=𝑏−𝑎 Simpson’s Rule 𝑎 𝑏 𝑓 𝑥 𝑑𝑥 = 𝒉 𝟑 𝒇 𝒙 𝟎 +𝟒𝒇 𝒙 𝟏 +𝒇( 𝒙 𝟐 ) − 𝒉 𝟓 𝟗𝟎 𝒇 𝟒 𝝃 ∗ ℎ=(𝑏−𝑎)/2 The midpoint Rule 𝑎 𝑏 𝑥 0 𝒚=𝒇(𝒙) How to use MATLAB Derivation 𝑎 𝑏 𝑓 𝑥 𝑑𝑥 =𝟐𝒉𝒇 𝒙 𝟎 + 𝒉 𝟑 𝟑 𝒇 ′′ 𝝃 ℎ=(𝑏−𝑎)/2 𝑥 0 =(𝑏+𝑎)/2

Sec:4.3 Elements of Numerical Integration Example The Trapezoidal Rule Approximate the integral using the Trapezoidal rule 𝑎 𝑏 𝑓 𝑥 𝑑𝑥 = 𝒉 𝟐 𝒇 𝒙 𝟎 +𝒇 𝒙 𝟏 − 𝒉 𝟑 𝟏𝟐 𝒇 ′′ 𝝃 0 2 𝑥 2 𝑑𝑥 ℎ=𝑏−𝑎 𝑓 𝑥 = 𝑥 2 ,ℎ=2, 𝑎=0,𝑏=2 0 2 𝑥 2 𝑑𝑥 ≈ 𝟏 𝟐 𝒉 𝒇 𝒙 𝟎 +𝒇 𝒙 𝟏 ≈ 𝟏 𝟐 𝒉 𝒇 𝒙 𝟎 +𝒇 𝒙 𝟏 ≈ 𝟏 𝟐 (𝟐) 𝟎+𝟒 ≈𝟒

Sec:4.3 Elements of Numerical Integration Example Simpson’s Rule Approximate the integral using the Simpson’s rule 𝑎 𝑏 𝑓 𝑥 𝑑𝑥 = 𝒉 𝟑 𝒇 𝒙 𝟎 +𝟒𝒇 𝒙 𝟏 +𝒇( 𝒙 𝟐 ) − 𝒉 𝟓 𝟗𝟎 𝒇 𝟒 𝝃 ∗ 0 2 𝑥 2 𝑑𝑥 ℎ=(𝑏−𝑎)/2 𝑓 𝑥 = 𝑥 2 ,ℎ=1, 𝑥 0 =0, 𝑥 1 =1, 𝑥 2 =2 0 2 𝑥 2 𝑑𝑥 ≈ 𝒉 𝟑 𝒇 𝒙 𝟎 +𝟒𝒇 𝒙 𝟏 +𝒇 𝒙 𝟐 ≈ 𝟏 𝟑 𝒇 𝟎 +𝟒𝒇 𝟏 +𝒇 𝟐 𝑥 0 =0 𝑥 1 =1 𝑥 2 =2 ≈ 𝟏 𝟑 𝟎+𝟒+𝟒 ≈ 𝟖 𝟑 It is exact

Sec:4.3 Elements of Numerical Integration Example The midpoint Rule Approximate the integral using the midpoint rule 𝑎 𝑏 𝑓 𝑥 𝑑𝑥 =𝟐𝒉𝒇 𝒙 𝟎 + 𝒉 𝟑 𝟑 𝒇 ′′ 𝝃 0 𝜋 4 sin⁡(𝑥) 𝑑𝑥 ℎ=(𝑏−𝑎)/2 𝑥 0 =(𝑏+𝑎)/2 𝑎 𝑏 𝑥 0 𝒚=𝒇(𝒙) 𝑓 𝑥 =sin⁡(𝑥),ℎ= 𝜋 8 , 𝑎=0, 𝑏= 𝜋 4 𝑥 0 = 𝜋 8 , 0 𝜋 4 sin⁡(𝑥)𝑑𝑥 ≈ 𝟐( 𝜋 8 ) 𝒇 𝜋 8 𝑎=0 𝑥 0 = 𝜋 8 𝑏= 𝜋 4 ≈𝟎.𝟑𝟎𝟎𝟓𝟓𝟖𝟖𝟕

Sec:4.3 Elements of Numerical Integration The Trapezoidal Rule f = @(x) x^2; a=0; b=2; h=b-a; intg = (h/2)*(f(a)+f(b)) 𝑎 𝑏 𝑓 𝑥 𝑑𝑥 = 𝒉 𝟐 𝒇 𝒙 𝟎 +𝒇 𝒙 𝟏 − 𝒉 𝟑 𝟏𝟐 𝒇 ′′ 𝝃 ℎ=𝑏−𝑎 Simpson’s Rule f = @(x) x^2; a=0; b=2; h=(b-a)/2; x=a:h:b; intg = (h/3)*(f(x(1))+4*f(x(2))+f(x(3))) 𝑎 𝑏 𝑓 𝑥 𝑑𝑥 = 𝒉 𝟑 𝒇 𝒙 𝟎 +𝟒𝒇 𝒙 𝟏 +𝒇( 𝒙 𝟐 ) − 𝒉 𝟓 𝟗𝟎 𝒇 𝟒 𝝃 ∗ ℎ=(𝑏−𝑎)/2 The midpoint Rule f = @(x) sin(x); a=0; b=pi/4; h=(b-a)/2; x0= =(b+a)/2; intg = 2*h*f(x0) 𝑎 𝑏 𝑓 𝑥 𝑑𝑥 =𝟐𝒉𝒇 𝒙 𝟎 + 𝒉 𝟑 𝟑 𝒇 ′′ 𝝃 ℎ=(𝑏−𝑎)/2 𝑥 0 =(𝑏+𝑎)/2

Sec:4.3 Elements of Numerical Integration Example Simpson’s Rule ℎ=(𝑏−𝑎)/2 Approximate the integral using the Simpson’s rule 𝑎 𝑏 𝑓 𝑥 𝑑𝑥 = 𝒉 𝟑 𝒇 𝒙 𝟎 +𝟒𝒇 𝒙 𝟏 +𝒇( 𝒙 𝟐 ) − 𝒉 𝟓 𝟗𝟎 𝒇 𝟒 𝝃 ∗ 0 2 𝑥 2 𝑑𝑥 Definition The degree of precision (or accuracy) of integral formula is n if and only if the error is zero for all polynomials 𝑞 0 𝑥 =1, 𝑞 1 𝑥 =𝑥, 𝑞 2 𝑥 = 𝑥 2 ,⋯, 𝑞 𝑛 𝑥 = 𝑥 𝑛 but is not zero for the polynomial 𝑞 𝑛+1 𝑥 = 𝑥 𝑛+1 𝑓 𝑥 = 𝑥 2 ,ℎ=1, 𝑥 0 =0, 𝑥 1 =1, 𝑥 2 =2 0 2 𝑥 2 𝑑𝑥 ≈ 𝒉 𝟑 𝒇 𝒙 𝟎 +𝟒𝒇 𝒙 𝟏 +𝒇 𝒙 𝟐 ≈ 𝟏 𝟑 𝒇 𝟎 +𝟒𝒇 𝟏 +𝒇 𝟐 ≈ 𝟖 𝟑 It is exact The approximation from Simpson's rule is exact because its truncation error involves 𝒇 𝟒 𝝃 ∗ , which is identically 0 when 𝑓 𝑥 = 𝑥 2 Remark the degree of precision of Simpson’s rule is 3. The integral of any polynomial of degree 3 or less is exact when using Simpson’s rule

How to find degree of precision Sec:4.3 Elements of Numerical Integration Definition Definition The degree of precision (or accuracy) of integral formula is n if and only if the error is zero for all polynomials 𝑞 0 𝑥 =1, 𝑞 1 𝑥 =𝑥, 𝑞 2 𝑥 = 𝑥 2 ,⋯, 𝑞 𝑛 𝑥 = 𝑥 𝑛 but is not zero for the polynomial 𝑞 𝑛+1 𝑥 = 𝑥 𝑛+1 Find the degree of precision of the formula −𝟏 𝟏 𝒇(𝒙) 𝒅𝒙≈𝒇 − 𝟑 𝟑 +𝒇( 𝟑 𝟑 ) solution function: Exact: Use the formula: −𝟏 𝟏 𝟏 𝒅𝒙=𝟐 𝒇 − 𝟑 𝟑 +𝒇 𝟑 𝟑 =𝟏+𝟏=𝟐 𝒇 𝒙 =𝟏 How to find degree of precision function: Exact: Use the formula: −𝟏 𝟏 𝒙 𝒅𝒙=𝟎 𝒇 − 𝟑 𝟑 +𝒇 𝟑 𝟑 =− 𝟑 𝟑 + 𝟑 𝟑 =𝟎 𝒇 𝒙 =𝒙 𝒇 𝒙 =𝟏 𝒂 𝒃 𝟏 𝒅𝒙 𝒂 𝒃 𝟏 𝒅𝒙 −𝟏 𝟏 𝒙 𝟐 𝒅𝒙 = 𝟐 𝟑 𝒇 − 𝟑 𝟑 +𝒇 𝟑 𝟑 = 𝟏 𝟑 + 𝟏 𝟑 = 𝟐 𝟑 𝒇 𝒙 = 𝒙 𝟐 𝒇 𝒙 =𝒙 𝒂 𝒃 𝒙 𝒅𝒙 𝒂 𝒃 𝒙 𝒅𝒙 −𝟏 𝟏 𝒙 𝟑 𝒅𝒙 =𝟎 𝒇 − 𝟑 𝟑 +𝒇 𝟑 𝟑 =− 𝟑 𝟗 + 𝟑 𝟗 =𝟎 𝒇 𝒙 = 𝒙 𝟑 𝒇 𝒙 = 𝒙 𝟐 𝒂 𝒃 𝒙 𝟐 𝒅𝒙 𝒂 𝒃 𝒙 𝟐 𝒅𝒙 −𝟏 𝟏 𝒙 𝟒 𝒅𝒙 = 𝟐 𝟓 𝒇 − 𝟑 𝟑 +𝒇 𝟑 𝟑 = 𝟏 𝟗 + 𝟏 𝟗 = 𝟐 𝟗 𝒇 𝒙 = 𝒙 𝟒 ⋮ ⋮ ⋮ the degree of precision is 3.

Derivation Sec:4.3 Elements of Numerical Integration Weighted Mean Value Theorem for Integrals Suppose f ∈ C[a, b], the Riemann integral of g exists on [a, b], and g(x) does not change sign on [a, b]. Then there exists a number c in (a, b) with The Trapezoidal Rule 𝑎 𝑏 𝑓 𝑥 𝑑𝑥 = 𝒉 𝟐 𝒇 𝒙 𝟎 +𝒇 𝒙 𝟏 − 𝒉 𝟑 𝟏𝟐 𝒇 ′′ 𝝃 ℎ=𝑏−𝑎 𝑎 𝑏 𝑓 𝑥 𝑔 𝑥 𝑑𝑥=𝒇(𝒄) 𝑎 𝑏 𝑔 𝑥 𝑑𝑥

Sec:4.3 Elements of Numerical Integration Derivation for The Trapezoidal Rule using first Lagrange polynomials 𝑥 0 =𝑎 𝑥 1 =𝑏 ℎ=𝑏−𝑎 𝑓 𝑥 = 𝒑 𝟏 𝒙 + 𝑹 𝟏 (𝒙) 𝑓 𝑥 =𝒇 𝒙 𝟎 𝑳 𝟎 (𝒙)+𝒇 𝒙 𝟏 𝑳 𝟏 (𝒙)+ 𝒇 ′′ 𝝃 𝟐! (𝒙− 𝒙 𝟎 )(𝒙− 𝒙 𝟏 ) 𝑓 𝑥 =𝒇 𝒙 𝟎 𝒙− 𝒙 𝟏 𝒙 𝟎 − 𝒙 𝟏 +𝒇 𝒙 𝟏 𝒙− 𝒙 𝟎 𝒙 𝟏 − 𝒙 𝟎 + 𝒇 ′′ 𝝃 𝟐! (𝒙− 𝒙 𝟎 )(𝒙− 𝒙 𝟏 ) 𝑎 𝑏 𝑓 𝑥 𝑑𝑥 =𝒇 𝒙 𝟎 𝒙 𝟎 𝒙 𝟏 𝑳 𝟎 𝒙 𝒅𝒙 +𝒇 𝒙 𝟏 𝒙 𝟎 𝒙 𝟏 𝑳 𝟏 𝒙 𝒅𝒙+ 𝒙 𝟎 𝒙 𝟏 𝒇 ′′ 𝝃 𝟐! (𝒙− 𝒙 𝟎 )(𝒙− 𝒙 𝟏 ) dx 𝑎 𝑏 𝑓 𝑥 𝑑𝑥 = 1 2 ℎ 𝒇 𝒙 𝟎 +𝒇 𝒙 𝟏 + 𝒙 𝟎 𝒙 𝟏 𝒇 ′′ 𝝃 𝟐! (𝒙− 𝒙 𝟎 )(𝒙− 𝒙 𝟏 ) dx 𝒙 𝟎 𝒙 𝟏 𝑳 𝟎 𝒙 𝒅𝒙= 𝒙 𝟎 𝒙 𝟏 𝒙− 𝒙 𝟏 𝒙 𝟎 − 𝒙 𝟏 𝒅𝒙= 𝟏 −𝒉 𝒙 𝟎 𝒙 𝟏 𝒙− 𝒙 𝟏 𝒅𝒙= − 𝟏 𝒉 𝒙− 𝒙 𝟏 𝟐 𝟐 𝒙 𝟎 𝒙 𝟏 = − 𝟏 𝒉 𝟎− 𝟏 𝟐 𝒉 𝟐 = 𝟏 𝟐 𝒉 𝒙 𝟎 𝒙 𝟏 𝑳 𝟏 𝒙 𝒅𝒙= 𝒙 𝟎 𝒙 𝟏 𝒙− 𝒙 𝟎 𝒙 𝟏 − 𝒙 𝟎 𝒅𝒙= 𝟏 𝒉 𝒙 𝟎 𝒙 𝟏 𝒙− 𝒙 𝟎 𝒅𝒙= 𝟏 𝒉 𝒙− 𝒙 𝟎 𝟐 𝟐 𝒙 𝟎 𝒙 𝟏 = 𝟏 𝒉 𝟏 𝟐 𝒉 𝟐 −𝟎 = 𝟏 𝟐 𝒉

Sec:4.3 Elements of Numerical Integration Error for The Trapezoidal Rule The Trapezoidal Rule Weighted Mean Value Theorem for Integrals Suppose f ∈ C[a, b], the Riemann integral of g exists on [a, b], and g(x) does not change sign on [a, b]. Then there exists a number c in (a, b) with 𝑎 𝑏 𝑓 𝑥 𝑑𝑥 = 1 2 ℎ 𝒇 𝒙 𝟎 +𝒇 𝒙 𝟏 + 𝒙 𝟎 𝒙 𝟏 𝒇 ′′ 𝝃 𝟐! (𝒙− 𝒙 𝟎 )(𝒙− 𝒙 𝟏 ) dx 𝒙 𝟎 𝒙 𝟏 𝒇 ′′ 𝝃 𝟐! (𝒙− 𝒙 𝟎 )(𝒙− 𝒙 𝟏 ) dx = 𝟏 𝟐 𝒙 𝟎 𝒙 𝟏 𝒇 ′′ 𝝃(𝒙) (𝒙− 𝒙 𝟎 )(𝒙− 𝒙 𝟏 ) dx 𝑎 𝑏 𝑓 𝑥 𝑔 𝑥 𝑑𝑥=𝑓(𝑐) 𝑎 𝑏 𝑔 𝑥 𝑑𝑥 The Weighted Mean Value Theorem for Integrals = 𝒇 ′′ 𝝃 𝟐 𝒙 𝟎 𝒙 𝟏 (𝒙− 𝒙 𝟎 )(𝒙− 𝒙 𝟏 ) dx = 𝒇 ′′ 𝝃 𝟐 − 𝒉 𝟑 𝟔 ==− 𝒉 𝟑 𝟏𝟐 𝒇 ′′ 𝝃 The Trapezoidal Rule 𝑎 𝑏 𝑓 𝑥 𝑑𝑥 = 1 2 ℎ 𝒇 𝒙 𝟎 +𝒇 𝒙 𝟏 − 𝒉 𝟑 𝟏𝟐 𝒇 ′′ 𝝃

Derivation Sec:4.3 Elements of Numerical Integration Simpson’s Rule 𝑎 𝑏 𝑓 𝑥 𝑑𝑥 = 𝒉 𝟑 𝒇 𝒙 𝟎 +𝟒𝒇 𝒙 𝟏 +𝒇( 𝒙 𝟐 ) − 𝒉 𝟓 𝟗𝟎 𝒇 𝟒 𝝃 ∗ ℎ=(𝑏−𝑎)/2

Sec:4.3 Elements of Numerical Integration Simpson’s Rule Derivation using second Lagrange polynomials 𝑥 0 =𝑎 𝑥 1 = 𝑥 0 +ℎ 𝑥 2 =𝑏 𝑓 𝑥 = 𝒑 𝟏 𝒙 + 𝑹 𝟏 (𝒙) 𝑓 𝑥 =𝒇 𝒙 𝟎 𝑳 𝟎 (𝒙)+𝒇 𝒙 𝟏 𝑳 𝟏 (𝒙)+𝒇 𝒙 𝟐 𝑳 𝟐 (𝒙)+ 𝒇 ′′′ 𝝃 𝟑! (𝒙− 𝒙 𝟎 )(𝒙− 𝒙 𝟏 ) (𝒙− 𝒙 𝟐 ) 𝑎 𝑏 𝑓 𝑥 𝑑𝑥 =𝒇 𝒙 𝟎 𝒙 𝟎 𝒙 𝟐 𝑳 𝟎 𝒙 𝒅𝒙 +𝒇 𝒙 𝟏 𝒙 𝟎 𝒙 𝟐 𝑳 𝟏 𝒙 𝒅𝑥+𝒇 𝒙 𝟐 𝒙 𝟎 𝒙 𝟐 𝑳 𝟐 𝒙 𝒅𝒙+ 𝒙 𝟎 𝒙 𝟐 𝒇 ′′′ 𝝃 𝟑! (𝒙− 𝒙 𝟎 )(𝒙− 𝒙 𝟏 )(𝒙− 𝒙 𝟐 )dx = 𝒂 𝟎 𝒇 𝒙 𝟎 + 𝒂 𝟏 𝒇 𝒙 𝟏 + 𝒂 𝟐 𝒇 𝒙 𝟐 + 𝒙 𝟎 𝒙 𝟐 𝒇 ′′′ 𝝃 𝟑! (𝒙− 𝒙 𝟎 )(𝒙− 𝒙 𝟏 )(𝒙− 𝒙 𝟐 )dx 𝒂 𝟎 = 𝒙 𝟎 𝒙 𝟐 𝑳 𝟎 𝒙 𝒅𝒙= 𝒉 𝟑 𝒂 𝟏 = 𝒙 𝟎 𝒙 𝟐 𝑳 𝟏 𝒙 𝒅𝒙= 𝟒𝒉 𝟑 𝒂 𝟐 = 𝒙 𝟎 𝒙 𝟐 𝑳 𝟐 𝒙 𝒅𝒙= 𝒉 𝟑 Simpson’s Rule 𝑎 𝑏 𝑓 𝑥 𝑑𝑥 = 𝒉 𝟑 𝒇 𝒙 𝟎 +𝟒𝒇 𝒙 𝟏 +𝒇 𝒙 𝟐 + 𝒙 𝟎 𝒙 𝟐 𝒇 ′′′ 𝝃 𝟑! (𝒙− 𝒙 𝟎 )(𝒙− 𝒙 𝟏 )(𝒙− 𝒙 𝟐 )dx Deriving Simpson’s rule in this manner, however, provides only an 𝑂( ℎ 4 ) error term involving 𝒇′′′ (𝝃).

Sec:4.3 Elements of Numerical Integration approaching the problem in another way, a higher-order term 𝑥 0 =𝑎 𝑥 1 = 𝑥 0 +ℎ 𝑥 2 =𝑏 Third Taylor polynomial 𝑓 𝑥 =𝑓 𝑥 1 + 𝑓 ′ ( 𝑥 1 ) 𝑥− 𝑥 1 + 𝑓 ′ ′( 𝑥 1 ) 2 𝑥− 𝑥 1 2 + 𝑓 ′ ′′( 𝑥 1 ) 6 𝑥− 𝑥 1 3 + 𝒇 (𝟒) (𝝃) 𝟐𝟒 𝒙− 𝒙 𝟏 𝟒 𝑥 0 𝑥 2 𝑓 𝑥 𝑑𝑥 = 𝑥 0 𝑥 2 𝑓 𝑥 1 + 𝑓 ′ ( 𝑥 1 ) 𝑥− 𝑥 1 + 𝑓 ′ ′( 𝑥 1 ) 2 𝑥− 𝑥 1 2 + 𝑓 ′ ′′( 𝑥 1 ) 6 𝑥− 𝑥 1 3 𝑑𝑥 + 𝒙 𝟎 𝒙 𝟐 𝒇 (𝟒) (𝝃) 𝟐𝟒 𝒙− 𝒙 𝟏 𝟒 𝒅𝒙 𝒙 𝟎 𝒙 𝟐 𝒇 ′ ( 𝒙 𝟏 ) 𝒙− 𝒙 𝟏 𝒅𝒙 =𝟎 𝑥 0 𝑥 2 𝑓 ′ ′′( 𝑥 1 ) 6 𝑥− 𝑥 1 3 𝑑𝑥=0 𝑥 0 𝑥 2 𝑓 𝑥 𝑑𝑥 = 𝑥 0 𝑥 2 𝑓 𝑥 1 + 𝑓 ′ ′( 𝑥 1 ) 2 𝑥− 𝑥 1 2 𝑑𝑥 + 𝒙 𝟎 𝒙 𝟐 𝒇 (𝟒) (𝝃) 𝟐𝟒 𝒙− 𝒙 𝟏 𝟒 𝒅𝒙

Sec:4.3 Elements of Numerical Integration 𝑥 0 𝑥 2 𝑓 𝑥 𝑑𝑥 = 𝑥 0 𝑥 2 𝑓 𝑥 1 + 𝑓 ′ ′( 𝑥 1 ) 2 𝑥− 𝑥 1 2 𝑑𝑥 + 𝒙 𝟎 𝒙 𝟐 𝒇 (𝟒) (𝝃) 𝟐𝟒 𝒙− 𝒙 𝟏 𝟒 𝒅𝒙 =2ℎ𝑓 𝑥 1 + ℎ 3 3 𝑓′′ 𝑥 1 + 𝒙 𝟎 𝒙 𝟐 𝒇 (𝟒) (𝝃) 𝟐𝟒 𝒙− 𝒙 𝟏 𝟒 𝒅𝒙 𝒇 ′′ 𝒙 𝟏 = 𝒇 𝒙 𝟎 −𝟐𝒇 𝒙 𝟏 +𝒇( 𝒙 𝟐 ) 𝒉 𝟐 − 𝒉 𝟐 𝟏𝟐 𝒇 𝟒 ( 𝝃 𝟐 ) Using centered difference formaula for =2ℎ𝑓 𝑥 1 + ℎ 3 3 𝒇 𝒙 𝟎 −𝟐𝒇 𝒙 𝟏 +𝒇( 𝒙 𝟐 ) 𝒉 𝟐 − 𝒉 𝟐 𝟏𝟐 𝒇 𝟒 ( 𝝃 𝟐 ) + 𝒙 𝟎 𝒙 𝟐 𝒇 (𝟒) (𝝃) 𝟐𝟒 𝒙− 𝒙 𝟏 𝟒 𝒅𝒙 =2ℎ𝑓 𝑥 1 + ℎ 3 𝒇 𝒙 𝟎 −𝟐𝒇 𝒙 𝟏 +𝒇( 𝒙 𝟐 ) − ℎ 3 𝒉 𝟒 𝟏𝟐 𝒇 𝟒 ( 𝝃 𝟐 ) + 𝒙 𝟎 𝒙 𝟐 𝒇 (𝟒) (𝝃) 𝟐𝟒 𝒙− 𝒙 𝟏 𝟒 𝒅𝒙 = ℎ 3 𝟔𝒇 𝒙 𝟏 +𝒇 𝒙 𝟎 −𝟐𝒇 𝒙 𝟏 +𝒇( 𝒙 𝟐 ) − 𝒉 𝟓 𝟑𝟔 𝒇 𝟒 ( 𝝃 𝟐 ) + 𝒙 𝟎 𝒙 𝟐 𝒇 (𝟒) (𝝃) 𝟐𝟒 𝒙− 𝒙 𝟏 𝟒 𝒅𝒙 𝑥 0 𝑥 2 𝑥− 𝑥 1 4 𝑑𝑥 = = 𝑥− 𝑥 1 5 5 𝑥 0 𝑥 2 = 2 ℎ 5 5 The Weighted Mean Value Theorem for Integrals = ℎ 3 𝒇 𝒙 𝟎 +𝟒𝒇 𝒙 𝟏 +𝒇( 𝒙 𝟐 ) − 𝒉 𝟓 𝟑𝟔 𝒇 𝟒 ( 𝝃 𝟐 ) + 𝒇 (𝟒) (𝝃) 𝟐𝟒 𝒙 𝟎 𝒙 𝟐 𝒙− 𝒙 𝟏 𝟒 𝒅𝒙 = ℎ 3 𝒇 𝒙 𝟎 +𝟒𝒇 𝒙 𝟏 +𝒇( 𝒙 𝟐 ) − 𝒉 𝟓 𝟑𝟔 𝒇 𝟒 𝝃 𝟐 + 𝒉 𝟓 𝟔𝟎 𝒇 𝟒 𝝃 = ℎ 3 𝒇 𝒙 𝟎 +𝟒𝒇 𝒙 𝟏 +𝒇( 𝒙 𝟐 ) − 𝒉 𝟓 𝟗𝟎 𝒇 𝟒 𝝃 ∗

Sec:4.3 Elements of Numerical Integration Notice that in each instance Simpson’s Rule is significantly superior. Simpson’s Rule The Trapezoidal Rule 𝑎 𝑏 𝑓 𝑥 𝑑𝑥 = 𝒉 𝟑 𝒇 𝒙 𝟎 +𝟒𝒇 𝒙 𝟏 +𝒇( 𝒙 𝟐 ) − 𝒉 𝟓 𝟗𝟎 𝒇 𝟒 𝝃 ∗ 𝑎 𝑏 𝑓 𝑥 𝑑𝑥 = 𝒉 𝟐 𝒇 𝒙 𝟎 +𝒇 𝒙 𝟏 − 𝒉 𝟑 𝟏𝟐 𝒇 ′′ 𝝃

Sec:4.3 Elements of Numerical Integration The Trapezoidal Rule 𝑎 𝑏 𝑓 𝑥 𝑑𝑥 = 𝒉 𝟐 𝒇 𝒙 𝟎 +𝒇 𝒙 𝟏 − 𝒉 𝟑 𝟏𝟐 𝒇 ′′ 𝝃 The Trapezoidal and Simpson's rules are examples of a class of methods known as closed Newton-cotes methods. ℎ=𝑏−𝑎 Simpson’s Rule In the formula information in the endpoints are used 𝑎 𝑏 𝑓 𝑥 𝑑𝑥 = 𝒉 𝟑 𝒇 𝒙 𝟎 +𝟒𝒇 𝒙 𝟏 +𝒇( 𝒙 𝟐 ) − 𝒉 𝟓 𝟗𝟎 𝒇 𝟒 𝝃 ∗ ℎ=(𝑏−𝑎)/2 The midpoint Rule The midpoint rules is an example of a class of methods known as open Newton-cotes methods. 𝑎 𝑏 𝑓 𝑥 𝑑𝑥 =𝟐𝒉𝒇 𝒙 𝟎 + 𝒉 𝟑 𝟑 𝒇 ′′ 𝝃 In the formula information in the endpoints are not used ℎ=(𝑏−𝑎)/2 𝑥 0 =(𝑏+𝑎)/2

Sec:4.3 Elements of Numerical Integration The Trapezoidal Rule (2pts) Simpson’s Rule (3pts) 𝑎 𝑏 𝑓 𝑥 𝑑𝑥 = 𝒉 𝟐 𝒇 𝒙 𝟎 +𝒇 𝒙 𝟏 − 𝒉 𝟑 𝟏𝟐 𝒇 ′′ 𝝃 𝑎 𝑏 𝑓 𝑥 𝑑𝑥 = 𝒉 𝟑 𝒇 𝒙 𝟎 +𝟒𝒇 𝒙 𝟏 +𝒇( 𝒙 𝟐 ) − 𝒉 𝟓 𝟗𝟎 𝒇 𝟒 𝝃 ∗ 𝑓 𝑥 ≈𝒇 𝒙 𝟎 𝑳 𝟎 (𝒙)+⋯+𝒇 𝒙 𝒏 𝑳 𝒏 (𝒙) 𝒉= 𝒃−𝒂 𝒏 𝑓 𝑥 ≈ 𝑖=0 𝑛 𝒇 𝒙 𝒊 𝑳 𝒊 (𝒙) 𝑥 0 𝑥 𝑛 𝑓 𝑥 𝑑𝑥 ≈ 𝑖=0 𝑛 𝒇 𝒙 𝒊 𝒙 𝟎 𝒙 𝒏 𝑳 𝒊 (𝒙)𝒅𝒙 𝑥 0 𝑥 𝑛 𝑓 𝑥 𝑑𝑥 ≈ 𝑖=0 𝑛 𝒂 𝒊 𝒇 𝒙 𝒊 Closed Newton-Cotes Formulas The (n+1)-point closed Newton-Cotes formula

𝑹 𝑹 𝑹 Sec:4.3 Elements of Numerical Integration Closed Newton-Cotes Formulas The (n+1)-point closed Newton-Cotes formula 𝑥 0 𝑥 𝑛 𝑓 𝑥 𝑑𝑥 = 𝑖=0 𝑛 𝒂 𝒊 𝒇 𝒙 𝒊 + 𝑹 𝒂 𝒊 = 𝒙 𝟎 𝒙 𝒏 𝑳 𝒊 (𝒙)𝒅𝒙 = 𝒙 𝟎 𝒙 𝒏 𝒋=𝟎 𝒋≠𝒊 𝒏 (𝒙− 𝒙 𝒋 ) ( 𝒙 𝒊 − 𝒙 𝒋 ) 𝒅𝒙 where Theorem 4.2 There exists 𝜉∈ 𝑎,𝑏 such that 𝒏 is odd 𝒏 is even 𝑹 = ℎ 𝑛+2 𝑓 𝑛+1 (𝜉) 𝑛+1 ! 0 𝑛 𝑡 (𝑡−1)⋯ 𝑡−𝑛 𝑑𝑡 𝑹 = ℎ 𝑛+3 𝑓 𝑛+2 (𝜉) 𝑛+2 ! 0 𝑛 𝑡 2 (𝑡−1)⋯ 𝑡−𝑛 𝑑𝑡 the degree of precision is 𝑛 the degree of precision is 𝑛+1 The Trapezoidal Rule (2pts, n=1) Simpson’s Rule (3pts, n=2) 𝑎 𝑏 𝑓 𝑥 𝑑𝑥 = 𝒉 𝟐 𝒇 𝒙 𝟎 +𝒇 𝒙 𝟏 − 𝒉 𝟑 𝟏𝟐 𝒇 ′′ 𝝃 𝑎 𝑏 𝑓 𝑥 𝑑𝑥 = 𝒉 𝟑 𝒇 𝒙 𝟎 +𝟒𝒇 𝒙 𝟏 +𝒇( 𝒙 𝟐 ) − 𝒉 𝟓 𝟗𝟎 𝒇 𝟒 𝝃 ∗

𝑹 Sec:4.3 Elements of Numerical Integration n=1 : The Trapezoidal Rule The (n+1)-point closed Newton-Cotes formula 𝑎 𝑏 𝑓 𝑥 𝑑𝑥 = 𝒉 𝟐 𝒇 𝒙 𝟎 +𝒇 𝒙 𝟏 − 𝒉 𝟑 𝟏𝟐 𝒇 ′′ 𝝃 𝑥 0 𝑥 𝑛 𝑓 𝑥 𝑑𝑥 = 𝑖=0 𝑛 𝒂 𝒊 𝒇 𝒙 𝒊 + 𝑹 n=2 : Simpson’s Rule It is called closed because the endpoints are included as nodes. 𝑎 𝑏 𝑓 𝑥 𝑑𝑥 = 𝒉 𝟑 𝒇 𝒙 𝟎 +𝟒𝒇 𝒙 𝟏 +𝒇( 𝒙 𝟐 ) − 𝒉 𝟓 𝟗𝟎 𝒇 𝟒 𝝃 n = 3: Simpson’s Three-Eighths rule 𝑎 𝑏 𝑓 𝑥 𝑑𝑥 = 𝟑𝒉 𝟖 𝒇 𝒙 𝟎 +𝟑𝒇 𝒙 𝟏 +𝟑𝒇 𝒙 𝟐 +𝒇( 𝒙 𝟑 ) − 𝟑𝒉 𝟓 𝟖𝟎 𝒇 𝟒 𝝃 n = 4: 𝑎 𝑏 𝑓 𝑥 𝑑𝑥 = 𝟐𝒉 𝟒𝟓 𝟕𝒇 𝒙 𝟎 +𝟑𝟐𝒇 𝒙 𝟏 +𝟏𝟐𝒇 𝒙 𝟐 +𝟑𝟐𝒇 𝒙 𝟑 +𝟕𝒇( 𝒙 𝟒 ) − 𝟖𝒉 𝟕 𝟗𝟒𝟓 𝒇 𝟔 𝝃

𝑹 Sec:4.3 Elements of Numerical Integration Open Newton-Cotes Formulas 𝒉= 𝒃−𝒂 𝒏+𝟐 The open Newton-Cotes formulas do not include the endpoints as nodes. Open Newton-Cotes Formulas 𝑥 −1 𝑥 𝑛+1 𝑓 𝑥 𝑑𝑥 = 𝑖=0 𝑛 𝒂 𝒊 𝒇 𝒙 𝒊 + 𝒂 𝒊 = 𝒙 −𝟏 𝒙 𝒏+𝟏 𝑳 𝒊 (𝒙)𝒅𝒙 = 𝒙 −𝟏 𝒙 𝒏+𝟏 𝒋=𝟎 𝒋≠𝒊 𝒏 (𝒙− 𝒙 𝒋 ) ( 𝒙 𝒊 − 𝒙 𝒋 ) 𝒅𝒙 𝑹 where

𝑹 𝑹 𝑹 Sec:4.3 Elements of Numerical Integration Open Newton-Cotes Formulas 𝑥 −1 𝑥 𝑛+1 𝑓 𝑥 𝑑𝑥 = 𝑖=0 𝑛 𝒂 𝒊 𝒇 𝒙 𝒊 + 𝒂 𝒊 = 𝒙 −𝟏 𝒙 𝒏+𝟏 𝑳 𝒊 (𝒙)𝒅𝒙 = 𝒙 −𝟏 𝒙 𝒏+𝟏 𝒋=𝟎 𝒋≠𝒊 𝒏 (𝒙− 𝒙 𝒋 ) ( 𝒙 𝒊 − 𝒙 𝒋 ) 𝒅𝒙 𝑹 where Theorem 4.2 There exists 𝜉∈ 𝑎,𝑏 such that 𝒏 is odd 𝒏 is even 𝑹 = ℎ 𝑛+2 𝑓 𝑛+1 (𝜉) 𝑛+1 ! −1 𝑛+1 𝑡 (𝑡−1)⋯ 𝑡−𝑛 𝑑𝑡 𝑹 = ℎ 𝑛+3 𝑓 𝑛+2 (𝜉) 𝑛+2 ! −1 𝑛+1 𝑡 2 (𝑡−1)⋯ 𝑡−𝑛 𝑑𝑡 n=1 : n=0 : The midpoint Rule 𝑎 𝑏 𝑓 𝑥 𝑑𝑥 = 𝟑𝒉 𝟐 𝒇 𝒙 𝟎 +𝒇 𝒙 𝟏 − 𝟑𝒉 𝟑 𝟒 𝒇 ′′ 𝝃 𝑎 𝑏 𝑓 𝑥 𝑑𝑥 =𝟐𝒉𝒇 𝒙 𝟎 + 𝒉 𝟑 𝟑 𝒇 ′′ 𝝃

𝑹 Sec:4.3 Elements of Numerical Integration Open Newton-Cotes Formulas n=0 : The midpoint Rule 𝑎 𝑏 𝑓 𝑥 𝑑𝑥 =𝟐𝒉𝒇 𝒙 𝟎 + 𝒉 𝟑 𝟑 𝒇 ′′ 𝝃 𝑥 −1 𝑥 𝑛+1 𝑓 𝑥 𝑑𝑥 = 𝑖=0 𝑛 𝒂 𝒊 𝒇 𝒙 𝒊 + 𝑹 n=1 : 𝑎 𝑏 𝑓 𝑥 𝑑𝑥 = 𝟑𝒉 𝟐 𝒇 𝒙 𝟎 +𝒇 𝒙 𝟏 − 𝟑𝒉 𝟑 𝟒 𝒇 ′′ 𝝃 n = 2: 𝑎 𝑏 𝑓 𝑥 𝑑𝑥 = 𝟒𝒉 𝟑 𝟐𝒇 𝒙 𝟎 −𝒇 𝒙 𝟏 +𝟐𝒇 𝒙 𝟐 − 𝟏𝟒𝒉 𝟓 𝟒𝟓 𝒇 𝟒 𝝃 n = 3: 𝑎 𝑏 𝑓 𝑥 𝑑𝑥 = 𝟓𝒉 𝟐𝟒 𝟏𝟏𝒇 𝒙 𝟎 +𝒇 𝒙 𝟏 +𝒇 𝒙 𝟐 +𝟏𝟏𝒇 𝒙 𝟑 − 𝟗𝟓𝒉 𝟕 𝟏𝟒𝟒 𝒇 𝟔 𝝃

Sec:4.3 Elements of Numerical Integration Example

Sec:4.3 Elements of Numerical Integration Example

Sec:4.3 Elements of Numerical Integration

Sec:4.3 Elements of Numerical Integration summary