From this relationship, we can derive this equation: $$\frac{a}{b} = \frac{a+b}{a}$$
And if we then let b=1 (so we can find the ratio of a to 1), we get: $$a = \frac{a+1}{a}$$
Then, with this formula, we can define a function: $$f(a) = \frac{a+1}{a}$$
If we then find the fixed-point in this function (so that f(x) = x), then we will have found a solution to $$a = \frac{a+1}{a}$$
A simple way to think about the fixed-point of this function is this: it is the place where $y=x$ (or $f(x) = x$ ) intersects with our function. And that intersction point should be the golden ratio.
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import math
# Plot y=(x+1)/x and y=x
x=np.linspace(0.5,3,1000)
y=map(lambda a: (a+1.0)/a, x)
y2=map(lambda a: a, x)
plt.plot(x, y)
plt.plot(x, y2, 'r')
# Make graph square
fig = plt.gcf()
fig.set_size_inches(5,5)
Another way to find the golden ratio is to use Fixed-point iteration - again, since we know that finding the fixed point of the function:
$$f(a) = \frac{a+1}{a}$$is the golden ratio.
# Alternatively, we can
golden_ratio = reduce(lambda acc,_: (acc+1.0)/acc, xrange(100), 1)
print golden_ratio
1.61803398875