Facebook Page Twitter Page LinkedIn Page
× Python Tutorial Python Advanced Python Resources Python Libraries


The Python cmath.tan() function is used to return trigonometric tangent of a complex number.

Syntax

cmath.tan(x)

Parameters

x Required. Specify a number to find the tangent of

Return Value

Returns the trigonometric tangent of x.

Example:

In the below example, tan() function is used to find out the trigonometric tangent of the given number.

import cmath

x = 2 + 2j
y = 2
z = 2j

print(cmath.tan(x))
print(cmath.tan(y))
print(cmath.tan(z))

The output of the above code will be:

(-0.028392952868232294+1.0238355945704727j)
(-2.185039863261519+0j)
0.9640275800758169j

❮ Python cMath Module