The cmath.rect()
method is used to convert polar coordinates to rectangular coordinates.
The
cmath
library in Python is used for complex number mathematics.
math.rect(r, phi)
r
: The modulus of a complex number in the complex plane.phi(ϕ)
: The phase of a complex number.Complex number
: it will return a complex value, which will represent a rectangular form.
It will return a complex number in pair form (X+Yj).
non zero
, it will return a complex number.phi=0
.r=0
.# include the Libraryimport cmath# r=4, phi=20# Printing the result on consoleprint(cmath.rect(4,20))