pymc.math.tan#
- pymc.math.tan = Elemwise(scalar_op=tan,inplace_pattern=<frozendict {}>)[source]#
tangent of a
Computes element-wise tangent of a tensor in radians.
- Parameters:
- a
TensorLike
Input tensor in radians
- a
- Returns:
TensorVariable
Output tensor with the tangent of each element
Notes
This function corresponds to NumPy’s np.tan function. Tangent is undefined at π/2 + nπ where n is an integer.
Examples
>>> import pytensor >>> import pytensor.tensor as pt >>> import numpy as np >>> x = pt.vector("x") >>> f = pytensor.function([x], pt.tan(x)) >>> f([0, np.pi / 4, np.pi / 2 - 1e-10]) # Avoiding exact π/2 which is undefined array([0.00000000e+00, 1.00000000e+00, 1.25655683e+10])