# python setup.
from numpy import sqrt, linspace
import matplotlib.pyplot as plt
import sys
print("Python version is ", sys.version)
# the Fibonnaci series
n = 300
fib = [0]*n
(fib[0], fib[1]) = (0, 1)
for i in range(2, n):
fib[i] = fib[i-1] + fib[i-2]
# and a few of its values at selected points
x_fib = [2**i for i in range(8)]
y_fib = [fib[i] for i in x_fib]
# an exponential curve
k = (sqrt(5) + 1)/2 # the golden ratio
x = linspace(1, x_fib[-1]) # a grid of points
y = k ** x
def myplot():
""" draw a plot of a curve and some points """
# I've put this into a function just to wrap up all the plotting stuff in one place.
plt.figure(dpi=220, figsize=(3,3)) # start new plot & set its screen size
plt.plot(x_fib, y_fib, linestyle="none", marker=".", color="red", markersize=8.0, label="$fib_n$")
plt.plot(x, y, label="$x^{{{:3.2f}}} $".format(k), color="blue")
plt.title('Fibonnaci series')
plt.yscale('log')
plt.xscale('log')
plt.legend()
myplot()