예제 #1
0
        private double CalculateCurrentRadical(IRadicalSign radicalSign, double previousRadical)
        {
            double currentRadical;
            var    power = Exponentiation(previousRadical, radicalSign.GetPower() - 1);
            var    a     = 1.0 / radicalSign.GetPower();
            var    b     = (radicalSign.GetPower() - 1.0) * previousRadical + radicalSign.GetNumericalRoot() / power;

            currentRadical = a * b;
            return(currentRadical);
        }
예제 #2
0
        private double ComputeRadicalWithAccuracy(IRadicalSign radicalSign)
        {
            double delta;
            var    step            = 1;
            var    previousRadical = 1.0;
            var    currentRadical  = 1.0;

            do
            {
                if (step > 1)
                {
                    previousRadical = currentRadical;
                }

                xNext = (1.0 / radicalSign.GetPower()) * ((radicalSign.GetPower() - 1.0) * xPrev + radicalSign.GetNumericalRoot() / Exponentiation(xPrev, (radicalSign.GetPower() - 1)));
                step  = 2;
                delta = Math.Abs(xPrev - xNext);
            } while (delta > radicalSign.GetAccuracy());
            return(delta);
        }