negative binomialverteilung
-
MathGenie123
- User
- Beiträge: 43
- Registriert: Montag 18. April 2022, 13:13
Verwenden Sie SciPy Stats um eine Frage zur negativen Binomialverteilung zu beantworten. Die negative Binomialverteilung tritt auf, wenn wir ein Bernoulli-Experiment wiederholt durchführen, und nun fragen, wie oft wir das tun müssen, bis wir wenigstens k mal Erfolg haben.Zur Erinnerung: Bei der Binomialverteilung fragt man für feste Anzahl n an Bernoulli-Experimenten nach der Wahrscheinlichkeit für k Erfolge. Bei der Negativ binomialver-teilung fragt man für feste Anzahl der Erfolge k nach der Anzahl n an Bernoulli-Experimenten .Wir betrachten das Experiment eines fairen Münzwurfs und interessieren uns dafür,wenigstens zwei Mal ’Zahl’ (Erfolg) zu werfen. Berechnen Sie die Wahrscheinlichkeit,dass dafür mehr als 5 Münzwürfe erforderlich sind
- __blackjack__
- User
- Beiträge: 14330
- Registriert: Samstag 2. Juni 2018, 10:21
- Wohnort: 127.0.0.1
- Kontaktdaten:
@MathGenie123: Das ist aber nett, dass Du Dir Aufgaben ausdenkst. Wo kann man denn Deine Musterlösung dazu einsehen? 
„Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.“ — Brian W. Kernighan
- __blackjack__
- User
- Beiträge: 14330
- Registriert: Samstag 2. Juni 2018, 10:21
- Wohnort: 127.0.0.1
- Kontaktdaten:
Stimmt natürlich.
Code: Alles auswählen
#!/usr/bin/env python3
from random import randint
def main():
repetition_count = 1_000_000
print(
sum(
sum(randint(0, 1) for _ in range(5)) < 2
for _ in range(repetition_count)
)
/ repetition_count
)
if __name__ == "__main__":
main()„Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.“ — Brian W. Kernighan
