Function otyca::ternary_search_min

Function Documentation

std::tuple<double, double, double> otyca::ternary_search_min(std::function<double(double)> func, double left, double right, double tol, double tol_h)

Performs ternary search to find the minimum of a unimodal function.

Parameters:
  • func – The function to minimize.

  • left – Left bound of the interval.

  • right – Right bound of the interval.

  • tol – Tolerance for x (input).

  • tol_h – Tolerance for function value (output).

Returns:

Tuple containing the minimizing x, the function value at that x, and the midpoint of the final interval.