import numpy as np
import matplotlib.pyplot as plt
def dfunc(x):
return x**3
# t will be an array with elements 0, .02, .04,..., 1
t = np.linspace(0, 1, 51)
plt.plot(t, dfunc(t), color="red")
experiments = [np.random.random()**3 for _ in range(1000)]
plt.hist(experiments, bins=t, density=1);
experiments2 = [i*np.random.random() for i in experiments]
plt.plot(experiments, experiments2, 'r.') #, alpha=1)
listt = [dfunc(i)*np.random.random() for i in t]
plt.plot(t, listt, 'r.')
plt.plot(t, dfunc(t))
?plt.hist