Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprenda Challenge: Solving Task Using Gaussian Distribution | Commonly Used Continuous Distributions
Probability Theory Basics

book
Challenge: Solving Task Using Gaussian Distribution

Tarefa

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:

  1. Calculate the probability that pressure is in the [740, 760] range.
  2. Calculate the probability that pressure is in the [750, 770] range.
  3. As our events intersect, we must use the inclusive-exclusive principle. Calculate the probability that pressure falls into the intersection of corresponding intervals.

Solução

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}')

Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 4. Capítulo 5
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}')

Pergunte à IA

expand
ChatGPT

Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo

some-alt