[Python] Complex NumPy values

Retrieving the Real or Complex part

num.real for real value
num.imag for complex value

Defining complex values

1j
np.complex(0,1)

Retrieving the Magnitude and Phase part

np.abs(num)
np.angle(num)

Back to complex number

mag * np.exp(1j * angle)

Reference

https://stackoverflow.com/questions/13567089/scale-the-real-part-of-complex-numpy-array
https://stackoverflow.com/questions/28872862/equivalent-of-j-in-numpy
https://stackoverflow.com/questions/16444719/python-numpy-complex-numbers-is-there-a-function-for-polar-to-rectangular-co

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.