\begin{frame}
\frametitle{Area Between Curves}
\begin{alertblock}{}
What if we want the area between the curve and the $x$-axis?
\end{alertblock}\smallskip
\begin{center}
\scalebox{.9}{
\begin{tikzpicture}[default]
\def\mfun{(-.9 + (\x-3+\mfunshift)^2 - .1*(\x-3+\mfunshift)^4)}
\diagram[1]{-.5}{6}{-1}{1.7}{1}
\diagramannotatez
\def\mfunshift{0}
\begin{scope}[ultra thick]
\draw[fill=cgreen,draw=none,opacity=.5] plot[smooth,domain=.5:2,samples=100] (\x,{\mfun}) -- (.5,0) -- cycle;
\draw[fill=cgreen,draw=none,opacity=.5] plot[smooth,domain=2:4,samples=100] (\x,{\mfun}) -- cycle;
\draw[fill=cgreen,draw=none,opacity=.5] plot[smooth,domain=4:5.5,samples=100] (\x,{\mfun}) -- (5.5,0) -- cycle;
\draw[cred] plot[smooth,domain=.5:5.5,samples=100] (\x,{\mfun});
\node[anchor=north] at (.5,0) {$a$};
\node[anchor=north] at (5.5,0) {$b$};
\node[scale=1.8] at (.9,.5) {+};
\node at (.9,.9) {$A_1$};
\node[scale=1.8] at (5.15,.5) {+};
\node at (5.15,.9) {$A_3$};
\node[scale=1.8] at (3,-.6) {+};
\node at (3,-.25) {$A_2$};
\draw[gray] (2,.2) -- node[at end,below,black] {$x_1$} (2,-.2);
\draw[gray] (4,.2) -- node[at end,below,black] {$x_2$} (4,-.2);
\end{scope}
\end{tikzpicture}
}
\end{center}\vspace{-.5ex}
\begin{exampleblock}{}
For example, let us consider the diagram above.
\medskip
\pause
% Let $x_1 < x_2$ be the $x$-intercepts.
% \medskip
% \pause
%
The area between the curve and the $x$-axis from $a$ to $b$ is
\begin{talign}
A = \int_a^b |f(x)|dx \;=\;
\left| \int_a^{x_1} \!\!\!f(x)\,dx \right| \;+\;
\left| \int_{x_1}^{x_2} \!\!\!f(x)\,dx \right| \;+\;
\left| \int_{x_2}^b \!\!\!f(x)\,dx \right|
\end{talign}\vspace{-1ex}
\pause
\alert{Note that we split the integral
from $a$ to the first $x$-intercept, from the first to the second $x$-intercept,\ldots}
\end{exampleblock}
\vspace{10cm}
\end{frame}