Title: Lecture 19 Numerical Integration
1Lecture 19 - Numerical Integration
2Lectures Goals
- Trapezoidal Rule
- Simpsons Rule
- 1/3 Rule
- 3/8 Rule
- Midpoint
- Gaussian Quadrature
Basic Numerical Integration
3Basic Numerical Integration
We want to find integration of functions of
various forms of the equation known as the Newton
Cotes integration formulas.
4Basic Numerical Integration
Weighted sum of function values
f(x)
x
x0
x1
xn
xn-1
5Numerical Integration
Idea is to do integral in small parts, like the
way you first learned integration - a
summation Numerical methods just try to make it
faster and more accurate
6Numerical Integration
- Newton-Cotes Closed Formulae -- Use both end
points - Trapezoidal Rule Linear
- Simpsons 1/3-Rule Quadratic
- Simpsons 3/8-Rule Cubic
- Booles Rule Fourth-order
7Numerical Integration
- Newton-Cotes Open Formulae -- Use only interior
points - midpoint rule
8Trapezoid Rule
- Straight-line approximation
f(x)
L(x)
x
x0
x1
9Trapezoid Rule
10Trapezoid Rule
- Integrate to obtain the rule
11ExampleTrapezoid Rule
- Evaluate the integral
- Exact solution
- Trapezoidal Rule
12Simpsons 1/3-Rule
- Approximate the function by a parabola
L(x)
f(x)
x
x0
x1
x2
h
h
13Simpsons 1/3-Rule
14Simpsons 1/3-Rule
Integrate the Lagrange interpolation
15Simpsons 3/8-Rule
- Approximate by a cubic polynomial
f(x)
L(x)
x
x0
x1
x2
h
h
x3
h
16Simpsons 3/8-Rule
17Example Simpsons Rules
- Evaluate the integral
- Simpsons 1/3-Rule
- Simpsons 3/8-Rule
18Midpoint Rule
- Newton-Cotes Open Formula
f(x)
x
a
b
xm
19Two-point Newton-Cotes Open Formula
- Approximate by a straight line
f(x)
x
x0
x1
x2
h
h
x3
h
20Three-Point Newton-Cotes Open Formula
- Approximate by a parabola
f(x)
x
x0
x1
x2
h
h
x3
h
h
x4
21Better Numerical Integration
- Composite integration
- Composite Trapezoidal Rule
- Composite Simpsons Rule
- Richardson Extrapolation
- Romberg integration
22Apply trapezoid rule to multiple segments over
integration limits
23Composite Trapezoid Rule
f(x)
x
x0
x1
x2
h
h
x3
h
h
x4
24Composite Trapezoid Rule
25Composite Trapezoid Example
26Composite Trapezoid Rule with Unequal Segments
- Evaluate the integral
- h1 2, h2 1, h3 0.5, h4 0.5
27Composite Simpsons Rule
Piecewise Quadratic approximations
f(x)
...
x
x0
x2
x4
h
h
xn-2
h
xn
h
x3
x1
xn-1
28Composite Simpsons Rule
- Multiple applications of Simpsons rule
29Composite Simpsons Rule
- Evaluate the integral
- n 2, h 2
- n 4, h 1
30Composite Simpsons Example
31Composite Simpsons Rule with Unequal Segments
- Evaluate the integral
- h1 1.5, h2 0.5
32Richardson Extrapolation
- Use trapezoidal rule as an example
- subintervals n 2j 1, 2, 4, 8, 16, .
33Richardson Extrapolation
- For trapezoidal rule
- kth level of extrapolation
34Romberg Integration
- Accelerated Trapezoid Rule
35Romberg Integration
- Accelerated Trapezoid Rule
36Romberg Integration Example
37Gaussian Quadratures
- Newton-Cotes Formulae
- use evenly-spaced functional values
- Gaussian Quadratures
- select functional values at non-uniformly
distributed points to achieve higher accuracy - change of variables so that the interval of
integration is -1,1 - Gauss-Legendre formulae
38Gaussian Quadrature on -1, 1
x2
x1
-1
1
- Choose (c1, c2, x1, x2) such that the method
yields exact integral for f(x) x0, x1, x2, x3
39Gaussian Quadrature on -1, 1
- Exact integral for f x0, x1, x2, x3
- Four equations for four unknowns
40Gaussian Quadrature on -1, 1
- Choose (c1, c2, c3, x1, x2, x3) such that the
method yields exact integral for f(x) x0, x1,
x2, x3,x4, x5
41Gaussian Quadrature on -1, 1
42Gaussian Quadrature on -1, 1
- Exact integral for f x0, x1, x2, x3, x4, x5
43Gaussian Quadrature on a, b
- Coordinate transformation from a,b to -1,1
t2
t1
a
b
44Example Gaussian Quadrature
- Evaluate
- Coordinate transformation
- Two-point formula
45Example Gaussian Quadrature
- Three-point formula
- Four-point formula
46Summary
- Integration Techniques
- Trapezoidal Rule Linear
- Simpsons 1/3-Rule Quadratic
- Simpsons 3/8-Rule Cubic
- Booles Rule Fourth-order
- Gaussian Quadrature
47Homework
- Check the Homework webpage