Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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

share|improve this question
is this in anyway related to this? ;o) –  Öskå Jan 22 '14 at 11:32
Could you provide the whole code generating the "end product" please? :) –  Öskå Jan 22 '14 at 11:52
@Ö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. –  MRN16 Jan 23 '14 at 2:07
I also tried to do it as well but failed beautifully.., maybe you can paste it to pastebin? –  Öskå Jan 23 '14 at 3:07
pastebin.com/qDsMe3J8 –  MRN16 Jan 23 '14 at 3:30

1 Answer 1

up vote 2 down vote accepted

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.

share|improve this answer
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. –  MRN16 Jan 20 '14 at 3:21
It works though and far more efficiently than I was expecting from what I was working with earlier. –  MRN16 Jan 20 '14 at 3:38

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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