Numerical Differentiation & Integration Elements of Numerical - - PowerPoint PPT Presentation

numerical differentiation integration elements of
SMART_READER_LITE
LIVE PREVIEW

Numerical Differentiation & Integration Elements of Numerical - - PowerPoint PPT Presentation

Numerical Differentiation & Integration Elements of Numerical Integration I Numerical Analysis (9th Edition) R L Burden & J D Faires Beamer Presentation Slides prepared by John Carroll Dublin City University c 2011 Brooks/Cole,


slide-1
SLIDE 1

Numerical Differentiation & Integration Elements of Numerical Integration I

Numerical Analysis (9th Edition) R L Burden & J D Faires

Beamer Presentation Slides prepared by John Carroll Dublin City University

c 2011 Brooks/Cole, Cengage Learning

slide-2
SLIDE 2

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Outline

1

Introduction to Numerical Integration

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 2 / 36

slide-3
SLIDE 3

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Outline

1

Introduction to Numerical Integration

2

The Trapezoidal Rule

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 2 / 36

slide-4
SLIDE 4

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Outline

1

Introduction to Numerical Integration

2

The Trapezoidal Rule

3

Simpson’s Rule

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 2 / 36

slide-5
SLIDE 5

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Outline

1

Introduction to Numerical Integration

2

The Trapezoidal Rule

3

Simpson’s Rule

4

Comparing the Trapezoidal Rule with Simpson’s Rule

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 2 / 36

slide-6
SLIDE 6

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Outline

1

Introduction to Numerical Integration

2

The Trapezoidal Rule

3

Simpson’s Rule

4

Comparing the Trapezoidal Rule with Simpson’s Rule

5

Measuring Precision

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 2 / 36

slide-7
SLIDE 7

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Outline

1

Introduction to Numerical Integration

2

The Trapezoidal Rule

3

Simpson’s Rule

4

Comparing the Trapezoidal Rule with Simpson’s Rule

5

Measuring Precision

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 3 / 36

slide-8
SLIDE 8

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Introduction to Numerical Integration

Numerical Quadrature

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 4 / 36

slide-9
SLIDE 9

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Introduction to Numerical Integration

Numerical Quadrature

The need often arises for evaluating the definite integral of a function that has no explicit antiderivative or whose antiderivative is not easy to obtain.

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 4 / 36

slide-10
SLIDE 10

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Introduction to Numerical Integration

Numerical Quadrature

The need often arises for evaluating the definite integral of a function that has no explicit antiderivative or whose antiderivative is not easy to obtain. The basic method involved in approximating b

a f(x) dx is called

numerical quadrature. It uses a sum n

i=0 aif(xi) to approximate

b

a f(x) dx.

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 4 / 36

slide-11
SLIDE 11

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Introduction to Numerical Integration

Quadrature based on interpolation polynomials

The methods of quadrature in this section are based on the interpolation polynomials.

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 5 / 36

slide-12
SLIDE 12

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Introduction to Numerical Integration

Quadrature based on interpolation polynomials

The methods of quadrature in this section are based on the interpolation polynomials. The basic idea is to select a set of distinct nodes {x0, . . . , xn} from the interval [a, b].

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 5 / 36

slide-13
SLIDE 13

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Introduction to Numerical Integration

Quadrature based on interpolation polynomials

The methods of quadrature in this section are based on the interpolation polynomials. The basic idea is to select a set of distinct nodes {x0, . . . , xn} from the interval [a, b]. Then integrate the Lagrange interpolating polynomial Pn(x) =

n

  • i=0

f(xi)Li(x) and its truncation error term over [a, b] to obtain:

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 5 / 36

slide-14
SLIDE 14

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Introduction to Numerical Integration

Quadrature based on interpolation polynomials (Cont’d)

b

a

f(x) dx = b

a n

  • i=0

f(xi)Li(x) dx + b

a n

  • i=0

(x − xi)f (n+1)(ξ(x)) (n + 1)! dx =

n

  • i=0

aif(xi) + 1 (n + 1)! b

a n

  • i=0

(x − xi)f (n+1)(ξ(x)) dx where ξ(x) is in [a, b] for each x and ai = b

a

Li(x) dx, for each i = 0, 1, . . . , n

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 6 / 36

slide-15
SLIDE 15

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Introduction to Numerical Integration

Quadrature based on interpolation polynomials (Cont’d)

