- rect() is python complex function which convert polar coordinates to rectangular coordinates and return a complex number.
- predefined in cmath library.
Syntax-
cmath.rect(r,ph)
-it take two argument, and they are modulus(r) and phase(ph)
program-
import cmath
print("Enter modulus of complex number")
r=float(input())
print("Enter phase of complex number")
ph=float(input())
print("complex number is ",cmath.rect(r,ph))
Enter modulus of complex number
4
Enter phase of complex number
2
complex number is (-1.6645873461885696+3.637189707302727j)
Enter modulus of complex number
5
Enter phase of complex number
0.9272952180016122
complex number is (3.0000000000000004+3.9999999999999996j)