二次公式的动画证明

二次公式的动画证明

我有以下内容代码先前由 Alenanno 发布我想给出二次公式的动画证明。我的问题是:

  • 我想改进代码,这样当我与 相乘时$4a$$4a$$bx$从公式 2 得出,依此类推,$4aax^2$$4ac.$
  • 然后我想将$a$$\textcolor{red}{a}$ 合并,这样它就变成了$a^2$。怎么做?

\documentclass[tikz, margin=10pt]{standalone}

\newcommand\basicstuff{
    \path (-9,-5) rectangle (9,5);
}

\tikzset{
    bas/.style={text width=6cm}
}

\begin{document}\Huge
\foreach \x in {0,...,10}{
\begin{tikzpicture}
\basicstuff

\node[bas] at (0,3) {$\textcolor{red}{ax^2} + \textcolor{green}{bx} + \textcolor{blue}{c}=0$};

\end{tikzpicture}
}
%
\foreach \x [
    count=\xx starting from 0, 
    evaluate=\x as \opac using (\x/10),
    evaluate=\x as \y using (3-\x)
    ] in {0,.25,...,2}{
\begin{tikzpicture}
\basicstuff

\node[bas] at (0,3) {$\textcolor{red}{ax^2} + \textcolor{green}{bx} + \textcolor{blue}{c}=0$};

\node[bas, opacity=\opac] at (0,\y) {$\textcolor{red}{ax^2} + \textcolor{green}{bx} + \textcolor{blue}{c}=0$};

%\node[bas, opacity=\opac] at (3,\y) {$\textcolor{green}{bx}$};
\end{tikzpicture}
}
%
\foreach \x in {1,...,10}{
\begin{tikzpicture}
\basicstuff

\node[bas] at (0,3) {$\textcolor{red}{ax^2} + \textcolor{green}{bx} + \textcolor{blue}{c}=0$};

\node[bas] at (0,1) {$\textcolor{red}{ax^2} + \textcolor{green}{bx} + \textcolor{blue}{c}=0$};


\end{tikzpicture}
}



%---------------------------


\foreach \x[ evaluate=\x as \opac using (\x/10),] in {1,...,10}{
\begin{tikzpicture}
\basicstuff

\node[bas] at (0,3) {$\textcolor{red}{ax^2} + \textcolor{green}{bx} + \textcolor{blue}{c}=0$};

\node[bas] at (0,1) {$\textcolor{red}{ax^2} + \textcolor{green}{bx} + \textcolor{blue}{c}=0$};

\node[bas, opacity=\opac] at (-0.2,0.88) {$( $}; %\hspace{4.4cm} \right) \hspace {1.cm} 
\node[bas, opacity=\opac] at (4.4,0.88) {$)$};
\node[bas, opacity=\opac] at (-1.2,.88) {$4a\cdot$};
\node[bas, opacity=\opac] at (6,.88) {$\cdot4a$};
\end{tikzpicture}
}

%
%


%-------------------------------------------------------------------------------------------------------

\foreach \x[ evaluate=\x as \opac using (\x/10),] in {1,...,10}{
\begin{tikzpicture}
\basicstuff

\node[bas] at (0,3) {$\textcolor{red}{ax^2} + \textcolor{green}{bx} + \textcolor{blue}{c}=0$};

\node[bas] at (0,1) {$\textcolor{red}{ax^2} + \textcolor{green}{bx} + \textcolor{blue}{c}=0$};

\node[bas] at (-0.2,0.88) {$( $}; %\hspace{4.4cm} \right) \hspace {1.cm} 
\node[bas] at (4.4,0.88) {$)$};
\node[bas] at (-1.2,.88) {$4a\cdot$};
\node[bas] at (6,.88) {$\cdot4a$};

\node[bas, opacity=\opac] at (-0.9,-1.) {$4a \textcolor{red}{ax^2}  \,$};
\end{tikzpicture}
}
%--------------------------------------------------------------------------------------------------------------------------

\foreach \x[ evaluate=\x as \opac using (\x/10),] in {1,...,10}{
\begin{tikzpicture}
\basicstuff

\node[bas] at (0,3) {$\textcolor{red}{ax^2} + \textcolor{green}{bx} + \textcolor{blue}{c}=0$};

\node[bas] at (0,1) {$\textcolor{red}{ax^2} + \textcolor{green}{bx} + \textcolor{blue}{c}=0$};

\node[bas] at (-0.2,0.88) {$( $}; %\hspace{4.4cm} \right) \hspace {1.cm} 
\node[bas] at (4.4,0.88) {$)$};
\node[bas] at (-1.2,.88) {$4a\cdot$};
\node[bas] at (6,.88) {$\cdot4a$};
\node[bas] at (-0.9,-1.) {$4a \textcolor{red}{ax^2} $};
\node[bas, opacity=\opac] at (1.5,-1.1) {$+ \,4a \textcolor{green}{bx}$};
\end{tikzpicture}
}

