The Spiral

I'm trying to place circles along the outside of an Archimedean spiral. Shown below: Archimedian Spiral from 0 to 6 Pi

ParametricPlot[{θ/(2*π)*Cos[θ], θ/(2*π)*Sin[θ]}, {θ, 0, 6π}, PlotStyle -> Red]

The Circles

Circle placement

To do this effectively I have been trying to use the Law of Cosines to determine the change in the angle. I found the path that would contain the circle centers:

f[θ_] := {((π+θ) Cos[θ])/(2π), ((π+θ) Sin[θ])/(2π)}

Using the Law of Cosines for the following:

Law of Cosines for this example

Seems pretty straight forward, right? Well, when I went to solve for the angle alpha Mathematica seems to have trouble.


seems to work "fine", but any subsequent evaluations don't seem to go smoothly. In fact, any evaluation that does not contain Pi seems to fail, and an evaluation of the distance between the points shows that the angle is off (!=1).


The Question

What am I doing wrong to be more than 5% off from what I expect. Also, is there a more efficient and correct method to solve for the angle?

An End Product

Thanks to KennyColnago for his response. Final Product

  • 1
    $\begingroup$ is this in anyway related to this? ;o) $\endgroup$
    – Öskå
    Jan 22, 2014 at 11:32
  • $\begingroup$ Could you provide the whole code generating the "end product" please? :) $\endgroup$
    – Öskå
    Jan 22, 2014 at 11:52
  • $\begingroup$ @Öskå Yes, that is precisely what it is related to. The code is quite boring with the exception of the code that KennyColnago helped me with. I just generated a table where each part was {Color,Disk} counting up to 1000, and pulling a number off the value of Pi. $\endgroup$
    – MRN16
    Jan 23, 2014 at 2:07
  • $\begingroup$ I also tried to do it as well but failed beautifully.., maybe you can paste it to pastebin? $\endgroup$
    – Öskå
    Jan 23, 2014 at 3:07
  • $\begingroup$ pastebin.com/qDsMe3J8 $\endgroup$
    – MRN16
    Jan 23, 2014 at 3:30

1 Answer 1


The expression I get for the angle angle increment $d$ is

(d^2 + 2d (Pi + t) + 2(Pi + t)^2 - 2(Pi + t)(d + Pi + t) Cos[d])/(4 Pi^2) = c^2

For your problem, $c=1$ and $t$ is the start angle of Pi/2. Solve the transcendental equation for d using

FindRoot[(d^2 + 2d (Pi + t) + 2(Pi + t)^2 - 2(Pi + t)(d + Pi + t) Cos[d])/(4 Pi^2) == 1
         /. {t->Pi/2}, {d,1.0}]

The answer is d=1.241radians. The second circle centre on your blue line is therefore atf[Pi/2+1.241]={-0.896,0.307}. The next angle increment isd=1.0054, found by solving witht->Pi/2+1.241.

However, you seem to be assuming that circles of radius 1/2 with centres on the blue curve are tangent to the red spiral. Not so. The circles touch the spiral function along a radial line from the origin, but they are not tangent to, or bounded by, the spiral.


I like your design! How about less random colourings, as in

Graphics[Map[{ColorData["DarkRainbow",Mod[#,Pi]/5 + Norm[CircleCentres[#]]^1.7/190], 
              Disk[CircleCentres[#],0.5]}&, NestList[NextAngle[#]&, Pi/2, 800]]]

whereCircleCentres[angle]is yourf[theta], andNextAngledoes aNestListof theFindRootresult.

  • $\begingroup$ The placement on the outside of the spiral is approximate, but becomes quite good after the first few turns. Towards the center the approximation does break down though, I'm avoiding a lot of problems by starting at Pi/2, but I understand that the average distance between the one loop and the +2Pi loop does not equate to being tangential or, by necessity, bounded by the spiral. $\endgroup$
    – MRN16
    Jan 20, 2014 at 3:21
  • $\begingroup$ It works though and far more efficiently than I was expecting from what I was working with earlier. $\endgroup$
    – MRN16
    Jan 20, 2014 at 3:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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