Python math.atan() - Arc / Inverse Tangent
Python math.atan()
math.atan() function returns the inverse tangent of given number.
The return value is angle in radians, and lies in [-pi/2, pi/2] radians.
Syntax
The syntax to call atan() function is
math.atan(x)
where
Parameter | Required | Description |
---|---|---|
x | Yes | A number in the range [-inf, inf]. |
Examples
In the following example, we find the inverse tangent of 1.732 using atan() function of math module.
Python Program
import math
x = 1.732
result = math.atan(x)
print('atan(x) :', result, 'radians')
Output
atan(x) : 1.0471848490249274 radians
We can convert the returned radians into degrees using math.degrees() function.
In the following example, we find the inverse tangent of 1.732 using atan() function and convert this returned radians to degrees.
Python Program
import math
x = 1.732
result = math.atan(x)
result = math.degrees(result)
print('atan(x) :', result, 'degrees')
Output
atan(x) : 59.99927221917264 degrees
Summary
In this Python Examples tutorial, we learned the syntax of, and examples for math.atan() function.