我想在 TeX 中绘制以下内容,但是我对 tikz 还很陌生,因此我不知道。
我想给出函数的定义域和值域的几何解释。也就是说,在 上定义的函数的每个元素在 x'x 轴上都有一个图像,并且在该特定 x 上求值的每个元素在 y'y 上都有一个图像。
我该怎么做?我还想有一些箭头指示整个过程。
问题:为什么我不能在这里用 LaTeX 写数学符号?
(来源:电子书)
编辑:我想在 Tikz 中绘制前两张图片,而不是第三张图片!希望这能有所帮助。
提前谢谢您。如能得到任何帮助,我将不胜感激。
答案1
虽然不是最优雅的代码,需要一些反复试验和代码重复,但它可以完成工作。
\documentclass[tikz,border=10pt]{standalone}
\usetikzlibrary{intersections,backgrounds}
\begin{document}
\begin{tikzpicture}
\draw [thick,-stealth] (-0.5,0) --node[below]{$A$} (4,0) node[below]{$x$};
\draw [thick,-stealth] (0,-0.5) -- (0,3) node[left]{$y$};
\node [below left] at (0,0) {$0$};
\draw [ultra thick, red] (0.5,0) -- (3.5,0);
\coordinate (start) at (0.499,0.7);
\coordinate (stop) at (3.501,2.5);
\fill (start) circle[radius=2pt];
\fill (stop) circle[radius=2pt];
\draw [name path=curve] (start) to[out=-35,in=190] node[pos=0.6,above left] {$C_f$} (stop);
\foreach \x in {0.5,1,...,3.5}
{
\path [name path=line] (\x,0) -- (\x,3);
\draw [name intersections={of=curve and line},dashed,-stealth]
(intersection-1) -- (\x,0);
}
\begin{scope}[xshift=6cm]
\draw [thick,-stealth] (-0.5,0) -- (4,0) node[below]{$x$};
\draw [thick,-stealth] (0,-0.5) --node[left]{$f(A)$} (0,3) node[left]{$y$};
\node [below left] at (0,0) {$0$};
\draw [ultra thick, red] (0,0.52) -- (0,2.5);
\coordinate (start) at (0.499,0.7);
\coordinate (stop) at (3.501,2.5);
\fill (start) circle[radius=2pt];
\fill (stop) circle[radius=2pt];
\draw [name path=curve] (start) to[out=-40,in=190] node[pos=0.6,below right] {$C_f$} (stop);
\foreach \y in {0.52,.916,...,2.5}
{
\path [name path=line] (0,\y) -- (4,\y);
\draw [name intersections={of=curve and line},dashed,-stealth]
(intersection-1) -- (0,\y);
}
\end{scope}
\end{tikzpicture}
\end{document}
答案2
\documentclass[tikz,border=5]{standalone}
\usetikzlibrary{positioning,calc}
\begin{document}
\begin{tikzpicture}
\coordinate (O) at (0,0);
\draw[-latex] (-1,0) node[below right = 0mm and 5mm] {$O$} --
node[pos=0.55,below]{$A$} (10,0)node[pos=0.99,below] {$x$};
\draw[-latex] (0,-1) -- node[pos=0.99,left] {$y$}(0,8);
\node[fill,circle,inner sep=2pt] (a) at (2,3) {};
\node[fill,circle,inner sep=2pt] (b) at (8,6) {};
\foreach \x [count=\y]in {0,0.05,...,1.05}{
\draw (a.center) to [out=-45, in=180]node[pos=\x] (\y){}
node[pos=0.5,above=1mm]{$C_{f}$} (b.center)
;
\draw[dashed,-latex] (\y) -- (\y|-O);
\draw[very thick,red] (a|-O) -- (b|-O);
}
\node at (5,-1) {($\alpha$)};
\begin{scope}[xshift=12cm]
\coordinate (O) at (0,0);
\draw[-latex] (-1,0) node[below right = 0mm and 5mm] {$O$} --
(10,0)node[pos=0.99,below] {$x$};
\draw[-latex] (0,-1) -- node[pos=0.55,left]{$f(A)$} node[pos=0.99,left] {$y$}(0,8);
\node[fill,circle,inner sep=2pt] (a) at (2,3) {};
\node[fill,circle,inner sep=2pt] (b) at (8,6) {};
\foreach \x [count=\y]in {0,0.1,...,1.05}{
\draw (a.center) to [out=-45, in=180]node[pos=\x] (\y){}
node[pos=0.5,below=1mm]{$C_{f}$} (b.center);
\draw[dashed,-latex] (\y) -- (\y-|O);
\draw[very thick,red] (4-|O) -- (b-|O);
}
\node at (5,-1) {($\beta$)};
\end{scope}
\end{tikzpicture}
\end{document}
答案3
\documentclass[pstricks,border=20pt,12pt]{standalone}
\usepackage{pst-plot,pst-node}
\psset
{
algebraic,
ticks=none,
labels=none,
xAxisLabel=$x$,
yAxisLabel=$y$,
saveNodeCoors,
}
\def\f{-2*sin(3*x/4-1/4)+2.5}
\begin{document}
% a
\begin{psgraph}{->}(0,0)(-.5,-.5)(7,5){10cm}{!}
\psplot[arrows=*-*]{1}{6}{\f}
\uput[-135](0,0){$O$}
\uput[-90](3.5,0){$A$}
\fnpnodes[plotpoints=10]{1}{6}{\f}{P}
\multido{\i=0+1}{\numexpr\Pnodecount+1}{\psline[linestyle=dashed]{<-}(P\i|0,0)(P\i)}
\uput[180](P6){$C_f$}
\psline[linecolor=red,linewidth=2\pslinewidth](P0|0,0)(P\Pnodecount|0,0)
\end{psgraph}
% b
\begin{psgraph}{->}(0,0)(-.5,-.5)(7,5){10cm}{!}
\psplot[arrows=*-*]{1}{6}{\f}
\uput[-135](0,0){$O$}
\uput[180](0,2.5){$f(A)$}
\fnpnodes[plotpoints=12]{1}{6}{\f}{P}
\multido{\i=0+1}{\numexpr\Pnodecount+1}{\psline[linestyle=dashed]{->}(P\i)(0,0|P\i)}
\uput[0](P6){$C_f$}
\psline[linecolor=red,linewidth=2\pslinewidth](0,0|P3)(0,0|P\Pnodecount)
\end{psgraph}
% c
\begin{psgraph}{->}(0,0)(-.5,-.5)(7,5){10cm}{!}
\psplot[arrows=*-*]{1}{6}{\f}
\uput[-135](0,0){$O$}
\pnode(*4 {\f}){A}
\psxTick(N-A.x){x_0}
\psyTick(N-A.y){f(x_0)}
\psCoordinates[linestyle=dashed](A)
\uput[0](A){$A(x_0,f(x_0))$}
\pcline[linestyle=dashed](A)(A|*5 {\f})\ncput[npos=1.2]{$x=x_0$}
\end{psgraph}
\end{document}