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 approxima

匿名用户 最后更新于 2021-11-29 17:10 计算机类Computing


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))

已邀请: