30
Today’s class Romberg integration Gauss quadrature Numerical Methods Lecture 13 Prof. Jinbo Bi CSE, UConn 1

Today’s class Romberg integration Gauss quadrature Numerical Methods Lecture 13 Prof. Jinbo Bi CSE, UConn 1

Embed Size (px)

Citation preview

Today’s class

• Romberg integration• Gauss quadrature

Numerical MethodsLecture 13

Prof. Jinbo BiCSE, UConn

1

Numerical Integration

• Multiple application of the Newton-Cotes Formulas will improve the accuracy of the approximation• As you increase the number of segments, you

reduce the error• However, if you increase the number of

segments too much, round-off errors begin to dominate and the error will start to increase

Numerical MethodsLecture 13

Prof. Jinbo BiCSE, UConn

2

Numerical Integration

Numerical MethodsLecture 13

Prof. Jinbo BiCSE, UConn

3

a=0, b = 0.8

Romberg integration

• Richardson’s extrapolation• Perform a numerical algorithm using multiple

values of a parameter h and then extrapolate that result to the limit h=0

• With numerical integration use two estimates of the integral to come up with a third more accurate approximation

Numerical MethodsLecture 13

Prof. Jinbo BiCSE, UConn

4

Richardson’s Extrapolation

Numerical MethodsLecture 13

Prof. Jinbo BiCSE, UConn

5

Richardson’s Extrapolation

• We’ve used the error calculation to come up with a new estimate• It can also be shown that this new estimate is

O(h4), whereas trapezoidal rule is only O(h2)

Numerical MethodsLecture 13

Prof. Jinbo BiCSE, UConn

6

Richardson’s Extrapolation

• Special case where you always halve the interval - i.e. h2=h1/2

Numerical MethodsLecture 13

Prof. Jinbo BiCSE, UConn

7

Richardson’s Extrapolation

Numerical MethodsLecture 13

Prof. Jinbo BiCSE, UConn

8

Richardson’s Extrapolation

Numerical MethodsLecture 13

Prof. Jinbo BiCSE, UConn

9

Romberg Integration• Accelerated Trapezoid Rule

+1

k: level of integration

j: level of accurancy

Numerical MethodsLecture 13

Prof. Jinbo BiCSE, UConn

10

Romberg Integration• Accelerated Trapezoid Rule

Numerical MethodsLecture 13

Prof. Jinbo BiCSE, UConn

11

Romberg Integration• Termination Criteria

• Trapezoidal method• 9 iterations before hitting precision limit

(n=256)• 511 function evaluations

• Romberg integration• 3 iterations before hitting precision limit• 15 function evaluations

Numerical MethodsLecture 13

Prof. Jinbo BiCSE, UConn

12

Romberg Integration

• very good convergence properties• less susceptible to round-off error than

Trapezoidal or Simpson’s rule • extra levels of extrapolation require very

little computational work

Numerical MethodsLecture 13

Prof. Jinbo BiCSE, UConn

13

Gauss Quadratures

• Newton-Cotes Formulas• use evenly-spaced functional values

• Gauss Quadratures• select functional values at non-uniformly

distributed points to achieve higher accuracy• Gauss-Legendre formulas

Numerical MethodsLecture 13

Prof. Jinbo BiCSE, UConn

14

Gauss Quadratures

• Trapezoidal Method

Numerical MethodsLecture 13

Prof. Jinbo BiCSE, UConn

15

Gauss Quadratures

• Find interior points so that the trapezoidal area outside the curve is equal to the area below the curve and above the trapezoid

Numerical MethodsLecture 13

Prof. Jinbo BiCSE, UConn

16

Gauss Quadratures

• Method of Undetermined Coefficients

• Trapezoidal method should be exact for

Numerical MethodsLecture 13

Prof. Jinbo BiCSE, UConn

17

Gauss Quadratures• Two-Point Gauss Legendre Derivation• Find a solution to following equation over range [-

1:1]

• Using similar reasoning as before, solve for the four unknowns using the following equations

Numerical MethodsLecture 13

Prof. Jinbo BiCSE, UConn

18

Gauss Quadratures

• This formula gives an integral estimate that is third-order accurate

• To be usable, the bounds of the definite integral have to be from -1 to 1

• It is easy to convert by using a new variable xd

Numerical MethodsLecture 13

Prof. Jinbo BiCSE, UConn

19

Gauss Quadratures

0.4dxd

Numerical MethodsLecture 13

Prof. Jinbo BiCSE, UConn

20

Gauss Quadratures

• Equivalent accuracy to Simpson’s 1/3 rule (O(n3))

• Fewer function evaluations• Can be extended to higher-point versions

Numerical MethodsLecture 13

Prof. Jinbo BiCSE, UConn

21

Gauss Quadratures

Numerical Methods Lecture 13

Prof. Jinbo BiCSE, UConn

22

Gauss Quadratures on [-1, 1]

Numerical MethodsLecture 13

Prof. Jinbo BiCSE, UConn

23

Gauss Quadratures on [-1, 1]

Numerical MethodsLecture 13

Prof. Jinbo BiCSE, UConn

24

Example: Gauss Quadratures

Numerical MethodsLecture 13

Prof. Jinbo BiCSE, UConn

25

Gauss Quadratures

• High accuracy with few function evaluations

• Error is proportional to the (2n+2)th

derivative• Function must be known - not appropriate

for tabular data

Numerical MethodsLecture 13

Prof. Jinbo BiCSE, UConn

26

Improper integrals

• How do you handle integrals where one of the bounds of the integral is ±∞?

• Do a translation of the bounds into a proper integral

• Works as long as a is -∞ and b is negative or a is positive and b is ∞.

• The function f(x) must also asymptotically approach zero at least as fast as 1/x2

Numerical MethodsLecture 13

Prof. Jinbo BiCSE, UConn

27

Improper integrals

• Example: Normal distribution• Split the integral at a point where the function

starts to approach zero faster than 1/x2

Numerical MethodsLecture 13

Prof. Jinbo BiCSE, UConn

28

Summary• Integration Techniques

– Trapezoidal Rule : Linear– Simpson’s 1/3-Rule : Quadratic– Simpson’s 3/8-Rule : Cubic– Improvement techniques

• Multiple application or composite methods• Romberg integration

• Gaussian Quadrature

• Improper integralsNumerical MethodsLecture 13

Prof. Jinbo BiCSE, UConn

29

Next class

• Numerical Differentiation• Read Chapter 23

Numerical MethodsLecture 13

Prof. Jinbo BiCSE, UConn

30