Arcsine distribution cumulative distribution function (CDF).
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!
[![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url]
[Arcsine][arcsine-distribution] distribution [cumulative distribution function][cdf].
math
F(x) = \frac{2}{\pi} \arcsin \left( \sqrt{\frac{x-a}{b-a}} \right)
a
is the minimum support and b
is the maximum support. The parameters must satisfy a < b
.bash
npm install @stdlib/stats-base-dists-arcsine-cdf
script
tag without installation and bundlers, use the [ES Module][es-module] available on the [esm
][esm-url] branch (see [README][esm-readme]).deno
][deno-url] branch (see [README][deno-readme] for usage intructions).umd
][umd-url] branch (see [README][umd-readme]).javascript
var cdf = require( '@stdlib/stats-base-dists-arcsine-cdf' );
a
(minimum support) and b
(maximum support).javascript
var y = cdf( 9.0, 0.0, 10.0 );
// returns ~0.795
y = cdf( 0.5, 0.0, 2.0 );
// returns ~0.333
y = cdf( -Infinity, 2.0, 4.0 );
// returns 0.0
y = cdf( +Infinity, 2.0, 4.0 );
// returns 1.0
NaN
as any argument, the function returns NaN
.javascript
var y = cdf( NaN, 0.0, 1.0 );
// returns NaN
y = cdf( 0.0, NaN, 1.0 );
// returns NaN
y = cdf( 0.0, 0.0, NaN );
// returns NaN
a >= b
, the function returns NaN
.javascript
var y = cdf( 1.0, 2.5, 2.0 );
// returns NaN
a
(minimum support) and b
(maximum support).javascript
var mycdf = cdf.factory( 0.0, 10.0 );
var y = mycdf( 0.5 );
// returns ~0.144
y = mycdf( 8.0 );
// returns ~0.705
javascript
var uniform = require( '@stdlib/random-array-uniform' );
var logEachMap = require( '@stdlib/console-log-each-map' );
var cdf = require( '@stdlib/stats-base-dists-arcsine-cdf' );
var opts = {
'dtype': 'float64'
};
var x = uniform( 25, -10.0, 10.0, opts );
var a = uniform( x.length, -20.0, 0.0, opts );
var b = uniform( x.length, 0.0, 40.0, opts );
logEachMap( 'x: %0.4f, a: %0.4f, b: %0.4f, F(x;a,b): %0.4f', x, a, b, cdf );
c
#include "stdlib/stats/base/dists/arcsine/cdf.h"
c
double out = stdlib_base_dists_arcsine_cdf( 0.5, 0.0, 2.0 );
// returns ~0.333
[in] double
input value.[in] double
minimum support.[in] double
maximum support.c
double stdlib_base_dists_arcsine_cdf( const double x, const double a, const double b );
c
#include "stdlib/stats/base/dists/arcsine/cdf.h"
#include <stdlib.h>
#include <stdio.h>
static double random_uniform( const double min, const double max ) {
double v = (double)rand() / ( (double)RAND_MAX + 1.0 );
return min + ( v*(max-min) );
}
int main( void ) {
double x;
double a;
double b;
double y;
int i;
for ( i = 0; i < 25; i++ ) {
x = random_uniform( -10.0, 10.0 );
a = random_uniform( -20.0, 0.0 );
b = random_uniform( a, a+40.0 );
y = stdlib_base_dists_arcsine_cdf( x, a, b );
printf( "x: %lf, a: %lf, b: %lf, F(x;a,b): %lf\n", x, a, b, y );
}
}