Nombres complexes¶

Le nombre complexe de carré -1 est noté j.

In [1]:
a = 1-2j
In [2]:
a**2
Out[2]:
(-3-4j)
In [3]:
i = complex(0,1)
i**2
Out[3]:
(-1+0j)

Partie réelle, partie imaginaire :

In [4]:
print(a.real)
print(a.imag)
1.0
-2.0

Conjugué :

In [5]:
a.conjugate()
Out[5]:
(1+2j)

Argument :

In [6]:
from cmath import phase
phase(a)
Out[6]:
-1.1071487177940904

Module :

In [7]:
abs(a)
Out[7]:
2.23606797749979
In [8]:
from cmath import polar
polar(a)
Out[8]:
(2.23606797749979, -1.1071487177940904)

Forme exponentielle :

In [9]:
from math import pi
from cmath import exp
b=complex(0,pi/3)
c=exp(b)
print(c.real)
print(c.imag)
0.5000000000000001
0.8660254037844386
In [ ]: