27 #ifndef gammaDistribution_hpp
28 #define gammaDistribution_hpp
50 template<
typename realT>
57 realT d = pow(q,
k) * tgamma<realT>(
k);
59 if(!std::isnormal(d))
return std::numeric_limits<realT>::max();
65 return std::numeric_limits<realT>::max();
78 template<
typename realT>
86 if(x - x0 < 0)
return 0;
88 realT v = pow(x-x0,
k-1) * exp( -(x-x0)/q) / denom;
90 if(!std::isnormal(v))
return 0;
105 template<
typename realT>
113 return gammaDistribution<realT>(x, x0,
k, q, gammaDistributionDenom<realT>(
k,q));
125 template<
typename realT>
143 template<
typename realT>
149 if(
k >= 1)
return x0 + (
k-1)*theta;
163 template<
typename realT>
168 return k*theta*theta;
Declares and defines the gamma function.
constexpr units::realT k()
Boltzmann Constant.
realT gammaDistributionMode(realT x0, realT k, realT theta)
The mode of the Gamma Distribution.
realT gammaDistributionDenom(realT k, realT q)
The denominator of the Gamma Distribution.
realT gammaDistributionVariance(realT k, realT theta)
The variance of the Gamma Distribution.
realT gammaDistribution(realT x, realT x0, realT k, realT q)
The general shifted Gamma Distribution at a point.
realT gammaDistributionMean(realT x0, realT k, realT theta)
The mean of the Gamma Distribution.