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

book
Challenge: Solving Task Using Exponential Distribution

Oppgave

Swipe to start coding

The average waiting time for a passing car on a rural road is 10 minutes. What is the probability of waiting more than 15 minutes for the next car if you have just seen another car?

We can solve this task using an exponential distribution. You have to:

  1. Calculate the probability of waiting less than 15 minutes.
  2. Calculate the probability of waiting for the car for more than 15 minutes, taking into account the fact that the sum of the probabilities of all elementary outcomes is always equal to 1.

Løsning

from scipy.stats import expon

# Mean waiting time
mean_waiting_time = 10

# Probability of waiting LESS then 15 minutes
proba_less = expon.cdf(15, scale=mean_waiting_time) - expon.cdf(0, scale=mean_waiting_time)

# Probability of waiting MORE then 15 minutes
probability = 1 - proba_less
# Print the probability
print(f'The probability of waiting more than 15 minutes is {probability:.4f}')

Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 4. Kapittel 3
from scipy.stats import expon

# Mean waiting time
mean_waiting_time = 10

# Probability of waiting LESS then 15 minutes
proba_less = expon.___(15, scale=mean_waiting_time) - expon.cdf(0, scale=___)

# Probability of waiting MORE then 15 minutes
probability = ___ - proba_less
# Print the probability
print(f'The probability of waiting more than 15 minutes is {probability:.4f}')
toggle bottom row
some-alt