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!
Cauchy distribution logarithm of cumulative distribution function.
The cumulative distribution function for a Cauchy random variable is
where x0 is the location parameter and gamma > 0 is the scale parameter.
import logcdf from 'https://cdn.jsdelivr.net/gh/stdlib-js/stats-base-dists-cauchy-logcdf@deno/mod.js';You can also import the following named exports from the package:
import { factory } from 'https://cdn.jsdelivr.net/gh/stdlib-js/stats-base-dists-cauchy-logcdf@deno/mod.js';Evaluates the natural logarithm of the cumulative distribution function (CDF) for a Cauchy distribution with parameters x0 (location parameter) and gamma > 0 (scale parameter).
var y = logcdf( 4.0, 0.0, 2.0 ); // returns ~-0.16 y = logcdf( 1.0, 0.0, 2.0 ); // returns ~-0.435 y = logcdf( 1.0, 3.0, 2.0 ); // returns ~-1.386If provided NaN as any argument, the function returns NaN.
var y = logcdf( NaN, 0.0, 2.0 ); // returns NaN y = logcdf( 1.0, 2.0, NaN ); // returns NaN y = logcdf( 1.0, NaN, 3.0 ); // returns NaNIf provided gamma <= 0, the function returns NaN.
var y = logcdf( 2.0, 0.0, -1.0 ); // returns NaN y = logcdf( 2.0, 0.0, 0.0 ); // returns NaNReturns a function for evaluating the natural logarithm of the cumulative distribution function of a Cauchy distribution with parameters x0 (location parameter) and gamma > 0 (scale parameter).
var mylogcdf = logcdf.factory( 10.0, 2.0 ); var y = mylogcdf( 10.0 ); // returns ~-0.693 y = mylogcdf( 12.0 ); // returns ~-0.288- In virtually all cases, using the
logpdforlogcdffunctions is preferable to manually computing the logarithm of thepdforcdf, respectively, since the latter is prone to overflow and underflow.
import uniform from 'https://cdn.jsdelivr.net/gh/stdlib-js/random-array-uniform@deno/mod.js'; import logEachMap from 'https://cdn.jsdelivr.net/gh/stdlib-js/console-log-each-map@deno/mod.js'; import EPS from 'https://cdn.jsdelivr.net/gh/stdlib-js/constants-float64-eps@deno/mod.js'; import logcdf from 'https://cdn.jsdelivr.net/gh/stdlib-js/stats-base-dists-cauchy-logcdf@deno/mod.js'; var opts = { 'dtype': 'float64' }; var gamma = uniform( 10, EPS, 10.0, opts ); var x0 = uniform( 10, 0.0, 10.0, opts ); var x = uniform( 10, 0.0, 10.0, opts ); logEachMap( 'x: %0.4f, x0: %0.4f, γ: %0.4f, ln(F(x;x0,γ)): %0.4f', x, x0, gamma, logcdf );This package is part of stdlib, a standard library 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.
See LICENSE.
Copyright © 2016-2025. The Stdlib Authors.