Talk:Simpson's rule

Alternative Extended Simpson's rule

 * This is another formulation of a Composite Simpson's rule. Instead of applying Simpson's rule to disjoint segments of the integral to be approximated, Simpson's rule is applied to overlapping segments.
 * $$\begin{align}

\int_a^b f(x) \, dx\approx \frac{h}{48}\bigg[17f(x_0)&+59f(x_1)+43f(x_2)+49f(x_3)+48f(x_4)+\cdots \\ &+48f(x_{n-4})+49f(x_{n-3})+43f(x_{n-2})+59f(x_{n-1})+17f(x_n)\bigg]. \end{align} $$

The above text was added to the article. Something seems to be wrong with the formula since the coefficients do not average to 1. Could we please have a reference to this formula? In the mean time, I moved the text from the article to here. -- Jitse Niesen (talk) 08:42, 13 September 2008 (UTC)


 * Yes, they do (if you combine the 17's into a 34 rather than counting an extra interval). But you're right to be suspicious of it, since it was preseneted without a source. Dicklyon (talk) 17:02, 13 September 2008 (UTC)


 * I didn't check what happens if you average all the coefficients listed; indeed, you then get 1. I tried a short cut: locate the bit that is repeated (4/3, 2/3 in the composite Simpson's rule) and compute the average for that. I don't see how the new rule works for general n. Perhaps the coefficients depend on n? Anyway, it does not make much sense to discuss it without a reference. -- Jitse Niesen (talk) 01:45, 15 September 2008 (UTC)


 * I'm presuming that at the dot dot dot, the 48 is repeated; so the average remains 1 always. But yes we need a source to understand it better. Dicklyon (talk) 05:23, 15 September 2008 (UTC)


 * Here it is, the "alternative extended Simpson's rule" in Numerical Recipes in Pascal, By William H. Press, Brian P. Flannery, William T. Vetterling, Saul A. Teukolsky. Dicklyon (talk) 05:29, 15 September 2008 (UTC)


 * Also equation 35 in https://mathworld.wolfram.com/Newton-CotesFormulas.html which is more easily accessible. -- Avi (talk) 22:11, 14 December 2022 (UTC)

too many implementations
There are too many implementations of the algorithm. From MOS:CODE: "Multiple source code implementations are not appropriate unless they contrast specific aspects of the code and that contrast is important to the encyclopedic content of the article." 00:57, 5 December 2013 (UTC)


 * I agree. Having an Octave version in addition to a Matlab version is especially silly. I'm removing everything except the python version. Ragnarstroberg (talk) 15:21, 9 December 2013 (UTC)


 * I agree with that. Bubba73 You talkin' to me? 23:37, 9 December 2013 (UTC)


 * I added an R version as that language is used more often for statistics than Python -- Avi (talk) 22:10, 14 December 2022 (UTC)

Cartwright 2017 - Necessary adjustments
The substitutions needed are: Both of these reflect the fact we are trying to calculate the last slice instead of the first. It's easier to crunch through the algebra if you then replace the subtractions with their associated differences: Doing the above, crunching through, and simplifying the results produces the values for $$\alpha, \beta,$$ and $$\eta$$ seen in the text. -- Avi (talk) 21:51, 18 December 2022 (UTC)
 * replacing $$(x_2 - x_1)$$ with $$(x_3 - x_2)$$ and vice versa
 * replacing $$f(x_3)$$ with $$f(x_1)$$ and vice versa
 * $$(x_3 - x_2)$$ with $$h_{N-1}$$
 * $$(x_2 - x_1)$$ with $$h_{N-2}$$
 * $$(x_3 - x_1)$$ with $$(h_{N-1} + h_{N-2})$$