Here is a piece of python 3 code that draws archimedean spiral using Turtle. Equation of the spiral in polar coordinates
$$r = a + b\theta$$
def draw_spiral(t, n, length=3, a=0.1, b=0.0002): """Draws an Archimedian spiral starting at the origin. Args: n: how many line segments to draw length: how long each segment is a: how loose the initial spiral starts out (larger is looser) b: how loosly coiled the spiral is (larger is looser) http://en.wikipedia.org/wiki/Spiral """ theta = 0.0 for i in range(n): t.fd(length) dtheta = 1 / (a + b * theta) t.lt(dtheta) theta += dtheta
Why do we define dtheta and theta like this? I mean, I don't see why such definition should draw the spiral. So, I want to know how author got these dtheta and theta.