rgsl/
gamma_beta.rs

1//
2// A rust binding for the GSL library by Guillaume Gomez (guillaume1.gomez@gmail.com)
3//
4
5//! This following routines compute the gamma and beta functions in their full and incomplete forms, as well as various kinds of factorials.
6
7/// The Gamma function is defined by the following integral,
8///
9/// \Gamma(x) = \int_0^\infty dt  t^{x-1} \exp(-t)
10///
11/// It is related to the factorial function by \Gamma(n)=(n-1)! for positive integer n.
12/// Further information on the Gamma function can be found in Abramowitz & Stegun, Chapter 6.
13pub mod gamma {
14    use crate::{types, Value};
15    use std::mem::MaybeUninit;
16
17    /// These routines compute the Gamma function \Gamma(x), subject to x not being a negative integer or zero. The function is computed using the real Lanczos method.
18    /// The maximum value of x such that \Gamma(x) is not considered an overflow is given by the macro GSL_SF_GAMMA_XMAX and is 171.0.
19    #[doc(alias = "gsl_sf_gamma")]
20    pub fn gamma(x: f64) -> f64 {
21        unsafe { sys::gsl_sf_gamma(x) }
22    }
23
24    /// This routine provides an exponential function \exp(x) using GSL semantics and error checking.
25    #[doc(alias = "gsl_sf_gamma_e")]
26    pub fn gamma_e(x: f64) -> Result<types::Result, Value> {
27        let mut result = MaybeUninit::<sys::gsl_sf_result>::uninit();
28        let ret = unsafe { sys::gsl_sf_gamma_e(x, result.as_mut_ptr()) };
29
30        result_handler!(ret, unsafe { result.assume_init() }.into())
31    }
32
33    /// This routine computes the Gamma function \Gamma(x), subject to x not being a negative integer or zero.
34    /// The function is computed using the real Lanczos method. The maximum value of x such that \Gamma(x) is not considered an overflow is given by the macro GSL_SF_GAMMA_XMAX and is 171.0.
35    #[doc(alias = "gsl_sf_lngamma")]
36    pub fn lngamma(x: f64) -> f64 {
37        unsafe { sys::gsl_sf_lngamma(x) }
38    }
39
40    /// This routine computes the Gamma function \Gamma(x), subject to x not being a negative integer or zero.
41    /// The function is computed using the real Lanczos method. The maximum value of x such that \Gamma(x) is not considered an overflow is given by the macro GSL_SF_GAMMA_XMAX and is 171.0.
42    #[doc(alias = "gsl_sf_lngamma_e")]
43    pub fn lngamma_e(x: f64) -> Result<types::Result, Value> {
44        let mut result = MaybeUninit::<sys::gsl_sf_result>::uninit();
45        let ret = unsafe { sys::gsl_sf_lngamma_e(x, result.as_mut_ptr()) };
46
47        result_handler!(ret, unsafe { result.assume_init() }.into())
48    }
49
50    /// This routine computes the sign of the gamma function and the logarithm of its magnitude, subject to x not being a negative integer or zero.
51    /// The function is computed using the real Lanczos method.
52    /// The value of the gamma function and its error can be reconstructed using the relation \Gamma(x) = sgn * \exp(result\_lg), taking into account the two components of result_lg.
53    #[doc(alias = "gsl_sf_lngamma_sgn_e")]
54    pub fn lngamma_sgn_e(x: f64, sgn: &mut f64) -> Result<types::Result, Value> {
55        let mut result = MaybeUninit::<sys::gsl_sf_result>::uninit();
56        let ret = unsafe { sys::gsl_sf_lngamma_sgn_e(x, result.as_mut_ptr(), sgn) };
57
58        result_handler!(ret, unsafe { result.assume_init() }.into())
59    }
60
61    /// This routine computes the regulated Gamma Function \Gamma^*(x) for x > 0. The regulated gamma function is given by,
62    ///
63    /// ```latex
64    /// \Gamma^*(x) = \Gamma(x)/(\sqrt{2\pi} x^{(x-1/2)} \exp(-x))
65    ///
66    ///             = (1 + (1/12x) + ...)  for x to infty
67    /// ```
68    ///
69    /// and is a useful suggestion of Temme.
70    #[doc(alias = "gsl_sf_gammastar")]
71    pub fn gammastar(x: f64) -> f64 {
72        unsafe { sys::gsl_sf_gammastar(x) }
73    }
74
75    /// This routine computes the regulated Gamma Function \Gamma^*(x) for x > 0. The regulated gamma function is given by,
76    ///
77    /// ```latex
78    /// \Gamma^*(x) = \Gamma(x)/(\sqrt{2\pi} x^{(x-1/2)} \exp(-x))
79    ///
80    ///             = (1 + (1/12x) + ...)  for x to infty
81    /// ```
82    ///
83    /// and is a useful suggestion of Temme.
84    #[doc(alias = "gsl_sf_gammastar_e")]
85    pub fn gammastar_e(x: f64) -> Result<types::Result, Value> {
86        let mut result = MaybeUninit::<sys::gsl_sf_result>::uninit();
87        let ret = unsafe { sys::gsl_sf_gammastar_e(x, result.as_mut_ptr()) };
88
89        result_handler!(ret, unsafe { result.assume_init() }.into())
90    }
91
92    /// This routine computes the reciprocal of the gamma function, 1/\Gamma(x) using the real Lanczos method.
93    #[doc(alias = "gsl_sf_gammainv")]
94    pub fn gammainv(x: f64) -> f64 {
95        unsafe { sys::gsl_sf_gammainv(x) }
96    }
97
98    /// This routine computes the reciprocal of the gamma function, 1/\Gamma(x) using the real Lanczos method.
99    #[doc(alias = "gsl_sf_gammainv_e")]
100    pub fn gammainv_e(x: f64) -> Result<types::Result, Value> {
101        let mut result = MaybeUninit::<sys::gsl_sf_result>::uninit();
102        let ret = unsafe { sys::gsl_sf_gammainv_e(x, result.as_mut_ptr()) };
103
104        result_handler!(ret, unsafe { result.assume_init() }.into())
105    }
106
107    /// This routine computes \log(\Gamma(z)) for complex z=z_r+i z_i and z not a negative integer or zero, using the complex Lanczos method.
108    /// The returned parameters are lnr = \log|\Gamma(z)| and arg = \arg(\Gamma(z)) in (-\pi,\pi]. Note that the phase part (arg) is not well-determined when |z| is very large, due to inevitable roundoff in restricting to (-\pi,\pi].
109    /// This will result in a GSL_ELOSS error when it occurs. The absolute value part (lnr), however, never suffers from loss of precision.
110    #[doc(alias = "gsl_sf_lngamma_complex_e")]
111    pub fn lngamma_complex_e(zr: f64, zi: f64) -> Result<(types::Result, types::Result), Value> {
112        let mut lnr = MaybeUninit::<sys::gsl_sf_result>::uninit();
113        let mut arg = MaybeUninit::<sys::gsl_sf_result>::uninit();
114        let ret =
115            unsafe { sys::gsl_sf_lngamma_complex_e(zr, zi, lnr.as_mut_ptr(), arg.as_mut_ptr()) };
116
117        result_handler!(
118            ret,
119            (
120                unsafe { lnr.assume_init() }.into(),
121                unsafe { arg.assume_init() }.into(),
122            )
123        )
124    }
125}
126
127/// Although factorials can be computed from the Gamma function, using the relation n! = \Gamma(n+1) for non-negative integer n, it is usually more
128/// efficient to call the functions in this section, particularly for small values of n, whose factorial values are maintained in hardcoded tables.
129pub mod factorials {
130    use crate::{types, Value};
131    use std::mem::MaybeUninit;
132
133    /// This routine computes the factorial n!. The factorial is related to the Gamma function by n! = \Gamma(n+1).
134    /// The maximum value of n such that n! is not considered an overflow is given by the macro SF_FACT_NMAX and is 170.
135    #[doc(alias = "gsl_sf_fact")]
136    pub fn fact(n: u32) -> f64 {
137        unsafe { sys::gsl_sf_fact(n) }
138    }
139
140    /// This routine computes the factorial n!. The factorial is related to the Gamma function by n! = \Gamma(n+1).
141    /// The maximum value of n such that n! is not considered an overflow is given by the macro SF_FACT_NMAX and is 170.
142    #[doc(alias = "gsl_sf_fact_e")]
143    pub fn fact_e(n: u32) -> Result<types::Result, Value> {
144        let mut result = MaybeUninit::<sys::gsl_sf_result>::uninit();
145        let ret = unsafe { sys::gsl_sf_fact_e(n, result.as_mut_ptr()) };
146
147        result_handler!(ret, unsafe { result.assume_init() }.into())
148    }
149
150    /// This routine computes the double factorial n!! = n(n-2)(n-4) \dots.
151    /// The maximum value of n such that n!! is not considered an overflow is given by the macro SF_DOUBLEFACT_NMAX and is 297.
152    #[doc(alias = "gsl_sf_doublefact")]
153    pub fn doublefact(n: u32) -> f64 {
154        unsafe { sys::gsl_sf_doublefact(n) }
155    }
156
157    /// This routine computes the double factorial n!! = n(n-2)(n-4) \dots.
158    /// The maximum value of n such that n!! is not considered an overflow is given by the macro SF_DOUBLEFACT_NMAX and is 297.
159    #[doc(alias = "gsl_sf_doublefact_e")]
160    pub fn doublefact_e(n: u32) -> Result<types::Result, Value> {
161        let mut result = MaybeUninit::<sys::gsl_sf_result>::uninit();
162        let ret = unsafe { sys::gsl_sf_doublefact_e(n, result.as_mut_ptr()) };
163
164        result_handler!(ret, unsafe { result.assume_init() }.into())
165    }
166
167    /// This routine computes the logarithm of the factorial of n, \log(n!).
168    /// The algorithm is faster than computing \ln(\Gamma(n+1)) via gsl_sf_lngamma for n < 170, but defers for larger n.
169    #[doc(alias = "gsl_sf_lnfact")]
170    pub fn lnfact(n: u32) -> f64 {
171        unsafe { sys::gsl_sf_lnfact(n) }
172    }
173
174    /// This routine computes the logarithm of the factorial of n, \log(n!).
175    /// The algorithm is faster than computing \ln(\Gamma(n+1)) via gsl_sf_lngamma for n < 170, but defers for larger n.
176    #[doc(alias = "gsl_sf_lnfact_e")]
177    pub fn lnfact_e(n: u32) -> Result<types::Result, Value> {
178        let mut result = MaybeUninit::<sys::gsl_sf_result>::uninit();
179        let ret = unsafe { sys::gsl_sf_lnfact_e(n, result.as_mut_ptr()) };
180
181        result_handler!(ret, unsafe { result.assume_init() }.into())
182    }
183
184    /// This routine computes the logarithm of the double factorial of n, \log(n!!).
185    #[doc(alias = "gsl_sf_lndoublefact")]
186    pub fn lndoublefact(n: u32) -> f64 {
187        unsafe { sys::gsl_sf_lndoublefact(n) }
188    }
189
190    /// This routine computes the logarithm of the double factorial of n, \log(n!!).
191    #[doc(alias = "gsl_sf_lndoublefact_e")]
192    pub fn lndoublefact_e(n: u32) -> Result<types::Result, Value> {
193        let mut result = MaybeUninit::<sys::gsl_sf_result>::uninit();
194        let ret = unsafe { sys::gsl_sf_lndoublefact_e(n, result.as_mut_ptr()) };
195
196        result_handler!(ret, unsafe { result.assume_init() }.into())
197    }
198
199    /// This routine computes the combinatorial factor n choose m = n!/(m!(n-m)!)
200    #[doc(alias = "gsl_sf_choose")]
201    pub fn choose(n: u32, m: u32) -> f64 {
202        unsafe { sys::gsl_sf_choose(n, m) }
203    }
204
205    /// This routine computes the combinatorial factor n choose m = n!/(m!(n-m)!)
206    #[doc(alias = "gsl_sf_choose_e")]
207    pub fn choose_e(n: u32, m: u32) -> Result<types::Result, Value> {
208        let mut result = MaybeUninit::<sys::gsl_sf_result>::uninit();
209        let ret = unsafe { sys::gsl_sf_choose_e(n, m, result.as_mut_ptr()) };
210
211        result_handler!(ret, unsafe { result.assume_init() }.into())
212    }
213
214    /// This routine computes the logarithm of n choose m. This is equivalent to the sum \log(n!) - \log(m!) - \log((n-m)!).
215    #[doc(alias = "gsl_sf_lnchoose")]
216    pub fn lnchoose(n: u32, m: u32) -> f64 {
217        unsafe { sys::gsl_sf_lnchoose(n, m) }
218    }
219
220    /// This routine computes the logarithm of n choose m. This is equivalent to the sum \log(n!) - \log(m!) - \log((n-m)!).
221    #[doc(alias = "gsl_sf_lnchoose_e")]
222    pub fn lnchoose_e(n: u32, m: u32) -> Result<types::Result, Value> {
223        let mut result = MaybeUninit::<sys::gsl_sf_result>::uninit();
224        let ret = unsafe { sys::gsl_sf_lnchoose_e(n, m, result.as_mut_ptr()) };
225
226        result_handler!(ret, unsafe { result.assume_init() }.into())
227    }
228
229    /// This routine computes the Taylor coefficient x^n / n! for x >= 0, n >= 0.
230    #[doc(alias = "gsl_sf_taylorcoeff")]
231    pub fn taylorcoeff(n: i32, x: f64) -> f64 {
232        unsafe { sys::gsl_sf_taylorcoeff(n, x) }
233    }
234
235    /// This routine computes the Taylor coefficient x^n / n! for x >= 0, n >= 0.
236    #[doc(alias = "gsl_sf_taylorcoeff_e")]
237    pub fn taylorcoeff_e(n: i32, x: f64) -> Result<types::Result, Value> {
238        let mut result = MaybeUninit::<sys::gsl_sf_result>::uninit();
239        let ret = unsafe { sys::gsl_sf_taylorcoeff_e(n, x, result.as_mut_ptr()) };
240
241        result_handler!(ret, unsafe { result.assume_init() }.into())
242    }
243}
244
245pub mod pochhammer_symbol {
246    use crate::{types, Value};
247    use std::mem::MaybeUninit;
248
249    /// This routine computes the Pochhammer symbol (a)_x = \Gamma(a + x)/\Gamma(a).
250    /// The Pochhammer symbol is also known as the Apell symbol and sometimes written as (a,x).
251    /// When a and a+x are negative integers or zero, the limiting value of the ratio is returned.
252    #[doc(alias = "gsl_sf_poch")]
253    pub fn poch(a: f64, x: f64) -> f64 {
254        unsafe { sys::gsl_sf_poch(a, x) }
255    }
256
257    /// This routine computes the Pochhammer symbol (a)_x = \Gamma(a + x)/\Gamma(a).
258    /// The Pochhammer symbol is also known as the Apell symbol and sometimes written as (a,x).
259    /// When a and a+x are negative integers or zero, the limiting value of the ratio is returned.
260    #[doc(alias = "gsl_sf_poch_e")]
261    pub fn poch_e(a: f64, x: f64) -> Result<types::Result, Value> {
262        let mut result = MaybeUninit::<sys::gsl_sf_result>::uninit();
263        let ret = unsafe { sys::gsl_sf_poch_e(a, x, result.as_mut_ptr()) };
264
265        result_handler!(ret, unsafe { result.assume_init() }.into())
266    }
267
268    /// This routine computes the logarithm of the Pochhammer symbol, \log((a)_x) = \log(\Gamma(a + x)/\Gamma(a)).
269    #[doc(alias = "gsl_sf_lnpoch")]
270    pub fn lnpoch(a: f64, x: f64) -> f64 {
271        unsafe { sys::gsl_sf_lnpoch(a, x) }
272    }
273
274    /// This routine computes the logarithm of the Pochhammer symbol, \log((a)_x) = \log(\Gamma(a + x)/\Gamma(a)).
275    #[doc(alias = "gsl_sf_lnpoch_e")]
276    pub fn lnpoch_e(a: f64, x: f64) -> Result<types::Result, Value> {
277        let mut result = MaybeUninit::<sys::gsl_sf_result>::uninit();
278        let ret = unsafe { sys::gsl_sf_lnpoch_e(a, x, result.as_mut_ptr()) };
279
280        result_handler!(ret, unsafe { result.assume_init() }.into())
281    }
282
283    /// These routines compute the sign of the Pochhammer symbol and the logarithm of its magnitude.
284    /// The computed parameters are result = \log(|(a)_x|) with a corresponding error term, and sgn = \sgn((a)_x) where (a)_x = \Gamma(a + x)/\Gamma(a).
285    #[doc(alias = "gsl_sf_lnpoch_sgn_e")]
286    pub fn lnpoch_sgn_e(a: f64, x: f64, sgn: &mut f64) -> Result<types::Result, Value> {
287        let mut result = MaybeUninit::<sys::gsl_sf_result>::uninit();
288        let ret = unsafe { sys::gsl_sf_lnpoch_sgn_e(a, x, result.as_mut_ptr(), sgn) };
289
290        result_handler!(ret, unsafe { result.assume_init() }.into())
291    }
292
293    /// This routine computes the relative Pochhammer symbol ((a)_x - 1)/x where (a)_x = \Gamma(a + x)/\Gamma(a).
294    #[doc(alias = "gsl_sf_pochrel")]
295    pub fn pochrel(a: f64, x: f64) -> f64 {
296        unsafe { sys::gsl_sf_pochrel(a, x) }
297    }
298
299    /// This routine computes the relative Pochhammer symbol ((a)_x - 1)/x where (a)_x = \Gamma(a + x)/\Gamma(a).
300    #[doc(alias = "gsl_sf_pochrel_e")]
301    pub fn pochrel_e(a: f64, x: f64) -> Result<types::Result, Value> {
302        let mut result = MaybeUninit::<sys::gsl_sf_result>::uninit();
303        let ret = unsafe { sys::gsl_sf_pochrel_e(a, x, result.as_mut_ptr()) };
304
305        result_handler!(ret, unsafe { result.assume_init() }.into())
306    }
307}
308
309pub mod beta {
310    use crate::{types, Value};
311    use std::mem::MaybeUninit;
312
313    /// This routine computes the Beta Function, B(a,b) = \Gamma(a)\Gamma(b)/\Gamma(a+b) subject to a and b not being negative integers.
314    #[doc(alias = "gsl_sf_beta")]
315    pub fn beta(a: f64, b: f64) -> f64 {
316        unsafe { sys::gsl_sf_beta(a, b) }
317    }
318
319    /// This routine computes the Beta Function, B(a,b) = \Gamma(a)\Gamma(b)/\Gamma(a+b) subject to a and b not being negative integers.
320    #[doc(alias = "gsl_sf_beta_e")]
321    pub fn beta_e(a: f64, b: f64) -> Result<types::Result, Value> {
322        let mut result = MaybeUninit::<sys::gsl_sf_result>::uninit();
323        let ret = unsafe { sys::gsl_sf_beta_e(a, b, result.as_mut_ptr()) };
324
325        result_handler!(ret, unsafe { result.assume_init() }.into())
326    }
327
328    /// This routine computes the logarithm of the Beta Function, \log(B(a,b)) subject to a and b not being negative integers.
329    #[doc(alias = "gsl_sf_lnbeta")]
330    pub fn lnbeta(a: f64, b: f64) -> f64 {
331        unsafe { sys::gsl_sf_lnbeta(a, b) }
332    }
333
334    /// This routine computes the logarithm of the Beta Function, \log(B(a,b)) subject to a and b not being negative integers.
335    #[doc(alias = "gsl_sf_lnbeta_e")]
336    pub fn lnbeta_e(a: f64, b: f64) -> Result<types::Result, Value> {
337        let mut result = MaybeUninit::<sys::gsl_sf_result>::uninit();
338        let ret = unsafe { sys::gsl_sf_lnbeta_e(a, b, result.as_mut_ptr()) };
339
340        result_handler!(ret, unsafe { result.assume_init() }.into())
341    }
342}
343
344pub mod incomplete_gamma {
345    use crate::{types, Value};
346    use std::mem::MaybeUninit;
347
348    /// This routine computes the unnormalized incomplete Gamma Function \Gamma(a,x) = \int_x^\infty dt t^{a-1} \exp(-t) for a real and x >= 0.
349    #[doc(alias = "gsl_sf_gamma_inc")]
350    pub fn gamma_inc(a: f64, x: f64) -> f64 {
351        unsafe { sys::gsl_sf_gamma_inc(a, x) }
352    }
353
354    /// This routine computes the unnormalized incomplete Gamma Function \Gamma(a,x) = \int_x^\infty dt t^{a-1} \exp(-t) for a real and x >= 0.
355    #[doc(alias = "gsl_sf_gamma_inc_e")]
356    pub fn gamma_inc_e(a: f64, x: f64) -> Result<types::Result, Value> {
357        let mut result = MaybeUninit::<sys::gsl_sf_result>::uninit();
358        let ret = unsafe { sys::gsl_sf_gamma_inc_e(a, x, result.as_mut_ptr()) };
359
360        result_handler!(ret, unsafe { result.assume_init() }.into())
361    }
362
363    /// This routine computes the normalized incomplete Gamma Function Q(a,x) = 1/\Gamma(a) \int_x^\infty dt t^{a-1} \exp(-t) for a > 0, x >= 0.
364    #[doc(alias = "gsl_sf_gamma_inc_Q")]
365    pub fn gamma_inc_Q(a: f64, x: f64) -> f64 {
366        unsafe { sys::gsl_sf_gamma_inc_Q(a, x) }
367    }
368
369    /// This routine computes the normalized incomplete Gamma Function Q(a,x) = 1/\Gamma(a) \int_x^\infty dt t^{a-1} \exp(-t) for a > 0, x >= 0.
370    #[doc(alias = "gsl_sf_gamma_inc_Q_e")]
371    pub fn gamma_inc_Q_e(a: f64, x: f64) -> Result<types::Result, Value> {
372        let mut result = MaybeUninit::<sys::gsl_sf_result>::uninit();
373        let ret = unsafe { sys::gsl_sf_gamma_inc_Q_e(a, x, result.as_mut_ptr()) };
374
375        result_handler!(ret, unsafe { result.assume_init() }.into())
376    }
377
378    /// This routine computes the complementary normalized incomplete Gamma Function P(a,x) = 1 - Q(a,x) = 1/\Gamma(a) \int_0^x dt t^{a-1} \exp(-t) for a > 0, x >= 0.
379    ///
380    /// Note that Abramowitz & Stegun call P(a,x) the incomplete gamma function (section 6.5).
381    #[doc(alias = "gsl_sf_gamma_inc_P")]
382    pub fn gamma_inc_P(a: f64, x: f64) -> f64 {
383        unsafe { sys::gsl_sf_gamma_inc_P(a, x) }
384    }
385
386    /// This routine computes the complementary normalized incomplete Gamma Function P(a,x) = 1 - Q(a,x) = 1/\Gamma(a) \int_0^x dt t^{a-1} \exp(-t) for a > 0, x >= 0.
387    ///
388    /// Note that Abramowitz & Stegun call P(a,x) the incomplete gamma function (section 6.5).
389    #[doc(alias = "gsl_sf_gamma_inc_P_e")]
390    pub fn gamma_inc_P_e(a: f64, x: f64) -> Result<types::Result, Value> {
391        let mut result = MaybeUninit::<sys::gsl_sf_result>::uninit();
392        let ret = unsafe { sys::gsl_sf_gamma_inc_P_e(a, x, result.as_mut_ptr()) };
393
394        result_handler!(ret, unsafe { result.assume_init() }.into())
395    }
396}
397
398pub mod incomplete_beta {
399    use crate::{types, Value};
400    use std::mem::MaybeUninit;
401
402    /// This routine computes the normalized incomplete Beta function I_x(a,b)=B_x(a,b)/B(a,b) where B_x(a,b) = \int_0^x t^{a-1} (1-t)^{b-1} dt for 0 <= x <= 1.
403    /// For a > 0, b > 0 the value is computed using a continued fraction expansion.
404    /// For all other values it is computed using the relation I_x(a,b,x) = (1/a) x^a 2F1(a,1-b,a+1,x)/B(a,b).
405    #[doc(alias = "gsl_sf_beta_inc")]
406    pub fn beta_inc(a: f64, b: f64, x: f64) -> f64 {
407        unsafe { sys::gsl_sf_beta_inc(a, b, x) }
408    }
409
410    /// This routine computes the normalized incomplete Beta function I_x(a,b)=B_x(a,b)/B(a,b) where B_x(a,b) = \int_0^x t^{a-1} (1-t)^{b-1} dt for 0 <= x <= 1.
411    /// For a > 0, b > 0 the value is computed using a continued fraction expansion.
412    /// For all other values it is computed using the relation I_x(a,b,x) = (1/a) x^a 2F1(a,1-b,a+1,x)/B(a,b).
413    #[doc(alias = "gsl_sf_beta_inc_e")]
414    pub fn beta_inc_e(a: f64, b: f64, x: f64) -> Result<types::Result, Value> {
415        let mut result = MaybeUninit::<sys::gsl_sf_result>::uninit();
416        let ret = unsafe { sys::gsl_sf_beta_inc_e(a, b, x, result.as_mut_ptr()) };
417
418        result_handler!(ret, unsafe { result.assume_init() }.into())
419    }
420}