autodiff.tan

autodiff.tan(x)

Return the tangent of x.

Parameters
xint, float, Dual
Returns
yfloat or Dual

Notes

The derivative of tan(x) is undefined when the cosine of x is zero.

Examples

>>> ad.tan(np.pi / 4)
1.0
>>> x = ad.Dual(np.pi / 4)
>>> ad.tan(x)
Dual(1.0, array([2.0]))

Derivative undefined:

>>> x = ad.Dual(np.pi / 2)
>>> ad.tan(x)
Traceback (most recent call last):
...
ValueError: Derivative of tan(x) is undefined for x = 1.5707963267948966