pymc.math.cos#

pymc.math.cos = Elemwise(scalar_op=cos,inplace_pattern=<frozendict {}>)[source]#

cosine of a

Computes element-wise cosine of a tensor in radians.

Parameters:
aTensorLike

Input tensor in radians

Returns:
TensorVariable

Output tensor with the cosine of each element

Notes

This function corresponds to NumPy’s np.cos function.

Examples

>>> import pytensor
>>> import pytensor.tensor as pt
>>> import numpy as np
>>> x = pt.vector("x")
>>> f = pytensor.function([x], pt.cos(x))
>>> f([0, np.pi / 2, np.pi])
array([ 1.000000e+00,  6.123234e-17, -1.000000e+00])