我正在使用 Beamer,迫切需要以下图像的图片:椭圆曲线 $y^2=x^3+17$,其中点 R = (-2, -3)、-R = (-2, 3)、P = (4,9) 和 Q=(2,5)。我还想要一条通过 R、P 和 Q 的直线。我该如何绘制它?
非常感谢!
答案1
隐式函数是基于 TeX 的绘图的弱点。您可以调用老大哥gnuplot
(参见 pgfplots 手册)来保存,也可以分别划分定义域和绘图域。
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}
\begin{document}
\begin{tikzpicture}
\begin{axis}[no marks,samples=200,domain=-2.571281:5,grid=both]
\addplot[blue] {sqrt(x^3+17)};
\addplot[blue] {-sqrt(x^3+17)};
\coordinate[label={90:$R$}] (R) at (axis cs:-2,3);
\coordinate[label={-90:$-R$}] (-R) at (axis cs:-2,-3);
\coordinate[label={90:$P$}] (P) at (axis cs:4,9);
\coordinate[label={90:$Q$}] (Q) at (axis cs:2,5);
\draw (P) -- (Q) -- (-R);
\end{axis}
\end{tikzpicture}
\end{document}
答案2
你也可以用以下方法绘制此类图元帖子. 用 进行编译mpost
并包含其生成的 .eps 文件\includegraphics
。
prologues := 3;
outputtemplate := "%j%c.eps";
beginfig(1);
u = 1.44cm; % horizontal unit
v = 3.2mm; % vertical unit
% axes
path xx, yy;
xx = (3 left -- 6 right) scaled u;
yy = (14 down -- 14 up) scaled v;
drawarrow xx withcolor .6 white;
drawarrow yy withcolor .6 white;
% the curve
path half_curve, full_curve;
root = -(17**1/3);
s = 0.1;
half_curve = (root, 0) for x=root+s step s until 5.4: .. (x, sqrt(17+x**3)) endfor;
full_curve = (reverse half_curve reflectedabout(left,right) & half_curve) xscaled u yscaled v;
draw full_curve withcolor .67 red;
% the points
pair R, P, Q;
R = (-2u,-3v);
P = (4u,9v);
Q = (2u,5v);
% the line through R and P
z1 = whatever[R,P]; x1 = -3u;
z2 = whatever[R,P]; x2 = +6u;
draw z1--z2;
% labels
dotlabel.top(btex $P$ etex, P); label.lrt(btex $(4,9)$ etex, P);
dotlabel.top(btex $Q$ etex, Q); label.lrt(btex $(2,5)$ etex, Q);
fill fullcircle scaled dotlabeldiam shifted R;
label(btex $R$ etex, R+8 up);
label(btex $(-2,-3)$ etex, R+14 down);
dotlabel.ulft(btex $-R$ etex, R reflectedabout(left,right));
endfig;
end.