本文实例讲述了python计算方程式根的方法。分享给大家供大家参考。具体实现方法如下:
''' roots = polyRoots(a).
Uses Laguerre's method to compute all the roots of
a[0] + a[1]*x + a[2]*x^2 +...+ a[n]*x^n = 0.
The roots are returned in the array 'roots',
'''
from evalPoly import *
from numpy import zeros,complex
from cmath import sqrt