import numpy as np
import matplotlib.pyplot as plt
import sys

r = 2.6
if len(sys.argv) > 1:
    r = float(sys.argv[1])

reps = 100  # number of repetitions
if len(sys.argv) > 2:
    reps = int(sys.argv[2])

xs = np.zeros(reps)

fig, biax = plt.subplots()
fig.set_size_inches(16, 9)

x = .5

for n in range(0, reps):
    x = r * x * (1 - x)
    xs[n] = x
    print(f"{x}")


biax.plot(range(0, reps), xs, markersize=.02)
biax.set(xlabel='n', ylabel='x', title='logistic function r = ' + str(r))
plt.show()
