Closed yhkalayci closed 4 years ago
I realized that when the last coefficient of the polynomial is not zero, the algorithm might get confused. For example:
roots([0, 1, 4, 1, 0, 0, 0]) produces -0.0 - 0.0im -0.0 - 0.0im -6120.14...+ 1922.269..im -3.73... + 0.0im -0.267... + 0.0im 0.0 + 0.0im
but the actual result: roots([0, 1, 4, 1]) produces -3.732...+ 0.0im -0.267... - 0.0im 0.0 + 0.0im
I realized that when the last coefficient of the polynomial is not zero, the algorithm might get confused. For example:
roots([0, 1, 4, 1, 0, 0, 0]) produces -0.0 - 0.0im
-0.0 - 0.0im
-6120.14...+ 1922.269..im -3.73... + 0.0im -0.267... + 0.0im 0.0 + 0.0im
but the actual result: roots([0, 1, 4, 1]) produces -3.732...+ 0.0im -0.267... - 0.0im 0.0 + 0.0im