Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Inverse trigonometric functions
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
====Two-argument variant of arctangent==== {{anchor|Two-argument variant of arctangent}} {{main|atan2}} The two-argument [[atan2|{{math|atan2}}]] function computes the arctangent of {{math|''y''/''x''}} given {{mvar|y}} and {{mvar|x}}, but with a range of {{open-closed|βΟ, Ο}}. In other words, {{math|atan2(''y'', ''x'')}} is the angle between the positive {{mvar|x}}-axis of a plane and the point {{math|(''x'', ''y'')}} on it, with positive sign for counter-clockwise angles (upper half-plane, {{math|''y'' > 0}}), and negative sign for clockwise angles (lower half-plane, {{math|''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 {{open-open|βΟ/2, Ο/2}}, it can be expressed as follows: <math display="block">\operatorname{atan2}(y, x) = \begin{cases} \arctan\left(\frac y x\right) & \quad x > 0 \\ \arctan\left(\frac y x\right) + \pi & \quad y \ge 0,\; x < 0 \\ \arctan\left(\frac y x\right) - \pi & \quad y < 0,\; x < 0 \\ \frac{\pi}{2} & \quad y > 0,\; x = 0 \\ -\frac{\pi}{2} & \quad y < 0,\; x = 0 \\ \text{undefined} & \quad y = 0,\; x = 0 \end{cases}</math> It also equals the [[principal value]] of the [[arg (mathematics)|arg]]ument of the [[complex number]] {{math|''x'' + ''iy''}}. This limited version of the function above may also be defined using the [[tangent half-angle formula]]e as follows: <math display="block">\operatorname{atan2}(y, x) = 2\arctan\left(\frac{y}{\sqrt{x^2 + y^2} + x}\right)</math> provided that either {{math|''x'' > 0}} or {{math|''y'' β 0}}. However this fails if given {{math|''x'' β€ 0}} and {{math|1= ''y'' = 0}} so the expression is unsuitable for computational use. The above argument order ({{mvar|y}}, {{mvar|x}}) seems to be the most common, and in particular is used in [[ISO standard]]s such as the [[C (programming language)|C programming language]], but a few authors may use the opposite convention ({{mvar|x}}, {{mvar|y}}) so some caution is warranted. {{crossref|(See variations at {{slink|atan2|Realizations of the function in common computer languages}}.)}}
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)