The arc tangent
functionR
returns the inverse tangent of a number. More specifically, it returns the inverse tangent of a number in radians.
Figure 1 below shows the mathematical representation of the atan()
function.
Figure 2 shows the visual representation of the atan()
function.
To convert radians
to degrees
, use:
degrees = radians * ( 180.0 / pi )
atan(num)
This function requires a number as a parameter.
atan()
will return the inverse tangent of a number (radians) sent as a parameter. The return values lie in the interval [-pi/2,pi/2]
in radians.
#Positive number in radiansa <- atan(0.5);print(paste0("atan(0.5): ", a, " radians"))#negative number in radiansb <- atan(-0.5);print(paste0("atan(-0.5): ", b, " radians"))#applying atan() and then converting the result in radians to degrees#radians = 1.0c <- atan(1) * (180.0 / pi);print(paste0("tan(1): ", c, " degrees"))