The quadrature formula is, therefore, b

a

f(x) dx ≈

n

  • i=0

aif(xi)

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 7 / 36

slide-16
SLIDE 16

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Introduction to Numerical Integration

Quadrature based on interpolation polynomials (Cont’d)

The quadrature formula is, therefore, b

a

f(x) dx ≈

n

  • i=0

aif(xi) where ai = b

a

Li(x) dx, for each i = 0, 1, . . . , n

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 7 / 36

slide-17
SLIDE 17

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Introduction to Numerical Integration

Quadrature based on interpolation polynomials (Cont’d)

The quadrature formula is, therefore, b

a

f(x) dx ≈

n

  • i=0

aif(xi) where ai = b

a

Li(x) dx, for each i = 0, 1, . . . , n and with error given by E(f) = 1 (n + 1)! b

a n

  • i=0

(x − xi)f (n+1)(ξ(x)) dx

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 7 / 36

slide-18
SLIDE 18

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Outline

1

Introduction to Numerical Integration

2

The Trapezoidal Rule

3

Simpson’s Rule

4

Comparing the Trapezoidal Rule with Simpson’s Rule

5

Measuring Precision

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 8 / 36

slide-19
SLIDE 19

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Numerical Integration: Trapezoidal Rule

Derivation (1/3)

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 9 / 36

slide-20
SLIDE 20

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Numerical Integration: Trapezoidal Rule

Derivation (1/3)

To derive the Trapezoidal rule for approximating b

a f(x) dx, let x0 = a,

x1 = b, h = b − a

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 9 / 36

slide-21
SLIDE 21

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Numerical Integration: Trapezoidal Rule

Derivation (1/3)

To derive the Trapezoidal rule for approximating b

a f(x) dx, let x0 = a,

x1 = b, h = b − a and use the linear Lagrange polynomial: P1(x) = (x − x1) (x0 − x1)f(x0) + (x − x0) (x1 − x0)f(x1)

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 9 / 36

slide-22
SLIDE 22

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Numerical Integration: Trapezoidal Rule

Derivation (1/3)

To derive the Trapezoidal rule for approximating b

a f(x) dx, let x0 = a,

x1 = b, h = b − a and use the linear Lagrange polynomial: P1(x) = (x − x1) (x0 − x1)f(x0) + (x − x0) (x1 − x0)f(x1) Then b

a

f(x) dx = x1

x0

(x − x1) (x0 − x1)f(x0) + (x − x0) (x1 − x0)f(x1)

  • dx

+ 1 2 x1

x0

f ′′(ξ(x))(x − x0)(x − x1) dx.

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 9 / 36

slide-23
SLIDE 23

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Numerical Integration: Trapezoidal Rule

Derivation (2/3)

The product (x − x0)(x − x1) does not change sign on [x0, x1], so the Weighted Mean Value Theorem for Integrals

See Theorem can be applied

to the error term

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 10 / 36

slide-24
SLIDE 24

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Numerical Integration: Trapezoidal Rule

Derivation (2/3)

The product (x − x0)(x − x1) does not change sign on [x0, x1], so the Weighted Mean Value Theorem for Integrals

See Theorem can be applied

to the error term to give, for some ξ in (x0, x1), x1

x0

f ′′(ξ(x))(x − x0)(x − x1) dx = f ′′(ξ) x1

x0

(x − x0)(x − x1) dx

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 10 / 36

slide-25
SLIDE 25

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Numerical Integration: Trapezoidal Rule

Derivation (2/3)

The product (x − x0)(x − x1) does not change sign on [x0, x1], so the Weighted Mean Value Theorem for Integrals

See Theorem can be applied

to the error term to give, for some ξ in (x0, x1), x1

x0

f ′′(ξ(x))(x − x0)(x − x1) dx = f ′′(ξ) x1

x0

(x − x0)(x − x1) dx = f ′′(ξ) x3 3 − (x1 + x0) 2 x2 + x0x1x x1

x0

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 10 / 36

slide-26
SLIDE 26

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Numerical Integration: Trapezoidal Rule

Derivation (2/3)

The product (x − x0)(x − x1) does not change sign on [x0, x1], so the Weighted Mean Value Theorem for Integrals

See Theorem can be applied

to the error term to give, for some ξ in (x0, x1), x1

x0

f ′′(ξ(x))(x − x0)(x − x1) dx = f ′′(ξ) x1

x0