%--------------------------------------------------


%--------------------------------------------------------------------------------------------------------------------------

\foreach \x[ evaluate=\x as \opac using (\x/10),] in {1,...,10}{
\begin{tikzpicture}
\basicstuff

\node[bas] at (0,3) {$\textcolor{red}{ax^2} + \textcolor{green}{bx} + \textcolor{blue}{c}=0$};

\node[bas] at (0,1) {$\textcolor{red}{ax^2} + \textcolor{green}{bx} + \textcolor{blue}{c}=0$};

\node[bas] at (-0.2,0.88) {$( $}; %\hspace{4.4cm} \right) \hspace {1.cm} 
\node[bas] at (4.4,0.88) {$)$};
\node[bas] at (-1.2,.88) {$4a\cdot$};
\node[bas] at (6,.88) {$\cdot4a$};
\node[bas] at (-0.9,-1.) {$4a \textcolor{red}{ax^2} $};
\node[bas] at (1.5,-1.1) {$+ \,4a \textcolor{green}{bx}$};
\node[bas, opacity=\opac] at (4.2,-1.2) {$+ \,4a \textcolor{blue}{c}$};
\end{tikzpicture}
}
%-------------------------------------------------------------------------




\foreach \x[ evaluate=\x as \opac using (\x/10),] in {1,...,10}{
\begin{tikzpicture}
\basicstuff

\node[bas] at (0,3) {$\textcolor{red}{ax^2} + \textcolor{green}{bx} + \textcolor{blue}{c}=0$};

\node[bas] at (0,1) {$\textcolor{red}{ax^2} + \textcolor{green}{bx} + \textcolor{blue}{c}=0$};

\node[bas] at (-0.2,0.88) {$( $}; %\hspace{4.4cm} \right) \hspace {1.cm} 
\node[bas] at (4.4,0.88) {$)$};
\node[bas] at (-1.2,.88) {$4a\cdot$};
\node[bas] at (6,.88) {$\cdot4a$};
\node[bas] at (-0.9,-1.) {$4a \textcolor{red}{ax^2} $};
\node[bas] at (1.5,-1.1) {$+ \,4a \textcolor{green}{bx}$};
\node[bas] at (4.2,-1.2) {$+ \,4a \textcolor{blue}{c}$};

\node[bas, opacity=\opac] at (6.5,-1.2) {$ = 0 $};
\end{tikzpicture}
}



%-------------------------------------------------------------------------



\foreach \x[ evaluate=\x as \opac using (\x/10),] in {1,...,10,10,10,10,9,8,...,0}{
\begin{tikzpicture}
\basicstuff

\node[bas] at (0,3) {$\textcolor{red}{ax^2} + \textcolor{green}{bx} + \textcolor{blue}{c}=0$};

\node[bas] at (0,1) {$\textcolor{red}{ax^2} + \textcolor{green}{bx} + \textcolor{blue}{c}=0$};

\node[bas] at (-0.2,0.88) {$( $}; %\hspace{4.4cm} \right) \hspace {1.cm} 
\node[bas] at (4.4,0.88) {$)$};
\node[bas] at (-1.2,.88) {$4a\cdot$};
\node[bas] at (6,.88) {$\cdot4a$};
\node[bas] at (-0.9,-1.) {$4a \textcolor{red}{ax^2} $};
\node[bas] at (1.5,-1.1) {$+ \,4a \textcolor{green}{bx}$};
\node[bas] at (4.2,-1.2) {$+ \,4a \textcolor{blue}{c}$};

\node[bas] at (6.5,-1.2) {$ = 0 $};


%\node[bas, opacity=\opac] at  (-0.9,-1.) {$  4 \textcolor{red}{a^2x^2}$};
\end{tikzpicture}
}



\end{document}

答案1

对于第一个问题,您可以使用相同的基本思想在改变不透明度的同时逐渐改变距离。至少,我是这么认为的。我不完全理解为什么事物在等式的右边较低,即为什么 4ac 低于 4abx,而 4abx 低于 4aax^2,所以也许我没有正确理解这是如何工作的。

