# How do you write the Simpson’s rule and Trapezoid rule approximations to the intsinx/x over the inteval [0,1] with n=6?

Mar 7, 2015

Simpson's sule with n=6 is simply:
${\int}_{0}^{1} f \left(x\right) = \frac{1}{18} \left[f \left(0\right) + 4 f \left(\frac{1}{6}\right) + 2 f \left(\frac{2}{6}\right) + 4 f \left(\frac{3}{6}\right) + 2 f \left(\frac{4}{6}\right) + 4 f \left(\frac{5}{6}\right) + f \left(1\right)\right]$

Here f(x) is just $\sin \frac{x}{x}$ and so one must calculate this for x=0, 1/6, ... 5/6, 1 and put the results into the formula.

The Trapezoidal rule is similar:
${\int}_{0}^{1} f \left(x\right) = \frac{1}{12} \left[f \left(0\right) + 2 f \left(\frac{1}{6}\right) + 2 f \left(\frac{2}{6}\right) + 2 f \left(\frac{3}{6}\right) + 2 f \left(\frac{4}{6}\right) + 2 f \left(\frac{5}{6}\right) + f \left(1\right)\right]$

Note that, although $f \left(0\right)$ does not exist, we know that ${\lim}_{x \rightarrow 0} f \left(x\right) = {\lim}_{x \rightarrow 0} \sin \frac{x}{x} = 1$.

Use $1$ where the formula calls for $f \left(0\right)$.