(x − x0)(x − x1) dx = f ′′(ξ) x3 3 − (x1 + x0) 2 x2 + x0x1x x1

x0

= −h3 6 f ′′(ξ)

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 10 / 36

slide-27
SLIDE 27

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Numerical Integration: Trapezoidal Rule

Derivation (3/3)

Consequently, the last equation, namely x1

x0

f ′′(ξ(x))(x − x0)(x − x1) dx = −h3 6 f ′′(ξ)

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 11 / 36

slide-28
SLIDE 28

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Numerical Integration: Trapezoidal Rule

Derivation (3/3)

Consequently, the last equation, namely x1

x0

f ′′(ξ(x))(x − x0)(x − x1) dx = −h3 6 f ′′(ξ) implies that b

a

f(x) dx = (x − x1)2 2(x0 − x1)f(x0) + (x − x0)2 2(x1 − x0)f(x1) x1

x0

− h3 12f ′′(ξ)

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 11 / 36

slide-29
SLIDE 29

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Numerical Integration: Trapezoidal Rule

Derivation (3/3)

Consequently, the last equation, namely x1

x0

f ′′(ξ(x))(x − x0)(x − x1) dx = −h3 6 f ′′(ξ) implies that b

a

f(x) dx = (x − x1)2 2(x0 − x1)f(x0) + (x − x0)2 2(x1 − x0)f(x1) x1

x0

− h3 12f ′′(ξ) = (x1 − x0) 2 [f(x0) + f(x1)] − h3 12f ′′(ξ)

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 11 / 36

slide-30
SLIDE 30

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Numerical Integration: Trapezoidal Rule

Using the notation h = x1 − x0 gives the following rule:

The Trapezoidal Rule

b

a

f(x) dx = h 2[f(x0) + f(x1)] − h3 12f ′′(ξ)

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 12 / 36

slide-31
SLIDE 31

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Numerical Integration: Trapezoidal Rule

Using the notation h = x1 − x0 gives the following rule:

The Trapezoidal Rule

b

a

f(x) dx = h 2[f(x0) + f(x1)] − h3 12f ′′(ξ)

Note:

The error term for the Trapezoidal rule involves f ′′, so the rule gives the exact result when applied to any function whose second derivative is identically zero, that is, any polynomial of degree one

  • r less.

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 12 / 36

slide-32
SLIDE 32

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Numerical Integration: Trapezoidal Rule

Using the notation h = x1 − x0 gives the following rule:

The Trapezoidal Rule

b

a

f(x) dx = h 2[f(x0) + f(x1)] − h3 12f ′′(ξ)

Note:

The error term for the Trapezoidal rule involves f ′′, so the rule gives the exact result when applied to any function whose second derivative is identically zero, that is, any polynomial of degree one

  • r less.

The method is called the Trapezoidal rule because, when f is a function with positive values, b

a f(x) dx is approximated by the

area in a trapezoid, as shown in the following diagram.

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 12 / 36

slide-33
SLIDE 33

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Trapezoidal Rule: The Area in a Trapezoid

y x a 5 x0 x1 5 b y 5 f (x) y 5 P1(x)

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 13 / 36

slide-34
SLIDE 34

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Outline

1

Introduction to Numerical Integration

2

The Trapezoidal Rule

3

Simpson’s Rule

4

Comparing the Trapezoidal Rule with Simpson’s Rule

5

Measuring Precision

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 14 / 36

slide-35
SLIDE 35

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Numerical Integration: Simpson’s Rule

Simpson’s rule results from integrating over [a, b] the second Lagrange polynomial with equally-spaced nodes x0 = a, x2 = b, and x1 = a + h, where h = (b − a)/2:

y x a 5 x0 x2 5 b x1 y 5 f (x) y 5 P2(x)

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 15 / 36

slide-36
SLIDE 36

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Numerical Integration: Simpson’s Rule

Naive Derivation

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 16 / 36

slide-37
SLIDE 37

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Numerical Integration: Simpson’s Rule

Naive Derivation

Therefore b

a

f(x) dx = x2

x0

(x − x1)(x − x2) (x0 − x1)(x0 − x2)f(x0) + (x − x0)(x − x2) (x1 − x0)(x1 − x2)f(x1) + (x − x0)(x − x1) (x2 − x0)(x2 − x1)f(x2)

  • dx

+ x2

x0

