Complex numbers: represented as two floating point numbers : Complex Numbers « Data Type « Python






Complex numbers: represented as two floating point numbers

Complex numbers: represented as two floating point numbers

#Complex numbers: represented as two floating point numbers 
#the real and imaginary part. 
#To extract these parts from a complex number z, use z.real and z.imag.

a=1.5+0.5j
print a.real

print a.imag

           
       








Related examples in the same category

1.Complex Numbers: MultiplyComplex Numbers: Multiply
2.Complex Number Multiply: the Complex partComplex Number Multiply: the Complex part
3.Complex Numbers: two complex numbersComplex Numbers: two complex numbers
4.Complex numbers: imaginary numbers are written with a suffix of 'j' or 'J'. Complex numbers: imaginary numbers are written with a suffix of 'j' or 'J'.
5.Use abs(z) to get its magnitude (as a float) or z.real to get its real part.Use abs(z) to get its magnitude (as a float) or z.real to get its real part.