Python - cmath.polar() Function
The Python cmath.polar() function is used to return the representation of x in polar coordinates. The function returns (r, θ) which is a polar representation of x, where r is is the modulus of x and θ is the phase of x. polar(x) is equivalent to (abs(x), phase(x)).
Syntax
cmath.polar(x)
Parameters
x |
Required. Specify the number. |
Return Value
Returns the representation of x in polar coordinates.
Example:
In the below example, polar() function is used to representation the given complex number in polar coordinates.
import cmath x = 3 + 4j print(cmath.polar(x))
The output of the above code will be:
(5.0, 0.9272952180016122)
❮ Python cMath Module