21 template<
class T,
class F> std::pair<T, T> solveBisection(F f,
28 for (
int i = 0; i < maxIter; i++)
30 x = (lower + upper) * (T) 0.5;
31 if (upper - lower < 2 * err)
41 return std::make_pair(x, (upper - lower) / 2);
47 template<
class T,
class F> std::pair<T, T> solveIteration(F f,
55 for (
int i = 0; i < maxIter; i++)
59 if (abs(x2 - x) < err)
60 return std::make_pair(x2, x2 - x);
63 return std::make_pair(x2, x2 - x);
68 template<
class T,
class F> std::pair<T, T> solveIteration_fixed(F f,
75 for (
int i = 0; i < maxIter; i++)
81 return std::make_pair(x2, x2 - x);