arctan

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

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

Parameters:
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.

Returns:
out : ndarray or scalar

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

Notes

arctan 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, arctan 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}.

Examples

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