1 #ifndef STAN__AGRAD__REV__FUNCTIONS__IBETA_HPP
2 #define STAN__AGRAD__REV__FUNCTIONS__IBETA_HPP
4 #include <boost/math/special_functions/digamma.hpp>
5 #include <boost/math/special_functions/gamma.hpp>
25 double ibeta_hypergeometric_helper(
double a,
double b,
double z,
double precision=1
e-8,
double max_steps=1000) {
39 class ibeta_vvv_vari :
public op_vvv_vari {
41 ibeta_vvv_vari(vari* avi, vari* bvi, vari* xvi) :
42 op_vvv_vari(stan::math::
ibeta(avi->val_,bvi->val_,xvi->val_),avi,bvi,xvi) {
45 double a = avi_->val_;
46 double b = bvi_->val_;
47 double c = cvi_->val_;
56 using stan::agrad::ibeta_hypergeometric_helper;
64 boost::math::ibeta_derivative(a,b,c);
67 class ibeta_vvd_vari :
public op_vvd_vari {
69 ibeta_vvd_vari(vari* avi, vari* bvi,
double x) :
70 op_vvd_vari(stan::math::
ibeta(avi->val_,bvi->val_,x),avi,bvi,x) {
73 double a = avi_->val_;
74 double b = bvi_->val_;
84 using stan::agrad::ibeta_hypergeometric_helper;
93 class ibeta_vdv_vari :
public op_vdv_vari {
95 ibeta_vdv_vari(vari* avi,
double b, vari* xvi) :
96 op_vdv_vari(stan::math::
ibeta(avi->val_,b,xvi->val_),avi,b,xvi) {
99 double a = avi_->val_;
101 double c = cvi_->val_;
110 using stan::agrad::ibeta_hypergeometric_helper;
115 boost::math::ibeta_derivative(a,b,c);
118 class ibeta_vdd_vari :
public op_vdd_vari {
120 ibeta_vdd_vari(vari* avi,
double b,
double x) :
121 op_vdd_vari(stan::math::
ibeta(avi->val_,b,x),avi,b,x) {
124 double a = avi_->val_;
135 using stan::agrad::ibeta_hypergeometric_helper;
141 class ibeta_dvv_vari :
public op_dvv_vari {
143 ibeta_dvv_vari(
double a, vari* bvi, vari* xvi) :
144 op_dvv_vari(stan::math::
ibeta(a,bvi->val_,xvi->val_),a,bvi,xvi) {
148 double b = bvi_->val_;
149 double c = cvi_->val_;
158 using stan::agrad::ibeta_hypergeometric_helper;
163 boost::math::ibeta_derivative(a,b,c);
166 class ibeta_dvd_vari :
public op_dvd_vari {
168 ibeta_dvd_vari(
double a, vari* bvi,
double x) :
169 op_dvd_vari(stan::math::
ibeta(a,bvi->val_,x),a,bvi,x) {
173 double b = bvi_->val_;
183 using stan::agrad::ibeta_hypergeometric_helper;
189 class ibeta_ddv_vari :
public op_ddv_vari {
191 ibeta_ddv_vari(
double a,
double b, vari* xvi) :
192 op_ddv_vari(stan::math::
ibeta(a,b,xvi->val_),a,b,xvi) {
197 double c = cvi_->val_;
200 boost::math::ibeta_derivative(a,b,c);
fvar< T > sin(const fvar< T > &x)
double ibeta(const double a, const double b, const double x)
The normalized incomplete beta function of a, b, and x.
fvar< T > tgamma(const fvar< T > &x)
fvar< T > pow(const fvar< T > &x1, const fvar< T > &x2)
vari * vi_
Pointer to the implementation of this variable.
var ibeta(const var &a, const var &b, const var &x)
The normalized incomplete beta function of a, b, and x.
fvar< T > abs(const fvar< T > &x)
Independent (input) and dependent (output) variables for gradients.
double e()
Return the base of the natural logarithm.
fvar< T > digamma(const fvar< T > &x)
int isnan(const stan::agrad::var &a)
Checks if the given number is NaN.
double pi()
Return the value of pi.
fvar< T > log(const fvar< T > &x)