## [PyX-checkins] pyx/pyx helper.py,1.15,1.16

 [PyX-checkins] pyx/pyx helper.py,1.15,1.16 From: Michael Schindler - 2005-09-01 08:26:31 ```Update of /cvsroot/pyx/pyx/pyx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7449 Modified Files: helper.py Log Message: correct a bug in realpolyroots Index: helper.py =================================================================== RCS file: /cvsroot/pyx/pyx/pyx/helper.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** helper.py 29 Aug 2005 16:09:49 -0000 1.15 --- helper.py 1 Sep 2005 08:26:21 -0000 1.16 *************** *** 52,62 **** else: ! N = len(coeffs) # build the Matrix of the polynomial problem mat = Numeric.zeros((N, N), Numeric.Float) for i in range(N-1): mat[i+1][i] = 1 ! for i in range(N-1): ! mat[0][i] = -coeffs[i+1]/coeffs[0] # find the eigenvalues of the matrix (== the zeros of the polynomial) zeros = [complex(zero) for zero in LinearAlgebra.eigenvalues(mat)] --- 52,62 ---- else: ! N = len(coeffs) - 1 # build the Matrix of the polynomial problem mat = Numeric.zeros((N, N), Numeric.Float) for i in range(N-1): mat[i+1][i] = 1 ! for i in range(N): ! mat[0][i] = -coeffs[i+1] / coeffs[0] # find the eigenvalues of the matrix (== the zeros of the polynomial) zeros = [complex(zero) for zero in LinearAlgebra.eigenvalues(mat)] *************** *** 67,71 **** #for zero in zeros: # p = 0 ! # for i in range(N): # p += coeffs[i] * zero**(N-i) # if abs(p) > epsilon: --- 67,71 ---- #for zero in zeros: # p = 0 ! # for i in range(N+1): # p += coeffs[i] * zero**(N-i) # if abs(p) > epsilon: ```

 [PyX-checkins] pyx/pyx helper.py,1.15,1.16 From: Michael Schindler - 2005-09-01 08:26:31 ```Update of /cvsroot/pyx/pyx/pyx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7449 Modified Files: helper.py Log Message: correct a bug in realpolyroots Index: helper.py =================================================================== RCS file: /cvsroot/pyx/pyx/pyx/helper.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** helper.py 29 Aug 2005 16:09:49 -0000 1.15 --- helper.py 1 Sep 2005 08:26:21 -0000 1.16 *************** *** 52,62 **** else: ! N = len(coeffs) # build the Matrix of the polynomial problem mat = Numeric.zeros((N, N), Numeric.Float) for i in range(N-1): mat[i+1][i] = 1 ! for i in range(N-1): ! mat[0][i] = -coeffs[i+1]/coeffs[0] # find the eigenvalues of the matrix (== the zeros of the polynomial) zeros = [complex(zero) for zero in LinearAlgebra.eigenvalues(mat)] --- 52,62 ---- else: ! N = len(coeffs) - 1 # build the Matrix of the polynomial problem mat = Numeric.zeros((N, N), Numeric.Float) for i in range(N-1): mat[i+1][i] = 1 ! for i in range(N): ! mat[0][i] = -coeffs[i+1] / coeffs[0] # find the eigenvalues of the matrix (== the zeros of the polynomial) zeros = [complex(zero) for zero in LinearAlgebra.eigenvalues(mat)] *************** *** 67,71 **** #for zero in zeros: # p = 0 ! # for i in range(N): # p += coeffs[i] * zero**(N-i) # if abs(p) > epsilon: --- 67,71 ---- #for zero in zeros: # p = 0 ! # for i in range(N+1): # p += coeffs[i] * zero**(N-i) # if abs(p) > epsilon: ```