
나는 tikz 그림을 가지고 있으며 다음 형식의 곡선을 포함하고 싶었습니다.
1/(x^2+1)
[1,4]와 같은 양의 영역에 대한 함수를 그릴 수 있습니다.
\draw[domain=1:4,smooth,variable=\x] plot ({\x},{1/(\x^2+1)});
[-4,4]의 함수를 플롯하고 싶습니다.
답변1
해결책은 다음 \x^2
으로 교체하는 것입니다.\x*\x
다음과 같이 보일 것입니다:
\begin{tikzpicture}
\fill[pattern=north west lines,opacity=.3] (-4,-1.11803*3) -- plot [domain=-4:4] ({\x},{-3/(\x*\x+2)-1.11803*3}) -- (4,-1.11803*3) -- cycle;
\draw[<-] (1.5,{-3/(1.5*1.5+2)-1.11803*3}) -- (2,-4.5) node[right] {$U(x)$};
\draw[<-] (-1.5,-3.6) -- (-2,-4.5) node[left] {$\displaystyle\int_{-\infty}^{\infty}\!\!\!\!\mbox{d}x \:U(x)$};
\draw[red,thick,domain=-4:4,smooth,samples=200,variable=\x] plot ({\x},{-3/(\x*\x+2)-1.11803*3});
\draw[red,dotted,thick,domain=-4:-5,smooth,samples=200,variable=\x] plot ({\x},{-3/(\x*\x+2)-1.11803*3});
\draw[red,dotted,thick,domain=4:5,smooth,samples=200,variable=\x] plot ({\x},{-3/(\x*\x+2)-1.11803*3});
\draw (0,0) circle (1.5cm);
\draw[->] (0,0) -- (0,-1.5) node[midway,left] {$R$};
\draw[->] (0,0) -- (1,-1.11803) node[midway,right] {$R$};
\draw[<->] (1,-1.11803) -- (1*3,-1.11803*3) node[midway,right] {$R$};
\draw[<->] (0,-1.5) -- (0,-1.11803*3) node[midway,right] {$z$};
\draw[-latex] (-5,-1.11803*3) -- (5,-1.11803*3);
\draw[|->|] (0,-1.11803*3-0.2) -- (3,-1.11803*3 -0.2) node[midway,below] {$x$};
\end{tikzpicture}
결과는 다음과 같습니다: