本文实例讲述了Python查找函数f(x)=0根的解决方法。分享给大家供大家参考。具体实现方法如下:
''' root = ridder(f,a,b,tol=1.0e-9).
Finds a root of f(x) = 0 with Ridder's method.
The root must be bracketed in (a,b).
'''
import error
from math import sqrt
def ridder(f,a,b,tol=1.0e-9):
fa = f(a)
if fa == 0.0: return a
fb = f(b)
if
1