approximate integration: the trapezoidal rule claus schubert may 25, 2000

16
Approximate Integration: The Trapezoidal Rule Claus Schubert May 25, 2000

Upload: jocelin-horn

Post on 11-Jan-2016

212 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Approximate Integration: The Trapezoidal Rule Claus Schubert May 25, 2000

Approximate Integration:The Trapezoidal Rule

Claus SchubertMay 25, 2000

Page 2: Approximate Integration: The Trapezoidal Rule Claus Schubert May 25, 2000

Why Approximate Integration?

Can’t always find an antiderivative

Example: dxex1

0

2

Don’t always know the function

Page 3: Approximate Integration: The Trapezoidal Rule Claus Schubert May 25, 2000

First Approach: Riemann Sums

Use left or right Riemann sums to approximate the integral.

b

a

n

ii xxfdxxf

11)()( Left Riemann sum:

x: length of the n subintervals

xi: endpoints of the subintervals

Page 4: Approximate Integration: The Trapezoidal Rule Claus Schubert May 25, 2000

x0 x1 x2 x3

Left Riemann Sums

By refining the partition, we obtain

better approximations.

Ln is the sum of all the inscribed

rectangles starting at the left endpoints.

It is called a left endpoint

approximation.

b

a

n

iin xxfLdxxf

11)()(

y

xx

f(x0)

x

f(x1)

x

f(x2)

Page 5: Approximate Integration: The Trapezoidal Rule Claus Schubert May 25, 2000

x0 x1 x2 x3

Right Riemann Sums

b

a

n

iin xxfRdxxf

1

)()(

y

x

Rn is the sum of all the inscribed

rectangles starting at the right endpoints.

It is called a right endpoint approximation.

Page 6: Approximate Integration: The Trapezoidal Rule Claus Schubert May 25, 2000

If Ln underestimates, then Rn overestimates, and vice versa

Left and Right Endpoint Approximations

Observations: Approximations get better if we increase n

Take the average of both approximations

Idea for improvement:

Page 7: Approximate Integration: The Trapezoidal Rule Claus Schubert May 25, 2000

Trapezoidal Approximation

b

a nnn RLTdxxf )(2

1)(

a

b

h

ahLn

bhRn

hbabhahTn )(2

1)(

2

1

Page 8: Approximate Integration: The Trapezoidal Rule Claus Schubert May 25, 2000

Trapezoidal Approximation

b

a nnn RLTdxxf )(2

1)(

Ln

Rn

x0 x1 x2 x3

y

x

Tn

Page 9: Approximate Integration: The Trapezoidal Rule Claus Schubert May 25, 2000

Trapezoidal Approximation

b

a nnn RLTdxxf )(2

1)(

x0 x1 x2 x3

y

x

Tn

Page 10: Approximate Integration: The Trapezoidal Rule Claus Schubert May 25, 2000

Trapezoidal Approximation

b

a nnn RLTdxxf )(2

1)(

])()([2

1

111

n

ii

n

ii xxfxxf

)]()(2...)(2)([2 110 nn xfxfxfxfx

Page 11: Approximate Integration: The Trapezoidal Rule Claus Schubert May 25, 2000

An Example

As an example, let us look at .dxx1

0

2

3

1

3|1

0

31

0

2 x

dxx

)]()(2)([2 2102 xfxfxfx

T

8

3]1

4

120[

4

1

Page 12: Approximate Integration: The Trapezoidal Rule Claus Schubert May 25, 2000

An Example

333333335.200000000

66666667

33335.20000

6667

34375.32

11

10000

100

4

T

T

T

Page 13: Approximate Integration: The Trapezoidal Rule Claus Schubert May 25, 2000

Error bounds

Question:How accurate is the trapezoidal approximation?

Answer:

where K is an upper bound for | f”(x) |.

2

3

12

)(||

n

abKET

Page 14: Approximate Integration: The Trapezoidal Rule Claus Schubert May 25, 2000

Error bounds: An Example

In our previous example, how large should n be so that the error is less than 0.00001 ?

1,0,)( 2 baxxf

2)('',2)(' xfxxf

2K

00001.012

12

12

)(||

22

3

nn

abKET

Page 15: Approximate Integration: The Trapezoidal Rule Claus Schubert May 25, 2000

Error bounds: An Example

00001.012

12

12

)(||

22

3

nn

abKET

099.1296.1666600001.012

2

n

130n

....333343195.

....333343348.

130

129

T

T

Page 16: Approximate Integration: The Trapezoidal Rule Claus Schubert May 25, 2000

Let’s Wrap Up

Approximations are useful if the function cannot be integrated or no function is given to begin with.

Left and right endpoint approximations are too inaccurate, so take their average.

The trapezoidal approximation is much more accurate than the left/right approximations, but better approximations exist (midpoint, Simpson’s etc.)

You need a computer to find approximations with large n - or you need to get a life!!!