我为我的微积分 1 学生画了这个,以便他们能够理解“La corde”的定义,基本上我想为以下图表制作动画:
\documentclass[tikz,border=50mm]{standalone}
\usepackage{pgfplots}
\usetikzlibrary{calc}
\usepackage{tikz-3dplot}
\usetikzlibrary{3d}
\usetikzlibrary{arrows.meta}
\usepackage{circuitikz}
\usetikzlibrary{decorations.pathmorphing,patterns, snakes}
\usetikzlibrary{arrows, shapes, positioning, calc, decorations.text, angles,
quotes}
\usetikzlibrary{decorations.markings}
\begin{tikzpicture}[>=stealth, scale=4.75]
\draw[smooth, ->] (0.8,0)--(4.5,0) node[above] {$x$};
\draw[smooth, ->] (1,-0.2)--(1,3.5) node[left] {$y$};
\begin{scope}[shift={(0,0)},scale=1.5]
\filldraw[red!30!white, opacity=0.7] (1.7,0)--(1.7,0.879)--(1.5,0.845)--(1.5,0)--cycle;
\draw[domain=1.1:2.1,blue, samples=900,scale=1,fill=white] plot(\x, {(1/7)*(\x-1)^3+(\x-
1)^2*ln(\x-1)+1});
\draw[domain=1.3:1.9,blue!30!black, samples=900, <->,scale=1] plot(\x, {0.846+0.1412*(\x-
1.6)});
\draw[dashed] (1.7,0)--(1.7,0.879) node[above, red] {$B'$};
\draw[dashed] (1.5,0)--(1.5,0.845) node[above, red] {$A'$};
\draw[magenta] (1.5,0.8445)--(1.7,0.874);
\node[magenta, rotate=0] at (1.6,0.9) {$[A'B']$};
\draw[dashed] (1.2,0)--(1.2,0.9367)--(0.665,0.9367)node[left, red] {$f(a)$};
\draw[dashed] (2,0)--(2,8/7)--(0.665,8/7)node[left, red] {$f(b)$};
\draw[dashed] (1.6,0)--(1.6,0.846)--(0.665,0.846)node[left=0.1cm, red] {$f(x_0)$};
\filldraw[red] (0.665,0.9367)circle(0.01);
\filldraw[red] (0.665,0.846)circle(0.01);
\filldraw[red] (0.665,8/7)circle(0.01);
\draw[thick, magenta] (2,8/7)--(1.2,0.9367) node[midway, above, rotate=30] {$[AB]$};
\node[red, above] at (2,8/7) {$B$};
\node[red, below] at (1.1,1.05) {$A$};
\filldraw[red] (1.6,0)circle(0.01) node[below] {$x_0$};
\filldraw[red] (1.2,0)circle(0.01) node[below] {$a$};
\filldraw[red] (2,0)circle(0.01) node[below] {$b$};
\filldraw[red] (1.6-0.1,0)circle(0.01) node[above=0.2cm, left] {$x_0-\varepsilon$};
\filldraw[red] (1.6+0.1,0)circle(0.01) node[above=0.2cm, right] {$x_0+\varepsilon$};
\end{scope}
\end{tikzpicture}
- 我如何通过改变参数来制作动画
\varepsilon
- 在哪里学习
animate
包(软件包文档还不够)
谢谢你:D!
编辑 : 在查看了有关动画人物的一些先前的帖子后,我尝试了以下操作:
\documentclass[tikz, border=12cm]{standalone}
\begin{document}
\foreach \i in {0,0.1,0.2,0.3,0.4}{
\begin{tikzpicture}[>=stealth, scale=5]
\draw[smooth, ->] (0.8,0)--(4.5,0) node[above] {$x$};
\draw[smooth, ->] (1,-0.2)--(1,3.5) node[left] {$y$};
\begin{scope}[shift={(0,0)},scale=1.5]
\filldraw[red!30!white, opacity=0.7] (1.6+\i,0)--(1.6+\i,{1/7*((\i+1.6)-1)^3+((\i+1.6)-1)^2*ln((\i+1.6)-1)+1})--((1.6-\i),{1/7*((1.6-\i)-1)^3+((1.6-\i)-1)^2*ln((1.6-\i)-1)+1})--(1.6-\i,0)--cycle;
\draw[domain=1.1:2.08,blue, samples=900,scale=1,fill=white] plot(\x, {(1/7)*(\x-1)^3+(\x-1)^2*ln(\x-1)+1});
\draw[domain=1.3:1.9,blue!30!black, samples=900, <->,scale=1] plot(\x, {0.846+0.1412*(\x-1.6)});
\draw[dashed] (1.6-\i,0)--(1.6-\i,{1/7*((1.6-\i)-1)^3+((1.6-\i)-1)^2*ln((1.6-\i)-1)+1})--(0.665,{1/7*((1.6-\i)-1)^3+((1.6-\i)-1)^2*ln((1.6-\i)-1)+1})node[left, red] {$f(a)$};
\draw[dashed] (1.6+\i,0)--(1.6+\i,{1/7*((\i+1.6)-1)^3+((\i+1.6)-1)^2*ln((\i+1.6)-1)+1})--(0.665,{1/7*((\i+1.6)-1)^3+((\i+1.6)-1)^2*ln((\i+1.6)-1)+1})node[left, red] {$f(b)$};
\draw[dashed] (1.6,0)--(1.6,0.846)--(0.665,0.846)node[left=0.1cm, red] {$f(x_0)$};
\filldraw[red] (0.665,{1/7*((\i+1.6)-1)^3+((\i+1.6)-1)^2*ln((\i+1.6)-1)+1})circle(0.01);
\filldraw[red] (0.665,0.846)circle(0.01);
\filldraw[red] (0.665,{1/7*((1.6-\i)-1)^3+((1.6-\i)-1)^2*ln((1.6-\i)-1)+1})circle(0.01);
\draw[thick, magenta] (1.6-\i,{1/7*((1.6-\i)-1)^3+((1.6-\i)-1)^2*ln((1.6-\i)-1)+1})--(1.6+\i,{1/7*((1.6+\i)-1)^3+((1.6+\i)-1)^2*ln((1.6+\i)-1)+1}) ;
\filldraw[red] (1.6,0)circle(0.01) node[below] {$x_0$};
\filldraw[red] (1.2,0)circle(0.01) node[below] {$a$};
\filldraw[red] (2,0)circle(0.01) node[below] {$b$};
\filldraw[red] (1.6-0.1,0)circle(0.01) node[above=0.2cm, left] {$x_0-\varepsilon$};
\filldraw[red] (1.6+0.1,0)circle(0.01) node[above=0.2cm, right] {$x_0+\varepsilon$};
\end{scope}
\end{tikzpicture}}
但是发生了一个错误,我无法修复它,因为修复这个错误的例子可以轻松地让我的人物动起来。
答案1
我发现了错误!所以基本上它是用红色填充绘图的命令,这里是代码和结果:
\documentclass[tikz, border=12cm]{standalone}
\begin{document}
\foreach \i in {0.05,0.1,0.15,0.2,0.25,0.3,0.35,0.375,0.4}{
\begin{tikzpicture}[>=stealth, scale=5]
\draw[smooth, ->] (0.8,0)--(4.5,0) node[above] {$x$};
\draw[smooth, ->] (1,-0.2)--(1,3.5) node[left] {$y$};
\begin{scope}[shift={(0,0)},scale=1.5]
\filldraw[red!30!white, opacity=0.7]
(1.6+\i, 0)--
(1.6+\i, {1/7*((\i+1.6)-1)^3+((\i+1.6)-1)^2*ln((\i+1.6)-1)+1})--
(1.6-\i, {1/7*((1.6-\i)-1)^3+((1.6-\i)-1)^2*ln((1.6-\i)-1)+1})--
(1.6-\i, 0)--cycle;
\draw[domain=1.1:2.08,blue, samples=900,scale=1,fill=white] plot(\x, {(1/7)*(\x-1)^3+(\x-1)^2*ln(\x-1)+1});
\draw[domain=1.3:1.9,blue!30!black, samples=900, <->,scale=1] plot(\x, {0.846+0.1412*(\x-1.6)});
\draw[dashed] (1.6-\i,0)--(1.6-\i,{1/7*((1.6-\i)-1)^3+((1.6-\i)-1)^2*ln((1.6-\i)-1)+1})--(0.665,{1/7*((1.6-\i)-1)^3+((1.6-\i)-1)^2*ln((1.6-\i)-1)+1})node[left, red] {$f(a)$};
\draw[dashed] (1.6+\i,0)--(1.6+\i,{1/7*((\i+1.6)-1)^3+((\i+1.6)-1)^2*ln((\i+1.6)-1)+1})--(0.665,{1/7*((\i+1.6)-1)^3+((\i+1.6)-1)^2*ln((\i+1.6)-1)+1})node[left, red] {$f(b)$};
\draw[dashed] (1.6,0)--(1.6,0.846)--(0.665,0.846)node[left=0.1cm, red] {$f(x_0)$};
\filldraw[red] (0.665,{1/7*((\i+1.6)-1)^3+((\i+1.6)-1)^2*ln((\i+1.6)-1)+1})circle(0.01);
\filldraw[red] (0.665,0.846)circle(0.01);
\filldraw[red] (0.665,{1/7*((1.6-\i)-1)^3+((1.6-\i)-1)^2*ln((1.6-\i)-1)+1})circle(0.01);
\draw[thick, magenta] (1.6-\i,{1/7*((1.6-\i)-1)^3+((1.6-\i)-1)^2*ln((1.6-\i)-1)+1})--(1.6+\i,{1/7*((1.6+\i)-1)^3+((1.6+\i)-1)^2*ln((1.6+\i)-1)+1}) ;
\filldraw[red] (1.6,0)circle(0.01) node[below] {$x_0$};
\filldraw[red] (1.6-\i,0)circle(0.01) node[below] {$a$};
\filldraw[red] (1.6+\i,0)circle(0.01) node[below] {$b$};
\end{scope}
\end{tikzpicture}}
\end{document}
它运行完美!