tan(x, out=None, **kwargs)

Compute tangent element-wise. Equivalent to np.sin(x)/np.cos(x) element-wise.

  • x (ndarray) – Input array.

  • out (ndarray or none, optional) – A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned. A tuple (possible only as a keyword argument) must have length equal to the number of outputs.


  • y (ndarray)

  • The corresponding tangent values. This is a scalar if x is a scalar.


>>> np.tan(np.array([-np.pi, np.pi/2, np.pi]))
array([-8.7422777e-08, -2.2877332e+07,  8.7422777e-08])