Search code examples
python-3.xpandasstatisticsdata-scienceusage-statistics

Value(s) of X Mean Standard deviation need to find Probability or area under the curve


An average light bulb manufactured by Acme corporations lasts 300 days with a standard deviation of 50 days . Assuming that bulb life is normally distributed, what is the probability that an Acme light bulb will last at most 365 days?

How can the same be replicated in code in python?


Solution

  • mu = 10*30
    std_d = 50
    import math
    def norm_pdf(x, mean, std):
        variance = float(std)**2
        denom = (2*math.pi*variance)**.5
        num = math.exp(-(float(x)-float(mean))**2/(2*variance))
        return num/denom
    norm_pdf(12*30, mu, std_d)
    

    Formula Refrence: Wikipedia