I need to graph the following implicit polar equation using Latex

enter image description here

I would be very thankful for any help. Thanks

  • 1
    Welcome to TeX.SX! pgfplots can draw polar graphs; you can make the equation explicit, by the way. – egreg Dec 12 '15 at 23:44

As @egreg suggests, you can plot your data in polar graphs. Say you want to plot r = sin(2a) where a is the angle and r is the magnitude,

enter image description here



    % the expression is the RADIUS


Now for your question, according to Matlab, the solution is

enter image description here

The above function is undefined if the angle equals to zero or pi.



        { (x + sqrt( (x - 2*sin(x) )*(x + 2*sin(x)) ))  /(2*sin(x) };


The result is

enter image description here

  • 1
    This should really be plotted in radians, not degrees, since you have theta in the same units as sin(theta). – Charles Staats Dec 13 '15 at 9:08

Here's how to do it using Asymptote, together with some code borrowed from Transform/Mapping of path in asymptote.

mirrored Hawaiian earring

% 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).

struct planeTransformation {
  int nInterpolate = 4;
  pair apply(real, real);
  pair apply(pair uv) { return apply(uv.x, uv.y); }
  transform derivative(real, real);
  transform derivative(pair uv) { return derivative(uv.x, uv.y); }
  transform linearization(real u, real v) {
    return shift(apply(u,v)) * derivative(u,v) * shift(-(u,v));
  transform linearization(pair uv) {
    return linearization(uv.x, uv.y);
  /* Apply to a single Bezier spline. */
  guide _apply(pair p1, pair c1, pair c2, pair p2) {
    return apply(p1) .. controls linearization(p1)*c1 and linearization(p2)*c2 .. apply(p2);
  guide _apply(path g) {
    assert((length(g)) == 1);
    return _apply(point(g,0), postcontrol(g,0), precontrol(g,1), point(g,1));
  path apply(path g, int nInterpolate = nInterpolate) {
    guide toreturn;
    for (int i = 0; i < nInterpolate*length(g); ++i) {
      real currentpos = i / nInterpolate;
      real nextpos = (i+1) / nInterpolate;
      toreturn = toreturn & _apply(subpath(g, currentpos, nextpos));
    if (cyclic(g)) toreturn = toreturn & cycle;
    return toreturn;

planeTransformation polar;

polar.apply = new pair(real theta, real r) {
  return r * expi(theta);

polar.derivative = new transform(real theta, real r) {
  transform t = (0, 0, -r*sin(theta), cos(theta), r*cos(theta), sin(theta));
  return t;

settings.outformat = "pdf";
import contour;

real F(real theta, real r) {
  return r^2*sin(theta) + sin(theta) - r*theta;

real rmax = 2;

path[] xygraphcomponents = contour(F, (-6 pi, -rmax), (6 pi, rmax), new real[] {0}, nx=600, ny=100)[0];

// Draw polar "axes"
for (real r = 1/2; r < rmax; r += 1/2) {
  draw(circle(r=r, c=(0,0)), gray + linewidth(0.4),
       L=Label("$"+(string)r+"$", black, position=BeginPoint, align=N, filltype=UnFill));
draw(circle(r=2, c=(0,0)), black);

for (int degrees = 0; degrees < 360; degrees += 30) {
  draw((0,0) -- scale(rmax)*dir(degrees), p=gray + linewidth(0.4), L=Label("$"+(string)degrees+"^{\circ}$", black, position=EndPoint, align=dir(degrees)));

for (path xycomponent : xygraphcomponents) {
  path rthetacomponent = polar.apply(xycomponent);
  draw(rthetacomponent, blue);


Here is the graph of the function, having simplified the expressions of the roots to

r=\frac{1 \pm \sqrt{1-4\sinc^2\theta}}{2\sinc\theta}

where sinc is the cardinal sine. It is defined for sinc θ <= 1/2, θ different from kπ. It happens that pst-math defines a SINC function, which simplifies the code:

\documentclass[11pt, a2paper, pdf, svgnames]{standalone}
\usepackage{ pst-plot, pst-math}

\def\Fone{(1 + sqrt(1-(2*SINC(x))^2))/(2*SINC(x))}
\def\Ftwo{(1 - sqrt(1-(2*SINC(x))^2))/(2*SINC(x))}


\psset{arrowinset=0.15, ticksize=2.5pt -2.5pt, labelFontSize=\footnotesize, tickwidth =0.6pt}
\psaxes[arrows=->, linecolor=LightSteelBlue, tickcolor=LightSteelBlue, Dx=2,ytrigLabels ,dy = \psPi] (0,0)(-11,-9)(11,9)[$x$,-110][$y$,-140]
\psset{linewidth=1.2pt, plotpoints=200, plotstyle=curve, polarplot, algebraic, labelsep=0.5em}
%First series
\psline[linecolor=LightSteelBlue](-11, \TwoPi)(11,\TwoPi)
\psline[linecolor=LightSteelBlue](-11, \Pi)(11,\Pi)
\psline[linecolor=LightSteelBlue](-11, -\Pi)(11,-\Pi)%
\psline[linecolor=LightSteelBlue](-11, -\TwoPi)(11,-\TwoPi)

%Second series
\psset{linecolor =OliveDrab }
\psset{linecolor =DarkSeaGreen}


enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.