def f(x): y=x**3-3*x+1 return y def résol(n): a=1 b=2 if f(a)<f(b) : while b-a>10**(-n): m=(a+b)/2 if f(m)<1 : a=m else: b=m return m print(résol(5))
To embed this project on your website, copy the following code and paste it into your website's HTML: