Created
October 8, 2012 20:11
-
-
Save anonymous/3854656 to your computer and use it in GitHub Desktop.
Simple Bayesian estimate of Falcon 9 total failure probability
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env perl | |
use strict; | |
use warnings; | |
my %observed; | |
my %failure; | |
my $total_observed = 0; | |
my $n = 10000; | |
for my $i (0..$n) { | |
my $x = $i/$n; | |
$failure{$x} = probability_of_failure($x); | |
my $o = probability_of_observation($x); | |
$observed{$x} = $o; | |
$total_observed += $o; | |
} | |
my $total_failure = 0; | |
for my $x (keys %observed) { | |
$total_failure += $failure{$x} * $observed{$x} / $total_observed; | |
} | |
print "Estimated failure rate: $total_failure\n"; | |
sub probability_of_observation { | |
my $x = shift; | |
return $x**35 * (1-$x) * 36; | |
} | |
sub probability_of_failure { | |
my $x = shift; | |
return 1 - $x**9 - $x**8 * (1-$x) * 9 - $x**7 * (1-$x)**2 * 36; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment