20/98
\begin{frame}
\frametitle{The Area below a Curve}

\begin{exampleblock}{}
Estimate the area below the curve $f(x) = x^2$ from $0$ to $1$.
\end{exampleblock}

\begin{center}
\scalebox{.65}{
\begin{tikzpicture}[default]
\def\mfun{(4*((\x+\mfunshift)/4)^2)}

\diagram[1]{-.5}{4.5}{-.4}{4.5}{1}
\diagramannotatez
\diagramannotatexx{1/.25,2/.5,3/.75,4/1}
\diagramannotateyy{1/.25,2/.5,3/.75,4/1}
\def\mfunshift{0}
\begin{scope}[ultra thick]
\draw[cred] plot[smooth,domain=0:4,samples=20] (\x,{\mfun});

\def\mwidth{4}
\setcounter{slide}{4}
\foreach \nrsteps/\mcolor in {3/cred} {
\setcounter{roundcounter}{\arabic{slide}}
\def\mstep{\mwidth/(\nrsteps+1)}
\def\mfunshift{\mstep}
\foreach \xx in {0,...,\nrsteps} {
\def\x{\xx*\mstep}
\setcounter{tmpcount}{\arabic{roundcounter}}
\onslide<\arabic{slide}->{
\draw[thick,draw=\mcolor!60!black,fill=\mcolor,opacity=.5] ({\x},0) rectangle ({\x+\mstep},{\mfun});
\node[include=\mcolor] at ({\x+\mfunshift},{\mfun}) {};
}
}
}
\end{scope}
\end{tikzpicture}
}
\end{center}
\pause\vspace{-1ex}

Let's split the area in $4$ vertical strips:
\begin{itemize}
\pause
\item height of each rectangle = value at right endpoint
\end{itemize}
\pause\pause\pause\pause\pause\smallskip

The sum of the area of these rectangles is:\vspace{-1ex}
\begin{talign}
&\alert{R_4} = \mpause[1]{ \frac{1}{4} \cdot \left(\frac{1}{4}\right)^2 }
\mpause{ + \frac{1}{4} \cdot \left(\frac{2}{4}\right)^2 }
\mpause{ + \frac{1}{4} \cdot \left(\frac{3}{4}\right)^2 }
\mpause{ + \frac{1}{4} \cdot 1^2 }
The area $A$ below the curve is \pause less then $R_4$, that is, \alert{$A < R_4$}.