python - Solving equation using bisection method -
is there bisection method can find online, python?
for example, given these equations how can solve them using bisection method?
x^3 = 9 3 * x^3 + x^2 = x + 5 cos^2x + 6 = x
using scipy.optimize.bisect:
import scipy.optimize optimize import numpy np def func(x): return np.cos(x)**2 + 6 - x # 0<=cos(x)**2<=1, root has between x=6 , x=7 print(optimize.bisect(func, 6, 7)) # 6.77609231632
optimize.bisect
calls _zeros._bisect
, implemented in c.
Comments
Post a Comment