Tutorials › Calculus II › Handling Odd Panel Counts with Simpson’s Three-Eighths Rule

Quadrature and Error Bounds · Tutorial 366 of 998

Handling Odd Panel Counts with Simpson’s Three-Eighths Rule

Learn when and how to combine Simpson’s three-eighths and one-third rules to estimate an integral using an odd number of equal panels.

Intermediate 9 min read

What You'll Learn

  • Apply Simpson’s three-eighths rule to a block of three equal panels.
  • Combine that block with Simpson’s one-third rule when the total panel count is odd.
  • Calculate the resulting estimate from equally spaced function values.
  • Choose whether the three-eighths block belongs at the beginning or end of the interval.
  • Check a mixed-rule calculation and state a suitable error bound.

Why an Odd Panel Count Needs a Different Simpson Rule

Composite Simpson’s one-third rule works by grouping panels in pairs, so it requires an even number of equal panels. Sometimes the available interval is divided into an odd number of panels, and changing that division is not practical. In that case, a block of three panels can be handled with Simpson’s three-eighths rule; any remaining panels can still be grouped in pairs using Simpson’s one-third rule.

The key is to use the rules on separate subintervals that share a boundary point. The shared function value is used once in each rule’s calculation because it is an endpoint of both subintervals. The estimates are then added to approximate the integral over the entire interval.

Central idea: For an odd number \(n\geq 3\) of equal panels, apply Simpson’s three-eighths rule to three consecutive panels and Simpson’s one-third rule to the remaining \(n-3\) panels, which form an even number of panels.

The Three-Eighths Rule on Three Panels

Consider four equally spaced points \(x_0,x_1,x_2,x_3\), with spacing \(h\), so \(x_i=x_0+ih\). Simpson’s three-eighths rule approximates the integral over these three panels by

$$ \int_{x_0}^{x_3} f(x)\,dx \approx \frac{3h}{8}\bigl[f(x_0)+3f(x_1)+3f(x_2)+f(x_3)\bigr]. $$

The endpoint values have weight \(1\), while the two interior values have weight \(3\). The interval covered by this rule has length \(3h\), not \(h\).

Suppose the whole interval \([a,b]\) has \(n\) equal panels, where \(n\) is odd and \(n\geq 3\). The common panel width is \(h=(b-a)/n\). If the first three panels are assigned to the three-eighths rule, the remaining \(n-3\) panels can be handled by the composite one-third rule. Since \(n\) is odd, \(n-3\) is even, as required.

Definition: The mixed Simpson estimate for an odd panel count applies the three-eighths rule to one block of three consecutive equal panels and the composite one-third rule to the remaining even number of panels. The three-eighths block may be placed at either end of the interval.

Why the Three-Eighths Weights Work

The weights can be derived by approximating \(f\) on the three panels with the cubic polynomial that passes through its four equally spaced values, then integrating that polynomial. To see the weights, first shift and scale the points to \(u=0,1,2,3\), where \(x=x_0+hu\). The cubic interpolation polynomial is a sum of four basis polynomials, each multiplied by one of the values \(f(x_i)\).

For example, the basis polynomial corresponding to \(f(x_0)\) is \(- (u-1)(u-2)(u-3)/6\). Integrating it from \(0\) to \(3\) gives \(3/8\). The basis polynomials for \(f(x_1)\) and \(f(x_2)\) each integrate to \(9/8\), and the basis polynomial for \(f(x_3)\) integrates to \(3/8\). Since \(dx=h\,du\), the integral of the interpolating polynomial is therefore

$$ h\left(\frac{3}{8}f(x_0)+\frac{9}{8}f(x_1) +\frac{9}{8}f(x_2)+\frac{3}{8}f(x_3)\right) = \frac{3h}{8}\bigl[f(x_0)+3f(x_1)+3f(x_2)+f(x_3)\bigr]. $$

This also shows why the rule is exact for every polynomial of degree at most three: for such a function, the cubic interpolant agrees with the function throughout the interval, so integrating the interpolant gives the exact integral.

Putting the Rules Together

Let \(x_i=a+ih\), where \(h=(b-a)/n\), and write \(f_i=f(x_i)\). If the three-eighths block is placed first, and there are at least two panels remaining, the full mixed estimate is

