Challenge: Solving Task Using Gaussian Distribution
Taak
Swipe to start coding
Suppose you are going fishing.
One type of fish is well caught at atmospheric pressure from 740
to 760
mm Hg.
Fish of the second species is well caught at a pressure of 750
to 770
mm Hg.
Calculate the probability that the fishing will be successful if the atmospheric pressure is Gaussian distributed with a mean of 760
mm and a mean deviation of 15
mm.
You have to:
- Calculate the probability that pressure is in the
[740, 760]
range. - Calculate the probability that pressure is in the
[750, 770]
range. - As our events intersect, we must use the inclusive-exclusive principle. Calculate the probability that pressure falls into the intersection of corresponding intervals.
Oplossing
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from scipy.stats import norm
mean = 760
std_dev = 15
# Calculate the probability of pressure between 740 and 760
prob_range_1 = norm.cdf(760, mean, std_dev) - norm.cdf(740, mean, std_dev)
# Calculate the probability of pressure between 750 and 770
prob_range_2 = norm.cdf(770, mean, std_dev) - norm.cdf(750, mean, std_dev)
# Calculate the probability of pressure in both ranges
prob_intersection = norm.cdf(760, mean, std_dev) - norm.cdf(750, mean, std_dev)
# Calculate the combined probability using the inclusion-exclusion principle
combined_prob = prob_range_1 + prob_range_2 - prob_intersection
print(f'Probability is {combined_prob:.4f}')
Was alles duidelijk?
Bedankt voor je feedback!
Sectie 4. Hoofdstuk 5
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from scipy.stats import norm
# Parameters of the distribution
mean = 760
std_dev = 15
# Calculate the probability of pressure between 740 and 760
prob_range_1 = norm.___(___, mean, std_dev) - norm.___(___, mean, std_dev)
# Calculate the probability of pressure between 750 and 770
prob_range_2 = norm.___(___, mean, std_dev) - norm.___(___, mean, std_dev)
# Calculate the probability of pressure in both ranges
prob_intersection = norm.cdf(___, mean, std_dev) - norm.cdf(___, mean, std_dev)
# Calculate the combined probability using the inclusion-exclusion principle
combined_prob = prob_range_1 + prob_range_2 - prob_intersection
print(f'Probability is {combined_prob:.4f}')
Vraag AI
Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.