6.4 Integration with tables and computer algebra systems

advertisement
6.4 Integration with tables and
computer algebra systems
6.5 Approximate Integration
Tables of Integrals
• A table of 120 integrals, categorized by form, is provided on the References Pages at
the back of the book.
• References to more extensive tables are given in the textbook.
• Integrals do not often occur in exactly the form listed in a table.
• Usually we need to use the Substitution rule or algebraic manipulation to transform a
given integral into one of the forms in the table.
Example: Evaluate

4  (ln x ) 2
dx
x
In the table we have forms involving
Let u = ln x.
a2  u2
Then using the integral #21 in the table,


1
(ln x )
2
2
u 2
2
2
  2  u du 
2  u  ln( u 
2
2
4  (ln x ) 2  2 ln[ln x  4  (ln x ) 2 ]  C
4  (ln x )
dx
x
2
2
2
22 u 2
)C
Computer Algebra Systems (CAS)
• Matlab, Mathematica, Maple.
• CAS also can perform substitutions that transform a given
integral into one that occurs in its stored formulas.
• But a hand computation sometimes produces an indefinite
integral in a form that is more convenient than a machine answer.
Example: Evaluate
2
8
x
(
x

5
)
dx

Maple and Mathematica give the same answer:
1 18 5 16
1750 12
21870 6
390625 2
x  x  50 x14 
x  4375 x10  21875 x 8 
x  156250 x 4 
x
18
2
3
3
2
If we integrate by hand instead, using the substitution u = x2 + 5,
we get x( x 2  5)8 dx  1 ( x 2  5) 9  C

18
This is a more convenient form of the answer.
Can we integrate all continuous functions?
• Most of the functions that we have been dealing with are what are
called elementary functions.
These are the polynomials, rational functions, exponential functions,
logarithmic functions, trigonometric and inverse trigonometric
functions,
and all functions that can be obtained from these by the five operations
of addition, subtraction, multiplication, division, and composition.
• If f is an elementary function,
then f ’ is an elementary function,
but its antiderivative need not be an elementary function.
Example,
x2
f ( x)  e
In fact, the majority of elementary functions don’t have elementary
antiderivatives.
How to find definite integrals for those functions? Approximate!
Approximating definite integrals:
Riemann Sums
Recall that the definite integral is defined as a limit of Riemann sums.
A Riemann sum for the integral of a function f over the interval [a,b] is
obtained by first dividing the interval [a,b] into subintervals and then placing a
rectangle, as shown below, over each subinterval. The corresponding
Riemann sum is the combined area of the green rectangles. The height of the
rectangle over some given subinterval is the value of the function f at some
point of the subinterval. This point can be chosen freely.
Taking more division points or subintervals in the Riemann sums, the
approximation of the area of the domain under the graph of f becomes
better.
Approximating definite integrals:
different choices for the sample points
• Recall that

b
a
n
f ( x)dx   f ( xi* )x
i 1
where xi* is any point in the ith subinterval [xi-1,xi].
• If xi* is chosen to be the left endpoint of the interval, then
n
xi* = xi-1 and we have b
 f ( x)dx  Ln   f ( xi 1 )x
a
i 1
• If xi* is chosen to be the right endpoint of the interval, then
n
xi* = xi and we have b

a
f ( x)dx  Rn   f ( xi )x
i 1
• Ln and Rn are called the left endpoint approximation and
right endpoint approximation , respectively.
Example
1 2
y  x 1
8
0 x4
First find the exact value
using definite integrals.
3
2
Actual area under curve:
1 2
A   x  1 dx
0 8
4
1 3
A
x x
24
0
4
1
0
1
2
3
4
20
A
 6.6
3

3
1 2
y  x 1
8
Left endpoint
approximation:
0 x4
2
1
0
1
1
8
1
2
2
1
8
3
4
3
4
Approximate area: 1  1  1  2  5  5.75
(too low)

3
1 2
y  x 1
8
0 x4
2
Right endpoint
approximation:
1
0
1
8
1
2
1
2
1
8
3
4
3
Approximate area: 1  1  2  3  7  7.75
(too high)
Averaging the right and left endpoint approximations:
7.75  5.75
 6.75
2
(closer to the actual value)
4
3
Averaging the areas of
the two rectangles is the
same as taking the area
of the trapezoid above
the subinterval.
2
1
0
1
2
3
1  9  1  9 3  1  3 17  1  17

T  1              3 
2 8 28 2 22 8  2 8

1  9 9 3 3 17 17

T  1        3 
2 8 8 2 2 8 8

1  27 
T  
2 2 
27

 6.75
4
4
Trapezoidal rule

b
a
f ( x)dx 
x
Tn 
[ f ( x0 )  2 f ( x1 )  2 f ( x2 )    2 f ( xn 1 )  f ( xn )]
2
ba
where x 
and
xi  a  i x
n
This gives us a better approximation
than either left or right rectangles.
3
1 2
y  x 1
8
0 x4
Can also apply
midpoint approximation:
choose the midpoint of
the subinterval as the
sample point.
2
1
0
1
1.03125
1.28125
2
1.78125
3
4
2.53125
Approximate area: 6.625
The midpoint rule gives a closer approximation than the
trapezoidal rule, but in the opposite direction.

Midpoint rule

b
a
f ( x)dx  M n  x[ f ( x1 )  f ( x2 )    f ( xn )]
ba
where x 
n
1
and
xi  2 ( xi 1  xi )  midpoint of [ xi 1 , xi ]
Trapezoidal Rule:
Midpoint Rule:
6.750 1.25% error
6.625 0.625% error
(higher than the
exact value)
(lower than the
exact value)
Notice that the trapezoidal rule gives us an answer that
has twice as much error as the midpoint rule, but in the
opposite direction.
If we use a weighted average:
2  6.625  6.750
 6.6
3
This is the
exact answer!
This weighted approximation gives us a closer approximation
than the midpoint or trapezoidal rules.
Midpoint:
M  2h  y1  2h  y3  2h  y1  y3 
Trapezoidal:
T
h x h x
1
2
h x h x
3
4
1
1
y

y
2
h

 0 2
 y2  y4  2 h
2
2
T  h  y0  y2   h  y2  y4 
2M  T
T  h  y0  2 y2  y4 
3
1
h
  4h  y1  y3   h  y0  2 y2  y4     4 y1  4 y3  y0  2 y2  y4 
3
3
twice midpoint
trapezoidal
h
  y0  4 y1  2 y2  4 y3  y4 
3

Simpson’s rule

b
a
f ( x)dx 
x
Sn 
[ f ( x0 )  4 f ( x1 )  2 f ( x2 )  4 f ( x3 )  
3
 2 f ( xn  2 )  4 f ( xn 1 )  f ( xn )]
ba
where n is even and x 
n
Simpson’s rule can also be interpreted as fitting parabolas to sections of
the curve.
Simpson’s rule will usually give a very good approximation with
relatively few subintervals.
Example: y  1 x 2  1
8
1 9
17

 1   3   3 
3 2
2

3
2
1
  20   6.6
3
1
0
1
9
3
17

S  1  4   2   4   3 
3
8
2
8

1
2
3
4
Error bounds for the approximation methods
max a  xb | f ''( x) | (b  a )
Midpoint error 
24n 2
3
max a  xb | f ''( x) | (b  a)
Trapezoidal error 
2
12n
3
max a  xb | f ( x) | (b  a )
Simpson's error 
180n 4
(4)
Examples of error estimations on the board.
5
Download