Python cmath.atan() Function
The Python cmath.atan() function returns the arc tangent of a number in radians.
The arc tangent is defined as the inverse of a tangent function. The domain of the arc tangent function is in the range between [-,], and its range is obtained in the form of radians.
Syntax
Following is the syntax for the Python cmath.atan() function −
cmath.atan(x)
Parameters
This function contains numeric values.
Return Value
This method returns arc tangent of x in radians.
Example 1
In the following example we are using Python cmath.atan() function as we are finding the arc tangent values of '0', '-1' and '1'.
import cmath
zero = cmath.atan(0)
neg_one = cmath.atan(-1)
pos_one = cmath.atan(1)
print("Arc Tangent value of 0:", zero)
print("Arc Tangent value of -1:", neg_one)
print("Arc Tangent value of 1:", pos_one)
Output
When we run the above code, it produces the following result −
Arc Tangent value of 0: 0j Arc Tangent value of -1: (-0.7853981633974483+0j) Arc Tangent value of 1: (0.7853981633974483+0j)
Example 2
Here, we are passing non-standard tangent ratios as arguments using arc sine() function.
import cmath x = cmath.atan(0.234) y = cmath.atan(-3.4) print(x,y)
Output
If we compile the above program, the output is as follows −
(0.2298640844033592+0j) (-1.2847448850775784+0j)
Example 3
In the below example we are calculating complex values using cmath.atan() function.
import cmath print(cmath.atan(2 + 3j)) print(cmath.atan(5 - 4j))
Output
When we run the above code, we will get the result as −
(1.4099210495965755+0.22907268296853878j) (1.4483069952314644-0.09641562020299617j)
python_modules.htm