Just wrote: > While googling for a non-linear equation solver, I found > Math::Polynomial::Solve in CPAN. It seems a great little module, except > it's not Python... I'm especially looking for its poly_root() > functionality (which solves arbitrary polynomials). Does anyone know of > a Python module/package that implements that?
If you don't have a great need for speed, you can accomplish this easily with the linear algebra module of Numeric/numarray. Suppose your quintic polynomial's in the form a + b*x + c*x**2 + d*x**3 + e*x**4 + x**5 The roots of it are equal to the eigenvalues of the companion matrix: 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 -a -b -c -d -e It should be pretty easy to set up a Numeric matrix and call LinearAlgebra.eigenvalues. For example, here is a simple quintic solver: . from Numeric import * . from LinearAlgebra import * . . def quinticroots(p): . cm = zeros((5,5),Float32) . cm[0,1] = cm[1,2] = cm[2,3] = cm[3,4] = 1.0 . cm[4,0] = -p[0] . cm[4,1] = -p[1] . cm[4,2] = -p[2] . cm[4,3] = -p[3] . cm[4,4] = -p[4] . return eigenvalues(cm) now-you-can-find-all-five-Lagrange-points-ly yr's, -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python-list