blosc2.cos#

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

Trigonometric cosine, element-wise.

Parameters:

ndarr (NDArray or NDField or C2Array or LazyExpr) – The input array containing angles in radians.

Returns:

out – A lazy expression representing the cosine of the input angles. The result can be evaluated.

Return type:

LazyExpr

References

np.cos

Examples

>>> import numpy as np
>>> import blosc2
>>> angles = np.array([0, np.pi/6, np.pi/4, np.pi/2, np.pi])
>>> nd_array = blosc2.asarray(angles)
>>> result_ = blosc2.cos(nd_array)
>>> result = result_[:]
>>> print("Angles in radians:", angles)
Angles in radians: [0.         0.52359878 0.78539816 1.57079633 3.14159265]
>>> print("Cosine of the angles:", result)
Cosine of the angles: [ 1.00000000e+00  8.66025404e-01  7.07106781e-01  6.12323400e-17
-1.00000000e+00]