File:BernoulliTrialsCs.svg
Summary
Description |
Čeština: Bernoulliho pokusy s pravděpodobností úspěchu p=0,5 a jejich průměrná úspěšnost v závislosti na opakování
English: Bernoulli trials with p = 0.5 and their average success depending on the # of trials |
Date | |
Source | Own work |
Author | Jan Spousta |
- Zdrojový kód / source code, Python 3:
import numpy as np import matplotlib.pyplot as plt import seaborn as sns np.random.seed(0)
x = np.arange(1, 1001, 1) samples = np.random.randint(0, 2, len(x)) averages = np.cumsum(samples)/x
samples = np.random.randint(0, 2, len(x)) averages1 = np.cumsum(samples)/x
samples = np.random.randint(0, 2, len(x)) averages2 = np.cumsum(samples)/x
- plt.plot((0, 1000), (0.5, 0.5), label='Teoretická střední hodnota')
plt.plot(x, averages, label='1. řada pokusů') plt.plot(x, averages1, label='2. řada pokusů') plt.plot(x, averages2, label='3. řada pokusů')
plt.title('Bernoulliho pokusy, p = 0,5: podíl úspěchů v závislosti na počtu opakování') plt.xlabel('Počet pokusů') plt.ylabel('Podíl úspěchů') plt.ylim((0, 1)) plt.legend() plt.savefig('BernoulliTrialsCs.svg')
Licensing
- You are free:
- to share – to copy, distribute and transmit the work
- to remix – to adapt the work
- Under the following conditions:
- attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
- share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.