Exercise 3: When Fixed-Grid Integration Is the Reasonable Choice — Possible Solution ==================================================================== WHAT'S TRUE ABOUT THE COLLEAGUE'S CLAIM ------------------------------ This chapter did verify a genuine, measurable advantage for adaptive quadrature on a function with a sharp, localized feature - roughly half the function evaluations for comparable accuracy. For functions that genuinely have this kind of uneven behavior (mostly flat with a narrow region of rapid change), adaptive quadrature really is the better choice, and the chapter's own tip box argues the advantage grows, not shrinks, as each function evaluation gets more expensive. WHY "ALWAYS ADAPTIVE" DOESN'T FOLLOW ------------------------------ The verified advantage came specifically from the function's own shape - most of the fixed grid's points were wasted because the function was nearly zero across most of the domain. For a function that is already smooth and evenly-varying across its entire domain (no narrow spikes, no localized features), a fixed grid doesn't waste evaluations the same way, because there's nowhere for a uniform grid to be "wrong" about where the interesting behavior is - the adaptive algorithm would likely end up subdividing close to uniformly anyway, gaining little or nothing over the simpler fixed-grid approach while still paying the extra implementation and runtime overhead of the adaptive subdivision logic itself (recursion, error estimation at each step, and so on). A REALISTIC SITUATION WHERE FIXED-GRID IS THE BETTER CHOICE ------------------------------ Consider a case where the function is cheap to evaluate, well-behaved and smooth across the whole interval (no sharp features anywhere), and the integration needs to run many times in a tight loop, such as inside a real-time simulation or a performance-critical inner loop. Here, the overhead of adaptive quadrature's own bookkeeping (checking error estimates, recursing, managing subintervals) could actually cost more than the extra function evaluations a simple fixed-grid approach would use, since the function itself is cheap and doesn't have any localized feature for adaptivity to usefully target. In this case, a fixed-grid method with a step size chosen once, based on prior knowledge of the function's smoothness, is simpler to implement, easier to reason about, and likely just as fast or faster in practice. WHY THIS WORKS AS AN ANSWER ------------------------------ The explanation credits the colleague's claim where this chapter's own evidence actually supports it, rather than dismissing it outright, and identifies the specific property of the verified example (an uneven, sharply-featured function) that adaptive quadrature is actually exploiting - then constructs a genuinely different scenario (a smooth, cheap, frequently-called function) where that same advantage wouldn't materialize and the added complexity wouldn't be worth it.