(x − x0)(x − x1)(x − x2) 6 f (3)(ξ(x)) dx.

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 16 / 36

slide-38
SLIDE 38

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Numerical Integration: Simpson’s Rule

Naive Derivation

Therefore b

a

f(x) dx = x2

x0

(x − x1)(x − x2) (x0 − x1)(x0 − x2)f(x0) + (x − x0)(x − x2) (x1 − x0)(x1 − x2)f(x1) + (x − x0)(x − x1) (x2 − x0)(x2 − x1)f(x2)

  • dx

+ x2

x0

(x − x0)(x − x1)(x − x2) 6 f (3)(ξ(x)) dx. Deriving Simpson’s rule in this manner, however, provides only an O(h4) error term involving f (3).

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 16 / 36

slide-39
SLIDE 39

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Numerical Integration: Simpson’s Rule

Naive Derivation

Therefore b

a

f(x) dx = x2

x0

(x − x1)(x − x2) (x0 − x1)(x0 − x2)f(x0) + (x − x0)(x − x2) (x1 − x0)(x1 − x2)f(x1) + (x − x0)(x − x1) (x2 − x0)(x2 − x1)f(x2)

  • dx

+ x2

x0

(x − x0)(x − x1)(x − x2) 6 f (3)(ξ(x)) dx. Deriving Simpson’s rule in this manner, however, provides only an O(h4) error term involving f (3). By approaching the problem in another way, a higher-order term involving f (4) can be derived.

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 16 / 36

slide-40
SLIDE 40

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Numerical Integration: Simpson’s Rule

Alternative Derivation (1/5)

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 17 / 36

slide-41
SLIDE 41

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Numerical Integration: Simpson’s Rule

Alternative Derivation (1/5)

Suppose that f is expanded in the third Taylor polynomial about x1.

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 17 / 36

slide-42
SLIDE 42

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Numerical Integration: Simpson’s Rule

Alternative Derivation (1/5)

Suppose that f is expanded in the third Taylor polynomial about x1. Then for each x in [x0, x2], a number ξ(x) in (x0, x2) exists with f(x) = f(x1) + f ′(x1)(x − x1) + f ′′(x1) 2 (x − x1)2 + f ′′′(x1) 6 (x − x1)3 +f (4)(ξ(x)) 24 (x − x1)4

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 17 / 36

slide-43
SLIDE 43

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Numerical Integration: Simpson’s Rule

Alternative Derivation (1/5)

Suppose that f is expanded in the third Taylor polynomial about x1. Then for each x in [x0, x2], a number ξ(x) in (x0, x2) exists with f(x) = f(x1) + f ′(x1)(x − x1) + f ′′(x1) 2 (x − x1)2 + f ′′′(x1) 6 (x − x1)3 +f (4)(ξ(x)) 24 (x − x1)4 and x2

x0

f(x) dx =

  • f(x1)(x − x1) + f ′(x1)

2 (x − x1)2 + f ′′(x1) 6 (x − x1)3 + f ′′′(x1) 24 (x − x1)4 x2

x0

+ 1 24 x2

x0

f (4)(ξ(x))(x − x1)4 dx

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 17 / 36

slide-44
SLIDE 44

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Numerical Integration: Simpson’s Rule

Alternative Derivation (2/5)

Because (x − x1)4 is never negative on [x0, x2], the Weighted Mean Value Theorem for Integrals

See Theorem Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 18 / 36

slide-45
SLIDE 45

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Numerical Integration: Simpson’s Rule

Alternative Derivation (2/5)

Because (x − x1)4 is never negative on [x0, x2], the Weighted Mean Value Theorem for Integrals

See Theorem implies that

1 24 x2

x0

f (4)(ξ(x))(x − x1)4 dx = f (4)(ξ1) 24 x2

x0

(x − x1)4 dx

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 18 / 36

slide-46
SLIDE 46

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Numerical Integration: Simpson’s Rule

Alternative Derivation (2/5)

Because (x − x1)4 is never negative on [x0, x2], the Weighted Mean Value Theorem for Integrals

See Theorem implies that

1 24 x2

x0

f (4)(ξ(x))(x − x1)4 dx = f (4)(ξ1) 24 x2

x0

(x − x1)4 dx = f (4)(ξ1) 120 (x − x1)5 x2

x0

for some number ξ1 in (x0, x2).

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 18 / 36

slide-47
SLIDE 47

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Numerical Integration: Simpson’s Rule

