1. ## Simpson Rule

Lets say the interval is [-4,4]
I am confused to choose the correct formula in given situations.

$\int_{a}^{b} f(x) \, dx \approx \frac{b-a}{6}\left[f(a) + 4f\left(\frac{a+b}{2}\right)+f(b)\right]$
AND
$\int_a^b f(x) \, dx\approx
\frac{h}{3}\bigg[f(x_0)+2\sum_{j=1}^{n/2-1}f(x_{2j})+
4\sum_{j=1}^{n/2}f(x_{2j-1})+f(x_n)$

I think the aobve is used for n+1 nodes but I am not sure how to get the nodes. Is the original interval [-4,4] has zero nodes?
Thanks

2. Originally Posted by charikaar
Lets say the interval is [-4,4]
I am confused to choose the correct formula in given situations.
$\int_{a}^{b} f(x) \, dx \approx \frac{b-a}{6}\left[f(a) + 4f\left(\frac{a+b}{2}\right)+f(b)\right]$
$\int_a^b f(x) \, dx\approx
The first is Simpson's rule with the interval divided into exactly two subintervals with the "break" at the midpoint: $x_0= a$, $x_1= \frac{a+ b}/2$, and $x_1= b$. The second is for any odd number of points (even number of subintervals). To find $x_i$, take $h= \frac{b- a}{n-1}$. Then $x_i= a+ hi$.