예제 #1
0
        private void ListOfBinomICdf()
        {
            Console.WriteLine("|||\n||  X~b( n , p ) P( X >= r ) [r = 0,..,n]\n|| List of cumulative likelyhoods of AT LEAST rate [r] success':\n" +
                              "|| given the probability of a success [p] among [n] elements: X~b(n,p) P(X=r)\n||");

            CheckValuesForBadness();

            bool longList = DecideListLength();

            int iterationsOfBinomCdf = (int)xVar.number; // number of times the binomCdf() will run; changed if only a non-longList is demanded by user

            int iterationStartingPoint = 0;              // will be 0 if traversing all values; set to xVars My value if going for short list

            //Here is implemented a way of cutting off the list that uses the actual numbers of the
            // xVar - doesn't make much difference... which is cool.
            DetermineIterationDetails(longList, ref iterationsOfBinomCdf, ref iterationStartingPoint);
            for (int i = iterationStartingPoint; i <= iterationsOfBinomCdf; i++)
            {
                double binomICdf = BinomialStochasticVariables.binomICdf(xVar, i);
                //if (binomICdf > 0.0025 && binomICdf < 0.951 | longList)
                //{

                ColorCodeIntervals(binomICdf);
                Console.WriteLine("||| Chance of {0} or more success' = {1}%:\t X~b( {2} , {3} ) P(X >= {0}) = {4} \t\t {5}",
                                  i, 100 * Math.Round(binomICdf, 4), xVar.number, xVar.probability,
                                  Math.Round(binomICdf, 7), Access.Dash(binomICdf /*, 3*/));
                //}
            }
            Console.ResetColor();
            Console.ReadLine();
        }
예제 #2
0
        void CalculateChanceOfNoLessThanRateSuccess()
        {
            Console.WriteLine("|||Calculate the chance of EQUAL TO OR MORE than rate [r] of success: X~b( n , p ) P( X >= r )\n" +
                              "|| given the probability of a success [p] among [n] elements: X~b(n,p) P(X=r)\n||");

            CheckValuesForBadness();
            Rate = FetchRate();

            Console.WriteLine("||\n||| Chance of {0} or more success' = {1}% : X~b( {2} , {3} ) P(X >= {0}) = {4}\n||",
                              Rate, 100 * Math.Round(BinomialStochasticVariables.binomICdf(xVar, Rate), 5), xVar.number, xVar.probability,
                              Math.Round(BinomialStochasticVariables.binomICdf(xVar, Rate), 7));
            Console.WriteLine("|| Enter to continue.");
            Console.ReadLine();
        }