The atan()
function (also called the arc tangent
function) returns the inverse tangent of a number.
To be more specific, 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 the following function.
rad2deg(angleInRadians)
atan(num)
This function requires a number as a parameter.
atan()
will return the inverse tangent
of a number (in radians) that is sent as a parameter.
The return value lies in the interval of [-pi/2,pi/2]
radians.
#this header for rad2deg() functionuse Math::Trig;#Positive number in radians$a = atan(0.5);print "atan(0.5): $a Radians\n";#negative number in radians$b = atan(-0.5);print "atan(-0.5): $b Radians\n";#applying atan() and then converting the result in radians to degrees#radians = 1.0$c = rad2deg(atan(1.0));print "atan(1.0): $c Degrees\n";