```
<- function(
generator frac = 2, # fraction of a round per turn
its = 100 # do this many rounds
){<- 2*pi / frac # turn angle each step, radians
turn <- 1 # which rotation are we at
it <- 0 # # Points in polars, first location
ang <- 1
r <- 1 # iterator
i while(TRUE) {
<- turn + ang[i]
newang if(newang >= 2*pi){ # have we done full round?
<- it + 1
it if(it > its) break # stop
+1] <- r[i] + 1
r[i
}else {
+1] <- r[i]
r[i
}+1] <- newang %% (2*pi)
ang[i<- i+1
i
}# In Cartesian
<- r * cos(ang)
x <- r * sin(ang)
y cbind(x = x, y = y, r = r, ang = ang)
}
# shorthand generate + plot
<- function(frac, its, ..., main = 1/frac) {
plop <- c(-1,1)*( its + 1)
lim plot(generator(frac, its),
axes=FALSE, asp = 1, xlim = lim, ylim =lim, main = main, ...)
points(0,0,pch=3)
}
```

# Golden ratio of Valium

# Hirst’s Valium and the Golden ratio

The artist Damien Hirst has a painting called *Valium* (2000) (£6k-8k at Christie’s) which is based on a geometrically repeating pattern coupled with randomised colors. The pattern of locations resembles that found in a sun flower, and has a beautiful connection to the golden ratio. Numberphile has a video that explains the maths quite nicely, let’s demostrate the idea here.

The priciple is to add dots around a center with a constant rotational step while moving further out each round. let’s write a script that does that:

We can now illustrate that if the turn is a rational fraction of a circle, we get a repeating pattern. Example:

```
<- c(2, 3, 5, 10)
fracs par(mfrow = c(2,2), mar = c(1,1,1,1))
for(f in fracs) plop(f, its = 20)
```

So when the fraction is 1/5 we will have 5 spokes, for example.

The interesting thing is that when the fraction becomes less like a rational number, the pattern becomes more and more staggered. Repeating the example in the Numberphile video where we are close to the fraction 1/3:

```
<- (3 + seq(-1,1, l = 7)*.01)[-1]
fracs par(mfrow = c(2,3), mar = c(1,1,2,1))
for(f in fracs) plop(f, its = 200)
```

In the video the golden ration \(\phi=\frac{1 + \sqrt{5}}{2}\approx 1.61808\) is argued to be”the most irrational number” because it is hardest to approximate with a rational number. The maths is not hard to understand, but to just illustrate the property discussed in the video, let’s see some irrational numbers alongside the golden ratio:

```
<- (1+sqrt(5))/2
gr <- list("pi"= pi, "Sqrt 2"= sqrt(2), "Golden ratio"= gr)
fracs par(mfrow = c(1,3), mar = c(1,1,1,1))
for(i in names(fracs)) plop(fracs[[i]], its = 500, main = i, cex = .5)
```

It is quite clear how \(\pi\)’s pattern has that spokiness of rational numbers, and this is because it can be approximated with a rational number quite well (*viz.* Figure 2 above). \(\sqrt{2}\) is a bit more mixed up but starts to show spokes as we get further out. The golden ratio is clearly the least spoky and keeps at it the furthest out. Note also the resemblance to the sun flower.

## Spot paintings

Returning to the paintings by Damien Hirst, we can now mimic the *Valium* painting pattern as it is quite obviously based on the golden ratio.

First, let’s adjust the radius of each dot, as otherwise the pattern is visually too packed near the center and thins out the further we go. To do this we transform each point’s distance from the center by taking the square-root of it, which will keep the intensity of the points per unit area constant (proof available somewhere). Then we decorate with the famous random colors, and just as a final touch we add some noise to mimic the imperfect human hand:

```
set.seed(1)
<- generator(gr, 700)
x <- x[,4]
ang <- sqrt( x[,3] )
newr <- cbind( newr * cos(ang), newr*sin(ang) )
xy # add some noise
<- xy + runif(length(xy), -.1, .1)
xy # Pick colors:
<- sample(colors(), nrow(xy), replace = TRUE)
col
# we are done:
par(mar=c(1,1,1,1), mfrow=c(1,1))
plot(xy, asp = 1, pch = 19, col = col, axes=F, cex= 1)
```

For reference, here is the original by Hirst:

I don’t have £7k or anything like that floating around, but I’m pretty sure that when I want random spots on a white canvas to decorate my flat with, I can figure out a sufficient substitute.