Python cmath.polar() Metode
Voorbeeld
Skakel 'n komplekse getal om na poolkoördinate vorm:
#import cmath for complex number operations
import cmath
#find
the polar coordinates of complex number
print (cmath.polar(2 + 3j))
print (cmath.polar(1 + 5j))
Definisie en gebruik
Die cmath.polar()
metode skakel 'n komplekse getal om na poolkoördinate. Dit gee 'n tupel van modulus en fase terug.
In poolkoördinate word 'n komplekse getal gedefinieer deur modulus r en fasehoek phi .
Sintaksis
cmath.polar(x)
Parameterwaardes
Parameter | Description |
---|---|
x | Required. A number to find polar coordinates of |
Tegniese besonderhede
Terugkeerwaarde: | 'n tuple Waarde wat poolkoördinate voorstel |
---|---|
Python weergawe: | 2.6 |