pymc.math.cosh#

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

hyperbolic cosine of a

Computes element-wise hyperbolic cosine of a tensor.

Parameters:
aTensorLike

Input tensor

Returns:
TensorVariable

Output tensor with the hyperbolic cosine of each element

Notes

This function corresponds to NumPy’s np.cosh function. The hyperbolic cosine is defined as: cosh(x) = (exp(x) + exp(-x))/2

Examples

>>> import pytensor
>>> import pytensor.tensor as pt
>>> x = pt.vector("x")
>>> f = pytensor.function([x], pt.cosh(x))
>>> f([0, 1, 2])
array([1.        , 1.54308063, 3.76219569])