Inverse Trigonometric Functions - Two-argument Variant of Arctangent

Two-argument Variant of Arctangent

The two-argument atan2 function computes the arctangent of y / x given y and x, but with a range of (−π, π]. In other words, atan2(y, x) is the angle between the positive x-axis of a plane and the point (x, y) on it, with positive sign for counter-clockwise angles (upper half-plane, y > 0), and negative sign for clockwise angles (lower half-plane, y < 0). It was first introduced in many computer programming languages, but it is now also common in other fields of science and engineering.

In terms of the standard arctan function, that is with range of (−π/2, π/2), it can be expressed as follows:

\operatorname{atan2}(y, x) = \begin{cases}
\arctan(\frac y x) & \qquad x > 0 \\
\pi + \arctan(\frac y x) & \qquad y \ge 0, x < 0 \\
-\pi + \arctan(\frac y x) & \qquad y < 0, x < 0 \\
\frac{\pi}{2} & \qquad y > 0, x = 0 \\
-\frac{\pi}{2} & \qquad y < 0, x = 0 \\
\text{undefined} & \qquad y = 0, x = 0
\end{cases}

It also equals the principal value of the argument of the complex number x + iy.

This function may also be defined using the tangent half-angle formulae as follows:

provided that either x > 0 or y ≠ 0. However this fails if given x ≤ 0 and y = 0 so the expression is unsuitable for computational use.

The above argument order (y, x) seems to be the most common, and in particular is used in ISO standards such as the C programming language, but a few authors may use the opposite convention (x, y) so some caution is warranted. These variations are detailed at Atan2.

Read more about this topic:  Inverse Trigonometric Functions

Famous quotes containing the word variant:

    “I am willing to die for my country” is a variant of “I am willing to kill for my country.”
    Mason Cooley (b. 1927)