Animated definite integral

This animation helps explain the geometric interpretation of the definite integral.


animated-definite-integral

Edit and compile if you like:

%
%
% Author:
% Efraín Soto Apolinar.
% http://www.aprendematematicas.org/
% 
% This animation helps explain the 
% geometric interpretation of the 
% definite integral.
%
\documentclass[10pt]{beamer}

\usepackage[utf8]{inputenc} % Language = Spanish
%

\usepackage{color}
\usepackage{tikz}
\usepackage{hyperref}
\hypersetup{pdfpagemode=FullScreen}
\usepackage{ifthen}
\usepackage{animate}
%
\usetheme{Warsaw} 
\usecolortheme{whale}
%
%
%
\newcounter{angle}
\setcounter{angle}{0}
%
\begin{document}
%
%
%
\newcounter{r}
\newcommand{\escalar}[1]{
\setcounter{r}{#1 * #1 * #1}
}
%
\newcounter{m}
\setcounter{m}{0}
\newcounter{mc}
%
%
%
\begin{frame}[fragile]{Animated Integral}
\begin{center}
\begin{animateinline}[loop, poster = first, controls, palindrome]{2}
\whiledo{\them < 21}{
    \begin{tikzpicture}[scale=1.25]
    \draw[red,thick,<->] (-1,1) parabola bend (0,0) (2.1,4.41)
        node[below right] {$y=x^2$};
    \draw[loosely dotted] (-1,0) grid (4,4);
    %\path[use as bounding box] (-2,-1) rectangle (5,5);
    \draw[->] (-0.2,0) -- (4.25,0) node[right] {$x$};
    \draw[->] (0,-0.25) -- (0,4.25) node[above] {$y$};
    \foreach \x/\xtext in {1/1, 2/2, 3/3}
    \draw[shift={(\x,0)}] (0pt,2pt) -- (0pt,-2pt) node[below] {$\xtext$};
    \foreach \y/\ytext in {1/1, 2/2, 3/3, 4/4}
    \draw[shift={(0,\y)}] (2pt,0pt) -- (-2pt,0pt) node[left] {$\ytext$};
%
    \setcounter{mc}{\value{m}*\value{m}}
    \shade[top color=blue,bottom color=gray!50]
        (0,0) parabola (0.1*\them,0.01*\themc) |- (0,0);
    \escalar{\them}
    \draw (3cm,2pt) node[above]
        {$\displaystyle\int\limits_0^{\them/10} \!\!x^2\mathrm{d}x = 
            \displaystyle\frac{\ther}{3000}$};
    \draw[fill=orange,color=orange] (0.1*\them,0.01*\themc) circle (0.5pt);
    \end{tikzpicture}
    %
    \stepcounter{m}
    \ifthenelse{\them < 21}{
            \newframe
    }{
        \end{animateinline}\relax % BREAK
    }
} % END \whiledo...
\end{center}
\end{frame}

%
%
%
\end{document}


Click to download: animated-definite-integral.texanimated-definite-integral.pdf
Open in Overleaf: animated-definite-integral.tex