blosc2.tanh#

blosc2.tanh(ndarr: NDArray | NDField | C2Array | LazyExpr, /) LazyExpr#

Compute the hyperbolic tangent, element-wise.

Parameters:

ndarr (NDArray or NDField or C2Array or LazyExpr) – The input array.

Returns:

out – A lazy expression representing the hyperbolic tangent of the input array. The result can be evaluated.

Return type:

LazyExpr

References

np.tanh

Examples

>>> import numpy as np
>>> import blosc2
>>> numbers = np.array([-2, -1, 0, 1, 2])
>>> ndarray = blosc2.asarray(numbers)
>>> result_lazy = blosc2.tanh(ndarray)
>>> result = result_lazy[:]
>>> print("Original numbers:", numbers)
Original numbers: [-2 -1  0  1  2]
>>> print("Hyperbolic tangent:", result)
Hyperbolic tangent: [-0.96402758 -0.76159416  0.          0.76159416  0.96402758]