[R] atan2(1,1i)
Jeff Newmiller
jdnewmil at dcn.davis.ca.us
Tue Mar 28 20:52:19 CEST 2006
Robin Hankin wrote:
> Hi
>
> ?atan2 says that atan2(y,x)=atan(y/x) for x and y numeric or complex
> vectors.
>
> Well, I would expect atan2(1,1i) to be equal to atan(-1i), but
>
> > atan2(1,1i)
> 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 originally
designed for complex arguments. I suspect that what you really want is
to use the Arg function:
> Arg(1/1i)
[1] -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
mailing list