acos(x) asin(x) atan(x) atan(x, y)
NA
s) are allowed.
x
. Missing values (
NA
s) are allowed.
This function will be used as the default method for classes that do not inherit a specific method for the function or for the Math group of functions. The result will retain the class and the attributes. If this behavior is not appropriate, the designer of the class should provide a method for the function or for the Math group
For
atan
with two arguments, both arguments should be numeric.
When
x^2+y^2==1
, the return value satisfies
cos(atan(x,y))==y
and
sin(atan(x,y))==x
.
That is,
atan(n,d)
(the quadrant correct arctangent)
is equal to
atan(n/d)
when
d
is positive.
Notice that there is a potential confusion in the
naming of the arguments in this form of
atan
, as it usual
to think of cos being associated with the x coordinate and
sin with the y coordinate. Thus, for example,
Arg(1-1i)
is the same as
atan(-1,1)
and not
atan(1,-1)
.
To put it another way,
Arg(z)
is the same as
atan(Im(z),Re(z))
.
For numeric arguments,
the domain of
acos
and
asin
is the interval [--1, 1],
and the range is
0 <= acos(x) <= pi
and
--pi/2 <= asin(x) <= pi/2
.
The domain of
atan
is unrestricted
and the range is
--pi/2 < atan(x) < pi/2
or
--pi < atan(x,y) <= pi
.
For values of the arguments outside of the appropriate domains,
NA is returned and a warning is given.
These functions are members of the
Math
group
of generic functions.
For further information on domains and branch cuts in the case of complex arguments, see section 5.1.5 of Becker, Chambers and Wilks.
atan(-1,1) # returns -pi/4 atan(1,-1) # returns 3*pi/4 acos(1/2) # returns pi/3 disk <-complex(arg = seq(-pi,pi, len = 50)) # fifty points on a unit circle asin(disk)