我不知道如何制作循环以及如何找到特定点的切线。请帮忙。以下代码片段是我用于拉格朗日 MVT 的代码片段,我相信它可以用作 MWE:
\documentclass{article}
\usepackage{tikz}
\usepackage{pgf}
\usepackage{pgfplots}
\pgfplotsset{compat=1.17}
\usetikzlibrary{hobby}
\usetikzlibrary{decorations.pathreplacing, calligraphy}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{patterns}
\usetikzlibrary{shapes.geometric}
\usepackage{xcolor}
\begin{document}
\begin{tikzpicture}[xscale=3, yscale=2, >=stealth, declare function={f(\x)=\x*\x*\x+0.5; a=sqrt(0.37); g(\x)=f(a)+1.11*(\x-a); h(\x)=f(0)+1.11*(\x-0.1);}]
\draw (0,0) -- (1.1,0);
\draw [smooth, blue, domain=0.1:1, samples=10] plot(\x,{f(\x)});
\draw [densely dashed, red, thick] (0,{h(0)}) -- (1.1,{h(1.1)});
\draw [densely dashed] (0.1,0) node[below] {\scriptsize$ a $} -- (0.1,{f(0.1)});
\draw [pen colour={white}, decorate, decoration={calligraphic brace, raise=1pt, amplitude=5pt}] (0.1,0) -- (0.1,{f(0.1)}) node[midway, left=5pt] {\scriptsize$ f(a) $};
\draw [densely dashed] (1,0) node[below] {\scriptsize$ b $} -- (1,{f(1)});
\draw [pen colour={white}, decorate, decoration={calligraphic brace, mirror, raise=1pt, amplitude=5pt}] (1,0) -- (1,{f(1)}) node[midway, right=5pt] {\scriptsize$ f(b) $};
\draw [yellow, domain=0.3:0.95, samples=2] plot(\x,{g(\x)});
\draw [yellow, densely dashed] (a,0) node[below] {\scriptsize$ \xi $} -- (a,{f(a)}) node[fill, circle, inner sep=1pt] {};
\end{tikzpicture}
\end{document}
我实际上是在黑色背景下做讲义的beamer
。请原谅 MWE 中的颜色选择。
答案1
经过深思熟虑,并得到了谢布·格拉夫,我终于找到了一个参数化曲线,其图形正是我想要的,如图所示。我使用外螺旋的部分作为参数的正值和负值,并旋转它以获得我想要的方向。我在这里将我的发现作为答案发布。如果有人想编辑问题以使其更易于搜索或答案使其更精确和简洁,请随时这样做。
\documentclass{article}
\usepackage{tikz}
\usepackage{pgf}
\usepackage{pgfplots}
\pgfplotsset{compat=1.17}
\usetikzlibrary{hobby}
\usetikzlibrary{decorations.pathreplacing, calligraphy}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{patterns}
\usetikzlibrary{shapes.geometric}
\usepackage{xcolor}
\begin{document}
\begin{figure}
\pgfarrowsdeclaredouble{<<s}{>>s}{stealth}{stealth}
\begin{tikzpicture}[rotate=-60, declare function={a=3.5; b=-a; m=0; f(\x)=\x*(sin (\x r)); g(\x)=\x*(cos(\x r));}]
\draw [decoration={markings, mark=at position 0.5 with {\arrow{>>}}}, postaction={decorate}] (0,-2) -- (0,2);
\draw [rotate=60] ({f(-a)-3},-2.5) -- ({f(b)+5},-2.5);
\draw [smooth, domain=a:-a, samples=50, decoration={markings, mark=at position 0.15 with {\arrow{>}}, mark=at position 0.85 with {\arrow{>}}}, postaction={decorate}] plot({f(\x)},{g(\x)});
\draw [densely dashed, red, thick, decoration={markings, mark=at position 0.5 with {\arrow{>>}}}, postaction={decorate}] ({f(a)},{g(a)-0.5}) -- ({f(b)},{g(b)+0.5});
\draw ({f(a)},{g(a)}) node[above left] {\scriptsize$ (f(a),g(a)) $};
\draw ({f(b)},{g(b)}) node[above left] {\scriptsize$ (f(b),g(b)) $};
\draw (0,0) node[above=-1pt, rotate=30] {\scriptsize$ \frac{g'(\xi)}{f'(\xi)}=\frac{g(b)-g(a)}{f(b)-f(a)} $};
\end{tikzpicture}
\caption{Cauchy's MVT}
\end{figure}
\end{document}
答案2
我离开了几天,但我有这个:
\documentclass[border=3.14159mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}
\begin{document}
\begin{tikzpicture}[x=0.7cm,y=1cm]
\tikzset{arrowsoncurve/.style={
decoration={markings,
mark=at position 0.15 with {\arrow{>}},
mark=at position 0.85 with {\arrow{>}}},
postaction={decorate}}}
\draw[line width=1pt,->] (-10,0) -- (10,0);
\draw[line width=1pt,->] (0,-5) -- (0,5);
\draw[line width=1pt,blue,arrowsoncurve] plot[samples=100,domain=-2.815:2.22,smooth,variable=\t] ({\t*\t*\t-4*\t+4},{\t*\t+\t-3.12});
\draw[line width=1pt,red] plot[samples=100,domain=-10:10,smooth] (\x,0.154*\x+3.08);
\draw[line width=1pt,red] plot[samples=100,domain=-2:10,smooth] (\x,0.154*\x-4.33);
\coordinate (A) at (-7,2);
\node [above left] at (A) {$A\left(f(a)\,,\,g(a)\right)$};
\coordinate (B) at (6,4);
\node [above left] at (B) {$B\left(f(b)\,,\,g(b)\right)$};
\coordinate (M) at (6.4,-3.35);
\node [below right] at (M) {$t \in \,]a\,,\,b[$};
\path (A) -- (B) node[red,pos=0.3,above,sloped] {slope $= \frac{g(b)-g(a)}{f(b)-f(a)}$};
\path (0,-4.33) -- (M) node[red,pos=0.4,below,sloped] {slope $= \frac{g(b)-g(a)}{f(b)-f(a)}$};
\foreach \p in {A,B,M} \fill (\p) circle (2pt);
\end{tikzpicture}
\end{document}