Python Tutorial Python Advanced Python References Python Libraries

Python cmath - atan() Function



The Python cmath.atan() function returns arc tangent of a complex number z. It is a function on complex plane, and has two branch cuts:

  • Extends from 1j along the imaginary axis to ∞j, continuous from the right.
  • Extends from -1j along the imaginary axis to -∞j, continuous from the left.

Mathematically, it can be expressed as:

complex atan

Syntax

cmath.atan(z)

Parameters

z Required. Specify the complex number.

Return Value

Returns the complex arc tangent of z.

Example:

In the example below, atan() function is used to find out the complex arc tangent of a given complex number.

import cmath

z1 = 2 + 2j
z2 = 2
z3 = 2j

print("cmath.atan(z1):", cmath.atan(z1))
print("cmath.atan(z2):", cmath.atan(z2))
print("cmath.atan(z3):", cmath.atan(z3))

The output of the above code will be:

cmath.atan(z1): (1.311223269671635+0.23887786125685911j)
cmath.atan(z2): (1.1071487177940904+0j)
cmath.atan(z3): (1.5707963267948966+0.5493061443340549j)

❮ Python cMath Module