Here's a pretty image
Recently a user published an image of their own physical artwork. It looked similar to this, but the spacing was crude -- they were asking exactly what spacing was necessary to make this pattern (it's easy to imagine getting the radii slightly wrong so that all triple tangencies are missed).
The circles grow by some scalar
$k$, and have centers along a ring whos radius is also
$k$ times larger than the next smallest ring. Thus it is sufficient to compute
$k$ for the first and second ring; the
$n$th ring is the first scaled by
$k^n$ (rotated, too). We compute
$k$ as follows:
Take three adjacent circles in the smallest ring,
$C$, with centers at angles
$-\frac{2\pi}n,0,\frac{2\pi}n$ from
$(0,0)$. The next ring has two circles,
$D$, nested among the smaller three, with centers at angles
$\frac\pi n,-\frac\pi n$. The distance between the left circles' centers of
$C$ and
$D$ must be the sum of their radii. The radii of
$C$ are
$\sin\frac\pi n$ (an exercise for the reader). The radii of
$D$ are in turn
$k\sin\frac\pi n$. Here's a diagram
We impose
$k\sin\frac\pi n=d\left((\cos\frac{2\pi}n,\sin\frac{2\pi}n),k(\cos\frac\pi n,\sin\frac\pi n)\right)-\sin\frac\pi n$ where
$d$ is the distance between points. The answer (there are actually two, one for small
$D$ and one for large
$D$ (of course we have the latter)) is
$$k\to \tan ^2\left(\frac{\pi }{n}\right)+\sec \left(\frac{\pi }{n}\right) \left( \tan \left(\frac{\pi }{n}\right)\sqrt{2 \cos \left(\frac{\pi
}{n}\right)+1}+1\right)$$
thanks to the tremendous trio Solve
, Simplify
and TeXForm
. That's really all we need to make the picture -- here's code to make the end result.
Manipulate[
With[{k=Tan[\[Pi]/n]^2+Sec[\[Pi]/n] (1+Sqrt[1+2Cos[\[Pi]/n]]Tan[\[Pi]/n])},
Graphics[{ColorData["Rainbow"]@(#2/n),
Table[
Disk[k^j RotationTransform[j \[Pi]/n]@#, k^j Sin[\[Pi]/n]],
{j, m}]} &[{Cos@((2 \[Pi] #)/n), Sin@((2 \[Pi] #)/n)}, #] & /@ Range@n,
Background -> Black]], {{n,10}, 3, 24, 1}, {{m,3}, 1, 20}]
Now let me justify posting on a Mathematica forum: the original artist had 24 circles in each ring. We know
$\cos\frac x2=\sqrt{\frac{1+\cos x}2}$. Why stop there? We know
$\cos3x=4\cos^3x-3\cos x$, so
$\cos\frac x3$ is some root of a cubic in
$\cos x$. Unfortunately, the word "some" is problematic, especially if we considered an arbitrary quotient
$\frac xp$. Thankfully, our problem is limited such that one particular root is always taken. Let me stop blabbing:
$K=\cos\frac\pi{24}=\cos\frac\pi{2^3\cdot3}$. That expands into
$$K=\frac{1}{2} \sqrt{2+\sqrt{2+\sqrt{3}}}$$
Notice that Simplify[Cos[Pi/24]-K]
actually doesn't evaluate in MMA -- this makes me very sad. A shortcut to that identity is FullSimplify@ToRadicals@Cos[\[Pi]/24]
-- nice! Thanks, as always, Daniel Lichtblau. Now let's answer the creative, confused and now censored artist who asked: what is
$k$ for 24 circles? Simply evaluate
Simplify[With[{n = 24},
Tan[\[Pi]/n]^2 + Sec[\[Pi]/n]
(1 + Sqrt[1 + 2 Cos[\[Pi]/n]] Tan[\[Pi]/n])] //.
{Sec[x_] :> HoldForm@(1/Cos[x]), Tan[x_] :> HoldForm@(Sin[x]/Cos[x]),
Sin[x_] :> Sqrt[1 - Cos[x]^2], Cos[\[Pi]/24] -> 1/2 Sqrt[2+Sqrt[2+Sqrt@3]]} /.
HoldForm@x_ :> x]
to find
$$k_{24}=\frac{4+2 \sqrt{2+\sqrt{3}}+2 \sqrt{2+\sqrt{2+\sqrt{3}}}-\sqrt{\left(2+\sqrt{3}\right)
\left(2+\sqrt{2+\sqrt{3}}\right)}+2 \sqrt{\left(2-\sqrt{3}\right)
\left(1+\sqrt{2+\sqrt{2+\sqrt{3}}}\right)}}{\left(2+\sqrt{2+\sqrt{3}}\right)^{3/2}}$$
I'll write it simpler: with
$n=\sqrt{2+\sqrt3}$ and
$m=\sqrt{2+n}$,
$$k_{24}=\frac{4+2\sqrt{2-\sqrt{3}}\sqrt{m+1}+2m+2n-mn}{m^3}$$
Finally, I'll relent with the analytic-mania and say
$k_{24}\approx1.2553$.
Before I finish up, here's a big one: 42 circles per ring, 200 rings.
I think eliminating that space in the center is, I'm ashamed to say, not a task Mathematica was meant for. Evaluating
$\cos\frac\pi{24}$ though, certainly is a task Mathematica was meant for (and it does beautifully, as I learned today)! I'd love to hear your opinions, and I'd be delighted to chat in the comments.
Have a good day!
Edit: I found the tab containing the original post. Here's his original attempt
Pretty good for human hands and hot glue! If he's OK with it, I'll put this image and his name at the top of the post for clearer reading.
I'm not necessarily against the deletion of the original post -- it wasn't strictly a Mathematica question, and it wasn't strictly an original Mathematica idea. It did inspire me, though!
I can't stop!