
나는 부등식에 대한 두 가지 그래픽 솔루션(및 이에 대한 대수적 솔루션)을 가지고 있습니다. 한 가지 해는 수직선에 표시되고, 다른 해는 데카르트 평면에 표시됩니다. 수직선과 데카르트 평면의 x축을 수직으로 정렬하고 싶습니다.
불평등은
\begin{방정식*} \frac{6}{x - 5} \geq x \end{방정식*}
그리고 솔루션 세트는 $(-\infty,-1) \cup (5,6]$입니다. 따라서 첫 번째 그래프에서 , , 및 왼쪽에 굵은 선을 그은 눈금 표시와 레이블 -1
이 5
필요 6
합니다 -1
. 5
사이 에 다음 명령을 사용했습니다 6
.TikZ
\draw[line width=2pt, -latex] ($(-1,0) +(-3pt,0pt)$) -- (-2.9,0);
\draw[fill] (-1,0) circle (3pt);
\draw (5,0) circle (3pt);
\draw[fill] (6,0) circle (3pt);
\draw[line width=2pt] ($(5,0) +(3pt,0pt)$) -- ($(6,0) +(-3pt,0pt)$);
적절한 명령이 무엇인지 잘 모르겠습니다 pgfplots
.
수직선의 코드가 컴파일되지 않습니다. 나는 숫자 줄에 대한 대부분의 명령 앞에 주석 줄을 넣었습니다.
그런데 점을 검은색 원이나 파란색 원으로 표시해 (-1,-1)
드리고 싶습니다. (6,6)
왜 파란색 마름모로 표시된 지점 과 빨간색 원으로 표시된 (-1,-1)
지점이 있나요?(6,6)
\documentclass{amsart}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{tikz}
\usetikzlibrary{calc,positioning,intersections}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}
\begin{document}
\noindent {\textbf{1.) }}Determine the solution set to
\begin{equation*}
\frac{6}{x - 5} \geq x .
\end{equation*}
Graph the solution set on the real number line.
\vskip0.2in
\noindent {\bf Solution} \vskip1.25mm
\noindent $q(x) = 6/(x - 5)$ is a rational function defined on ${\mathbb{R}}\setminus\{5\}$. On the interval $(5, \, \infty)$, $q(x) \geq x$ if, and only if,
\begin{equation*}
(x - 6)(x + 1) = x^{2} - 5x - 6 \leq 0 ,
\end{equation*}
or equivalently, $5 < x \leq 6$. Likewise, on the interval $(-\infty, \, 5)$, $q(x) \geq x$ if, and only if, $x \leq -1$. \rule{1.5ex}{1.5ex}
\vskip0.2in
\noindent \hspace*{\fill}
\begin{tikzpicture}
\begin{axis}[name=plot1, %height=0.5in, width=5in, clip=false,
% xmin=-10,xmax=16,
% xlabel=$x$,
% axis line style={latex-latex},
% xtick={},
% extra x ticks={-1,5,6},
% extra x tick labels={$-1$,5,6},
% extra x tick style={xticklabel style={below}},
% xlabel style={at={(ticklabel* cs:1)},anchor=north west}
]
\end{axis}
\begin{axis}[name=plot2, at={($(plot1.south)+(0,-0.75cm)$)}, anchor=north, height=5in, width=5in,
axis lines=middle, clip=false,
xmin=-10,xmax=16,
ymin=-10,ymax=16,
restrict y to domain=-10:16,
xtick={\empty},ytick={\empty},
ticklabel style={font=\tiny,fill=white},
extra x ticks={-1,6},
extra x tick labels={$-1$,6},
axis line style={latex-latex},
xlabel=$x$,ylabel=$y$,
enlargelimits={abs=0.25cm},
xlabel style={at={(ticklabel* cs:1)},anchor=north west},
ylabel style={at={(ticklabel* cs:1)},anchor=south west}
]
\addplot[samples=501,domain=-10:4.4, blue] {6/(x - 5)};
\addplot[samples=501,domain=5.4:16, blue] {6/(x - 5)} node[above,pos=0.9,font=\footnotesize]{$y=\dfrac{6}{x-5}$};
\addplot[latex-latex, samples=2, domain=-10:15] {x} node[anchor=west, pos=1, font=\footnotesize]{$y=x$};
\addplot[dashed, latex-latex, samples=2, domain=-10:16] (5,x) node [pos=0.05, anchor=north, font=\footnotesize, sloped] {$x=5$};
\addplot coordinates{(-1,-1)};
\addplot coordinates{(6,6)} node[anchor=west,font=\footnotesize]{$(6,6)$};
\end{axis}
\end{tikzpicture}
\end{document}
답변1
PGFplots를 사용하면 Ti의 모든 일반적인 기능을 사용할 수 있습니다.케이{axis}
해당 환경 내에서 Z. 노드를 위치시키는 axis cs
것을 통해 좌표계에 접근할 수 있습니다.\node at (axis cs: 3, 4) {};
엑스-와이좌표 (3, 4)
. 버전 1.11에서는 axis cs
Ti가 사용하는 기본 좌표계가 되었습니다.케이Z는 {axis}
환경 내에서 사용되므로 매번 지정할 필요가 없고 axis cs
대신 \node at (3, 4) {};
.
나는 당신이 원하는 (내 생각에) 그리는 두 가지 매우 유사한 방법을 아래에 제공합니다. 둘 다 두 개의 관련 곡선( x
및 6 / (5 - x)
)을 플롯하지만 첫 번째 곡선도엑스-축을 수직선으로 지정하고 두 번째 축은 플롯 위에 수직선을 배치합니다.
버전 1: 올인원
이 솔루션은 한 세트의 축을 사용하여 부등식에 대한 적절한 방정식을 표시하고 부등식이 적용되는 수직선 부분에 레이블을 지정합니다.
\documentclass{amsart}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amsthm}
\usepackage{thmtools}
\declaretheoremstyle[
headfont=\normalfont\bfseries,
numbered=unless unique,
bodyfont=\normalfont,
spaceabove=1em plus 0.75em minus 0.25em,
spacebelow=1em plus 0.75em minus 0.25em,
qed={\rule{1.5ex}{1.5ex}},
]{solstyle}
\declaretheorem[
style=solstyle,
title=Solution,
refname={solution,solutions},
Refname={Solution,Solutions}
]{solution}
\usepackage{enumitem}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.13}
\begin{document}
\begin{enumerate}[label=\bfseries\arabic*)]
\item Determine the solution set to
\begin{equation*}
\frac{6}{x - 5} \geq x .
\end{equation*}
Graph the solution set on the real number line.
\begin{solution}
We first observe that there is a singularity at \(x = 5\) as we consider the
region above and below \(5\) separately:
\begin{description}
\item[\(\boldsymbol{x > 5}\)] Over this interval, the denominator is always
greater than zero. As a result, multiplying both sides by \(x-5\) we
obtain:
\begin{align*}
& 6 \geq x^{2} - 5x \\
\Leftrightarrow & 0 \geq x^{2} - 5x - 6 = (x-6)(x+1)
\end{align*}
Over the given domain, \(x+1\) is always positive; therefore, we must have
that \(x-6 \leq 0\) and conclude that the inequality is satisfied only for
\(5 < x \leq 6\).
\item[\(\boldsymbol{x < 5}\)] Over this internal, the denominator is always
less than zero. As a result, multiplying both sides by \(x-5\) flips the
inequality and we obtain:
\begin{align*}
& 6 \leq x^{2} - 5x \\
\Leftrightarrow & 0 \leq x^{2} - 5x - 6 = (x-6)(x+1)
\end{align*}
Over the given domain, \(x-6\) is always negative; therefore, we must have
that \(x+1 \leq 0\) and conclude that the inequality is satisfied only for
\(x \leq -1\).
\end{description}
The two relevant curves for this inequality are plotted below with the
appropriate domain marked in red along the \(x\)-axis:
\begin{center}
\begin{tikzpicture}
\begin{axis}[
width=\linewidth,
height=0.7\linewidth,
axis lines=middle,
xlabel=\(x\),
ylabel=\(y\),
xlabel style={at={(ticklabel* cs:1)},anchor=west},
ylabel style={at={(ticklabel* cs:1)},anchor=south},
clip=false,
domain=-5:10,
samples=501,
restrict y to domain=-10:16,
clip=false,
]
\addplot [blue] {6/(x - 5)}
node [above, pos=0.95, font=\footnotesize] {\(y=\dfrac{6}{x-5}\)};
\addplot [latex-latex] {x}
node[anchor=west, pos=1, font=\footnotesize]{\(y=x\)};
\draw [dashed, latex-latex]
(5,\pgfkeysvalueof{/pgfplots/ymin}) -- (5, \pgfkeysvalueof{/pgfplots/ymax})
node [pos=0.05, below, sloped, font=\footnotesize] {\(x=5\)};
\fill [blue] (-1, -1) circle [radius=2pt]
node [anchor=north, font=\footnotesize] {\((-1, -1)\)};
\fill [blue] (6, 6) circle [radius=2pt]
node [anchor=west, font=\footnotesize] {\((6, 6)\)};
\draw [-latex, red, very thick] (-1, 0) -- (\pgfkeysvalueof{/pgfplots/xmin}, 0);
\draw [red, very thick] (5, 0) -- (6, 0);
\fill [black] (-1, 0) circle [radius=2pt];
\draw [draw=black, fill=white] (5, 0) circle [radius=2pt];
\fill [black] (6, 0) circle [radius=2pt];
\end{axis}
\end{tikzpicture}
\end{center}
\end{solution}
\end{enumerate}
\end{document}
버전 2: 상단에 수직선
원래 질문에서 의도한 대로 수직선을 축과 분리하려면 기본적으로 모든 것이 가능합니다.
\begin{center}
\begin{tikzpicture}
\begin{axis}[
name=plot1,
width=\linewidth,
height=11em,
axis x line=middle,
axis y line=none,
clip=false,
domain=-5:10,
axis line style={latex-latex},
]
\addplot [draw=none] {0};
\draw [-latex, red, very thick] (-1, 0) -- (\pgfkeysvalueof{/pgfplots/xmin}, 0);
\draw [red, very thick] (5, 0) -- (6, 0)
node [above, pos=0] {\(5\)}
node [above, pos=1] {\(6\)};
\fill [black] (-1, 0) circle [radius=2pt]
node [red, above] {\(-1\)};
\draw [draw=black, fill=white] (5, 0) circle [radius=2pt];
\fill [black] (6, 0) circle [radius=2pt];
\end{axis}
\begin{axis}[
at=(plot1.south),
anchor=north,
width=\linewidth,
height=0.7\linewidth,
axis lines=middle,
xlabel=\(x\),
ylabel=\(y\),
xlabel style={at={(ticklabel* cs:1)},anchor=west},
ylabel style={at={(ticklabel* cs:1)},anchor=south},
clip=false,
domain=-5:10,
samples=501,
restrict y to domain=-10:16,
clip=false,
]
\addplot [blue] {6/(x - 5)}
node [above, pos=0.95, font=\footnotesize] {\(y=\dfrac{6}{x-5}\)};
\addplot [latex-latex] {x}
node[anchor=west, pos=1, font=\footnotesize]{\(y=x\)};
\draw [dashed, latex-latex]
(5,\pgfkeysvalueof{/pgfplots/ymin}) -- (5, \pgfkeysvalueof{/pgfplots/ymax})
node [pos=0.05, below, sloped, font=\footnotesize] {\(x=5\)};
\fill [blue] (-1, -1) circle [radius=2pt]
node [anchor=north, font=\footnotesize] {\((-1, -1)\)};
\fill [blue] (6, 6) circle [radius=2pt]
node [anchor=west, font=\footnotesize] {\((6, 6)\)};
\end{axis}
\end{tikzpicture}
\end{center}
추가 메모
먼저, 귀하의 예제를 자유롭게 정리하고 와 같은 환경을 활용하여 enumerate
자동 으로 서식을 처리할 수 있는 환경을 description
만들었습니다 . 일을 하고 있기 는 solution
하지만 실제로 LaTeX를 사용하는 가장 좋은 방법은 아닙니다. 당신은 당신이 무엇을 작성해야합니다\texbf{1) }
\vskip1em
평균하고 싶은 말을 쓰는 것보다보다. 즉, 대신에 \textbf{1) }
열거 \textbf{2) }
된 목록이 있습니다. 대신 환경이 \textbf{Solution: } ... \rule{1.5ex}{1.5ex}
있습니다 {solution}
.
당신이 쓴 것을 쓰는 것의 장점평균솔루션의 모양을 변경하려는 경우 전체 문서를 살펴보고 모든 인스턴스를 변경하는 대신 한 곳에서 변경할 수 있다는 것입니다.
몇 가지 다른 작은 것들:
- 어떤 이유에서인지
{axis}
환경에 최소한 하나의\addplot
명령이 필요한 것 같습니다. 나는 그것이 두 축의 범위를 계산하는 데 필요하기 때문에 그것이라고 생각합니다xmin
.xmax,
ymin
및 가ymax
모두 지정되어 . 수직선에 대해 실제로 아무 것도 표시하고 싶지 않기 때문에 를 사용했습니다\addplot [draw=none] {0};
. PGFplots 문서에서 이 요구 사항에 대한 언급을 찾을 수 없는 것 같습니다. - PGFplots가 모든 라벨의 위치를 계산할 때 최소 높이가 필요한 것 같습니다. 수직선을 그릴 때 처음에는 를 사용했는데
height=0pt
오류가 발생해서 대신 사용했습니다.height=11em
.plot1.south
기준선의 수직 높이가 충분하므로 더 이상 좌표를 조정할 필요가 없다는 추가적인 이점이 있습니다 . - 선언할 때마다
samples
및 호출domain
할 때마다\addplot
전체 축에 대해 이러한 속성을 선언합니다. 이렇게 하면 코드가 좀 더 깔끔해지고 모든 플롯이 전체 도메인에 걸쳐 그려집니다(예를 들어 줄이y=x
중간에 멈추는 것을 원하지 않습니다 ). 그래도 그것이 의도된 행동이라면,\addplot [domain=-5:0] {x};
축 전체를 무시할 것입니다domain
. - 이전 참고 사항과 유사하게
restrict y to domain
옵션을 사용하면 해당 환경의{axis}
모든 명령에 대해 해당 변경 사항이 적용됩니다 .\addplot
게다가,restrict y to domain
지정된 도메인 외부에 있는 포인트를 삭제합니다. 지정된 값을 벗어나는 값이 있으므로6 / (5-x)
두 번의 개별 호출로 플롯할 필요가 없습니다.\addplot
와이도메인은 자동으로 삭제됩니다. - 이전 두 가지 사항에 관해
domain
다음을 생각해보세요.restrict y to domain
PGFplots가 무엇을 그릴지 파악합니다. - 나는
\pgfkeysvalueof{/pgfplots/xmin}
의 값을 얻기 위해 (및 유사한)를 사용합니다xmin
.ymin
ymax
를 하드 코딩하는 대신 사용 합니다. 이는 내가 위치를 변경하고 싶다면와이-축이 시작되고 중지되면 점근선이 자동으로 조정됩니다. \addplot
선을 그리는 대신x=5
명시적인 좌표를 사용합니다. 이는 주로 PGFplot의 동작이 때때로 약간 일관성이 없다는 것을 알았기 때문입니다.- 사용하는 대신
\addplot coordinates{-1,-1};
기본 Ti 중 하나를 사용했습니다.케이Z 명령. 첫째, 실제로 다른 곡선을 그리는 것이 아니라 주석을 달기 때문에\addplot
이미 필요한 것 같지 않습니다. 또한 추가\addplot
명령을 사용하면 범례 항목과 플롯 스타일 주기가 엉망이 되므로 지정하지 않았음에도 불구하고 초기 플롯에 다양한 모양과 색상이 있는 이유가 됩니다. width=\linewidth
플롯이 현재 줄의 너비를 채우도록 선택했습니다 . 의 경우height=0.7\linewidth
임의적이지만(을 사용할 수도 있음height=5cm
) 사용 이유\linewidth
는 문서의 서식을 변경하면 플롯 너비와 높이의 종횡비가 동일하게 유지되고 항상 너비를 차지한다는 것이 보장된다는 것입니다. 라인의. 특히 플롯이 다음을 따르도록 보장하기 때문에0.7
일반적으로 사용합니다.0.62
황금비율, 하지만 이 그래프의 특별한 경우에는 너무 눌려 보인다고 생각하여 대신 을 사용했습니다0.7
.