# Golden ratio base useful? Easy logarithm in phinary system

1. Aug 31, 2008

### Gerenuk

I was wondering if the Golden ratio base (phinary system) has any use somewhere and if arithmetics with it is easy?

I programmed a surprisingly simple algorithm to calculate the logarithm yielding digits in base phi using nothing more than 2 multiplications/divisions per result digit. Can it be useful?

Here the python programm if you want to see:
Code (Text):

phi=(sqrt(5)+1)/2
base=2
digits=5
totalDigits=30

a0,b0=1/base**(phi**digits),base**(phi**(digits-1))

def logPhinary(x):
a,b=a0,b0
result=""
x*=a
switch=0
for i in range(totalDigits):
if switch==0:
a*=b
if x > 1:
result+="1"
b*=a
x*=a
else:
switch=1
x/=a
else:
b*=a
if x > 1:
result+="1"
a*=b
x/=b
else:
switch=0
x*=b
result+="0"
return result[0:digits+1]+"."+result[digits+1:] #insert decimal point

2. Aug 31, 2008

### granpa

how difficult is it to convert to base 10 or base 2? and vice versa.

i found it especially interesting that 1/0 is (apparently) easy to calculate. doesnt that mean that division can be done as quickly as multiplication?

are there lots of irrational bases that have these properties or is (1+ sqr(5))/2 unique?

Last edited: Aug 31, 2008
3. Aug 31, 2008

### Gerenuk

You mean to convert the result of the logarithm (which is in base phi) to binary again?
Haven't checked yet. Just learned about them and noticed that logarithm should be quite easy.

Maybe one can stay phinary for a while in calculations :-)

4. Aug 31, 2008

### Gerenuk

Actually there are ways to avoid division in my algorithm, but I thought division and multiplication are equally complex for floats. Not sure about that though...

5. Aug 31, 2008

### granpa

well I know that there are tricks that make multiplication quite fast. I was assuming that division would necessarily be slower.

6. Aug 31, 2008

### granpa

division is slower

7. Sep 1, 2008

### granpa

actually calculating 1/x isnt any faster in phinary.

the result of your function is in phinary. what is the input to the function?

8. Sep 1, 2008

### Gerenuk

OK, then here is the algorithm without division (for performance unfolding of the variable swapping can be also done)
Code (Text):

from math import *
phi=(sqrt(5)+1)/2
base=2
digits=5
totalDigits=30
x=100
a0,b0,y0=1/base**(phi**digits),base**(phi**(digits-1)),base**(phi**digits)

def logPhinary(x):
a,b,y=a0,b0,y0
result=""
while 1:
while x>y:
result+="10"
a*=b
b*=a
x*=a
a,b,x,y=b,a,-y,-x
result+="0"
b*=a
x*=b
if len(result)>=totalDigits: break
return result[0:digits+1]+"."+result[digits+1:]

The input can be any system, where you are able to store the initial values a0,b0,y0, do multiplications and compare. So probably the internal machine binary is best.

9. Jan 20, 2009

### kerchack

If you are still interested in this, there's an interesting passage in a book called the Modulor 2 by Le Corbusier, he was interested in the golden ratio as a tool to dictate design, but he was looking for people to affirm his ideas, so he asked some mathematicians to look at what he did. In the passage a mathematician ( I can find his name for you if you want) wrote about how the golden ratio may become a the new base to use - how the study and analysis of logarithm were largely forgotten after 1900, especially after people new topics in physics prioritized theoretical physics and quantum mechanics - and how maybe the logarithm of the golden ratio may revive studies in them.

10. Jan 21, 2009

### Gerenuk

The Golden ratio doesn't help to study logarithms directly - I mean not the algebra.
But calculating the digits might be easy. I couldn't think of an overall performance increase in calculations though, as the phinary system isn't easy in other contexts.