(21) Numerical Integration

(21) Numerical Integration - 11/10/2008 Integration...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
11/10/2008 1 Numerical Integration Nathan Friedman Integration ± Many applications require evaluating the integral of a function ± The integrals of many elementary 2008 Numerical Integration 2 The integrals of many elementary functions cannot be derived analytically ± As we have seen, we may not even have an analytic form for the function. We may just be able to sample it at various points Integration ± This lead to the development of techniques for evaluating such integrals numerically 2008 Numerical Integration 3 numerically ± Numerical integration techniques predate the use of electronic computers Definite Integral ± The definite integral of a function of a single variable, f(x), between two limits a and b can be viewed as the area 2008 Numerical Integration 4 a and b can be viewed as the area under the curve defined by the function ± Numerical integration algorithms try to estimate this area Numerical Integration ± Our approach will be to divide the region between a and b into n segments 2008 Numerical Integration 5 ± We then estimate the area under the curve in each segment ± Finally, we sum these areas Numerical Integration We consider three algorithms for estimating this area ± The Midpoint method 2008 Numerical Integration 6 ± The Trapezoidal method ± Simpson’s method
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
11/10/2008 2 The Midpoint Method ± We begin by dividing the region from a to b into n equal segments ± The width of each segment i 2008 Numerical Integration 7 The width of each segment is dx = (b-a)/n ± The endpoint of the segments are a, a+dx, a+2dx, … ,a+ndx Midpoint Method We estimate the area under the curve in each segment using the value of f at the midpoint of this segment 2008 Numerical Integration 8 area = dx * f(x+dx/2) To compute an approximation to the interval, we just have to sum these areas Midpoint Method Multiplication (especially by small values) may cause roundoff errors To reduce the effect of these errors, we 2008 Numerical Integration 9 try to simplify expressions to reduce the number of multiplications We can factor out the dx and add all of the function values before multiplying by dx Function Arguments ± We want to write a integration function that takes any function and the range as arguments and returns the integral 2008 Numerical Integration
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 6

(21) Numerical Integration - 11/10/2008 Integration...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online