4 #include <utl/MathConstants.h>
5 #include <utl/Vector.h>
7 #include <utl/LambertW.h>
8 #include <utl/Kolmogorov.h>
32 Sign(
const T x,
const boost::integral_constant<bool, false>)
42 Sign(
const T x,
const boost::integral_constant<bool, true>)
44 return (T(0) < x) - (x < T(0));
56 return Sign(x, boost::integral_constant<
bool, std::numeric_limits<T>::is_signed>());
80 template<
typename T, std::
size_t n>
84 Length(
const T (&)[n])
97 return num >= 0 ? num / den : (num - (den - 1)) / den;
105 template<
typename Container>
108 EvalPoly(
const Container&
a,
const double x)
110 auto it = std::crbegin(a);
111 const auto end = std::crend(a);
113 return std::numeric_limits<double>::quiet_NaN();
115 for (++it; it != end; ++it) {
153 EvalPoly(
const std::initializer_list<T>&
a,
const double x)
161 #include <utl/NormalDistribution.h>
171 inline double LogGamma(
const double x) {
return std::lgamma(x); }
240 Fermi(
const double x,
const double x0,
const double sigma)
242 return 1/(1 + std::exp((x - x0)/sigma));
250 double& thetaError,
double& phiError,
double& thetaPhiCorrelation);
259 std::pair<double, double>
262 const double b2 = b *
b;
263 const double fac = 4*a*
c;
264 const double d = b2 - fac;
265 const double sd =
sqrt(d);
267 const double ta = 0.5 /
a;
268 return std::make_pair((-b + sd) * ta, (-b - sd) * ta);
271 const double t = -(b + sd);
272 return std::make_pair(2 * c / t, t / (2 * a));
274 const double t = -b + sd;
275 return std::make_pair(t / (2 * a), 2 * c / t);
double IncompleteGammaQ(const double a, const double x)
Incomplete gamma Q(a, x) = 1 - P(a, x) function.
double IncompleteGammaPCF(const double a, const double x)
Continued Fraction for incomplete gamma function Q(a, x)
double IncompleteGammaP(const double a, const double x)
Incomplete gamma P(a, x) function.
double NormalizeAngleMinusPiPi(const double x)
Normalize angle to lie between -pi and pi (-180 and 180 deg)
constexpr T Sqr(const T &x)
double IncompleteGammaPSeries(const double a, const double x)
logarithm of Gamma function
boost::tuple< double, double, double > Triple
Coordinate triple for easy getting or setting of coordinates.
std::pair< double, double > SolveQuadraticEquation(const double a, const double b, const double c)
double IncompleteBeta(const double a, const double b, const double x)
Incomplete Beta function.
double Fermi(const double x)
void PropagateAxisErrors(const Vector::Triple &u_v_w, const Vector::Triple &sigma_u2_uv_v2, double &thetaError, double &phiError, double &thetaPhiCorrelation)
double LogGamma(const double x)
constexpr std::size_t noexcept
double EvalPoly(const T &a, const double x)
Simple polynomial evaluator.
constexpr int FloorDiv(const int num, const int den)
constexpr int Sign(const T x, const boost::integral_constant< bool, false >)
double Chi2Probability(const double chi2, const double ndof)
double NormalizeAngleZero2Pi(const double x)
Normalize angle to lie between 0 and 2pi (0 and 360 deg)