Computer >> Computer tutorials >  >> Programming >> Python

How to find Square root of complex numbers in Python?


You can find the Square root of complex numbers in Python using the cmath library. The cmath library in python is a library for dealing with complex numbers. You can use it as follows to find the square root −

Example

from cmath import sqrt

a = 0.2 + 0.5j
print(sqrt(a))

Output

This will give the output 

(0.6076662244659689+0.4114100635092987j)