python
2) root = secant(f, x0, x1, acceptableValue) This function takes in the continuous function f with initial guesses of x0 and X1. It also takes in the acceptable value error threshold acceptableValue such that the simulation should stop after the approximate relative error is less than the acceptableValue. Note that acceptable Value is in % units. This function then performs the secant method and outputs the root such that f(root) 0. def f(x): return x*2 - 1 print (secant (f,0,10,40))
没有找到相关结果