Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

liczby zespolone python

# complex number

x = -5.79829066331+4.55640490659j

# parts

r = x.real   # float
i = x.imag   # float

# tuple, not complex number

y = (x.real, x.imag)

# complex number again

a = complex(r, i)

b = r + i * 1j

# operations

c = a + b

d = a * b

e = 1j * 1j   # -1

f = abs(x)    # distance - float

g = x.conjugate()

import cmath  # not `math`

h = cmath.sin(x)

print('x:', x, type(x))
print('r:', r, type(r))
print('i:', i, type(i))
print('y:', y, type(y))
print('a:', a, type(a))
print('b:', b, type(b))
print('c:', c, type(c))
print('d:', d, type(d))
print('e:', e, type(e))
print('f:', f, type(f))
print('g:', g, type(g))
print('h:', h, type(h))
Copy To Clipboad
Comment

PREVIOUS NEXT
Code Example
Python :: Jun 12, 2007 hoteis othon 
Python :: how to run pytest and enter console on failure 
Python :: colorized progress bar python in console 
Python :: How to save XLSX file to ir_attachment odoo 
Python :: folium python map in full screen 
Python :: requirements.py for flask 
Python :: cut 0s on string python 
Python :: pause program python 
Python :: ask a question on python 
Python :: max of first element in a list of tuples 
Python :: Join a list of items with different types as string in Python 
Python :: python get words between two words 
Python :: Finding the sum of even Fibonacci numbers less than or equal to given limit 
Python :: override the text in buttons django admin 
Python :: Filler values must be provided when X has more than 2 training features 
Python :: how to calculate average in list python by using whil loop 
Python :: python create hash from string 
Python :: wait for page to load selenium python 
Python :: scroll to bottom in selenium python 
Python :: how to set screen brightness automatically depending on battery percentage using python 
Python :: pros and cons of python flush print function 
Python :: lock window size tkinter 
Python :: jupyter notebook for loop progress bar 
Python :: matplotlib axes limits 
Python :: how to use python to open camera app using python 
Python :: array comparison in percent 
Python :: how to write in google chrome console in python 
Python :: python replace newline 
Python :: pandas sample seed 
Python :: virtual env in python 
ADD CONTENT
Topic
Content
Source link
Name
6+8 =