python - Numpy throws incorrect roots -
i'm using numpy solve quadratic equations, found equation i'm not getting correct result using function numpy.roots()
the following equation:
has these roots (tested manually , online calculators):
but entering command numpy.roots([1, 6, 9])
output got was
array([-3. +3.72529030e-08j, -3. -3.72529030e-08j])
i tried different equations, in cases numpy's result correct. problem particular example. other successful examples tried were:
numpy.roots([1, 6, 13]) numpy.roots([1, -6, 17]) numpy.roots([1, -5, 6]) numpy.roots([1, -10, 25]) numpy.roots([1, 4, 4])
is there possibility of being bug or i'm misundersanding behavior of function?
thanks
Comments
Post a Comment