$$ \int_a^b f(x)\,dx \approx \frac{3h}{8}(f_0+3f_1+3f_2+f_3) + \frac{h}{3} \left[ f_3+f_n+ 4\sum_{\substack{i=4\\ i\ \mathrm{odd}}}^{n-1} f_i + 2\sum_{\substack{i=4\\ i\ \mathrm{even}}}^{n-2} f_i \right]. $$

The second term is the composite one-third rule on \([x_3,b]\). Its endpoints are \(x_3\) and \(x_n\); its interior odd-indexed points have weight \(4\), and its interior even-indexed points have weight \(2\). If the three-eighths block is placed last instead, apply the composite one-third rule on \([a,x_{n-3}]\) and the three-eighths rule on \([x_{n-3},b]\).

For \(n=3\), there are no panels left for the one-third rule, so use only the three-eighths rule. For \(n=5\), there are two remaining panels and one one-third block. For \(n=7\), there are four remaining panels and two one-third blocks. The same pattern continues for larger odd counts.

1
Find the spacing.
For \(n\) equal panels on \([a,b]\), calculate \(h=(b-a)/n\).
2
Set aside three panels.
Choose a consecutive block of three panels for the three-eighths rule.
3
Check the remainder.
The remaining \(n-3\) panels must be grouped in pairs for the one-third rule.
4
Calculate and add.
Apply each rule on its own subinterval, using the function values at that subinterval’s endpoints, and add the two estimates.

Worked Examples

Worked Example: Three Panels on a Cubic

Approximate \(\int_0^3 x^3\,dx\) using three equal panels. Here \(h=(3-0)/3=1\), and the four function values are \(f_0=0^3=0\), \(f_1=1^3=1\), \(f_2=2^3=8\), and \(f_3=3^3=27\). Apply the three-eighths rule:

$$ \begin{aligned} \int_0^3 x^3\,dx &\approx \frac{3(1)}{8}\bigl[0+3(1)+3(8)+27\bigr]\\ &=\frac{3}{8}(0+3+24+27)\\ &=\frac{3}{8}(54)=\frac{162}{8}=\frac{81}{4}=20.25. \end{aligned} $$

Check against the exact integral: \(\int_0^3 x^3\,dx=[x^4/4]_0^3=81/4-0=20.25\). The estimate agrees exactly, as expected for a cubic.

Worked Example: Five Panels with the Three-Eighths Block First

Estimate \(\int_0^5 \frac{1}{1+x}\,dx\) using five equal panels. The spacing is \(h=(5-0)/5=1\). The tabulated values are \(f_0=1\), \(f_1=1/2\), \(f_2=1/3\), \(f_3=1/4\), \(f_4=1/5\), and \(f_5=1/6\).

Use the three-eighths rule on \([0,3]\):

$$ \begin{aligned} S_{3/8} &=\frac{3}{8}\left[1+3\left(\frac12\right)+3\left(\frac13\right)+\frac14\right]\\ &=\frac{3}{8}\left(1+\frac32+1+\frac14\right)\\ &=\frac{3}{8}\cdot\frac{15}{4} =\frac{45}{32}=1.40625. \end{aligned} $$

The two remaining panels lie on \([3,5]\). Apply the one-third rule using \(f_3,f_4,f_5\):

$$ \begin{aligned} S_{1/3} &=\frac{1}{3}\left[\frac14+4\left(\frac15\right)+\frac16\right]\\ &=\frac{1}{3}\left(\frac{15+48+10}{60}\right) =\frac{73}{180}\approx 0.40556. \end{aligned} $$

Add the two subinterval estimates. With common denominator \(1440\), the result is

$$ S=\frac{45}{32}+\frac{73}{180} =\frac{2025+584}{1440} =\frac{2609}{1440} \approx 1.81181. $$

Check the arithmetic by evaluating the two rules separately: \(45/32=1.40625\) and \(73/180\approx0.40556\), whose sum is approximately \(1.81181\). The exact integral is \(\ln(6)\approx1.79176\), so the estimate is about \(0.02005\) greater than the exact value.

Worked Example: Seven Panels with the Three-Eighths Block Last

Estimate \(\int_0^7 x^3\,dx\) using seven equal panels, placing the three-eighths block last. The width is \(h=(7-0)/7=1\). Use the one-third rule over \([0,4]\), with values \(f_0=0\), \(f_1=1\), \(f_2=8\), \(f_3=27\), and \(f_4=64\):

