如何才能擦除到达无穷远的线(保持较短)并使用无穷大符号来表示这一点?(如果可能,请不要触碰其余的图和插入的数字。)
\documentclass{standalone}
\usepackage{expl3}
\ExplSyntaxOn
\int_zero_new:N \g__prg_map_int
\ExplSyntaxOff
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes,positioning}
\usepackage{pgfplots}
\usetikzlibrary{calc}
\begin{document}
\newcommand\ddfrac[2]{\frac{\displaystyle #1}{\displaystyle #2}}
\pagestyle{empty}
\centering
\begin{tikzpicture}[yscale=1,xscale=0.05]
\draw[thick,->,>=stealth] (-10,0) -- (45,0);
\draw[thick] (0,-2) -- (0,5);
\draw [smooth,very thick,domain=0.1:40,black] plot (\x,{((1*exp(-\x/10))/(1-1*exp(-\x/10)))+((0.00001*exp(-\x/10))/((1-1*exp(-\x/10))*(1-1*exp(-\x/10))))});
\end{tikzpicture}
\end{document}
答案1
编辑:看来我的解决方案与 @marmoth (+1) 的解决方案几乎相同。在上传我的解决方案时,我并没有意识到这一点。
我知道你正在寻找这样的东西:
使用\clip
功能:
\documentclass[margin=3mm]{standalone}
\usepackage{pgfplots}
\usetikzlibrary{arrows,
calc,
positioning,
shapes}
\begin{document}
\newcommand\ddfrac[2]{\frac{\displaystyle #1}{\displaystyle #2}}
\pagestyle{empty}
\centering
\begin{tikzpicture}[yscale=1, xscale=0.1]
\clip (-1,-1.75) rectangle (50,5);
\draw[-stealth] (-1,0) -- (45,0);
\draw[-stealth] (0,-1.75) -- (0,5);
\draw [domain=0.1:40, smooth,very thick] plot (\x,{((1*exp(-\x/10))/(1-1*exp(-\x/10)))+((0.00001*exp(-\x/10))/((1-1*exp(-\x/10))*(1-1*exp(-\x/10))))});
\draw [domain=0.1:40, samples=51,red] plot (\x,{((1*exp(-\x/10))/(1-1*exp(-\x/10)))+((0.00001*exp(-\x/10))/((1-1*exp(-\x/10))*(1-1*exp(-\x/10))))});
\node[below right] at (1,5.1) {$\uparrow\infty$};
\end{tikzpicture}
\end{document}
您在绘制图表选项中的选择smooth
是错误的。当您用选定的样本数替换它时,结果是正确的。例如用samples=51
。参见红色曲线。
答案2
我假设你不想使用它,pgfplots
即使你正在加载它。在这种情况下,你可以剪辑和相交。
\documentclass[tikz]{standalone}
\usetikzlibrary{positioning,intersections}
\begin{document}
\begin{tikzpicture}[yscale=1,xscale=0.1]
\draw[thick,->,>=stealth] (-10,0) -- (45,0);
\draw[thick] (0,-2) -- (0,5);
\begin{scope}
\clip[name path global=box] (-10,-2) rectangle (45,5);
\draw[smooth,very thick,domain=0.1:40,samples=101,black,name path global=curve]
plot (\x,{((1*exp(-\x/10))/(1-1*exp(-\x/10)))+((0.00001*exp(-\x/10))/((1-1*exp(-\x/10))*(1-1*exp(-\x/10))))});
\end{scope}
\draw[-stealth,very thick,name intersections={of=box and curve}]
([yshift=-0.1pt]intersection-1) -- ++(0,0.5) node[midway,right]{$\infty$};
\end{tikzpicture}
\end{document}
使用 pgfplots 会变得容易得多。
\documentclass[tikz]{standalone}
\usetikzlibrary{positioning,intersections}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\begin{document}
\begin{tikzpicture}
\begin{axis}[axis lines=middle,xtick=\empty,ytick=\empty,ymin=-2,ymax=5,
xmin=-2,xmax=45]
\addplot[domain=0.1:45,samples=101,smooth,name path global=curve,
very thick] {((1*exp(-x/10))/(1-1*exp(-x/10)))+((0.00001*exp(-x/10))/((1-1*exp(-x/10))*(1-1*exp(-x/10))))};
\path[name path global=top] (-2,4.99) -- (45,4.99);
\end{axis}
\draw[-stealth,very thick,name intersections={of=top and curve}]
([yshift=-0.1pt]intersection-1) -- ++(0,0.5) node[midway,right]{$\infty$};
\end{tikzpicture}
\end{document}
有趣的是,这些图并不相同,很可能是因为 pgfplots 的精度更高。Mathematica 似乎站在 pgfplots 一边。所以我增加了 Ti 中的样本钾Z 图片与此相匹配(但无论如何我觉得 pgfplots 更优雅)。