Exemplo n.º 1
0
        public double Calculate()
        {
            double x1        = -1;
            double x2        = 1;
            double Precision = dane.GetPrecision();

            do
            {
                x1 = x2;
                x2 = x1 - dane.getFunctionInPointX(x1) / dane.getDerivativeInPoint(x1);
                if (Math.Abs(x2 - x1) <= Precision)
                {
                    break;
                }
                if (Math.Abs(dane.getFunctionInPointX(x1)) <= Precision)
                {
                    break;
                }
            } while (true);
            return(Math.Round(x2, 0));
        }