Golden ratio base useful? Easy logarithm in phinary system

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
9 replies · 9K views
Gerenuk
Messages
1,027
Reaction score
5
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:
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
 
Mathematics news on Phys.org
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. doesn't 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:
granpa said:
how difficult is it to convert to base 10 or base 2? and vice versa.

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 :-)
 
granpa said:
i found it especially interesting that 1/0 is (apparently) easy to calculate. doesn't that mean that division can be done as quickly as multiplication?
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...
 
well I know that there are tricks that make multiplication quite fast. I was assuming that division would necessarily be slower.
 
actually calculating 1/x isn't any faster in phinary.

the result of your function is in phinary. what is the input to the function?
 
OK, then here is the algorithm without division (for performance unfolding of the variable swapping can be also done)
Code:
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.
 
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.
 
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.