csch
Compute the hyperbolic cosecant of a number.
Usage
var csch = require( '@stdlib/math/base/special/csch' );
csch( x )
Computes the hyperbolic cosecant of x
.
var v = csch( 0.0 );
// returns Infinity
v = csch( 2.0 );
// returns ~0.2757
v = csch( -2.0 );
// returns ~-0.2757
v = csch( NaN );
// returns NaN
Examples
var linspace = require( '@stdlib/array/base/linspace' );
var csch = require( '@stdlib/math/base/special/csch' );
var x = linspace( -5.0, 5.0, 100 );
var i;
for ( i = 0; i < x.length; i++ ) {
console.log( csch( x[ i ] ) );
}
C APIs
Usage
#include "stdlib/math/base/special/csch.h"
stdlib_base_csch( x )
Computes the hyperbolic cosecant of double-precision floating-point number x
.
double out = stdlib_base_csch( 2.0 );
// returns ~0.2757
out = stdlib_base_csch( -2.0 );
// returns ~-0.2757
The function accepts the following arguments:
- x:
[in] double
input value.
double stdlib_base_csch( const double x );
Examples
#include "stdlib/math/base/special/csch.h"
#include <stdio.h>
int main( void ) {
const double x[] = { -4.0, -3.11, -2.22, -1.33, -0.44, 0.44, 1.33, 2.22, 3.11, 4.0 };
double v;
int i;
for ( i = 0; i < 10; i++ ) {
v = stdlib_base_csch( x[ i ] );
printf( "csch(%lf) = %lf\n", x[ i ], v );
}
}