1 24 x2

x0

f (4)(ξ(x))(x − x1)4 dx = f (4)(ξ1) 120 (x − x1)5 x2

x0

Alternative Derivation (3/5)

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 19 / 36

slide-48
SLIDE 48

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Numerical Integration: Simpson’s Rule

1 24 x2

x0

f (4)(ξ(x))(x − x1)4 dx = f (4)(ξ1) 120 (x − x1)5 x2

x0

Alternative Derivation (3/5)

However, h = x2 − x1 = x1 − x0, so (x2 − x1)2 − (x0 − x1)2 = (x2 − x1)4 − (x0 − x1)4 = 0

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 19 / 36

slide-49
SLIDE 49

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Numerical Integration: Simpson’s Rule

1 24 x2

x0

f (4)(ξ(x))(x − x1)4 dx = f (4)(ξ1) 120 (x − x1)5 x2

x0

Alternative Derivation (3/5)

However, h = x2 − x1 = x1 − x0, so (x2 − x1)2 − (x0 − x1)2 = (x2 − x1)4 − (x0 − x1)4 = 0 whereas (x2 − x1)3 − (x0 − x1)3 = 2h3 and (x2 − x1)5 − (x0 − x1)5 = 2h5

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 19 / 36

slide-50
SLIDE 50

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Numerical Integration: Simpson’s Rule

Alternative Derivation (4/5)

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 20 / 36

slide-51
SLIDE 51

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Numerical Integration: Simpson’s Rule

Alternative Derivation (4/5)

Consequently, x2

x0

f(x) dx =

  • f(x1)(x − x1) + f ′(x1)

2 (x − x1)2 + f ′′(x1) 6 (x − x1)3 + f ′′′(x1) 24 (x − x1)4 x2

x0

+ 1 24 x2

x0

f (4)(ξ(x))(x − x1)4 dx

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 20 / 36

slide-52
SLIDE 52

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Numerical Integration: Simpson’s Rule

Alternative Derivation (4/5)

Consequently, x2

x0

f(x) dx =

  • f(x1)(x − x1) + f ′(x1)

2 (x − x1)2 + f ′′(x1) 6 (x − x1)3 + f ′′′(x1) 24 (x − x1)4 x2

x0

+ 1 24 x2

x0

f (4)(ξ(x))(x − x1)4 dx can be re-written as x2

x0

f(x) dx = 2hf(x1) + h3 3 f ′′(x1) + f (4)(ξ1) 60 h5

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 20 / 36

slide-53
SLIDE 53

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Numerical Integration: Simpson’s Rule

Alternative Derivation (5/5)

If we now replace f ′′(x1) by the approximation given by the Second Derivative Midpoint Formula

See Formula Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 21 / 36

slide-54
SLIDE 54

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Numerical Integration: Simpson’s Rule

Alternative Derivation (5/5)

If we now replace f ′′(x1) by the approximation given by the Second Derivative Midpoint Formula

See Formula we obtain

x2

x0

f(x) dx = 2hf(x1) + h3 3 1 h2 [f(x0) − 2f(x1) + f(x2)] − h2 12f (4)(ξ2)

  • +f (4)(ξ1)

60 h5

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 21 / 36

slide-55
SLIDE 55

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Numerical Integration: Simpson’s Rule

Alternative Derivation (5/5)

If we now replace f ′′(x1) by the approximation given by the Second Derivative Midpoint Formula

See Formula we obtain

x2

x0

f(x) dx = 2hf(x1) + h3 3 1 h2 [f(x0) − 2f(x1) + f(x2)] − h2 12f (4)(ξ2)

  • +f (4)(ξ1)

60 h5 = h 3[f(x0) + 4f(x1) + f(x2)] − h5 12 1 3f (4)(ξ2) − 1 5f (4)(ξ1)

  • Numerical Analysis (Chapter 4)

Elements of Numerical Integration I R L Burden & J D Faires 21 / 36

slide-56
SLIDE 56

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Numerical Integration: Simpson’s Rule

Alternative Derivation (5/5)

If we now replace f ′′(x1) by the approximation given by the Second Derivative Midpoint Formula

See Formula we obtain

x2

x0

f(x) dx = 2hf(x1) + h3 3 1 h2 [f(x0) − 2f(x1) + f(x2)] − h2 12f (4)(ξ2)

  • +f (4)(ξ1)

