答案1
一些 PSTricks 解决方案仅用于娱乐目的!
\documentclass[pstricks,border=12pt,12pt]{standalone}
\usepackage{pst-plot,pst-eucl}
\def\f{(x-1)^2/5+1}
\def\L#1#2#3{\psCoordinates[linestyle=dashed](#1)\uput[-90](#1|0,0){$#2\mathstrut$}\uput[180](0,0|#1){$#3$}}
\begin{document}
\begin{pspicture}[algebraic,saveNodeCoors,NodeCoorPrefix=N](-2,-1)(7,5)
\psaxes[labels=none,ticks=none]{->}(0,0)(-1,-1)(6.5,4.5)[$x$,0][$y$,90]
\psplot[linecolor=red]{-1}{5}{\f}
\pstGeonode[PosAngle=90](*1 {\f}){P}(*3.5 {\f}){Q}
\psdot(Q|P)
\pcline[nodesep=-2](P)(Q)
\L{P}{x}{f(x)}
\L{Q}{x+\varepsilon}{f(x+\varepsilon)}
\pcline[linecolor=blue](P)(Q|P)\nbput{$\varepsilon$}
\pcline[linecolor=blue](Q)(!NQx NPy)\naput{$f(x+\varepsilon)-f(x)$}
\uput[-45]([nodesep=-1]{p}Q){secant}
\uput[0](*5 {\f}){\textcolor{red}{$y=f(x)$}}
\end{pspicture}
\end{document}
\documentclass[pstricks,border=12pt,12pt]{standalone}
\usepackage{pstricks-add,pst-eucl}
\def\f(#1){((#1+3)/3+sin(#1+3))}
\def\fp(#1){Derive(1,\f(#1))}
\psset{unit=2}
\begin{document}
\multido{\r=2.0+-.1}{19}{%
\begin{pspicture}[algebraic](-1.6,-.6)(4.4,3.4)
\psaxes[ticks=none,labels=none]{->}(0,0)(-1.6,-.6)(4.1,3.1)[$x$,0][$y$,90]
\psplot[linecolor=red,linewidth=2pt]{-1}{3.9}{\f(x)}
%
\psplotTangent[linecolor=blue]{1.6}{1}{\f(x)}
\psplotTangent[linecolor=cyan,Derive={-1/\fp(x)}]{1.6}{.5}{\f(x)}
%
\pstGeonode[PosAngle={135,90}]
(*1.6 {\f(x)}){A}
(*{1.6 \r\space add} {\f(x)}){B}
\pstGeonode[PosAngle={-120,-60},PointName={x_1,x_2},PointNameSep=8pt]
(A|0,0){x1}
(B|0,0){x2}
\pstGeonode[PosAngle={210,150},PointName={f(x_1),f(x_2)},PointNameSep=20pt]
(0,0|A){fx1}
(0,0|B){fx2}
\pcline[nodesep=-.5,linecolor=green](A)(B)
%
\psset{linestyle=dashed}
\psCoordinates(A)
\psCoordinates(B)
%
\psset{linecolor=gray,linestyle=dashed,labelsep=4pt,arrows=|*-|*,offset=-16pt}
\pcline(x1)(x2)
\nbput{$x_2-x_1$}
\pcline(fx2)(fx1)
\nbput{$f(x_2)-f(x_1)$}
\end{pspicture}}
\end{document}
答案2
我推荐 Ti钾Z 就是这个。(我以前很喜欢 pstricks,还有普斯特里克溶液真的很棒,我投了赞成票,但是看到 Ti钾Z 可以做到我不能再推荐 pstricks,抱歉。)
\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{intersections}
\begin{document}
\begin{tikzpicture}[declare function={f(\x)=0.3*(\x-3.5)^3-\x+7;a=1;b=6;c=4.94;}]
\draw[-stealth] (-0.5,0) -- (6.5,0);
\draw[-stealth] (0,-0.5) -- (0,6.5);
\draw[blue] plot[smooth,domain=0.5:6.1] ({\x},{f(\x)});
\foreach \X in {a,b}
{\draw[dashed] (\X,0) node[below]{$\X$} |- (0,{f(\X)}) node[left] {$f(\X)$};}
\draw ({a},{f(a)}) -- ({b},{f(b)});
\draw[dashed] (c,0) -- (c,{f(c)});
\draw[dashed,name path=hori] (a,{f(a)}) -- (b,{f(a)});
\pgfmathsetmacro{\slopeangle}{atan2(f(b)-f(a),b-a)}
\draw[red,name path=sloped] (c,{f(c)}) +(\slopeangle:2) -- ++ (\slopeangle+180:4);
\draw ({a},{f(a)}) + (1,0) arc(0:\slopeangle:1) node[midway,right]{$\beta$};
\draw[name intersections={of=hori and sloped,by=i}] (i) +(1,0)
arc(0:\slopeangle:1) node[midway,right]{$\beta$};
\end{tikzpicture}
\end{document}
答案3
为了完整性,添加 MetaPost 解决方案。这就是我们在为学生撰写的文本中所做的。由于我不喜欢在图中放置太多标签,所以我宁愿在文本中解释“虚线是平行的,因此...”
正如所写,人们可以context
在该文件上运行,但人们可以轻松地将其采用为普通的 MetaPost。
\startMPpage
%Set unit
u=1cm;
%Introduce paths
path p,xax,yax;
% Draw axes
xax = ((-0.5,0)--(7.5,0));
yax = ((0,-0.5)--(0,4));
drawarrow xax scaled u;
drawarrow yax scaled u;
%Define your path p
z0 = (1.5u,u);
z1 = (3u,3u);
z2 = (5u,3u);
z3 = (6.5u,2u);
p = z0{dir 80}..z1..{dir 0}z2..{dir -10}z3;
%Find the right "time" and tangent point (calculated by MetaPost)
t = directiontime (z3-z0) of p;
z4 = point t of p;
%Draw path, secant and tangent
draw p;
draw z0--z3 dashed evenly;
draw (z0--z3) shifted (z4-0.5[z0,z3]) dashed evenly;
label.bot(textext("$(a,f(a))$"), z0);
label.lrt(textext("$(b,f(b))$"), z3);
label.ulft(textext("$(\xi,f(\xi))$"), z4);
\stopMPpage
结果如下:
答案4
还有一些更有趣的东西pstricks
,它有一个\psPlotTangent
命令:
\documentclass[svgnames, x11names, border = 5pt]{standalone}%
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{auto-pst-pdf}%
\usepackage{pstricks-add}%,
\def\F{x^3-6*x^2 + 9*x + 1}
\begin{document}
\psset{unit=2cm, arrowinset=0.12, algebraic, plotstyle=curve, plotpoints=200, dimen=inner}
\everypsbox{\footnotesize}
\begin{pspicture*}(-1,-1)(6,5.5)
\psaxes[linecolor = LightSteelBlue, ticks=none, labels=none]{->}(0,0)(-2,-1.2)(5,5.5)[$x$,-135][$y$,-135]
\psplot[linecolor = IndianRed, linewidth =1.2pt]{0.05}{4}{\F}
\psset{linestyle=dashed, linewidth=0.3pt}
\psCoordinates(*0.5 {\F})\uput[d](0.5,0){$a$}\uput[l](0,4.125){$f(a)$)}
\psCoordinates(*3.5 {\F})\uput[d](3.5,0){$b$}\uput[l](0,1.875){$f(b)$)}
\psline[linecolor=Gold, linewidth=0.6pt] (0.5, 4.125)(3.5,1.875)
\psline(1.134,0)(1.134, 4.949)(3.134, 4.949)\uput[d](1.134,0){$c$}
\psline(2.866, 0)(2.866, 1.051)(4.866,1.051)\uput[d](2.866,0){$c_1$}
\psset{linestyle=solid, labelsep=24pt}
\foreach \x in {1.134, 2.866}{\psplotTangent[algebraic, linewidth=0.6pt, Derive={3*x^2-12*x + 9}, linecolor=Gold, showpoints]{\x}{1.5}{\F}}
\psarc(3.5, 1.875){0.4}{143}{180}\uput[161](3.5, 1.875){$\beta$}
\psarcn(1.134, 4.949){0.4}{0}{-37}\uput[-18](1.134, 4.949){$\beta$}
\psarcn(2.866, 1.051){0.4}{0}{-37}\uput[-18](2.866, 1.051){$\beta$}
\rput(5,1.5){$\boxed{\tan\beta = \dfrac{f(b)-f(a)}{b-a} = f'(c)}$}
\end{pspicture*}
\end{document}