\documentclass[border=10pt,tikz,multi]{standalone}
% code from Alenanno's answer at http://tex.stackexchange.com/a/305603/
\newcommand\basicstuff{
  \path (-9,-5) rectangle (9,5);
}
\tikzset{%
  bas/.style={text width=6cm}
}
\begin{document}\Huge
  \foreach \x in {0,...,10}{
    \begin{tikzpicture}
      \basicstuff
      \node[bas] at (0,3) {$\textcolor{red}{ax^2} + \textcolor{green}{bx} + \textcolor{blue}{c}=0$};
    \end{tikzpicture}
  }
  \foreach \x [
  count=\xx starting from 0,
  evaluate=\x as \opac using (\x/10),
  evaluate=\x as \y using (3-\x)
  ] in {0,.25,...,2}{
    \begin{tikzpicture}
      \basicstuff
      \node[bas] at (0,3) {$\textcolor{red}{ax^2} + \textcolor{green}{bx} + \textcolor{blue}{c}=0$};
      \node[bas, opacity=\opac] at (0,\y) {$\textcolor{red}{ax^2} + \textcolor{green}{bx} + \textcolor{blue}{c}=0$};
      %\node[bas, opacity=\opac] at (3,\y) {$\textcolor{green}{bx}$};
    \end{tikzpicture}
  }
  \foreach \x in {1,...,10}{
    \begin{tikzpicture}
      \basicstuff
      \node[bas] at (0,3) {$\textcolor{red}{ax^2} + \textcolor{green}{bx} + \textcolor{blue}{c}=0$};
      \node[bas] at (0,1) {$\textcolor{red}{ax^2} + \textcolor{green}{bx} + \textcolor{blue}{c}=0$};
    \end{tikzpicture}
  }
  \foreach \x[ evaluate=\x as \opac using (\x/10),] in {1,...,10}{
    \begin{tikzpicture}
      \basicstuff
      \node[bas] at (0,3) {$\textcolor{red}{ax^2} + \textcolor{green}{bx} + \textcolor{blue}{c}=0$};
      \node[bas] at (0,1) {$\textcolor{red}{ax^2} + \textcolor{green}{bx} + \textcolor{blue}{c}=0$};
      \node[bas, opacity=\opac] at (-0.2,0.88) {$( $}; %\hspace{4.4cm} \right) \hspace {1.cm}
      \node[bas, opacity=\opac] at (4.4,0.88) {$)$};
      \node[bas, opacity=\opac] at (-1.2,.88) {$4a\cdot$};
      \node[bas, opacity=\opac] at (6,.88) {$\cdot4a$};
    \end{tikzpicture}
  }
  \foreach \x[ evaluate=\x as \opac using (\x/10),] in {1,...,10}{
    \begin{tikzpicture}
      \basicstuff
      \node[bas] at (0,3) {$\textcolor{red}{ax^2} + \textcolor{green}{bx} + \textcolor{blue}{c}=0$};
      \node[bas] at (0,1) {$\textcolor{red}{ax^2} + \textcolor{green}{bx} + \textcolor{blue}{c}=0$};
      \node[bas] at (-0.2,0.88) {$( $}; %\hspace{4.4cm} \right) \hspace {1.cm}
      \node[bas] at (4.4,0.88) {$)$};
      \node[bas] at (-1.2,.88) {$4a\cdot$};
      \node[bas] at (6,.88) {$\cdot4a$};
      \node[bas, opacity=\opac] at (-0.9,{1-\x/5}) {$4a \textcolor{red}{ax^2}  \,$};
    \end{tikzpicture}
  }
  \foreach \x[ evaluate=\x as \opac using (\x/10),] in {1,...,10}{
    \begin{tikzpicture}
      \basicstuff
      \node[bas] at (0,3) {$\textcolor{red}{ax^2} + \textcolor{green}{bx} + \textcolor{blue}{c}=0$};
      \node[bas] at (0,1) {$\textcolor{red}{ax^2} + \textcolor{green}{bx} + \textcolor{blue}{c}=0$};
      \node[bas] at (-0.2,0.88) {$( $}; %\hspace{4.4cm} \right) \hspace {1.cm}
      \node[bas] at (4.4,0.88) {$)$};
      \node[bas] at (-1.2,.88) {$4a\cdot$};
      \node[bas] at (6,.88) {$\cdot4a$};
      \node[bas] at (-0.9,-1.) {$4a \textcolor{red}{ax^2} $};
      \node[bas, opacity=\opac] at (1.5,{.9-\x/5}) {$+ \,4a \textcolor{green}{bx}$};
    \end{tikzpicture}
  }
  \foreach \x[ evaluate=\x as \opac using (\x/10),] in {1,...,10}{
    \begin{tikzpicture}
      \basicstuff
      \node[bas] at (0,3) {$\textcolor{red}{ax^2} + \textcolor{green}{bx} + \textcolor{blue}{c}=0$};
      \node[bas] at (0,1) {$\textcolor{red}{ax^2} + \textcolor{green}{bx} + \textcolor{blue}{c}=0$};
      \node[bas] at (-0.2,0.88) {$( $}; %\hspace{4.4cm} \right) \hspace {1.cm}
      \node[bas] at (4.4,0.88) {$)$};
      \node[bas] at (-1.2,.88) {$4a\cdot$};
      \node[bas] at (6,.88) {$\cdot4a$};
      \node[bas] at (-0.9,-1.) {$4a \textcolor{red}{ax^2} $};
      \node[bas] at (1.5,-1.1) {$+ \,4a \textcolor{green}{bx}$};
      \node[bas, opacity=\opac] at (4.2,{.8-\x/5}) {$+ \,4a \textcolor{blue}{c}$};
    \end{tikzpicture}
  }
  \foreach \x[ evaluate=\x as \opac using (\x/10),] in {1,...,10}{
    \begin{tikzpicture}
      \basicstuff
      \node[bas] at (0,3) {$\textcolor{red}{ax^2} + \textcolor{green}{bx} + \textcolor{blue}{c}=0$};
      \node[bas] at (0,1) {$\textcolor{red}{ax^2} + \textcolor{green}{bx} + \textcolor{blue}{c}=0$};
      \node[bas] at (-0.2,0.88) {$( $}; %\hspace{4.4cm} \right) \hspace {1.cm}
      \node[bas] at (4.4,0.88) {$)$};
      \node[bas] at (-1.2,.88) {$4a\cdot$};
      \node[bas] at (6,.88) {$\cdot4a$};
      \node[bas] at (-0.9,-1.) {$4a \textcolor{red}{ax^2} $};
      \node[bas] at (1.5,-1.1) {$+ \,4a \textcolor{green}{bx}$};
      \node[bas] at (4.2,-1.2) {$+ \,4a \textcolor{blue}{c}$};
      \node[bas, opacity=\opac] at (6.5,{.8-\x/5}) {$ = 0 $};
    \end{tikzpicture}
  }
  \foreach \x[ evaluate=\x as \opac using (\x/10),] in {1,...,10,10,10,10,9,8,...,0}{
    \begin{tikzpicture}
      \basicstuff
      \node[bas] at (0,3) {$\textcolor{red}{ax^2} + \textcolor{green}{bx} + \textcolor{blue}{c}=0$};
      \node[bas] at (0,1) {$\textcolor{red}{ax^2} + \textcolor{green}{bx} + \textcolor{blue}{c}=0$};
      \node[bas] at (-0.2,0.88) {$( $}; %\hspace{4.4cm} \right) \hspace {1.cm}
      \node[bas] at (4.4,0.88) {$)$};
      \node[bas] at (-1.2,.88) {$4a\cdot$};
      \node[bas] at (6,.88) {$\cdot4a$};
      \node[bas] at (-0.9,-1.) {$4a \textcolor{red}{ax^2} $};
      \node[bas] at (1.5,-1.1) {$+ \,4a \textcolor{green}{bx}$};
      \node[bas] at (4.2,-1.2) {$+ \,4a \textcolor{blue}{c}$};
      \node[bas] at (6.5,-1.2) {$ = 0 $};
      %\node[bas, opacity=\opac] at  (-0.9,-1.) {$  4 \textcolor{red}{a^2x^2}$};
    \end{tikzpicture}
  }
