Why We Still Use Simpson's Rule In 2024
Simpson's approximation, or Simpson's 1/3 rule as most people who actually do numerical work call it, is one of those methods you learn in your second-year calculus class and then immediately forget because textbooks make it sound far more elegant than it is in practice. I started using it around 2008 on a project where we needed to integrate experimental sensor data that had no closed-form antiderivative. I was integrating pressure readings across a wind tunnel test cycle. I tried several methods before settling on Simpson's because it gave decent accuracy with relatively few sample points, and honestly, it was just there when I needed it. The method approximates an integral by fitting parabolas through consecutive groups of three points on your curve and then integrating those parabolas analytically. If your function is smooth and your spacing is uniform, you don't need much data to get a result that holds up against actual analytical integration for well-behaved functions. Here is the core formula: the integral from a to b equals h divided by 3, times f of a plus four times the sum of the odd-indexed function values plus two times the sum of the even-indexed function values plus f of b, where h is the step size and you need an even number of intervals. That h over 3 part is what gives it the name 1/3 rule, and it comes directly from integrating the interpolating quadratic through any three points.
Unlocking Precision With Simpsons Approximation The Definitive Guide To Numerical Integration
I ran into a real issue with Simpson's rule back in 2013 on a thermal analysis project. I was integrating a heat flux profile measured by a gauge that had a known periodic oscillation at high frequency sitting on top of a slower varying signal. When I applied the standard 1/3 rule directly, the result was garbage, way off from what a finer grid gave me. The oscillation period was roughly equivalent to only about three sampling intervals, which meant the parabola fit was trying to accommodate something it simply could not represent. What I ended up doing was applying a simple moving average filter across the raw data before running Simpson's rule on the smoothed values. It was not the most elegant solution but it worked immediately and brought my error down from roughly 12 percent relative error to under 0.3 percent relative to a reference result obtained by brute-force trapezoidal integration with ten thousand points. You can also use Simpson's rule recursively or apply the 3/8 rule to groups of four intervals instead if you hit similar edge cases, though you lose the nice even-odd structure. The error term for Simpson's 1/3 rule is negative h to the fifth over 180, times the fourth derivative of the function evaluated at some point in the interval, times the interval width. That is why it is order h to the fourth accurate. The h to the fifth part is important because it tells you something non-obvious: halving your step size gives you roughly a sixteen-fold improvement in accuracy, not a twofold one. Most beginners underestimate how fast convergence is once your step size is small enough that higher order terms die out. That also means Simpson's rule can be dangerous when your step size is too large, because the error blows up faster than you might expect when you double h, since the fourth derivative term sits on top of a power that grows quickly.
When Simpson's Rule Breaks Down
I want to be direct about the situations where this method fails badly, because people often try to apply it blindly. If your function has a discontinuity anywhere inside the integration interval, the error term becomes meaningless and the result is essentially random depending on where the discontinuity falls relative to your grid. I dealt with this when integrating a material property curve that had a sudden step change at a phase transition temperature, and I literally got wildly different answers depending on whether the transition point aligned with an even or odd index in my grid. The workaround there is to split the integral at the discontinuity and treat each piece separately, or switch to a method like Gauss-Kronrod if you are running this inside adaptive quadrature software. Nested or highly oscillatory integrands also wreck standard Simpson's rule unless your mesh is fine enough to resolve the oscillations, which is often impractical. A common example is integrals involving Bessel functions or damped oscillatory kernels where the period shrinks significantly across the domain. In those cases, specialized asymptotic methods or Filon-type quadrature will beat Simpson's rule hands down, and you should not waste time trying to force the 1/3 rule to work. It is also worth noting that Simpson's rule assumes uniform spacing for the standard derivation, so if your data is irregularly sampled, you either need to interpolate onto a uniform grid first or use a modified version that accounts for varying step sizes, which gets more complicated and less robust.
Get the Full Details

Practical Implementation Notes
If you are writing code for this, avoid calculating the odd and even sums separately in a way that creates floating point rounding issues on very long arrays, because the coefficients are 4 and 2 alternating and you end up adding a lot of numbers. A single loop that applies the correct weight to each point as you encounter it is usually cleaner and numerically safer than separating the sums. I typically structure it so the endpoints get weight 1, odd indices get weight 4, and even indices get weight 2, then multiply the final sum by h over 3. With modern compilers and languages, performance is not really the bottleneck here for anything under a few million points, so simplicity matters more than micro-optimizations. The composite version is what you will use almost always, where you partition the interval into n subintervals with n even, apply the rule to each pair of subintervals, and add everything up. The basic non-composite version, sometimes called Simpson's rule proper, only uses one quadratic approximation over the whole interval and is generally useless outside of toy problems because it lacks the flexibility to capture curvature variations across a broad domain. A lot of people I have worked with confuse the two versions, and it shows in their results. I also want to mention a practical tip that is not obvious: if you need to check your implementation, integrate x to the fourth power from 0 to 1 analytically and compare it against your Simpson result. The exact answer is 0.2, and with a single application using three points, you should get exactly 0.2 because Simpson's rule integrates cubics exactly. If you do not get 0.2 with that simple test, your code is wrong. This catches indexing errors and coefficient mistakes quickly.
Comparison To Other Methods
Trapezoidal rule is simpler and works with odd numbers of points, but its error term is only proportional to h squared, so you need substantially more points to match Simpson's accuracy for smooth functions. For most engineering applications where your integrand is reasonably smooth, Simpson's rule reaches machine precision tolerance with far fewer evaluations, which translates directly into faster run times in iterative contexts like optimization loops or parameter sweeps. Gaussian quadrature is more accurate per evaluation point for smooth functions but requires evaluating the function at non-uniform interior points and precomputing nodes and weights, which adds overhead and complexity that Simpson's rule avoids entirely. For oscillatory or singular integrands, neither Simpson's rule nor trapezoidal rule is competitive without heavy modification, and you should look toward Chebyshev-Gauss quadrature, Clenshaw-Curtis methods, or asymptotic expansion approaches depending on the specific structure of your problem. There is no single best numerical integration method, and Simpson's rule occupies a narrow band where it is effective: smooth enough functions, uniform or near-uniform sampling, and moderate accuracy requirements where extreme precision is not necessary. When those conditions hold, it is hard to argue against using it because it is straightforward to implement and predictable in behavior. I have been running Simpson-based integration routines in production for over a decade on everything from structural dynamics simulations to financial payoff integrals, and the method still shows up regularly in production codebases. It is not glamorous, and it has real limitations, but it is reliable when you respect the assumptions it makes and know when to switch to a different approach. I keep a small reference implementation in my standard utility library mostly out of habit, though these days I usually pull from existing numerical libraries unless there is a reason to write something custom.