答案1
使用以下方式编译渐近线或者http://asymptote.ualberta.ca/
import contour;
import graph;
size(300);
typedef real newreal(real,real);
newreal f(real a){
return new real(real x, real y){
return (x^2-a^2)*(x-a)^2+(y^2-a^2)^2;
// from https://mathworld.wolfram.com/BicuspidCurve.html
};
}
xaxis(xmin=-2,xmax=2,RightTicks(Step=0.5),Arrow);
yaxis(ymin=-2,ymax=2,LeftTicks(Step=0.5,modify=NoZero),Arrow);
draw(contour(f(1),(-2,-2),(2,2),new real[]{0},1000),red+1bp);
答案2
以下是 pstricks 包的简短代码pst-contourplot
:
\documentclass[border=10pt, svgnames]{standalone}
\usepackage{pst-plot, pst-contourplot}
\begin{document}
\psset{unit=2cm, algebraic, plotstyle=curve, plotpoints=200, linejoin=1}
\begin{pspicture}(-1.8,-2)(1.8,2)
\psaxes[linecolor=LightSteelBlue, arrows=->, arrowinset=0.12, ticksize=3.5pt, tickcolor=DarkBlue, subticks=5,showorigin=false](0,0)(-1.75,-1.9)(1.75,2)[$x$, -120][$y$,-135]
\psContourPlot[linecolor=Crimson, linewidth=1.5pt, function=(x^2-1)*(x-1)^2 + (y^2-1)^2](-1.1,-1.75)(1.1,1.75)
\end{pspicture}
\end{document}