QLNet.Secant.solveImpl C# (CSharp) Метод

solveImpl() защищенный Метод

protected solveImpl ( QLNet.ISolver1d f, double xAccuracy ) : double
f QLNet.ISolver1d
xAccuracy double
Результат double
        protected override double solveImpl(ISolver1d f, double xAccuracy)
        {
            /* The implementation of the algorithm was inspired by
               Press, Teukolsky, Vetterling, and Flannery,
               "Numerical Recipes in C", 2nd edition, Cambridge
               University Press
            */

            double fl, froot, dx, xl;

            // Pick the bound with the smaller function value
            // as the most recent guess
            if (Math.Abs(fxMin_) < Math.Abs(fxMax_)) {
                root_ = xMin_;
                froot = fxMin_;
                xl = xMax_;
                fl = fxMax_;
            } else {
                root_ = xMax_;
                froot = fxMax_;
                xl = xMin_;
                fl = fxMin_;
            }
            while (evaluationNumber_ <= maxEvaluations_) {
                dx = (xl-root_)*froot/(froot-fl);
                xl = root_;
                fl = froot;
                root_ += dx;
                froot = f.value(root_);
                evaluationNumber_++;
                if (Math.Abs(dx) < xAccuracy || froot == 0.0)
                    return root_;
            }

             throw new ArgumentException("maximum number of function evaluations (" + maxEvaluations_ + ") exceeded");
        }