help-octave
[Top][All Lists]

## Re: apparently wrong description of 'arg' function in octave-3.0.5

 From: Ben Abbott Subject: Re: apparently wrong description of 'arg' function in octave-3.0.5 Date: Sun, 17 Apr 2011 10:54:26 -0400

```On Apr 17, 2011, at 8:55 AM, Sergei Steshenko wrote:

> Hello,
>
> in octave-3.0.5 'help arg' produces:
>
> "
> -- Mapping Function:  arg (Z)
> -- Mapping Function:  angle (Z)
>     Compute the argument of Z, defined as THETA = `atan (Y/X)'.  in
> ".
>
> According to Wiki and my memories from school:
>
> http://en.wikipedia.org/wiki/Inverse_trigonometric_functions :
>
> arctangent    y = arctan x    x = tan y       all real numbers        −π/2 <
> y < π/2  −90° < y < 90°
>
> , i.e. the ranges equivalently are:
>
> −π/2 < y < π/2        −90° < y < 90°
> .
>
> The above ranges are insufficient for complex numbers - the range in
>
> -pi .. pi
>
> or
>
> 0 .. 2 * pi.
>
> In reality the 'arg' function works correctly:
>
> "
> octave:23> 180 / pi * arg(-1 + 0.01i)
> ans =  179.43
> octave:24> 180 / pi * arg(-1 - 0.01i)
> ans = -179.43
> ",
>
> i.e. it implements -pi .. pi (-180 .. 180 degrees) range - opposed to
> what its built-in help message says (because of 'atan' and it's
> -pi/2 .. pi/2 range).
>
> Is the description fixed in later 'octave' versions ?

The current sources include ...

-- Mapping Function:  arg (Z)
-- Mapping Function:  angle (Z)
Compute the argument of Z, defined as, THETA = `atan2 (Y, X)', in