Python cmath - acos() Function
The Python cmath.acos() function returns arc cosine of a complex number z. It is a function on complex plane, and has two branch cuts:
- Extends right from 1 along the real axis to ∞, continuous from below.
- Extends left from -1 along the real axis to -∞, continuous from above.
Mathematically, it can be expressed as:
For any z, acos(z) = 𝜋 - acos(-z)
Syntax
cmath.acos(z)
Parameters
z |
Required. Specify the complex number. |
Return Value
Returns the complex arc cosine of z.
Example:
In the example below, acos() function is used to find out the complex arc cosine of a given complex number.
import cmath z1 = 2 + 2j z2 = 2 z3 = 2j print("cmath.acos(z1):", cmath.acos(z1)) print("cmath.acos(z2):", cmath.acos(z2)) print("cmath.acos(z3):", cmath.acos(z3))
The output of the above code will be:
cmath.acos(z1): (0.8165471820968505-1.7343245214879666j) cmath.acos(z2): -1.3169578969248166j cmath.acos(z3): (1.5707963267948966-1.4436354751788103j)
❮ Python cMath Module