Python Tutorial Python Advanced Python References Python Libraries

Python cmath - sin() Function



The Python cmath.sin() function returns complex sine of a complex number z. It is a function on complex plane, and has no branch cuts. Mathematically, it can be expressed as:

complex sin

Syntax

cmath.sin(z)

Parameters

z Required. Specify the complex number, representing an angle expressed in radians.

Return Value

Returns the complex sine of z.

Example:

In the example below, sin() function is used to find out the complex sine of the given number.

import cmath

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

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

The output of the above code will be:

cmath.sin(z1): (3.4209548611170133-1.5093064853236158j)
cmath.sin(z2): (0.9092974268256817-0j)
cmath.sin(z3): 3.626860407847019j

❮ Python cMath Module

5