When defining a lognormal function with a mean of 15.1466 and a standard deviation of 0.3738, the result you should get is the following:
However when I run the following code to do it with python the result I get is not the same.
mu, sigma = 15.1466, 0.3738
s = np.random.lognormal(mu, sigma, 10000)
count, bins, ignored = plt.hist(s, 30,
density=True,
color='blue')
x = np.linspace(min(bins),
max(bins), 10000)
pdf = (np.exp(-(np.log(x) - mu)**2 / (2 * sigma**2))
/ (x * sigma * np.sqrt(2 * np.pi)))
plt.plot(x, pdf, color='black')
plt.grid()
plt.show()
Aucun commentaire:
Enregistrer un commentaire