Trapezoidal Rule/ Having trouble understanding what is k?! QUESTION:
I know of the more understanding formula for the trapezoidal rule. However, I came across this new form in a book i'm reading. Can someone tell me how I'm suppose to enter the respected values into this new form. Really would like to understand what is going on.

I'm assuming that the first part (b-a)/n will come to 1 so we can disregard it. 
Next I'm assuming that [f(a) + f(b)]/2 will be set up like (f(-2)+f(5))/2 which is about 3.667544
The summation part is confusing and I'm not even for sure if i'm correct above. I'm coming out with an answer around 13.334698. Which it should be around 17.017422. Any guidance is appreciated. 
 A: The sum gives you the following values (the first value is the value of $x$ that is put into the function at each step, so you can verify)::


*

*$−1.,1.41421356237309505$

*$0.,1.$

*$1.,1.41421356237309505$

*$2.,2.2360679774997897$

*$3.,3.16227766016837933$

*$4.,4.12310562561766055$


The sum of those values is: $13.3498783880320197$.
The result of $\displaystyle ~\frac{f(a)+f(b)}{2} = 3.66754374554628726$
The final result is the sum of those two and is $17.0174221335783069$.
The actual result from the integral is $16.8617$.
Here is a Trapezoidal calculator showing the results.
A: It is the ordinary Trapezoidal Rule. You may have seen the version 
$$\frac{\Delta x}{2}\left(f(x_0)+2f(x_1)+2f(x_2)+\cdots+2f(x_{n-1})+f(x_n)\right),$$
where $x_k=a+k\Delta x$ and $\Delta x=\frac{b-a}{n}$.
In the formula you quoted, the first and last terms, which are $f(a)$ and $f(b)$ respectively, have been separated out and put in front, as $\frac{f(a)+f(b)}{2}$. 
The rest of the terms, corresponding to $k=1$ to $n-1$, when divided by $2$, give $f(x_1)+f(x_2)+\cdots+f(x_{n-1})$, exactly as in the quoted formula. 
A: Note that the usual alternative to the 
Trapezoidal rule, which uses the endpoints
of the interval and equally spaced points inside
is the Midpoint Rule,
which uses equally spaced points
all inside the interval.
If you properly combine these two rules,
you can get Simpson's Rule,
which is usually significantly more accurate
than either.
Playing around with successively subdividing the intervals,
you may end up with either Romberg Integration,
which subdivides the interval uniformly,
or an adaptive integration method,
which tries to only subdivide parts of the interval
where the function is unruly.
Oh, the places you'll go!
