34 QL_REQUIRE(
d>=0,
"d (" <<
d <<
") must be non negative");
36 "a+d (" <<
a <<
"+" <<
d <<
") must be non negative");
42 Time zeroFirstDerivative = 1.0/
c-
a/
b;
43 if (zeroFirstDerivative>=0.0) {
47 "b (" <<
b <<
") less than " <<
48 -(
d*
c)/std::exp(
c*
a/
b-1.0) <<
": negative function"
49 " value at stationary point " << zeroFirstDerivative);
72 :
a_(aa),
b_(bb),
c_(cc),
d_(dd), abcd_(4), dabcd_(4) {
100 return (zeroFirstDerivative>0.0 ? zeroFirstDerivative : 0.0);
112 Real expcdt = std::exp(-
c_*dt);
113 std::vector<Real> result(4);
115 result[1] =
dibc_ * (1.0 - expcdt);
125 Real expcdt = std::exp(-
c_*dt);
126 std::vector<Real> result(4);
127 result[1] =
b_*
c_/(1.0-expcdt);
128 result[0] =
a_*
c_ -
b_ + result[1]*dt*expcdt;
129 result[0] /= 1.0-expcdt;
static void validate(Real a, Real b, Real c, Real d)
Real definiteIntegral(Time t1, Time t2) const
std::vector< Real > definiteIntegralCoefficients(Time t, Time t2) const
Time maximumLocation() const
time at which the function reaches maximum (if any)
std::vector< Real > abcd_
AbcdMathFunction(Real a=0.002, Real b=0.001, Real c=0.16, Real d=0.0005)
std::vector< Real > dabcd_
Real primitive(Time t) const
std::vector< Real > definiteDerivativeCoefficients(Time t, Time t2) const
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
ext::function< Real(Real)> b
Real Time
continuous quantity with 1-year units