Spiral of Roots

This example plots a spiral of roots.
A spiral of roots

\documentclass[border=10pt]{standalone}
\usepackage[inline]{asymptote}
\begin{document}
\begin{asydef}
unitsize(2cm);
import fontsize;
defaultpen(fontsize(9pt));
pen linepen=deepblue+0.8bp;
pen labelpen=black;
pen markpen=gray+0.6bp;

void spiralOfRoots(int n){
  assert(n>0);
  real w=0.15;
  pair O=0E,a=E,b;
  pair p,q,r;
  for(int i=1;i<=n;++i){
    draw(O--a,linepen);
    label("$\sqrt{"+string(i)+"}$",O--a,O,labelpen,UnFill);
    b=a+dir(degrees(a)+90);
    draw(a--b,linepen);
    p= w*dir(b-a);
    r=-w*dir(a);
    q=p+r;
    draw(a+p--a+q--a+r,markpen);
    label("$1$",a--b,dir(degrees(a-b)+90),labelpen);
    a=b;
  }
  draw(O--a,linepen);
  label("$\sqrt{x}$",O--a,O,labelpen,UnFill);
}
\end{asydef}

\begin{asy}[width=\the\linewidth,inline=true]
unitsize(15mm);
spiralOfRoots(15);
\end{asy}
\end{document}

Source: TeX.SE

Author: g.kov (License)