내 문제는 ]-1,1[에 정의되어 있어서 도메인을 작성하는 방법을 모른다는 것입니다.
\def\Xmin{-1} \def\Xmax{1}
\def\Ymin{-2} \def\Ymax{2}
\def\Xunit{1cm} \def\Yunit{1cm}
\def\Xleg{\small \sffamily $x$} % légende en abscisse
\def\Yleg{\small \sffamily $y$} % légende en ordonnées
\begin{tikzpicture}[x=\Xunit,y=\Yunit]
\draw[>= latex,->,thick](\Xmin,0)--(\Xmax,0);
\draw[>= latex,->,thick](0,\Ymin)--(0,\Ymax);
\draw [domain=\Xmin:0,thick,red] plot (\x,{((1/2) (ln((1+\x)/(1-\x)))) });
\draw [domain=0:\Xmax,thick,red] plot (\x,{((1/2) (ln((1+\x)/(1-\x)))) });
\end{tikzpicture}
나는 이런 것을 얻고 싶다
답변1
다음을 사용하는 솔루션은 다음과 같습니다 pgfplots
.
\documentclass{standalone}
\usepackage{pgfplots}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
axis lines = middle,
xmin = -1.6,
xmax = 1.6,
> = Stealth
]
\addplot[
blue,
thick,
domain = -1:1,
samples = 1000
]
{0.5*ln((1+x)/(1-x))};
\addplot[
dashed,
mark = none
]
coordinates {(-1,-4) (-1,4)};
\addplot[
dashed,
mark = none
]
coordinates {(1,-4) (1,4)};
\addplot[
<->,
thick,
mark = none
]
coordinates {(-1.1,-1.1) (1.1,1.1)};
\end{axis}
\end{tikzpicture}
\end{document}
답변2
y = 1/2 * ln((x + 1) / (x - 1))
x가 1 또는 -1에 접근하면 함수는 무한대에 접근합니다. 게다가 이 기능은한정되지 않은x = 1 및 x = -1 모두에서. 따라서 이 함수는 작은 양수 값인 (-1 + delta, 1 - delta)
범위 에서만 플롯할 수 있습니다 . delta
그러므로,
- 플롯 도메인은 작은 양수가 있는
[-1 + \Xshift, 1 - \Xshift]
곳 으로 변경됩니다.\Xshift
- 도면 범위를 모방하기 위해 y 범위가 로 변경됩니다
[-3, 3]
.
\documentclass{article}
\usepackage{tikz}
\def\Xmin{-1} \def\Xmax{1}
\def\Ymin{-3} \def\Ymax{3}
\def\Xunit{1cm} \def\Yunit{1cm}
\def\Xleg{\small \sffamily $x$} % légende en abscisse
\def\Yleg{\small \sffamily $y$} % légende en ordonnées
\def\Xshift{0.005} % \Xshift is not a good name, :(
\begin{document}
\begin{tikzpicture}[x=\Xunit,y=\Yunit]
\draw[>= latex,->,thick] (\Xmin-.5, 0) -- (\Xmax+.5, 0);
\draw[>= latex,->,thick] (0, \Ymin) -- (0, \Ymax);
\draw [domain=\Xmin+\Xshift:\Xmax-\Xshift, samples=700, very thick, red]
plot (\x, {0.5*(ln((1+\x)/(1-\x)))});
\draw[dashed] (\Xmin, \Ymin) -- (\Xmin, \Ymax);
\draw[dashed] (\Xmax, \Ymin) -- (\Xmax, \Ymax);
\end{tikzpicture}
\end{document}
답변3
또 다른 pgfplots
해결책:
\documentclass[margin=3mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16,
x=1cm, y=1cm, % global defined image features, instead "\def"
ticklabel style={rounded corners=4pt, fill=white, inner xsep=1pt,
font=\small\sffamily},
xmin=-1.5,xmax=1.5,
ymin=-3.5,ymax=3.5,
set layers = axis on top,
}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
axis lines = middle,
xtick=\empty, extra x ticks={-1,0,1},
ytick=\empty,
xlabel = $x$,
ylabel = $y$,
samples at ={-1,-0.998,...,-0.5,-0.4,...,0.5,0.5002,0.5004,...,1}
]
\addplot [blue, very thick] {0.5*(ln((1+x)/(1-x)))};
%
\addplot [dashed] coordinates {(-1,-3.5) (-1,3.5) };
\addplot [dashed] coordinates {( 1,-3.5) ( 1,3.5) };
%
\draw[<->,semithick] (-1.5,-1.5) -- (1.5,1.5) node[above, pos=0.1, sloped] {$\Delta$};
\end{axis}
\end{tikzpicture}
\end{document}