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:

enter image description here

has these roots (tested manually , online calculators):

enter image description here

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

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -