jdnewmil at dcn.davis.ca.us
Wed Mar 29 19:18:34 CEST 2006
Prof Brian Ripley wrote:
> And only the designers can say
> 'but atan2 wasn't originally designed for complex arguments.'
> but the code suggests otherwise.
I was not referring to the _coding_ of the function... I was
referring to the _design_. The design of the "atan2" function
preceeds the existence of the "R" software package by decades,
and it was created to get around the limitations of the "atan"
function for extracting the angular component of a polar
coordinate from rectangular coordinates. Applications of this
function with complex arguments remain obscure, while its use
in obtaining the argument of a complex number is not.
Regardless of obscurity, given that the "R" version does
support complex numbers, I agree with Robin that it should accept
any combination of numeric and complex parameters, and I concur
with you that this suggestion belongs on the developers list.
>> On 28 Mar 2006, at 19:52, Jeff Newmiller wrote:
>>> Robin Hankin wrote:
>>>> ?atan2 says that atan2(y,x)=atan(y/x) for x and y numeric or complex
>>>> Well, I would expect atan2(1,1i) to be equal to atan(-1i), but
>>>> Error in atan2(y, x) : Non-numeric argument to mathematical function
>>> Ravi Varadhan pointed out that you need to make both arguments complex
>>> to address the error message you obtained... but atan2 wasn't
>>> designed for complex arguments. I suspect that what you really want is
>>> to use the Arg function:
>>>  -1.570796
Jeff Newmiller The ..... ..... Go Live...
DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go...
Live: OO#.. Dead: OO#.. Playing
Research Engineer (Solar/Batteries O.O#. #.O#. with
/Software/Embedded Controllers) .OO#. .OO#. rocks...1k
More information about the R-help