Presentation is loading. Please wait.

Presentation is loading. Please wait.

Integration COS 323. Numerical Integration Problems Basic 1D numerical integration:Basic 1D numerical integration: – Given ability to evaluate f (x) for.

Similar presentations


Presentation on theme: "Integration COS 323. Numerical Integration Problems Basic 1D numerical integration:Basic 1D numerical integration: – Given ability to evaluate f (x) for."— Presentation transcript:

1 Integration COS 323

2 Numerical Integration Problems Basic 1D numerical integration:Basic 1D numerical integration: – Given ability to evaluate f (x) for any x, find – Goal: best accuracy with fewest samples Other problems (future lectures):Other problems (future lectures): – Improper integration – Multi-dimensional integration – Ordinary differential equations – Partial differential equations

3 Trapezoidal Rule Approximate function by trapezoidApproximate function by trapezoid ab f(a) f(b)

4 Trapezoidal Rule ab f(a)f(b)

5 Extended Trapezoidal Rule ab f(a)f(b) Divide into segments of width h : ab

6 Trapezoidal Rule Error Analysis How accurate is this approximation?How accurate is this approximation? Start with Taylor series for f (x) around aStart with Taylor series for f (x) around a

7 Trapezoidal Rule Error Analysis Expand LHS:Expand LHS: Expand RHSExpand RHS

8 Trapezoidal Rule Error Analysis So,So, In general, error for a single segment proportional to h 3In general, error for a single segment proportional to h 3 Error for subdividing entire a  b interval proportional to h 2Error for subdividing entire a  b interval proportional to h 2 – “Cubic local accuracy, quadratic global accuracy”

9 Determining Step Size Change in integral when reducing step size is a reasonable guess for accuracyChange in integral when reducing step size is a reasonable guess for accuracy For trapezoidal rule, easy to go from h  h/2 without wasting previous samplesFor trapezoidal rule, easy to go from h  h/2 without wasting previous samples ab

10 Approximate integral by parabola through three pointsApproximate integral by parabola through three points Better accuracy for same # of evaluationsBetter accuracy for same # of evaluations Simpson’s Rule ab f(a) f(b)

11 Richardson Extrapolation Better way of getting higher accuracy for a given # of samplesBetter way of getting higher accuracy for a given # of samples Suppose we’ve evaluated integral for step size h and step size h/2:Suppose we’ve evaluated integral for step size h and step size h/2: ThenThen

12 Richardson Extrapolation This treats the approximation as a function of h and “extrapolates” the result to h=0This treats the approximation as a function of h and “extrapolates” the result to h=0 Can repeat:Can repeat: –1/3 4/3 –1/15 16/15 –1/63 64/63

13 Open Methods Trapezoidal rule won’t work if function undefined at one of the points where evaluatingTrapezoidal rule won’t work if function undefined at one of the points where evaluating – Most often: function infinite at one endpoint Open methods only evaluate function on the open interval (i.e., not at endpoints)Open methods only evaluate function on the open interval (i.e., not at endpoints)

14 Midpoint Rule Approximate function by rectangle evaluated at midpointApproximate function by rectangle evaluated at midpoint ab

15 Extended Midpoint Rule Divide into segments of width h : ab ab

16 Midpoint Rule Error Analysis Following similar analysis to trapezoidal rule, find that local accuracy is cubic, quadratic global accuracyFollowing similar analysis to trapezoidal rule, find that local accuracy is cubic, quadratic global accuracy Formula suitable for adaptive method, Richardson extrapolation, but can’t halve intervals without wasting samplesFormula suitable for adaptive method, Richardson extrapolation, but can’t halve intervals without wasting samples

17 Discontinuities All the above error analyses assumed nice (continuous, differentiable) functionsAll the above error analyses assumed nice (continuous, differentiable) functions In the presence of a discontinuity, all methods revert to accuracy proportional to hIn the presence of a discontinuity, all methods revert to accuracy proportional to h Locally-adaptive methods: do not subdivide all intervals equally, focus on those with large error (estimated from change with a single subdivision)Locally-adaptive methods: do not subdivide all intervals equally, focus on those with large error (estimated from change with a single subdivision)


Download ppt "Integration COS 323. Numerical Integration Problems Basic 1D numerical integration:Basic 1D numerical integration: – Given ability to evaluate f (x) for."

Similar presentations


Ads by Google