60 h5 = h 3[f(x0) + 4f(x1) + f(x2)] − h5 12 1 3f (4)(ξ2) − 1 5f (4)(ξ1)

  • It can be shown by alternative methods that the values ξ1 and ξ2 in this

expression can be replaced by a common value ξ in (x0, x2). This gives Simpson’s rule.

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 21 / 36

slide-57
SLIDE 57

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Numerical Integration: Simpson’s Rule

Simpson’s Rule

x2

x0

f(x) dx = h 3[f(x0) + 4f(x1) + f(x2)] − h5 90f (4)(ξ) The error term in Simpson’s rule involves the fourth derivative of f, so it gives exact results when applied to any polynomial of degree three or less.

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 22 / 36

slide-58
SLIDE 58

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Outline

1

Introduction to Numerical Integration

2

The Trapezoidal Rule

3

Simpson’s Rule

4

Comparing the Trapezoidal Rule with Simpson’s Rule

5

Measuring Precision

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 23 / 36

slide-59
SLIDE 59

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Trapezoidal Rule .v. Simpson’s Rule

Example

Compare the Trapezoidal rule and Simpson’s rule approximations to 2 f(x) dx when f(x) is (a) x2 (b) x4 (c) (x + 1)−1 (d) √ 1 + x2 (e) sin x (f) ex

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 24 / 36

slide-60
SLIDE 60

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Trapezoidal Rule .v. Simpson’s Rule

Solution (1/3)

On [0, 2], the Trapezoidal and Simpson’s rule have the forms Trapezoidal: 2 f(x) dx ≈ f(0) + f(2) Simpson’s: 2 f(x) dx ≈ 1 3[f(0) + 4f(1) + f(2)]

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 25 / 36

slide-61
SLIDE 61

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Trapezoidal Rule .v. Simpson’s Rule

Solution (1/3)

On [0, 2], the Trapezoidal and Simpson’s rule have the forms Trapezoidal: 2 f(x) dx ≈ f(0) + f(2) Simpson’s: 2 f(x) dx ≈ 1 3[f(0) + 4f(1) + f(2)] When f(x) = x2 they give Trapezoidal: 2 f(x) dx ≈ 02 + 22 = 4 Simpson’s: 2 f(x) dx ≈ 1 3[(02) + 4 · 12 + 22] = 8 3

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 25 / 36

slide-62
SLIDE 62

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Trapezoidal Rule .v. Simpson’s Rule

Solution (2/3)

The approximation from Simpson’s rule is exact because its truncation error involves f (4), which is identically 0 when f(x) = x2.

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 26 / 36

slide-63
SLIDE 63

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Trapezoidal Rule .v. Simpson’s Rule

Solution (2/3)

The approximation from Simpson’s rule is exact because its truncation error involves f (4), which is identically 0 when f(x) = x2. The results to three places for the functions are summarized in the following table.

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 26 / 36

slide-64
SLIDE 64

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Trapezoidal Rule .v. Simpson’s Rule

Solution (3/3): Summary Results

(a) (b) (c) (d) (e) (f) f(x) x2 x4 (x + 1)−1 √ 1 + x2 sin x ex Exact value 2.667 6.400 1.099 2.958 1.416 6.389 Trapezoidal 4.000 16.000 1.333 3.326 0.909 8.389 Simpson’s 2.667 6.667 1.111 2.964 1.425 6.421 Notice that, in each instance, Simpson’s Rule is significantly superior.

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 27 / 36

slide-65
SLIDE 65

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Outline

1

Introduction to Numerical Integration

2

The Trapezoidal Rule

3

Simpson’s Rule

4

Comparing the Trapezoidal Rule with Simpson’s Rule

5

Measuring Precision

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 28 / 36

slide-66
SLIDE 66

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Numerical Integration: Measuring Precision

Rationale

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 29 / 36

slide-67
SLIDE 67

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Numerical Integration: Measuring Precision

Rationale

The standard derivation of quadrature error formulas is based on determining the class of polynomials for which these formulas produce exact results.

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 29 / 36

slide-68
SLIDE 68

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Numerical Integration: Measuring Precision

Rationale

The standard derivation of quadrature error formulas is based on determining the class of polynomials for which these formulas produce exact results. The following definition is used to facilitate the discussion of this derivation.

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 29 / 36

slide-69
SLIDE 69

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Numerical Integration: Measuring Precision

Rationale

