如何绘制麦克劳林三分线的极坐标图

如何绘制麦克劳林三分线的极坐标图

https://en.wikipedia.org/wiki/Trisectrix_of_Maclaurin

Divide by zero在编译以下代码时遇到此问题,但我不知道如何解决它:

import graph;
size(300);

real a=2;
real f(real t){ return a*sin(3*t)/sin(2*t); }

xaxis(xmin=-2,xmax=4,Ticks(Step=1,modify=NoZero,pTick=invisible));
yaxis(ymin=-3,ymax=3,Ticks(Step=1,modify=NoZero,pTick=invisible));

int n=500;
guide g=polargraph(f,0,pi,n,operator ..);
draw(g,dashed);

我希望这条曲线看起来像

在此处输入图片描述

答案1

使用具有适当限制的函数的替代形式:

settings.tex="pdflatex";
import graph;
size(300);
real a=2;
real f(real t){ 
  return a/2*(4*cos(t)-1/cos(t));
}

xaxis(xmin=-2,xmax=4,Ticks(Step=1,modify=NoZero,pTick=invisible));
yaxis(ymin=-3,ymax=3,Ticks(Step=1,modify=NoZero,pTick=invisible));

real dtheta=0.25;
int n=500;
guide g=polargraph(f,-pi/2+dtheta,pi/2-dtheta,n,operator ..);
draw(g,dashed);

我们得到

在此处输入图片描述

绘制具有可移除奇点的曲线的另一个常见技巧是在该点处将其分割,例如像这样:

real dtheta=0.25;
real eps=1e-6;
int n=500;
guide g1=polargraph(f0,-pi/2+dtheta,0-eps,n,operator ..);
guide g2=polargraph(f0,0+eps,pi/2-dtheta,n,operator ..);
draw(g1,dashed);
draw(g2,dashed);

答案2

为了好玩,代码如下pstricks

\documentclass[11pt, a4paper, pdf, svgnames]{standalone}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fourier}
\usepackage{ pst-plot, pst-eucl}

\begin{document}

\psset{arrowinset=0.12, ticksize=2pt -2pt, labels = none, ticks=x, algebraic}
\begin{pspicture}(-2.5,-4)(4.5,4)
    \psaxes[arrows=->, linecolor=LightSteelBlue, tickcolor=LightSteelBlue] (0,0)(-2.5,-4)(4.5,4)[$x$,-115][$y$,-140]
    \psset{linewidth=1.2pt, linecolor=Crimson, plotpoints=200, plotstyle=curve, polarplot, algebraic, labelsep=0.5em}
    \psplot{0.00005}{1.570}{2*(sin(3*x)/sin(2*x))}%
    \psplot{1.571}{3.1414}{2*(sin(3*x)/sin(2*x))}%
    \uput[dr](3,0){$ \frac{3a}2 $}\uput[d](2,0){$\scriptstyle a$}
    \psline[linecolor=Crimson!40](-1,-4)(-1,4)\uput[dl](-1,0){$-\frac a2$} %vertical asymptote
    \pnodes(0,0){O}(2,0){A}(2.694;20){M}(3,0){I}
    \psline[linewidth=0.6pt, linecolor=LimeGreen, linejoin=1](O)(M)(A)
    \psset{linestyle=none}
    \pstMarkAngle{A}{O}{M}{$\scriptstyle\varphi/3$}
    \pstMarkAngle[LabelSep=0.4]{I}{A}{M}{$\scriptstyle\varphi$}
\end{pspicture}

\end{document} 

在此处输入图片描述

相关内容