private void ListOfBinomCdf() { Console.WriteLine("|||\n" + "|| List of cumulative likelyhoods of AT MOST rate [r] success': X~b( n , p ) P( X <= r ) [r = 0,..,n]\n" + "|| given the probability [p] of a success among [n] elements: X~b(n,p) P(X=r)\n||"); CheckValuesForBadness(); bool longList = DecideListLength(); for (int i = 0; i <= xVar.number; i++) { double binomCdf = BinomialStochasticVariables.binomCdf(xVar, i); if (binomCdf > 0.0025 && binomCdf < 0.98 | longList) { //Console.ForegroundColor = ConsoleColor.Green; //if ((binomCdf <= 0.05)) { Console.ForegroundColor = ConsoleColor.DarkRed; } //if ((binomCdf >= 0.95)) { Console.ForegroundColor = ConsoleColor.DarkYellow; } ColorCodeIntervals(binomCdf); Console.WriteLine("||| Chance of {0} or less success' = {1}%:\t X~b( {2} , {3} ) P(X <= {0}) = {4} \t\t {5}", i, 100 * Math.Round(binomCdf, 4), xVar.number, xVar.probability, Math.Round(binomCdf, 5), Access.Dash(binomCdf /*, 4*/)); if (binomCdf > 0.9999) { break; } } } Console.ResetColor(); Console.ReadLine(); }
void CalculateChanceOfAtLeastRateSuccess() { Console.WriteLine("|||Calculate the probability of EQUAL OR LESS than rate [r] of success: X~b( n , p ) P( X <= r )\n" + "|| given the probability [p] of a success among [n] elements: X~b(n,p) P(X=r)\n||"); CheckValuesForBadness(); Rate = FetchRate(); Console.WriteLine("||\n||| Chance of no more than {0} success' = {1}% : X~b( {2} , {3} ) P(X <= {0}) = {4}\n||", Rate, 100 * Math.Round(BinomialStochasticVariables.binomCdf(xVar, Rate), 5), xVar.number, xVar.probability, Math.Round(BinomialStochasticVariables.binomCdf(xVar, Rate), 5)); Console.WriteLine("|| Enter to continue."); Console.ReadLine(); }