In [1]:
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np

In [2]:
def diagram(n=1000,niters=1000):
    
    ax = np.random.rand(n,n)
    for j in range(n):
        a = 4*j/n
        for i in range(niters):
            ax[:,j] = a*ax[:,j]*(1-ax[:,j])
    return ax

In [3]:
%time ax = diagram()


CPU times: user 18.2 s, sys: 0 ns, total: 18.2 s
Wall time: 18.2 s

In [4]:
n=1000
plt.plot( np.repeat(4/n*np.arange(n),n), ax.T.flatten(),'.',markersize=.1 )


Out[4]:
[<matplotlib.lines.Line2D at 0x7f29599f0080>]

In [ ]: