10 lines
331 B
Python
10 lines
331 B
Python
|
view plaincopy to clipboardprint?
|
|||
|
import cmath
|
|||
|
cn = complex(3,4)
|
|||
|
# get polar coordinates
|
|||
|
print("Polar Coordinates: ",cmath.polar(cn))
|
|||
|
|
|||
|
# polar to rectangular. Format for input is (length, ‹angle in radians›).
|
|||
|
#Returns a complex number
|
|||
|
cn1 = cmath.rect(2, cmath.pi)
|
|||
|
print("Polar to rectangular: ",cn1)
|