Metoda cmath.sqrt() Pythonu
Příklad
Najděte druhou odmocninu komplexního čísla:
#Import cmath Library
import cmath
#Return the square root of a
complex number
print (cmath.sqrt(2 + 3j))
print (cmath.sqrt(15))
Definice a použití
Metoda cmath.sqrt()
vrací druhou odmocninu komplexního čísla.
Poznámka: Číslo musí být větší nebo rovno 0.
Syntax
cmath.sqrt(x)
Hodnoty parametrů
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 |
Technické údaje
Návratová hodnota: | Hodnota complex představující druhou odmocninu komplexního čísla |
---|---|
Verze Pythonu: | 1.5 |