You want to iterate over elements of a list and apply the sqrt function on it so. You can use the built-in function map which will apply the first argument to every elements of the second:

Copylst = [-1, 3, -8]
results = map(cmath.sqrt, lst)

Another way is with the classic list comprehension:

Copylst = [-1, 3, -8]
results = [cmath.sqrt(x) for x in lst]

Execution example:

Copy>>> lst = [-4, 3, -8, -9]
>>> map(cmath.sqrt, lst)
[2j, (1.7320508075688772+0j), 2.8284271247461903j, 3j]
>>> [cmath.sqrt(x) for x in lst]
[2j, (1.7320508075688772+0j), 2.8284271247461903j, 3j]

If you're using Python 3, you may have to apply list() on the result of map (or you'll have a ietrator object)

Answer from Maxime Lorant on Stack Overflow
🌐
Real Python
realpython.com › python-square-root-function
The Python Square Root Function – Real Python
November 3, 2024 - While you probably won’t need to calculate the square root of zero often, you may be passing a variable to sqrt() whose value you don’t actually know. So, it’s good to know that it can handle zero in those cases. ... The square of any real number can’t be negative.
🌐
Reddit
reddit.com › r/learnpython › finding negative values of a square root
r/learnpython on Reddit: Finding negative values of a square root
May 23, 2020 -

Does anyone know how to return the negative value of a square root? Normal operators only produce positive values. For example 25**(1/2) returns a value of 5. I’m looking for a calculation that would return a collection -5, 5. Is this possible?

🌐
Bbolker
bbolker.github.io › math1mp › notes › random › r3_sqrtminusone.html
square roots of negative numbers
This didn’t work due to a logical but surprising glitch: the operator precedence (i.e., the order in which operators get executed) is higher for the power operator ** than for the unary minus operator -. In other words, Python interprets -1**0.5 as -(1**0.5), not (-1)**0.5. Then I guessed that there might be a square-root function called sqrt(): this is common in a lot of computer languages
🌐
SciPy
scipy.github.io › old-wiki › pages › NegativeSquareRoot.html
NegativeSquareRoot - SciPy wiki dump
These reside in numpy.lib.scimath and can be imported using ... Note that this doesn't actually change the default behavior. Still numpy.sqrt(-1) will return nan. It just makes the version of sqrt that checks for complex results more accessible via SM.sqrt instead of numpy.lib.scimath.sqrt.
🌐
Initial Commit
initialcommit.com › blog › python-square-root
Python Square Root
This makes intuitive sense: a negative times a negative always equals a positive, and the square root is by definition a number multiplied by itself. As such, negative real squares can't exist, and Python won't return a real value for such a number.
🌐
GeeksforGeeks
geeksforgeeks.org › compute-the-square-root-of-negative-input-with-emath-in-python
Compute the square root of negative input with emath in Python - GeeksforGeeks
May 1, 2022 - Complex numbers are those numbers ... the real part, and b is called the imaginary part. Imaginary numbers are those numbers whose square root is a negative number....
🌐
LearnDataSci
learndatasci.com › solutions › python-square-root
Python Square Root: Real and Complex – LearnDataSci
In this case, Python perceives the operation as -(4**0.5), which gives us -2. However, (-4)**0.5 gives us: ... Since the square root of a negative number gives a complex answer, We recommend using cmath.sqrt(), as shown at the end of the next section.
Find elsewhere
🌐
YouTube
youtube.com › watch
How to Find a Square Root of a Negative Number in Python (Complex numbers) - YouTube
In this lesson we're going to talk about that how to find a square root of a negative number in python programming language by using sqrt method of cmath mod...
Published   March 13, 2017
🌐
YouTube
youtube.com › universal science hub
Quadratic Equation || Python || Find square root of negative number in python - YouTube
In this video, You will learn how to find the square root of a negative number also how to solve quadratic equations in Python.
Published   November 21, 2021
Views   969
🌐
Python
mail.python.org › pipermail › tutor › 2005-July › 039461.html
[Tutor] How do I make Python calculate square roots?
> > >>> 4**.5 > 2.0 > >>> 16**.5 > 4.0 > >>> 81**.5 > 9.0 By the way, if you need to take the square roots of negative numbers, then the 'sqrt' function in the cmath module should do the trick: ###### >>> (-1)**0.5 Traceback (most recent call last): File "<stdin>", line 1, in ?
🌐
Analytics Vidhya
analyticsvidhya.com › home › python square root
Python Square Root
October 10, 2024 - It is used when working with complex numbers or when negative square roots need to be calculated. In Python, the exponentiation operator (**) can be used to calculate square roots by raising a number to the power of 1/2 (0.5).
🌐
Squash
squash.io › how-to-calculate-square-root-in-python
How to Calculate the Square Root in Python
Here's an example: import math number = -9 square_root = math.sqrt(number) print(square_root) ... In this case, the square root of -9 is a complex number with a very small real part and an imaginary part.
🌐
TutorialsPoint
tutorialspoint.com › compute-the-square-root-of-negative-input-with-emath-in-python
Compute the square root of negative input with emath in Python
To compute the square root of input, use the scimath.sqrt() method in Python Numpy. The method returns the square root of x. If x was a scalar, so is out, otherwise an array is returned. The parameter x is the input value. For negative input eleme
🌐
EDUCBA
educba.com › home › software development › software development tutorials › python tutorial › square root in python
Square Root in Python | Top 6 Square Root in Python with Examples
April 14, 2023 - With the help of sympy.sqrt() function we can get the square root of positive, zero, negative and complex numbers. The only difference between this method and other methods are in this method when the argument is an integer, then the square ...
Address   Unit no. 202, Jay Antariksh Bldg, Makwana Road, Marol, Andheri (East),, 400059, Mumbai
🌐
Spark By {Examples}
sparkbyexamples.com › home › python › python numpy square root
Python NumPy Square Root - Spark By {Examples}
March 27, 2024 - In the context of complex numbers, the square root of a negative number is a complex number with a real part of 0 and an imaginary part corresponding to the positive square root of the absolute value of the input.
🌐
NumPy
numpy.org › devdocs › reference › generated › numpy.sqrt.html
numpy.sqrt — NumPy v2.5.dev0 Manual
An array of the same shape as x, containing the positive square-root of each element in x. If any element in x is complex, a complex array is returned (and the square-roots of negative reals are calculated). If all of the elements in x are real, so is y, with negative elements returning nan. If ...
🌐
Towards Data Science
towardsdatascience.com › home › latest › python square roots: 5 ways to take square roots in python
Python Square Roots: 5 Ways to Take Square Roots in Python | Towards Data Science
November 26, 2024 - There are ways to calculate square roots of negative numbers, and that’s by writing them as a multiple of -1. For instance, -9 can be written as -1 x 9. The result would be 3i. Stepping into the realm of imaginary numbers is out of the scope ...