On Mon, 16 May 2005, Robin Hankin wrote:
> Hi
>
> the following gave me a shock:
>
>> atan(2)
> [1] 1.107149
>> atan(2+0i)
> [1] -0.4636476+0i
>>
>
> or, perhaps more of a gotcha:
>
>> atan(1.0001+0i)
> [1] -0.7853482+0i
>> atan(0.9999+0i)
> [1] 0.7853482+0i
>>
>
>
>
> evidently atan()'s branch cuts aren't where I thought they were.
>
> Where do I look for documentation on this?
In the sources. Specifically for complex atan() in src/main/complex.c
/* Complex Arctangent Function */
/* Equation (4.4.39) Abramowitz and Stegun */
static void z_atan(Rcomplex *r, Rcomplex *z)
...
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595