Skip to main content
All hyperbolic functions operate element-wise.

sinh

Compute the hyperbolic sine, element-wise.
function sinh(x: ArrayLike): NDArray
NameTypeDefaultDescription
xArrayLike-Input array.
Returns: NDArray — Element-wise sinh(x) = (exp(x) - exp(-x)) / 2.
import * as np from 'numpy-ts';

const a = np.sinh(np.array([0, 1, -1]));
// array([0, 1.1752..., -1.1752...])

cosh

Compute the hyperbolic cosine, element-wise.
function cosh(x: ArrayLike): NDArray
NameTypeDefaultDescription
xArrayLike-Input array.
Returns: NDArray — Element-wise cosh(x) = (exp(x) + exp(-x)) / 2.
import * as np from 'numpy-ts';

const a = np.cosh(np.array([0, 1, -1]));
// array([1, 1.5431..., 1.5431...])

tanh

Compute the hyperbolic tangent, element-wise.
function tanh(x: ArrayLike): NDArray
NameTypeDefaultDescription
xArrayLike-Input array.
Returns: NDArray — Element-wise tanh(x) = sinh(x) / cosh(x).
import * as np from 'numpy-ts';

const a = np.tanh(np.array([0, 1, -1, 100]));
// array([0, 0.7616..., -0.7616..., 1])

arcsinh

Compute the inverse hyperbolic sine, element-wise. Also available as the alias asinh.
function arcsinh(x: ArrayLike): NDArray
NameTypeDefaultDescription
xArrayLike-Input array.
Returns: NDArray — Element-wise arcsinh(x) = ln(x + sqrt(x**2 + 1)).
import * as np from 'numpy-ts';

const a = np.arcsinh(np.array([0, 1, -1]));
// array([0, 0.8814..., -0.8814...])

// Alias
const b = np.asinh(np.array([0, 1]));

arccosh

Compute the inverse hyperbolic cosine, element-wise. Also available as the alias acosh.
function arccosh(x: ArrayLike): NDArray
NameTypeDefaultDescription
xArrayLike-Input array. All values must be >= 1.
Returns: NDArray — Element-wise arccosh(x) = ln(x + sqrt(x**2 - 1)).
import * as np from 'numpy-ts';

const a = np.arccosh(np.array([1, 2, 10]));
// array([0, 1.3170..., 2.9932...])

// Alias
const b = np.acosh(np.array([1, 2]));

arctanh

Compute the inverse hyperbolic tangent, element-wise. Also available as the alias atanh.
function arctanh(x: ArrayLike): NDArray
NameTypeDefaultDescription
xArrayLike-Input array. All values must be in the range (-1, 1).
Returns: NDArray — Element-wise arctanh(x) = 0.5 * ln((1+x) / (1-x)).
import * as np from 'numpy-ts';

const a = np.arctanh(np.array([0, 0.5, -0.5]));
// array([0, 0.5493..., -0.5493...])

// Alias
const b = np.atanh(np.array([0, 0.5]));