About stdlib...
We believe in a future in which the web is a preferred environment for numerical computation. To help realize this future, we've built stdlib. stdlib is a standard library, with an emphasis on numerical and scientific computation, written in JavaScript (and C) for execution in browsers and in Node.js.
The library is fully decomposable, being architected in such a way that you can swap out and mix and match APIs and functionality to cater to your exact preferences and use cases.
When you use stdlib, you can be absolutely certain that you are using the most thorough, rigorous, well-written, studied, documented, tested, measured, and high-quality code out there.
To join us in bringing numerical computing to the web, get started by checking us out on GitHub, and please consider financially supporting stdlib. We greatly appreciate your continued support!
Inverse of the lower incomplete beta function.
The function computes the inverse of the lower regularized incomplete beta function. This is a kernel function used internally by higher-level inverse beta function implementations.
npm install @stdlib/math-base-special-kernel-betaincinvAlternatively,
- To load the package in a website via a
scripttag without installation and bundlers, use the ES Module available on theesmbranch (see README). - If you are using Deno, visit the
denobranch (see README for usage intructions). - For use in Observable, or in browser/node environments, use the Universal Module Definition (UMD) build available on the
umdbranch (see README).
The branches.md file summarizes the available branches and displays a diagram illustrating their relationships.
To view installation and usage instructions specific to each branch build, be sure to explicitly navigate to the respective README files on each branch, as linked to above.
var kernelBetaincinv = require( '@stdlib/math-base-special-kernel-betaincinv' );Inverts the lower regularized incomplete beta function at a > 0 and b > 0. Input probabilities p and q must satisfy p = 1 - q. The function returns a two-element array holding the function value y and 1-y.
var y = kernelBetaincinv( 3.0, 3.0, 0.2, 0.8 );
// returns [ ~0.327, ~0.673 ]
y = kernelBetaincinv( 3.0, 3.0, 0.4, 0.6 );
// returns [ ~0.446, ~0.554 ]
y = kernelBetaincinv( 1.0, 6.0, 0.4, 0.6 );
// returns [ ~0.082, ~0.918 ]
y = kernelBetaincinv( 1.0, 6.0, 0.8, 0.2 );
// returns [ ~0.235, ~0.765 ]var randu = require( '@stdlib/random-base-randu' );
var EPS = require( '@stdlib/constants-float64-eps' );
var kernelBetaincinv = require( '@stdlib/math-base-special-kernel-betaincinv' );
var out;
var i;
var p;
var a;
var b;
for ( i = 0; i < 100; i++ ) {
p = randu();
a = ( randu() * 10.0 ) + EPS;
b = ( randu() * 10.0 ) + EPS;
out = kernelBetaincinv( a, b, p, 1.0-p );
console.log( 'p: %d, \t a: %d, \t b: %d, \t y: %d, \t 1-y: %d', p.toFixed( 4 ), a.toFixed( 4 ), b.toFixed( 4 ), out[ 0 ].toFixed( 4 ), out[ 1 ].toFixed( 4 ) );
}#include "stdlib/math/base/special/kernel_betaincinv.h"Computes the inverse of the lower incomplete beta function.
double out1;
double out2;
stdlib_base_kernel_betaincinv( 3.0, 3.0, 0.2, 0.8, &out1, &out2 );The function accepts the following arguments:
- a:
[in] doublefirst function parameter (a positive number). - b:
[in] doublesecond function parameter (a positive number). - p:
[in] doubleprobability. - q:
[in] doubleprobability equal to1-p. - out1:
[out] double*destination pointer to store the function valuey. - out2:
[out] double*destination pointer to store1-y.
void stdlib_base_kernel_betaincinv( const double a, const double b, const double p, const double q, double *out1, double *out2 );#include "stdlib/math/base/special/kernel_betaincinv.h"
#include "stdlib/constants/float64/eps.h"
#include "stdlib/random/base/randu.h"
#include <stdio.h>
#include <stdint.h>
int main( void ) {
struct BasePRNGObject *obj = stdlib_base_random_randu_allocate( 0 );
double out1;
double out2;
int32_t i;
double p;
double a;
double b;
for ( i = 0; i < 100; i++ ) {
p = stdlib_base_random_randu( obj );
a = ( stdlib_base_random_randu( obj ) * 10.0 ) + STDLIB_CONSTANT_FLOAT64_EPS;
b = ( stdlib_base_random_randu( obj ) * 10.0 ) + STDLIB_CONSTANT_FLOAT64_EPS;
stdlib_base_kernel_betaincinv( a, b, p, 1.0-p, &out1, &out2 );
printf( "p: %lf, a: %lf, b: %lf, y: %lf, 1-y: %lf\n", p, a, b, out1, out2 );
}
stdlib_base_random_randu_free( obj );
}@stdlib/math-base/special/betaincinv: inverse incomplete beta function.
This package is part of stdlib, a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.
For more information on the project, filing bug reports and feature requests, and guidance on how to develop stdlib, see the main project repository.
Copyright © 2016-2026. The Stdlib Authors.