@@ -41,7 +41,7 @@ P( x, a ) = \frac{\gamma(a,x)}{\Gamma(a)} = \frac{1}{\Gamma(a)} \int_0^x t^{a-1}
41
41
42
42
Specifically, for given ` p ` and ` a ` it finds the ` x ` such that ` p = P(x, a) ` .
43
43
44
- The function can also be used to invert the upper incomplete gamma function, which is defined as follows:
44
+ The function can also be used to invert the upper incomplete gamma function, which is defined as follows:
45
45
46
46
<!-- <equation class="equation" label="eq:upper_incomplete_gamma" align="center" raw="Q( x, a ) = \frac{\Gamma(a,x)}{\Gamma(a)} = \frac{1}{\Gamma(a)} \int_x^\infty t^{a-1} e^{-t} \; dt" alt="Regularized upper incomplete gamma function."> -->
47
47
@@ -119,18 +119,17 @@ y = gammaincinv( -0.5, 1.0 );
119
119
<!-- eslint no-undef: "error" -->
120
120
121
121
``` javascript
122
- var randu = require ( ' @stdlib/random/base/randu' );
122
+ var uniform = require ( ' @stdlib/random/array/uniform' );
123
+ var logEachMap = require ( ' @stdlib/console/log-each-map' );
123
124
var gammaincinv = require ( ' @stdlib/math/base/special/gammaincinv' );
124
125
125
- var a;
126
- var i;
127
- var p;
126
+ var opts = {
127
+ ' dtype' : ' float64'
128
+ };
129
+ var p = uniform ( 100 , 0.0 , 1.0 , opts );
130
+ var a = uniform ( 100 , 0.0 , 50.0 , opts );
128
131
129
- for ( i = 0 ; i < 100 ; i++ ) {
130
- p = randu ();
131
- a = randu () * 50.0 ;
132
- console .log ( ' p: %d, \t a: %d, \t P^(-1)(p, a): %d' , p .toFixed ( 4 ), a .toFixed ( 4 ), gammaincinv ( p, a ).toFixed ( 4 ) );
133
- }
132
+ logEachMap ( ' p: %0.4f, \t a: %0.4f, \t P^(-1)(p, a): %0.4f' , p, a, gammaincinv );
134
133
```
135
134
136
135
</section >
0 commit comments