38 - ( fs_ + (fs_-fdelta_h_)/(std::pow(s_, k)-1.0));
57 QL_REQUIRE(
t > 1,
"scaling factor must be greater than 1");
60 const Real tk = std::pow(
t,
n_);
67 QL_REQUIRE(
t > 1 &&
s > 1,
"scaling factors must be greater than 1");
75 const Real step = 0.1;
77 Real fr = eqn(left + step), fl = eqn(left);
78 while (fr*fl > 0.0 && left < 15.1) {
81 fr = eqn(left + step);
84 QL_REQUIRE(left < 15.1,
"could not estimate the order of convergence");
86 const Real k =
Brent().
solve(eqn, 1e-8, left+0.5*step, left, left+step);
88 const Real ts = std::pow(
s, k);
template class providing a null value for a given type.
Real solve(const F &f, Real accuracy, Real guess, Real step) const
ext::function< Real(Real)> f_
Classes and functions for error handling.
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified