<s>[INST] Calculate Riemann sums for $f(x)=4+3x^3$ for $x \in [-2,1]$ I have the following exercise:
Let $f(x)$ = $4+3x^3$, $x$ $\in$ $[-2; 1]$. Calculate the Riemann sums for $f$ on $[-2; 1]$ by dividing the interval into n equal sub-intervals and taking midpoints as sample points. Find the limit of Riemann sums as $n \to \infty$. 
I have used the general formula
$\lim_{n \to \infty}$ $\frac{1}{n}$$\sum_{k=1}^{n}$$f(\frac{x_{k-1}+x_k}{2})$
Then I used $x_k$ formula($x_k=a+\frac{k(b-a)}{n}$) and got $\frac{x_{k-1}+x_k}{2}$ = $\frac{6k-3-4n}{2n}$
Then I plugged in my $x_k$ sample points and got the following:
\begin{align}
&\lim_{n \to \infty}\frac{1}{n}\sum_{k=1}^{n}4+(3\frac{6k-3-4n}{2n})^3\\&=
\lim_{n \to \infty}\frac{3}{2n^3}\sum_{k=1}^{n}(6k-(3+4n))^3\\&=
\lim_{n \to \infty}\frac{3}{2n^3}\sum_{k=1}^{n}(216k^3-108k^2(3+4n)+18k(3+4n)^2-(3+4n)^3)\\&=
\lim_{n \to \infty}\frac{3}{2n^3}(-n(3+4n)^3)\sum_{k=1}^{n}216k^3-\sum_{k=1}^{n}108k^2(3+4n)+\sum_{k=1}^{n}18k(3+4n)^2\\&=
\lim_{n \to \infty}\frac{3}{2n^3}(-n(3+4n)^3)216\sum_{k=1}^{n}k^3-108(3+4n)\sum_{k=1}^{n}k^2+18(3+4n)^2\sum_{k=1}^{n}k\\&=
\lim_{n \to \infty}\frac{3}{2n^3}(-n(3+4n)^3)216(\frac{n(n+1)}{2})^2-108(3+4n)(\frac{n(n+1)(2n+1)}{6})+18(3+4n)^2(\frac{n(n+1)}{2}) \end{align}
The limit of the last part is $-\infty$, however, I should get $\frac{3}{4}$ as it is another way to calculate the definite integral. Can someone please tell if there is something I have done wrong or there is a better way to solve this problem?
 [/INST] Mistake $1$:
$$\lim_{n \to \infty}\frac{1}{\color{blue}n}\sum_{k=1}^{n}\left[4+\color{red}3(\frac{6k-3-4n}{2n})^3\right]= \color{red}{4}+
\lim_{n \to \infty}\frac{3}{\color{red}{8n^4}}\sum_{k=1}^{n}(6k-(3+4n))^3$$
Mistake $2$:
\begin{align}&\lim_{n \to \infty}\frac{3}{2n^3}\sum_{k=1}^{n}(216k^3-108k^2(3+4n)+18k(3+4n)^2-(3+4n)^3)\\&=
\lim_{n \to \infty}\frac{3}{2n^3}\color{red}{(-n(3+4n)^3)}\sum_{k=1}^{n}216k^3-\sum_{k=1}^{n}108k^2(3+4n)+\sum_{k=1}^{n}18k(3+4n)^2 \end{align}
Correction:
\begin{align}&\color{blue}4+\lim_{n \to \infty}\frac{3}{\color{blue}{8n^4}}\sum_{k=1}^{n}(216k^3-108k^2(3+4n)+18k(3+4n)^2-(3+4n)^3)\\&=4+
\lim_{n \to \infty}\frac{3}{\color{blue}{8n^4}}\left[\color{red}{(-n(3+4n)^3)}\color{blue}+\sum_{k=1}^{n}216k^3-\sum_{k=1}^{n}108k^2(3+4n)+\sum_{k=1}^{n}18k(3+4n)^2\right] \end{align}
Mistake $3$:
The general formula should be 
$$\lim_{n \to \infty}\frac{\color{red}{b-a}}{n}\sum_{k=1}^{n}f\left(\frac{x_{k-1}+x_k}{2}\right)$$
</s>