$$ \begin{aligned} S_{1/3} &=\frac{1}{3}[f_0+4f_1+2f_2+4f_3+f_4]\\ &=\frac{1}{3}[0+4(1)+2(8)+4(27)+64]\\ &=\frac{192}{3}=64. \end{aligned} $$

Now use the three-eighths rule on \([4,7]\), where \(f_4=64\), \(f_5=125\), \(f_6=216\), and \(f_7=343\):

$$ \begin{aligned} S_{3/8} &=\frac{3}{8}[64+3(125)+3(216)+343]\\ &=\frac{3}{8}[64+375+648+343]\\ &=\frac{3}{8}(1430)=\frac{4290}{8}=536.25. \end{aligned} $$

The mixed estimate is \(64+536.25=600.25\). To check, evaluate the exact integral: \(\int_0^7 x^3\,dx=[x^4/4]_0^7=2401/4=600.25\). The result is exact because both rules integrate cubic polynomials exactly.

Conditions and an Error Bound

The rules above require equally spaced panels within each Simpson block. In the mixed method, the spacing is the same throughout the original interval, so each block uses the same \(h\). The method is suitable when \(f\) is sufficiently smooth on the interval; in particular, a standard error bound applies if the fourth derivative \(f^{(4)}\) exists and is continuous there.

For a three-eighths block of width \(3h\), the error has the form \(-3h^5 f^{(4)}(\xi)/80\) for some point \(\xi\) in that block. For a composite one-third block covering a length \(L\) with panel width \(h\), the absolute error is at most \(Lh^4M/180\), where \(M\) is an upper bound for \(|f^{(4)}(x)|\) on that block. If \(|f^{(4)}(x)|\leq M\) over all of \([a,b]\), adding the two error bounds gives

$$ |E| \leq \frac{3h^5}{80}M + \frac{(n-3)h^5}{180}M. $$

When \(n=3\), the second term is zero because there is no one-third portion. This bound describes the mixed method; it should not be confused with the error bound for a single rule applied over the whole interval.

A Common Mistake: Using One-Third Weights on an Odd Count

The composite one-third rule has a repeating pattern of endpoint weights \(1\), odd-indexed interior weights \(4\), and even-indexed interior weights \(2\). That pattern requires an even number of panels. Extending it mechanically to an odd count can give incorrect weights and even fail a basic check on constant functions.

For example, on \([0,5]\) with five panels of width \(1\), suppose \(f(x)=1\). Using the invalid weights \(1,4,2,4,2,1\) gives

$$ \frac{1}{3}(1+4+2+4+2+1)=\frac{14}{3}, $$

but the exact integral of \(1\) from \(0\) to \(5\) is \(5\). The weights have not even produced the correct interval length. Instead, apply the three-eighths rule on \([0,3]\), which gives \(3\), and the one-third rule on \([3,5]\), which gives \(2\). Their sum is \(3+2=5\), as required. This constant-function check is a useful way to catch mistakes before using a mixed rule on more complicated data.

Choosing the Block and Checking the Estimate

Either end of the interval can be used for the three-eighths block. If function values are available at every equally spaced point, both choices are valid applications of the method, though they need not give exactly the same estimate for a general function. In practice, select the arrangement that fits the data or that is convenient to calculate, and keep the grid spacing consistent.

Before accepting a result, check that the panel count is odd and at least three, that the three-eighths block covers exactly three panels, and that the remaining count is even. Then confirm that the one-third calculation begins and ends at the correct shared grid points. Finally, adding the estimates should cover the interval once, with no gaps or overlaps in the subintervals themselves.

Takeaway: An odd number of equal panels does not prevent the use of Simpson methods. Set aside three consecutive panels for the three-eighths rule and pair the remainder for the one-third rule.

Check Your Understanding

Work through these questions to check your understanding of mixed Simpson estimates.

  1. Why does a total of seven panels leave a valid number of panels for the composite one-third rule after setting aside three?
  2. For five equal panels, which four function values are used by the three-eighths rule if its block is placed first?
  3. On five panels, how many one-third-rule blocks remain after using the three-eighths rule once?
  4. What basic check can reveal that a proposed set of Simpson weights is incorrect?
  5. State a condition on \(f^{(4)}\) that allows the mixed error bound to be used.