Python cmath.rect() Yöntemi
Örnek
Kutupsal koordinatları dikdörtgen forma dönüştürün:
#import cmath for complex number operations
import cmath
#convert
a polar coordinate to rectangular form
print(cmath.rect(3.1622776601683795, 1.2490457723982544))
Tanım ve Kullanım
Yöntem cmath.rect()
, kutupsal koordinatları karmaşık sayının dikdörtgen biçimine dönüştürür. Faz ve modül ile karmaşık bir sayı oluşturur.
Bu yöntem eşdeğerdir r * (math.cos(phi) +
math.sin(phi)*1j)
.
Not: Yarıçap r vektörün uzunluğudur ve phi (faz açısı) gerçek eksenle yapılan açıdır.
Sözdizimi
cmath.rect(r, phi)
Parametre Değerleri
Parameter | Description |
---|---|
r | Required. Represents the modulus of a complex number |
phi | Required. Represents the phase of a complex number |
Teknik detaylar
Geri dönüş değeri: | complex Karmaşık bir sayının dikdörtgen biçimini temsil eden bir değer |
---|---|
Python Sürümü: | 2.6 |