Python - Methode cmath.sqrt()
Beispiel
Finden Sie die Quadratwurzel einer komplexen Zahl:
#Import cmath Library
import cmath
#Return the square root of a
complex number
print (cmath.sqrt(2 + 3j))
print (cmath.sqrt(15))
Definition und Verwendung
Die cmath.sqrt()
Methode gibt die Quadratwurzel einer komplexen Zahl zurück.
Hinweis: Die Zahl muss größer oder gleich 0 sein.
Syntax
cmath.sqrt(x)
Parameterwerte
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 |
Technische Details
Rückgabewert: | Ein complex Wert, der die Quadratwurzel einer komplexen Zahl darstellt |
---|---|
Python-Version: | 1.5 |