/// <summary> /// Convenience method to find a zero of a univariate real function. A default /// solver is used. /// </summary> /// <param name="function"> Function. </param> /// <param name="x0"> Lower bound for the interval. </param> /// <param name="x1"> Upper bound for the interval. </param> /// <param name="absoluteAccuracy"> Accuracy to be used by the solver. </param> /// <returns> a value where the function is zero. </returns> /// <exception cref="NoBracketingException"> if the function has the same sign at the /// endpoints. </exception> /// <exception cref="NullArgumentException"> if {@code function} is {@code null}. </exception> public static double Solve(UnivariateFunction function, double x0, double x1, double absoluteAccuracy) { if (function == null) { throw new ArgumentNullException("LocalizedFormats.FUNCTION"); } UnivariateSolver solver = new BrentSolver(absoluteAccuracy); return(solver.Solve(int.MaxValue, function, x0, x1)); }
/// <summary> /// Convenience method to find a zero of a univariate real function. A default /// solver is used. /// </summary> /// <param name="function"> Function. </param> /// <param name="x0"> Lower bound for the interval. </param> /// <param name="x1"> Upper bound for the interval. </param> /// <param name="absoluteAccuracy"> Accuracy to be used by the solver. </param> /// <returns> a value where the function is zero. </returns> /// <exception cref="NoBracketingException"> if the function has the same sign at the /// endpoints. </exception> /// <exception cref="NullArgumentException"> if {@code function} is {@code null}. </exception> public static double Solve(UnivariateFunction function, double x0, double x1, double absoluteAccuracy) { if (function == null) { throw new NullArgumentException(LocalizedFormats.FUNCTION); } //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final UnivariateSolver solver = new BrentSolver(absoluteAccuracy); UnivariateSolver solver = new BrentSolver(absoluteAccuracy); return(solver.solve(int.MaxValue, function, x0, x1)); }