Beispiel #1
0
        public static double SumOfPowers(uint index, int power)
        {
            double c   = (double)1 / (power + 1);
            double sum = 0;

            for (int i = 0; i <= power; i++)
            {
                sum += MathTools.NcR(power + 1, i) * MathTools.BrenoulliNumber((uint)i, true) * Math.Pow(index, power + 1 - i);
            }
            return(Math.Round(sum * c));
        }