ineedhelpnow said:
what would the setup look like for something from 0 to $\pi$ if n=6 and $\Delta x=\pi/6$
From what you write later, I assume that you have to apply the Simpson's rule 3 times on 3 subintervals of $[0,\pi]$. The intervals are
\begin{array}{c|c|c|c}
\text{No} & 1 & 2 & 3\\
\hline
\text{Interval} & [0,\pi/3] & [\pi/3,2\pi/3] & [2\pi/3,\pi]\\
\hline
\text{Midpoint} & \pi/6 & \pi/2 & 5\pi/6\\
\end{array}
Applying the Simpson's rule to each interval we get
\begin{align*}
&\frac{\pi/3}{6}\big[f(0)+4f(\pi/6)+f(\pi/3)\big]\\
&\frac{\pi/3}{6}\big[f(\pi/3)+4f(\pi/2)+f(2\pi/3)\big]\\
&\frac{\pi/3}{6}\big[f(2\pi/3)+4f(5\pi/6)+f(\pi)\big]\\
\end{align*}
Summing this up we get
\[
\frac{\pi}{18}\big[f(0)+4f(\pi/6)+2f(\pi/3)+4f(\pi/2)+2f(2\pi/3)+4f(5\pi/6)+f(\pi)\big]\qquad(*)
\]
We can use the formula you gave
ineedhelpnow said:
$\frac{\Delta x}{3} [f(x_0) +4f(x_1) +2f(x_2)+...+2f(x_{n-2}) +4f(x_{n-1})+f(x_n)]$
(see also
Wikipedia). Here $x_i=\frac{\pi}{6}i$, $i=0,\dots,6$ and the rule gives
\[
\frac{\pi/6}{3}\big[f(x_0)+4f(x_1)+2f(x_2)+4f(x_3)+2f(x_4)+4f(x_5)+f(x_6)\big]
\]
which is the same thing as (*).