/// <summary>
        /// Prepare for computation.
        /// Subclasses must call this method if they override any of the
        /// <c>solve</c> methods.
        /// </summary>
        /// <param name="maxEval"></param>
        /// <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="startValue">Start value to use.</param>
        /// <exception cref="NullArgumentException"> if f is null</exception>
        protected void setup(int maxEval, FUNC f, double min, double max, double startValue)
        {
            // Checks.
            MathUtils.checkNotNull(f);

            // Reset.
            searchMin   = min;
            searchMax   = max;
            searchStart = startValue;
            function    = f;
            evaluations.setMaximalCount(maxEval);
            evaluations.resetCount();
        }