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

Trigonometric inverse tangent, element-wise. The inverse of tan, so that if y = tan(x) then x = atan(y).

>>>np.atan is np.arctan True

  • x (ndarray or scalar) – Input values.

  • 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.


out – Out has the same shape as x. It lies is in [-pi/2, pi/2] (atan(+/-inf) returns +/-pi/2). This is a scalar if x is a scalar.

Return type

ndarray or scalar


atan is a alias for arctan. It is a standard API in instead of an official NumPy operator.

atan is a multi-valued function: for each x there are infinitely many numbers z such that tan(z) = x. The convention is to return the angle z whose real part lies in [-pi/2, pi/2]. For real-valued input data types, atan always returns real output. For each value that cannot be expressed as a real number or infinity, it yields nan and sets the invalid floating point error flag. For complex-valued input, we do not have support for them yet. The inverse tangent is also known as atan or tan^{-1}.


>>> x = np.array([0, 1])
>>> np.atan(x)
array([0.       , 0.7853982])
>>> np.pi/4