Python cmath.sqrt() Metodo
Esempio
Trova la radice quadrata di un numero complesso:
#Import cmath Library
import cmath
#Return the square root of a
complex number
print (cmath.sqrt(2 + 3j))
print (cmath.sqrt(15))
Definizione e utilizzo
Il cmath.sqrt()
metodo restituisce la radice quadrata di un numero complesso.
Nota: il numero deve essere maggiore o uguale a 0.
Sintassi
cmath.sqrt(x)
Valori dei parametri
Parameter | Description |
---|---|
x | Required. A number to find the square root of. If the number is less than 0, it returns a ValueError. If the value is not a number, it returns a TypeError |
Dettagli tecnici
Valore di ritorno: | Un complex valore, che rappresenta la radice quadrata di un numero complesso |
---|---|
Versione Python: | 1.5 |