pylab, matplotlib ... roots function question

Schüle Daniel uval at rz.uni-karlsruhe.de
Sun Jan 21 12:18:14 EST 2007


Hello NG,

given this call to roots funtion from pylab

In [342]: roots([0,2,2])
Out[342]: array([-1.])

as far as I understand it [a0,a1,a2] stands for a0+a1*x+a2*x^2
in the above case it yields 2x^2+2x = 2x(1+x)
and the roots are 0 and -1
I am wondering why roots function gives me only the -1

second try

In [343]: roots([1,0,0])
Out[343]: array([], dtype=float64)

ok, as it should be

In [344]: roots([0,0,1])
Out[344]: array([], dtype=float64)

here again, 0 is the root of x^2

Do I miss something important?


Regards, Daniel



More information about the Python-list mailing list