我需要画一个圆锥曲线:给定两个椭圆
$\left( \frac{x}{a_1}\right)^2 + \left( \frac{y}{b_1} \right)^2 - 1 = 0$
和
$\left( \frac{x}{a_2}\right)^2 + \left( \frac{y}{b_2} \right)^2 - 1 = 0$,
我要密谋
$$
t_1 \left( \left( \frac{x}{a_1}\right)^2 + \left( \frac{y}{b_1} \right)^2 - 1 \right) + t_1 \left( \left( \frac{x}{a_2}\right)^2 + \left( \frac{y}{b_b} \right)^2 - 1 \right) = 0
$$
对于$t_1$
和的某些值$t_2$
。
我理解 Ti钾Z 可能不适合绘制隐函数。你有什么在 Ti 中执行此操作的技巧吗钾Z 或其他程序的建议?
答案1
这是一个使用选项pgfplots
和gnuplot
(带--shell-escape
选项的处理):
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot +[no markers,
raw gnuplot,
thick,
] gnuplot {
set contour base;
set cntrparam levels discrete 0.003;
unset surface;
set view map;
set isosamples 500;
splot (x/2)^2+ (y/3)^2 -1;
};
\addplot +[no markers,
red,
raw gnuplot,
thick,
] gnuplot {
set contour base;
set cntrparam levels discrete 0.003;
unset surface;
set view map;
set isosamples 500;
splot (x/5)^2+ (y/2)^2 -1;
};
\foreach \Valora/\Valorb in {0/1,0.25/0.75,0.5/0.5,0.75/0.25,1/0}
{
\addplot +[no markers,
raw gnuplot,
thin,
dashed
] gnuplot {
set contour base;
set cntrparam levels discrete 0.003;
unset surface;
set view map;
set isosamples 500;
splot \Valora*((x/2)^2+ (y/3)^2 -1) + \Valorb*((x/5)^2+ (y/2)^2 -1);
};
}
\end{axis}
\end{tikzpicture}
\end{document}
答案2
如果您真的想绘制圆锥束,Asymptote 可以用更几何的方式完成此操作。它有一个例程来计算通过任意给定五个点(没有三个共线)的圆锥,因此您实际上可以通过指定的四个点的基轨迹来计算圆锥束。
[数学注释:如果一条线恰好经过四个点中的一个,则存在自然同构(线上的点)->(铅笔中的圆锥曲线),将一个点引向与该点和四个固定点相交的唯一圆锥曲线。]
% file: foo.tex
% to compile: pdflatex --shell-escape foo
%
% For MikTeX users: Asymptote requires a separate program that cannot be installed
% by the package manager. You can get the installation file from
% https://sourceforge.net/projects/asymptote/files/2.35/
% (specifically, the file ending in setup.exe).
\documentclass{standalone}
\usepackage{asypictureB}
\begin{document}
\begin{asypicture}{name=PencilOfConics}
settings.outformat = "pdf";
import geometry; // Import the geometry module to use conics
unitsize(1cm);
pair a=(-3,-2), b=(-3,2), c=(2.5,1.5), d=(3,-2);
pair fifthpoint(real t) { return d + (0,t); }
real tmin = -3-.01*unitrand(), tmax = 3 + 0.01*unitrand();
int n = 20;
pair[] points = new pair[n];
for (int i = 0; i <= n; ++i) {
real t = interp(tmin, tmax, i/n);
pair pt = fifthpoint(t);
draw(conic(a,b,c,d,pt), interp(blue, red, i/n));
points[i] = pt;
}
dot(points);
\end{asypicture}
\end{document}
答案3
运行xelatex
:
\documentclass{article}
\usepackage{pst-func}
\begin{document}
\begin{pspicture*}(-5.5,-5.5)(5.5,5.5)
\psaxes{->}(0,0)(-5,-5)(5,5)
\def\aI{2} \def \aII{3}
\def\bI{-1} \def \bII{-2}
\pgfforeach \tI/\tII in {0/1,0.25/0.75,0.5/0.5,0.75/0.25,1/0}{%
\psplotImp[algebraic,linewidth=1.5pt,linecolor=red](-6,-6)(6,6)
{\tI *((x/\aI)^2 +(y/\bI)^2-1) + \tII*((x/\aII)^2+(y/\bII)^2-1)}}
\end{pspicture*}
\end{document}