Template Function otyca::ternary_search_min
Function Documentation
-
template<typename F>
std::tuple<double, double, double> otyca::ternary_search_min(F &&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 second derivative calculation.
- Returns:
Tuple containing the minimizing x, the approximate function value at that x, and the second derivative of the function around the minimizing x