Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
601 B
2
Indexable
Never
import numpy as np
import math
import matplotlib.pyplot as pl
from numpy.random import RandomState

r = RandomState()

nexp = 100000 # liczba próbek
nsam = 100 # liczba kresek

mu, sigma = 0.5, 1

experiment_results = np.zeros(nexp)

for experiment in range(nexp):
    x = np.random.normal(mu, sigma, nsam)
    experiment_results[experiment] = x.mean()

fr = experiment_results.mean()
fe = experiment_results.std()
ee = 1./math.sqrt(nsam) 

print ('Wyniki:')
print ('Średnia ={0:8.5f} Spodziewana = 0'.format(fr))
print ('Błąd={0:8.5f} Spodziewana ={1:8.5f}'.format(fe,ee))