import numpy as np def f(x): return np.log(x)+2-x a = 0.001 b = 1 while abs(b-a)>=0.001 : c = (a+b)/2 if f(c)<0 : a = c else : b = c print (c)
To embed this project on your website, copy the following code and paste it into your website's HTML: