Reputation: 11
I've been able to use the polyRoots function since day one, but all of a sudden it stopped working and it keeps returning an empty result,does someone know what is happening? Thank you in advance! This is the return I get, I´ve put a very simple one so that I know it's not an input problem
Upvotes: 1
Views: 691
Reputation: 115
The function polyRoots
only returns the real-valued zeros of a polynomial. Instead, you can use cPolyRoots
to include complex-valued zeros, which will -- in your case -- look something like this:
cPolyRoots(3*x^2+4*x+5,x)
{-2/3-sqrt(11)/3*i,-2/3+sqrt(11)/3*i}
In case you're not familiar with complex numbers, here's a Wikipedia article regarding them. Basically, i=sqrt(-1)
, which is a number that isn't present anywhere on the real number line; the real number line only includes negative infinity through positive infinity.
Upvotes: 0