\end{document}

对于第二个问题,你不能简单地使用类似下面的方法吗?

  \foreach \x[ evaluate=\x as \opac using (\x/10),] in {1,...,10}{
    \begin{tikzpicture}
      \basicstuff
      \node[bas] at (0,3) {$\textcolor{red}{ax^2} + \textcolor{green}{bx} + \textcolor{blue}{c}=0$};
      \node[bas] at (0,1) {$\textcolor{red}{ax^2} + \textcolor{green}{bx} + \textcolor{blue}{c}=0$};
      \node[bas] at (-0.2,0.88) {$( $}; %\hspace{4.4cm} \right) \hspace {1.cm}
      \node[bas] at (4.4,0.88) {$)$};
      \node[bas] at (-1.2,.88) {$4a\cdot$};
      \node[bas] at (6,.88) {$\cdot4a$};
      \node[bas, opacity={1-\opac}] at (-0.9,-1) {$4a \textcolor{red}{ax^2} $};
      \node[bas] at (1.5,-1.1) {$+ \,4a \textcolor{green}{bx}$};
      \node[bas] at (4.2,-1.2) {$+ \,4a \textcolor{blue}{c}$};
      \node[bas] at (6.5,-1.2) {$ = 0 $};
      \node[bas, opacity=\opac] at  (-0.9,-1) {$  4 \textcolor{red}{a^2x^2}$};
    \end{tikzpicture}
  }

动态图片

相关内容