In [22]:
# #Python Library Imports
import numpy as np
from scipy import stats
In [24]:
# #Distribution
scipy.stats.norm(30, 4)
Out[24]:
In [38]:
scipy.stats.norm(30, 4).cdf(40)
Out[38]:
In [47]:
1 - scipy.stats.norm(30, 4).cdf(21)
Out[47]:
In [48]:
scipy.stats.norm(30, 4).cdf(35) - scipy.stats.norm(30, 4).cdf(30)
Out[48]:
In this challenge, we practice solving problems with normally distributed variables.
In a certain plant, the time taken to assemble a car is a random variable having a normal distribution with a mean of 20 hours and a standard deviation of 2 hours. What is the probability that a car can be assembled at this plant in:
Less than 19.5 hours?
Between 20 and 22 hours?
In [52]:
scipy.stats.norm(20, 2).cdf(19.5)
Out[52]:
In [53]:
scipy.stats.norm(20, 2).cdf(22) - scipy.stats.norm(20, 2).cdf(20)
Out[53]:
In this challenge, we practice solving problems based on the Central Limit Theorem.
A large elevator can transport a maximum of 9800 pounds. Suppose a load of cargo containing 49 boxes must be transported via the elevator. The box weight of this type of cargo follows a distribution with a mean of µ=205 pounds and a standard deviation of σ=15 pounds. Based on this information, what is the probability that all 49 boxes can be safely loaded onto the freight elevator and transported?
In [54]:
# #Distribution
scipy.stats.norm(205, 15)
Out[54]:
Normal Distribution with mean=0 and std. dev=1 x ~ N(0, 1)
Normal Distribution with mean=205 and std. dev=15 x ~ N(205, 15)
Normal Distribution with mean=205 and std. dev=15, multiplied by n samples nx ~ N(205n, 15*sqrt(n))
In [64]:
scipy.stats.norm(205*49, 15*7).cdf(9800)
Out[64]:
In this challenge, we practice solving problems based on the Central Limit Theorem.
The number of tickets purchased by each student for the University X vs. University Y football game follows a distribution that has a mean of µ=2.4 and a standard deviation of σ=2.0.
Suppose that a few hours before the game starts, there are 100 eager students standing in line to purchase tickets. If there are only 250 tickets left, what is the probability that all 100 students will be able to purchase the tickets they want?
In [66]:
scipy.stats.norm(2.4*100, 2*10).cdf(250)
Out[66]:
In [ ]: