A World So Phi-ne

Anna Rasshivkina
Mar 17, 2016 · 4 min read

My last posts have been practical and concrete, aiming to take the mind-boggling and make it evident. This time around, I wanted to choose something more abstract, theoretical — to take something evident and make it mind-boggling. Enter the Golden Ratio.

If you’re any kind of nerd, you’ve probably already heard of the Golden Ratio. This intriguing number has so many curious qualities and appears in so many aspects of life that it comes to seem almost mystical.

In physics, biology, mathematics, music, art — all disciplines concerned with making sense of and finding order in the universe — there is a hidden constant, a single variable that repeatedly asserts itself. That constant is phi, or the “Golden Ratio.” The number itself — 1.61803339… — is an irrational number, like pi, which means that it can’t be expressed in a fraction. That, aside from that fact that it sounds cool, isn’t particularly interesting. What is interesting is that phi can be expressed in a fractal: an indefinitely repeating pattern that contains itself.

The Golden Ratio can be expressed as a fractal.

Phi (φ) equals 1 + 1/φ. Which is the same as saying φ = 1 + 1/(1 + 1/φ). And on and on and on.

Image for post
Image for post

It’s another infinite recursion no matter how you play with the equation. Multiply both sides by φ, and you get φ² = 1 + φ. This means φ = √(1 + φ), which is the same as φ = √(1 + √(1 + φ)), and on and on and on:

Image for post
Image for post

Now, we see that phi is a pretty unique and curious number. It reaches a level of near-mysticism when we see how often it crops up in the world around us.

The golden ratio is a number found in the count and arrangement of petals on a flower, the breeding patterns of rabbits and bees, the spread of branches on a tree, the curve of the galaxy. The natural world intrinsically organizes itself around this number.

Image for post
Image for post
Image for post
Image for post

This bit of information is in everything around us (see where I’m going with this?). And that includes, naturally, computer and information science, where the Golden Ratio is a long-standing locus of study and theorizing.

 The golden rectangle—all squares growing along the golden ratio, the spiral moving outward in proportion to it
 The golden rectangle—all squares growing along the golden ratio, the spiral moving outward in proportion to it
The golden rectangle — all squares growing along the golden ratio, the spiral moving outward in proportion to it

How does the golden ratio crop up in computer programming?

1) You may have heard of binary search (bsearch in Ruby), a search algorithm that’s exponentially faster than a regular search. But you probably haven’t heard of the golden section search or its close cousin, the Fibonacci search. Instead of searching data by segmenting it in halves, these search algorithms segment data according to the golden mean.

With normal data, the Fibonacci search is just as fast as binary search, but it’s even better with more complex information — like datasets that are too large to load into the CPU cache at once, or for finding the minimum/maximum point on the chart of a complicated function. It’s particularly useful in data science.

2) Life is full of complexities, branching logic and weighted decision-making. In programming, this is reflected as priority queues: data organized not just by location (like an array or hash), but also by priority. Imagine a triage doctor, deciding which patient has the greatest need for immediate attention. Heaps are the tree-like data structures that implement priority queues, in fields like statistics, number theory, operating systems, artificial intelligence and on.

Fibonacci numbers and the golden ratio are the cornerstone of the most efficient structure for organizing this data: the Fibonacci heap.

Image for post
Image for post

3) The golden ratio is useful not only for sorting data, but also for concealing it, with phi as the constant value at the root of encryption algorithms.

4) And finally: web design. Just as the golden ratio appears in art and architecture, it also appears online, in the sites we interact with every day.

Image for post
Image for post
Image for post
Image for post

This article is a stub. You can improve it by teaching Anna about information theory, computer science, Fibonacci numbers, and the Theory of Everything, so she could write more about it.

Code blog covering Ruby, Javascript, HTML, CSS, and other…

Anna Rasshivkina

Written by

Synaptic Sugar
Anna Rasshivkina

Written by

All things language. Writer, translator, coder. www.thesewords.live

Synaptic Sugar

Code blog covering Ruby, Javascript, HTML, CSS, and other assorted coding topics. Attempting to make simple the confusing, with minimum nerd jargon. Written by Anna Rasshivkina.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store