The standard derivation of quadrature error formulas is based on determining the class of polynomials for which these formulas produce exact results. The following definition is used to facilitate the discussion of this derivation.

Definition

The degree of accuracy or precision, of a quadrature formula is the largest positive integer n such that the formula is exact for xk, for each k = 0, 1, . . . , n.

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 29 / 36

slide-70
SLIDE 70

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Numerical Integration: Measuring Precision

Rationale

The standard derivation of quadrature error formulas is based on determining the class of polynomials for which these formulas produce exact results. The following definition is used to facilitate the discussion of this derivation.

Definition

The degree of accuracy or precision, of a quadrature formula is the largest positive integer n such that the formula is exact for xk, for each k = 0, 1, . . . , n. This implies that the Trapezoidal and Simpson’s rules have degrees of precision one and three, respectively.

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 29 / 36

slide-71
SLIDE 71

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Numerical Integration: Measuring Precision

Establishing the Degree of Precision

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 30 / 36

slide-72
SLIDE 72

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Numerical Integration: Measuring Precision

Establishing the Degree of Precision

Integration and summation are linear operations; that is, b

a

(αf(x) + βg(x)) dx = α b

a

f(x) dx + β b

a

g(x) dx and

n

  • i=0

(αf(xi) + βg(xi)) = α

n

  • i=0

f(xi) + β

n

  • i=0

g(xi), for each pair of integrable functions f and g and each pair of real constants α and β.

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 30 / 36

slide-73
SLIDE 73

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Numerical Integration: Measuring Precision

Establishing the Degree of Precision

Integration and summation are linear operations; that is, b

a

(αf(x) + βg(x)) dx = α b

a

f(x) dx + β b

a

g(x) dx and

n

  • i=0

(αf(xi) + βg(xi)) = α

n

  • i=0

f(xi) + β

n

  • i=0

g(xi), for each pair of integrable functions f and g and each pair of real constants α and β. This implies the following:

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 30 / 36

slide-74
SLIDE 74

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Numerical Integration: Measuring Precision

Degree of Precision

The degree of precision of a quadrature formula is n if and only if the error is zero for all polynomials of degree k = 0, 1, . . . , n, but is not zero for some polynomial of degree n + 1.

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 31 / 36

slide-75
SLIDE 75

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Numerical Integration: Measuring Precision

Degree of Precision

The degree of precision of a quadrature formula is n if and only if the error is zero for all polynomials of degree k = 0, 1, . . . , n, but is not zero for some polynomial of degree n + 1.

Footnote

The Trapezoidal and Simpson’s rules are examples of a class of methods known as Newton-Cotes formulas.

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 31 / 36

slide-76
SLIDE 76

Introduction Trapezoidal Rule Simpson’s Rule Comparison Measuring Precision

Numerical Integration: Measuring Precision

Degree of Precision

The degree of precision of a quadrature formula is n if and only if the error is zero for all polynomials of degree k = 0, 1, . . . , n, but is not zero for some polynomial of degree n + 1.

Footnote

The Trapezoidal and Simpson’s rules are examples of a class of methods known as Newton-Cotes formulas. There are two types of Newton-Cotes formulas, open and closed.

Numerical Analysis (Chapter 4) Elements of Numerical Integration I R L Burden & J D Faires 31 / 36

slide-77
SLIDE 77

Questions?

slide-78
SLIDE 78

Reference Material

slide-79
SLIDE 79

The 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 b

a

f(x)g(x) dx = f(c) b

a

g(x) dx. When g(x) ≡ 1, this result is the usual Mean Value Theorem for

  • Integrals. It gives the average value of the function f over the

interval [a, b] as f(c) = 1 b − a b

a

f(x) dx.

See Diagram Return to Derivation of the Trapezoidal Rule Return to Derivation of Simpson’s Method

slide-80
SLIDE 80

The Mean Value Theorem for Integrals

f(c) = 1 b − a b

a

f(x) dx.

Return to the Weighted Mean Value Theorem for Integrals

x y f (c) y 5 f (x) a b c

slide-81
SLIDE 81

Numerical Differentiation Formulae

Second Derivative Midpoint Formula

f ′′(x0) = 1 h2 [f(x0 − h) − 2f(x0) + f(x0 + h)] − h2 12f (4)(ξ) for some ξ, where x0 − h < ξ < x0 + h.

Return to Derivation of Simpson’s Rule