1 #ifndef STAN_MATH_PRIM_SCAL_FUN_TRIGAMMA_HPP 2 #define STAN_MATH_PRIM_SCAL_FUN_TRIGAMMA_HPP 34 double small = 0.0001;
41 double b2 = 1.0 / 6.0;
42 double b4 = -1.0 / 30.0;
43 double b6 = 1.0 / 42.0;
44 double b8 = -1.0 / 30.0;
48 if ((x <= 0.0) && (
floor(x) == x)) {
55 if ((x <= 0) && (
floor(x) != x)) {
70 value += 1.0 / (z * z);
77 value += 0.5 * y + (1.0 + y * (b2 + y * (b4 + y * (b6 + y * b8)))) / z;
128 return trigamma(static_cast<double>(u));
T trigamma_impl(const T &x)
Return the trigamma function applied to the argument.
fvar< T > sin(const fvar< T > &x)
fvar< T > trigamma(const fvar< T > &u)
Return the value of the trigamma function at the specified argument (i.e., the second derivative of t...
double positive_infinity()
Return positive infinity.
fvar< T > floor(const fvar< T > &x)
double pi()
Return the value of pi.