Square Root -1 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Square Root -1

Is there a way to calculate sqrt. -1 in any programming language?

6th Jun 2021, 7:48 PM
H Ξ X V G 0 И
H Ξ X V G 0 И - avatar
2 Answers
+ 4
Python natively supports complex numbers and operations. a = -1 print(a**0.5) Output: (6.123233995736766e-17+1j) Although it should be (0+1j), it looks like it's within floating point epsilon range of zero. https://code.sololearn.com/c0d8170pCSmZ/?ref=app
6th Jun 2021, 9:37 PM
Brian
Brian - avatar
0
Hi H Ξ X V G 0 И I don’t think you can with real numbers however you could use imanginary numbers to solve the problem
6th Jun 2021, 8:25 PM
Ollie Q
Ollie Q - avatar