Commit e3ee204c authored by Alexander Lapshin's avatar Alexander Lapshin

.

parent 6bb51a74
......@@ -5,8 +5,8 @@
template<typename T> double golden_section_search(const T& f, double a, double b, double tol)
{
double invphi = (sqrt(5.0) - 1) / 2.0;
double invphi2 = (3 - sqrt(5.0)) / 2.0;
double invphi = (std::sqrt(5.0) - 1) / 2.0;
double invphi2 = (3 - std::sqrt(5.0)) / 2.0;
a = std::min(a, b);
b = std::max(a, b);
......@@ -17,7 +17,7 @@ template<typename T> double golden_section_search(const T& f, double a, double b
return (a + b) / 2.0;
}
int n = ceil( log(tol/h) / log(invphi) );
int n = ceil( std::log(tol/h) / std::log(invphi) );
double c = a + invphi2 * h;
double d = a + invphi * h;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment