Stan Math Library  2.20.0
reverse mode automatic differentiation
inc_beta_ddz.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_PRIM_SCAL_FUN_INC_BETA_DERIVATIVES_HPP
2 #define STAN_MATH_PRIM_SCAL_FUN_INC_BETA_DERIVATIVES_HPP
3 
6 #include <boost/math/special_functions/beta.hpp>
7 #include <cmath>
8 
9 namespace stan {
10 namespace math {
11 
26 template <typename T>
27 T inc_beta_ddz(T a, T b, T z) {
28  using std::exp;
29  using std::log;
30  return exp((b - 1) * log(1 - z) + (a - 1) * log(z) + lgamma(a + b) - lgamma(a)
31  - lgamma(b));
32 }
33 
34 template <>
35 inline double inc_beta_ddz(double a, double b, double z) {
36  using boost::math::ibeta_derivative;
37  return ibeta_derivative(a, b, z);
38 }
39 
40 } // namespace math
41 } // namespace stan
42 #endif
fvar< T > lgamma(const fvar< T > &x)
Return the natural logarithm of the gamma function applied to the specified argument.
Definition: lgamma.hpp:21
fvar< T > log(const fvar< T > &x)
Definition: log.hpp:12
T inc_beta_ddz(T a, T b, T z)
Returns the partial derivative of the regularized incomplete beta function, I_{z}(a, b) with respect to z.
fvar< T > exp(const fvar< T > &x)
Definition: exp.hpp:11

     [ Stan Home Page ] © 2011–2018, Stan Development Team.