I tried to find the square root of a negative number while writing a function to solve quadratic equations but the interpreter said something , it said math domain error, what does this mean. Even though I've been able to solve the quadratic equation using complex numbers and i will be posting it very soon, i want to know when to expect such errors
e-papa
13
Posting Pro in Training
Recommended Answers
Jump to PostMaybe you understand from this interactive session by 'no comments' style:
>>> from math import * >>> sqrt(-1) Traceback (most recent call last): File "<pyshell#1>", line 1, in <module> sqrt(-1) ValueError: math domain error >>> sqrt(-1+0j) Traceback (most recent call last): File "<pyshell#2>", line 1, in <module> …
All 3 Replies
e-papa
13
Posting Pro in Training
TrustyTony
888
pyMod
Team Colleague
Featured Poster
e-papa
13
Posting Pro in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.