[R] branch cuts of atan()

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon May 16 13:54:38 CEST 2005


On Mon, 16 May 2005, Robin Hankin wrote:

> Professor Ripley
>
> thanks for this.  Always good to know that I'm not missing any documentation!
>
> The source is clear;  formula 4.4.39 effectively has a branch cut at |z|=1.
> A 'n' S show the standard branch cuts in their figure 4.4, which are 
> different (they
> were the ones I was expecting).  Mathematica and Maple both have branch cuts
> matching ams-55.
>
> Should the the Trig.Rd manpage   warn that the branch cuts are non-standard?
> Simple workarounds exist to shift them to the standard place.
>
> Is this type of concern worthy of a  bug report?

If you have a suggestion and code to implement it, definitely.

> The archetype would be
>
> tan(atan(2))
> [1] 2
>> tan(atan(2+0i))
> [1] -0.5+0i
>>
>
>
>
> best wishes
>
> Robin
>
>
>
>
>
> On May 16, 2005, at 10:23 am, Prof Brian Ripley wrote:
>
>> On Mon, 16 May 2005, Robin Hankin wrote:
>> 
>>> Hi
>>> 
>>>> 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




More information about the R-help mailing list