I where playing with a stm32 discovery board on linux. I got the tool-chain installed and the stlink upload software.
I got the error “bind: Address already in use”.
After some looking around I found that st-link uses port 4242. As it happens crash plan which I use for backup, uses the same port. Luckily this where simple to change in crashplan.
The golden ratio is a number often seen in nature. It is often seen in spirals. You can see these in the sunflower. The pattern found in a sunflower was described by Vogel in 1979. He described it as a Fermat spiral. It has the simple formula with polar coordinates:
Where is the golden angle. It can be defined as in degrees as , where is the golden ratio. That equals about 137.5°. I wrote a simple python script to plot the function. The blue lines is the connection between consecutive. We see that the connection pattern is quite messy. So this would be a bad way to connect all the squares.
A much better way of connecting them is to follow the spirals. In the image above you can see a couple of spirals. The easiest to spot is perhaps the one with 21 arms. All the spirals you can find will have a Fibonacci number of arms.
To work out the formula for each arm takes a bit more work. First lets define the angle between two consecutive points on one arm. Note her that we want θ to be between π and -π . To do this I use the modulo operator. This works for 21, but not for 34. For 34 you have to subtract an additional 2π.
We can now set up an equation for the theta of the arm equation. Where k is the starting point of the spiral. Here I work with 21 spirals, so k is between 1 and 21. The first point in the spiral is n = 0.
Now we use the same idea for the r varable. We will then get
Now if we solve theta for n, and substitute it in r we finally get
As the figure shows, the spirals are now clearly defined. This is probably the best way to connect point in such a pattern. The next spiral up, would have 34 arms. This spiral will go the other way around.
Sunflowers and Fibonacci: Models of Efficiency