Computation
The principal value Arg of a complex number given as x+iy is normally available in programming languages using the function atan2( ) or some language specific variant. The value of atan2(y, x) is the principal value in the range (−π, π].
Many texts say the value is given by arctan(y/x), as y/x is slope, and arctan converts slope to angle. This is correct only when x > 0, so the quotient is defined and the angle lies between −π/2 and π/2, but extending this definition to cases where x is not positive is relatively involved. Specifically, one may define the principal value of the argument separately on the four half-planes x > 0, x < 0 (separated into two quadrants if one wishes a branch cut on the negative x-axis), y > 0, y < 0, and then patch together.
For the variant where Arg is defined to lie in the interval [0, 2π), the value can be found by adding 2π to the value above when it is negative.
Alternatively, the principal value can be calculated in a uniform way using the tangent half-angle formula, the function being defined over the complex plane but excluding the origin:
This is based on a parametrization of the circle (except for the negative x-axis) by rational functions. This version of Arg is not stable enough for numerical use but can be used in symbolic calculation. In many programming libraries there is a function called atan2 which performs an equivalent computation.
Read more about this topic: Argument (complex Analysis)
Famous quotes containing the word computation:
“I suppose that Paderewski can play superbly, if not quite at his best, while his thoughts wander to the other end of the world, or possibly busy themselves with a computation of the receipts as he gazes out across the auditorium. I know a great actor, a master technician, can let his thoughts play truant from the scene ...”
—Minnie Maddern Fiske (18651932)