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

  \begin{center}
  \scalebox{.9}{
  \begin{tikzpicture}[default]
    \def\mfun{(4*(\x+\mfunshift) - 2.6*(\x+\mfunshift)^2 + .44*(\x+\mfunshift)^3)}

    {\def\diaborderx{.3cm}
    \def\diabordery{.3cm}
    \diagram[1]{-.5}{4}{-.4}{2}{1}}
    \diagramannotatez
    \def\mfunshift{0}
    \begin{scope}[ultra thick]
      \draw[cred] plot[smooth,domain=.5:3.5,samples=20] (\x,{\mfun});
      \def\mwidth{3}
      \def\mstep{\mwidth/5}
      \def\mfunshift{0}
      \foreach \xx in {0,...,4} {
        \coordinate (height) at (0,0);
        \def\x{.5+ \xx*\mstep}
        \foreach \xxx in {0,0.01,...,1} {
          \gettikzxy{(height)}
          \def\mfunshift{\xxx*\mstep}
          \pgfmathparse{\mfun}
          \ifthenelse{\lengthtest{\pgfmathresult cm > \myy}}{
            \coordinate (height) at (0,\pgfmathresult cm);
          }{}
        }
        \draw[thick,draw=cred!60!black,fill=cred,opacity=.5] ({\x},0) rectangle ($({\x+\mstep},0) + (height)$); 
      }
      \node[anchor=north] at (.5,0) {$a$};
      \node[anchor=north] at (3.5,0) {$b$};
      \node at (2,-1.1) {upper sum $U_5$};
    \end{scope}
  \end{tikzpicture}~\hspace{.5cm}~%
  \mpause[1]{%
  \begin{tikzpicture}[default]
    \def\mfun{(4*(\x+\mfunshift) - 2.6*(\x+\mfunshift)^2 + .44*(\x+\mfunshift)^3)}

    {\def\diaborderx{.3cm}
    \def\diabordery{.3cm}
    \diagram[1]{-.5}{4}{-.4}{2}{1}}
    \diagramannotatez
    \def\mfunshift{0}
    \begin{scope}[ultra thick]
      \draw[cred] plot[smooth,domain=.5:3.5,samples=20] (\x,{\mfun});
      \def\mwidth{3}
      \def\mstep{\mwidth/5}
      \def\mfunshift{0}
      \foreach \xx in {0,...,4} {
        \coordinate (height) at (0,5);
        \def\x{.5+ \xx*\mstep}
        \foreach \xxx in {0,0.01,...,1} {
          \gettikzxy{(height)}
          \def\mfunshift{\xxx*\mstep}
          \pgfmathparse{\mfun}
          \ifthenelse{\lengthtest{\pgfmathresult cm < \myy}}{
            \coordinate (height) at (0,\pgfmathresult cm);
          }{}
        }
        \draw[thick,draw=cred!60!black,fill=cred,opacity=.5] ({\x},0) rectangle ($({\x+\mstep},0) + (height)$); 
      }
      \node[anchor=north] at (.5,0) {$a$};
      \node[anchor=north] at (3.5,0) {$b$};
      \node at (2,-1.1) {lower sum $D_5$};
    \end{scope}
  \end{tikzpicture}
  }
  }
  \end{center}\vspace{-1ex}

  \begin{block}{}
  The \emph{upper sum} is
  \begin{malign}
    U_n = \Delta x\big(f(x_1) + f(x_2) + \ldots + f(x_n)\big)
  \end{malign}\vspace{-1ex}
  
  where $x_i$ is chosen from $I_i$ such that $f(x_i)$ is the maximum on $I_i$
  \end{block}
  \pause
  
  \begin{block}{}
  The \emph{lower sum} is
  \begin{malign}
    D_n = \Delta x\big(f(x_1) + f(x_2) + \ldots + f(x_n)\big)
  \end{malign}\vspace{-1ex}
  
  where $x_i$ is chosen from $I_i$ such that $f(x_i)$ is the minimum on $I_i$
  \end{block}
\end{frame}