• + 0 comments
    import math
    
    def cdf(x, mu, sigma):
        return 0.5 + math.erf((x-mu)/(sigma*2**0.5))*0.5
    
    n_samples=100
    lower_bound = 490
    upper_bound  =510
    population_mu = 500
    population_sigma = 80
    
    sample_mean_mu=population_mu
    sample_mean_sigma=population_sigma/n_samples**0.5
    
    Prob_l = cdf(lower_bound, sample_mean_mu, sample_mean_sigma)
    Prob_u = cdf(upper_bound, sample_mean_mu, sample_mean_sigma)
    
    print('{:0.4f}'.format(Prob_u-Prob_l))