The cmath(complex math) module in the standard library provides mathematical functions for working with complex numbers. The cos() function in this module is used to find the cosine of a given complex number.
cmath.cos(x)
x |
The angle in radians(real or complex) whose cosine should be calculated |
The function returns a complex value representing the cosine of the input value, x
.
import cmath
print(cmath.cos(1.5))
print(cmath.cos(2.1))
print(cmath.cos(4 + 0j))
print(cmath.cos(2 -0.25j))