1 #ifndef STAN_MATH_PRIM_SCAL_FUN_TRIGAMMA_HPP 2 #define STAN_MATH_PRIM_SCAL_FUN_TRIGAMMA_HPP 37 double small = 0.0001;
45 double b4 = -
inv(30.0);
46 double b6 =
inv(42.0);
47 double b8 = -
inv(30.0);
51 if ((x <= 0.0) && (
floor(x) == x)) {
58 if ((x <= 0) && (
floor(x) != x)) {
79 value += 0.5 * y + (1.0 + y * (b2 + y * (b4 + y * (b6 + y * b8)))) / z;
T trigamma_impl(const T &x)
Return the trigamma function applied to the argument.
fvar< T > square(const fvar< T > &x)
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...
fvar< T > inv_square(const fvar< T > &x)
double positive_infinity()
Return positive infinity.
fvar< T > floor(const fvar< T > &x)
double pi()
Return the value of pi.
fvar< T > inv(const fvar< T > &x)