rect() complex function in python by R4R Team

- 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))


output-

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)


-In this program, (3.0000000000000004+3.9999999999999996j) refers the 3+4j whose modulus and phase is 5.0 and 0.9272952180016122.




Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!