示例#1
0
        public static dynamic Variance(dynamic arrayA)
        {
            dynamic theMean      = StatMean.Mean(arrayA);
            int     arrayCount_1 = arrayA.Length;

            dynamic squares     = new Array[0];
            dynamic squareSum   = 0.0;
            dynamic differences = 0.0;

            foreach (dynamic a in arrayA)
            {
                differences = a - theMean;
                squares     = differences * differences;
                squareSum   = (squareSum + squares);
            }

            result = squareSum / arrayCount_1;
            return(result);
        }
示例#2
0
        public static double StandardDeviation(double[] arrayA)
        {
            double theMean      = StatMean.Mean(arrayA);
            int    arrayCount_1 = arrayA.Length;

            double squareSum = 0.0;

            foreach (double a in arrayA)
            {
                double differences = Subtraction.Subtract(a, theMean);
                double squares     = differences * differences;
                squareSum += squares;
            }

            double Result1 = Division.Quotient(squareSum, arrayCount_1);

            result = SquareRoots.Root(Result1);
            return(result);
        }