Le lundi 06 juillet 2009 à 17:57 +0200, Fabrice Silva a écrit : > Le lundi 06 juillet 2009 à 17:13 +0200, Nils Wagner a écrit : > > IIRC, the coefficients of your polynomial are complex. > > So, you cannot guarantee that the roots are complex > > conjugate pairs. > > Correct! If the construction is done with X1 and X1* treated separately, > the coefficients appear to be complex. But if their processing is done > simultaneously, the combination gives real coefficients. Let me modify > this point and come back to tell you if it is the breakpoint...
Alright, the coefficients are now all real (I still wonder how it passed the check tests I have). You can find attached a simple test. Looking at the evolution of a.r, it seems there really is a trouble with the representation of high order polynomial. 'a' is initialized with its roots, but a.r is far from equal to the input roots... -- Fabrice Silva Laboratory of Mechanics and Acoustics - CNRS 31 chemin Joseph Aiguier, 13402 Marseille, France.
import matplotlib.pyplot as plt import numpy as np import numpy.lib.polynomial as pol plt.figure() S1 = plt.subplot(111) for n in np.arange(50): a = pol.poly1d(np.arange(n)*1.,r=True) print n,np.all(np.diff(a.r)==1), a.r b = pol.poly1d(a.c, r=False) sol = b.r S1.plot(sol, n*np.ones_like(sol), 'r+') plt.xlabel('roots') plt.ylabel('order of polynomial') plt.show()
<<attachment: teste_roots.png>>
_______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion