NM4_integration_s02

NM4_integration_s02 - CGN 3421 - Computer Methods Gurley...

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

View Full Document Right Arrow Icon
CGN 3421 - Computer Methods Gurley Numerical Methods Lecture 4 - Numerical Integration / Differentiation page 83 of 88 Numerical Methods Lecture 4 - Numerical Integration / Differentiation Numerical Integration - approximating the area under a function We will consider 3 methods: Trapezoidal rule, Simpson’s rule, Gauss Quadrature The basic concept is to break the area up into smaller pieces with simple shapes fitted to approximate the func- tion over short lengths. The area under these simple shapes are then added up to approximate the total. Trapezoidal rule - piece-wise linear approximation to curve f(x) • chop area into N smaller pieces (sample of two pieces on the right) • connect areas with straight lines, creating trapezoids • find the area under each trapezoid A=1/2*dx*(f(x)+f(x+dx)) • add up the trapezoids Example, the figure at the bottom of the page chops a function into 4 trapezoids over the range [a, b]. The trapeziodal rule adds up the area of each of the 4 trape- zoids to represent the area under the fucntion f(x). dx = (b-a)/N (a, b are limits, N is number of pieces we divide the area into) A1= 1/2 * dx * (f(x1) + f(x2)) A2 = 1/2* dx * ( f(x2) + f(x3)) A3 = 1/2* dx * ( f(x3) + f(x4)) A4 = 1/2* dx * ( f(x4) + f(x5)) _____________________________________________ Area = 1/2 * dx * (f(x1)+ 2 *f(x2)+ 2 *f(x3)+ 2 *f(x4)+f(x5)) The generalized equation expressing trapezoidal rule is then ==> Error: The error (in blue) between the area of the trapezoid and the curve it represents builds up Error reduction: We can reduce error if we can shorten the straight lines used to estimate curves. Increasing the number (increase N) of trapezoids used over the same range [a,b] will reduce error in the area estimate. A1 A2 x1 x2 x3 dx f(x) A1=1/2*dx*(f(x1)+f(x2)) !"#$ ! " -- %& ’ & ! () " ’& ( ( " # ) ) ! $ $$ fx x a b Numerically estimate area under fx within [a, b] A1 A2 A3 A4 dx x1 x2 x3 x4 x5 Error
Background image of page 1

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

View Full DocumentRight Arrow Icon
CGN 3421 - Computer Methods Gurley Numerical Methods Lecture 4 - Numerical Integration / Differentiation page 84 of 88 We can also get a little more sophisticated than straight line estimates The error using trapezoidal rule comes from using a series of straight lines to represent a curve. To reduce
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.

This note was uploaded on 05/18/2011 for the course CGN 3421 taught by Professor Long during the Spring '08 term at University of Florida.

Page1 / 6

NM4_integration_s02 - CGN 3421 - Computer Methods Gurley...

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