Python - Methode cmath.polar()
Beispiel
Wandeln Sie eine komplexe Zahl in Polarkoordinaten um:
#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))
Definition und Verwendung
Die cmath.polar()
Methode wandelt eine komplexe Zahl in Polarkoordinaten um. Es gibt ein Tupel aus Modulus und Phase zurück.
In Polarkoordinaten wird eine komplexe Zahl durch Modul r und Phasenwinkel phi definiert .
Syntax
cmath.polar(x)
Parameterwerte
Parameter | Description |
---|---|
x | Required. A number to find polar coordinates of |
Technische Details
Rückgabewert: | Ein tuple Wert, der Polarkoordinaten darstellt |
---|---|
Python-Version: | 2.6 |