Esempio n. 1
0
        double Combination(double n, double r)
        {
            double ans    = 0;
            double divide = n - r;

            if (!(divide < 0))
            {
                ans = (DMASSolver.Factorial(n) / (DMASSolver.Factorial(r) * DMASSolver.Factorial(n - r)));
            }
            else
            {
                processError = true;
                ans          = 0;
            }
            return(ans);
        }
Esempio n. 2
0
        //Operations

        double Permutation(double n, double r)
        {
            double ans    = 0;
            double divide = n - r;

            if (!(divide <= 0))
            {
                ans = DMASSolver.Factorial(n) / DMASSolver.Factorial(divide);
            }
            else if (divide == 0)
            {
                ans = DMASSolver.Factorial(n) / 1;
            }
            else
            {
                processError = true;
                ans          = 0;
            }
            return(ans);
        }