Trig {base} | R Documentation |
These functions give the obvious trigonometric functions. They respectively compute the cosine, sine, tangent, arc-cosine, arc-sine, arc-tangent, and the two-argument arc-tangent.
cos(x) sin(x) tan(x) acos(x) asin(x) atan(x) atan2(y, x)
x, y |
numeric or complex vectors. |
The arc-tangent of two arguments atan2(y, x)
returns the angle
between the x-axis and the vector from the origin to (x, y),
i.e., for positive arguments atan2(y, x) == atan(y/x)
.
Angles are in radians, not degrees (i.e., a right angle is π/2).
All except atan2
are generic functions: methods can be defined
for them individually or via the Math
group generic.
For the inverse trigonometric functions, branch cuts are defined as in Abramowitz and Stegun, figure 4.4, page 79. Continuity on the branch cuts is standard.
For asin()
and acos()
, there are two cuts, both along
the real axis: (-Inf, -1] and
[1, Inf). Functions asin()
and acos()
are continuous from above on the interval
(-Inf, -1] and continuous from
below on [1, Inf).
For atan()
there are two cuts, both along the pure imaginary
axis: (-1i*Inf, -1i] and
[1i, 1i*Inf). It is continuous
from the left on the interval
(-1i*Inf, -1i] and from the
right on the interval [1i, 1i*Inf).
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.
Abramowitz, M. and Stegun, I. A. (1972). Handbook of
Mathematical Functions, New York: Dover.
Chapter 4. Elementary Transcendental Functions: Logarithmic,
Exponential, Circular and Hyperbolic Functions