0.2.1 • Published 3 months ago
@stdlib/math-base-special-spence v0.2.1
spence
Spence’s function, also known as the dilogarithm.
The dilogarithm is defined as
or also alternatively as
Installation
npm install @stdlib/math-base-special-spence
Usage
var spence = require( '@stdlib/math-base-special-spence' );
spence( x )
Evaluates Spence’s function, which is alternatively known as the dilogarithm.
var v = spence( 3.0 );
// returns ~-1.437
v = spence( 0.0 );
// returns ~1.645
v = spence( NaN );
// returns NaN
For negative numbers, the dilogarithm is not defined.
var v = spence( -4.0 );
// returns NaN
Examples
var randu = require( '@stdlib/random-base-randu' );
var spence = require( '@stdlib/math-base-special-spence' );
var x;
var i;
for ( i = 0; i < 100; i++ ) {
x = randu() * 100.0;
console.log( 'spence( %d ) = %d', x, spence( x ) );
}
Notice
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.
Community
Copyright
Copyright © 2016-2024. The Stdlib Authors.