pymc.math.arccos#

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

arccosine of a

Computes element-wise inverse cosine (arc cosine) of a tensor.

Parameters:
aTensorLike

Input tensor (values should be in the range [-1, 1])

Returns:
TensorVariable

Output tensor with the arc cosine of each element in radians, in the range [0, π]

Notes

This function corresponds to NumPy’s np.arccos function. The values returned are in the range [0, π]. Input values outside the domain [-1, 1] will produce NaN outputs.

Examples

>>> import pytensor
>>> import pytensor.tensor as pt
>>> x = pt.vector("x")
>>> f = pytensor.function([x], pt.arccos(x))
>>> f([1, 0, -1])
array([0.        , 1.57079633, 3.14159265])