Ejemplo n.º 1
0
        public static void Test()
        {
            double             min              = -4.0;
            double             max              = 0.0;
            int                maxEval          = 1000;
            UnivariateFunction f1               = (UnivariateFunction) new DelegateUnivariateFunction((Func <double, double>)(x => (x + 3.0) * (x - 1.0) * (x - 1.0)));
            DifferentiableUnivariateFunction f2 = (DifferentiableUnivariateFunction) new DelegateDifferentiableUnivariateFunction((Func <double, double>)(x => (x + 3.0) * (x - 1.0) * (x - 1.0)), (Func <double, double>)(x => 2.0 * (x - 1.0) * (x + 3.0) + (x - 1.0) * (x - 1.0)));

            new BisectionSolver().Solve(maxEval, f1, min, max);
            new BrentSolver().Solve(maxEval, f1, min, max);
            new RegulaFalsiSolver().Solve(maxEval, f1, min, max);
            new IllinoisSolver().Solve(maxEval, f1, min, max);
            new PegasusSolver().Solve(maxEval, f1, min, max);
            new RiddersSolver().Solve(maxEval, f1, min, max);
            new SecantSolver().Solve(maxEval, f1, min, max);
            new MullerSolver().Solve(maxEval, f1, min, max);
            new MullerSolver2().Solve(maxEval, f1, min, max);
            new BracketingNthOrderBrentSolver().Solve(maxEval, f1, min, max);
            new NewtonSolver().Solve(maxEval, f2, min, max);
        }
Ejemplo n.º 2
0
 public UnivariateDifferentiableFunctionAnonymous4(DifferentiableUnivariateFunction f)
 {
     this.f = f;
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Find a zero near the midpoint of {@code min} and {@code max}.
        /// </summary>
        /// <param name="f"> Function to solve. </param>
        /// <param name="min"> Lower bound for the interval. </param>
        /// <param name="max"> Upper bound for the interval. </param>
        /// <param name="maxEval"> Maximum number of evaluations. </param>
        /// <returns> the value where the function is zero. </returns>
        /// <exception cref="org.apache.commons.math3.exception.TooManyEvaluationsException">
        /// if the maximum evaluation count is exceeded. </exception>
        /// <exception cref="org.apache.commons.math3.exception.NumberIsTooLargeException">
        /// if {@code min >= max}. </exception>
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: @Override public double solve(int maxEval, final org.apache.commons.math3.analysis.DifferentiableUnivariateFunction f, final double min, final double max) throws org.apache.commons.math3.exception.TooManyEvaluationsException
        public virtual double Solve(int maxEval, DifferentiableUnivariateFunction f, double min, double max)
        {
            return(base.Solve(maxEval, f, UnivariateSolverUtils.Midpoint(min, max)));
        }
Ejemplo n.º 4
0
 public static UnivariateDifferentiableFunction toUnivariateDifferential(DifferentiableUnivariateFunction f)
 {
     return(new UnivariateDifferentiableFunctionAnonymous4(f));
 }