Class UnivariateRealSolverImpl

    • Constructor Detail

      • UnivariateRealSolverImpl

        protected UnivariateRealSolverImpl​(int defaultMaximalIterationCount,
                                           double defaultAbsoluteAccuracy)
        Deprecated.
        Construct a solver with given iteration count and accuracy.
        Parameters:
        defaultAbsoluteAccuracy - maximum absolute error
        defaultMaximalIterationCount - maximum number of iterations
        Throws:
        java.lang.IllegalArgumentException - if f is null or the defaultAbsoluteAccuracy is not valid
    • Method Detail

      • checkResultComputed

        protected void checkResultComputed()
                                    throws java.lang.IllegalStateException
        Deprecated.
        Check if a result has been computed.
        Throws:
        java.lang.IllegalStateException - if no result has been computed
      • getResult

        public double getResult()
        Deprecated.
        Get the result of the last run of the solver.
        Specified by:
        getResult in interface UnivariateRealSolver
        Returns:
        the last result.
      • getFunctionValue

        public double getFunctionValue()
        Deprecated.
        Get the result of the last run of the solver.
        Specified by:
        getFunctionValue in interface UnivariateRealSolver
        Returns:
        the value of the function at the last result.
      • setFunctionValueAccuracy

        public void setFunctionValueAccuracy​(double accuracy)
        Deprecated.
        Set the function value accuracy.

        This is used to determine when an evaluated function value or some other value which is used as divisor is zero.

        This is a safety guard and it shouldn't be necessary to change this in general.

        Specified by:
        setFunctionValueAccuracy in interface UnivariateRealSolver
        Parameters:
        accuracy - the accuracy.
      • resetFunctionValueAccuracy

        public void resetFunctionValueAccuracy()
        Deprecated.
        Reset the actual function accuracy to the default. The default value is provided by the solver implementation.
        Specified by:
        resetFunctionValueAccuracy in interface UnivariateRealSolver
      • solve

        public double solve​(int maxEval,
                            UnivariateRealFunction function,
                            double min,
                            double max)
                     throws ConvergenceException,
                            FunctionEvaluationException
        Deprecated.
        Solve for a zero root in the given interval.

        A solver may require that the interval brackets a single zero root. Solvers that do require bracketing should be able to handle the case where one of the endpoints is itself a root.

        Parameters:
        function - the function to solve.
        min - the lower bound for the interval.
        max - the upper bound for the interval.
        maxEval - Maximum number of evaluations.
        Returns:
        a value where the function is zero
        Throws:
        ConvergenceException - if the maximum iteration count is exceeded or the solver detects convergence problems otherwise.
        FunctionEvaluationException - if an error occurs evaluating the function
        java.lang.IllegalArgumentException - if min > max or the endpoints do not satisfy the requirements specified by the solver
        Since:
        2.2
      • solve

        public double solve​(int maxEval,
                            UnivariateRealFunction function,
                            double min,
                            double max,
                            double startValue)
                     throws ConvergenceException,
                            FunctionEvaluationException,
                            java.lang.IllegalArgumentException
        Deprecated.
        Solve for a zero in the given interval, start at startValue.

        A solver may require that the interval brackets a single zero root. Solvers that do require bracketing should be able to handle the case where one of the endpoints is itself a root.

        Parameters:
        function - the function to solve.
        min - the lower bound for the interval.
        max - the upper bound for the interval.
        startValue - the start value to use
        maxEval - Maximum number of evaluations.
        Returns:
        a value where the function is zero
        Throws:
        ConvergenceException - if the maximum iteration count is exceeded or the solver detects convergence problems otherwise.
        FunctionEvaluationException - if an error occurs evaluating the function
        java.lang.IllegalArgumentException - if min > max or the arguments do not satisfy the requirements specified by the solver
        Since:
        2.2
      • setResult

        protected final void setResult​(double newResult,
                                       int iterationCount)
        Deprecated.
        Convenience function for implementations.
        Parameters:
        newResult - the result to set
        iterationCount - the iteration count to set
      • setResult

        protected final void setResult​(double x,
                                       double fx,
                                       int iterationCount)
        Deprecated.
        Convenience function for implementations.
        Parameters:
        x - the result to set
        fx - the result to set
        iterationCount - the iteration count to set
      • clearResult

        protected final void clearResult()
        Deprecated.
        Convenience function for implementations.
      • isBracketing

        protected boolean isBracketing​(double lower,
                                       double upper,
                                       UnivariateRealFunction function)
                                throws FunctionEvaluationException
        Deprecated.
        Returns true iff the function takes opposite signs at the endpoints.
        Parameters:
        lower - the lower endpoint
        upper - the upper endpoint
        function - the function
        Returns:
        true if f(lower) * f(upper) < 0
        Throws:
        FunctionEvaluationException - if an error occurs evaluating the function at the endpoints
      • isSequence

        protected boolean isSequence​(double start,
                                     double mid,
                                     double end)
        Deprecated.
        Returns true if the arguments form a (strictly) increasing sequence
        Parameters:
        start - first number
        mid - second number
        end - third number
        Returns:
        true if the arguments form an increasing sequence
      • verifyInterval

        protected void verifyInterval​(double lower,
                                      double upper)
        Deprecated.
        Verifies that the endpoints specify an interval, throws IllegalArgumentException if not
        Parameters:
        lower - lower endpoint
        upper - upper endpoint
        Throws:
        java.lang.IllegalArgumentException
      • verifySequence

        protected void verifySequence​(double lower,
                                      double initial,
                                      double upper)
        Deprecated.
        Verifies that lower < initial < upper throws IllegalArgumentException if not
        Parameters:
        lower - lower endpoint
        initial - initial value
        upper - upper endpoint
        Throws:
        java.lang.IllegalArgumentException
      • verifyBracketing

        protected void verifyBracketing​(double lower,
                                        double upper,
                                        UnivariateRealFunction function)
                                 throws FunctionEvaluationException
        Deprecated.
        Verifies that the endpoints specify an interval and the function takes opposite signs at the endpoints, throws IllegalArgumentException if not
        Parameters:
        lower - lower endpoint
        upper - upper endpoint
        function - function
        Throws:
        java.lang.IllegalArgumentException
        FunctionEvaluationException - if an error occurs evaluating the function at the endpoints