gdtr.c
Go to the documentation of this file.
1 /* gdtr.c
2  *
3  * Gamma distribution function
4  *
5  *
6  *
7  * SYNOPSIS:
8  *
9  * double a, b, x, y, gdtr();
10  *
11  * y = gdtr( a, b, x );
12  *
13  *
14  *
15  * DESCRIPTION:
16  *
17  * Returns the integral from zero to x of the Gamma probability
18  * density function:
19  *
20  *
21  * x
22  * b -
23  * a | | b-1 -at
24  * y = ----- | t e dt
25  * - | |
26  * | (b) -
27  * 0
28  *
29  * The incomplete Gamma integral is used, according to the
30  * relation
31  *
32  * y = igam( b, ax ).
33  *
34  *
35  * ACCURACY:
36  *
37  * See igam().
38  *
39  * ERROR MESSAGES:
40  *
41  * message condition value returned
42  * gdtr domain x < 0 0.0
43  *
44  */
45  /* gdtrc.c
46  *
47  * Complemented Gamma distribution function
48  *
49  *
50  *
51  * SYNOPSIS:
52  *
53  * double a, b, x, y, gdtrc();
54  *
55  * y = gdtrc( a, b, x );
56  *
57  *
58  *
59  * DESCRIPTION:
60  *
61  * Returns the integral from x to infinity of the Gamma
62  * probability density function:
63  *
64  *
65  * inf.
66  * b -
67  * a | | b-1 -at
68  * y = ----- | t e dt
69  * - | |
70  * | (b) -
71  * x
72  *
73  * The incomplete Gamma integral is used, according to the
74  * relation
75  *
76  * y = igamc( b, ax ).
77  *
78  *
79  * ACCURACY:
80  *
81  * See igamc().
82  *
83  * ERROR MESSAGES:
84  *
85  * message condition value returned
86  * gdtrc domain x < 0 0.0
87  *
88  */
89 
90 /* gdtr() */
91 
92 
93 /*
94  * Cephes Math Library Release 2.3: March,1995
95  * Copyright 1984, 1987, 1995 by Stephen L. Moshier
96  */
97 
98 #include "mconf.h"
99 
100 
101 double gdtr(double a, double b, double x)
102 {
103 
104  if (x < 0.0) {
105  sf_error("gdtr", SF_ERROR_DOMAIN, NULL);
106  return (NAN);
107  }
108  return (igam(b, a * x));
109 }
110 
111 
112 double gdtrc(double a, double b, double x)
113 {
114 
115  if (x < 0.0) {
116  sf_error("gdtrc", SF_ERROR_DOMAIN, NULL);
117  return (NAN);
118  }
119  return (igamc(b, a * x));
120 }
121 
122 
123 double gdtri(double a, double b, double y)
124 {
125 
126  if ((y < 0.0) || (y > 1.0) || (a <= 0.0) || (b < 0.0)) {
127  sf_error("gdtri", SF_ERROR_DOMAIN, NULL);
128  return (NAN);
129  }
130 
131  return (igamci(b, 1.0 - y) / a);
132 }
igamc
double igamc(double a, double x)
Definition: igam.c:169
b
Scalar * b
Definition: benchVecAdd.cpp:17
x
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x
Definition: gnuplot_common_settings.hh:12
igam
double igam(double a, double x)
Definition: igam.c:128
y
Scalar * y
Definition: level1_cplx_impl.h:124
a
ArrayXXi a
Definition: Array_initializer_list_23_cxx11.cpp:1
gdtr
double gdtr(double a, double b, double x)
Definition: gdtr.c:101
mconf.h
sf_error
void sf_error(const char *func_name, sf_error_t code, const char *fmt,...)
Definition: sf_error.c:41
NULL
#define NULL
Definition: ccolamd.c:609
gdtrc
double gdtrc(double a, double b, double x)
Definition: gdtr.c:112
SF_ERROR_DOMAIN
@ SF_ERROR_DOMAIN
Definition: sf_error.h:16
gdtri
double gdtri(double a, double b, double y)
Definition: gdtr.c:123
igamci
double igamci(double a, double q)
Definition: igami.c:301


gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:02:19