CGN 3421 - Computer Methods GurleyNumerical Methods Lecture 4 - Numerical Integration / Differentiationpage 83 of 88Numerical Methods Lecture 4 - Numerical Integration / DifferentiationNumerical Integration - approximating the area under a functionWe will consider 3 methods: Trapezoidal rule, Simpson’s rule, Gauss QuadratureThe 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 trapezoidsExample, 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 upError 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. A1A2x1x2x3dxf(x)A1=1/2*dx*(f(x1)+f(x2))!"#$!"--%& ’ &!()"’ &(()("#)∑’ &)!$()$$≅fxxabNumerically estimate areaunder fx within [a, b]A1A2A3A4dxx1x2x3x4x5Error
has intentionally blurred sections.
Sign up to view the full version.