Re: [R] branch cuts of atan()

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Mon 16 May 2005 - 19:23:18 EST

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@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

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Mon May 16 19:28:39 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:46 EST