Home >>Python cmath Module >Python cmath.rect() Method
Python cmath.rect() method in python is used to converts polar coordinates to rectangular form of the complex given number and creates a complex number with phase and modulus. It is equivalent to r * (math.cos(phi) + math.sin(phi)*1j).
Syntax:cmath.rect(r, phi)
Parameter | Description |
---|---|
r | It is a required parameter used to Represents the modulus of a given complex number |
phi | It is a required parameter used to Represents the phase of a given complex number |
import cmath
print(cmath.rect(3.1622776601683795, 1.2490457723982544))
import cmath
print(cmath.rect(7.211102550927978, 0.982793723247329))