@stdlib/math-base-special-spencef
v0.1.1
Published
Spence's function (the dilogarithm) for a single-precision floating-point number.
Readme
spencef
Spence's function (the dilogarithm) for a single-precision floating-point number.
The dilogarithm is defined as
or also alternatively as
Installation
npm install @stdlib/math-base-special-spencefUsage
var spencef = require( '@stdlib/math-base-special-spencef' );spencef( x )
Evaluates Spence's function (the dilogarithm) for a single-precision floating-point number.
var v = spencef( 3.0 );
// returns ~-1.437
v = spencef( 0.0 );
// returns ~1.645
v = spencef( NaN );
// returns NaNFor negative numbers, the dilogarithm is not defined.
var v = spencef( -4.0 );
// returns NaNExamples
var uniform = require( '@stdlib/random-array-uniform' );
var logEachMap = require( '@stdlib/console-log-each-map' );
var spencef = require( '@stdlib/math-base-special-spencef' );
var opts = {
'dtype': 'float32'
};
var x = uniform( 100, 0.0, 100.0, opts );
logEachMap( 'spencef(%0.4f) = %0.4f', x, spencef );C APIs
Usage
#include "stdlib/math/base/special/spencef.h"stdlib_base_spencef( x )
Evaluates Spence's function (the dilogarithm) for a single-precision floating-point number.
float out = stdlib_base_spencef( 3.0f );
// returns ~-1.437f
out = stdlib_base_spencef( 0.0f );
// returns ~1.645fThe function accepts the following arguments:
- x:
[in] floatinput value.
float stdlib_base_spencef( const float x );Examples
#include "stdlib/math/base/special/spencef.h"
#include <stdio.h>
int main( void ) {
const float x[] = { 3.0f, 9.0f, 0.0f, -10.0f };
float y;
int i;
for ( i = 0; i < 4; i++ ) {
y = stdlib_base_spencef( x[ i ] );
printf( "spencef(%f) = %f\n", x[ i ], y );
}
}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-2026. The Stdlib Authors.
