Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
def f(x):
return 10-x**2
epsilon = 1e-4
fc = 1
a = 0
b = 10
fa = f(a)
fb = f(b)
n = 0
while (abs(fc)> epsilon):
c = (a+b)/2.0
fc = f(c)
if(fc < 0):
b = c
if(fc > 0):
a = c
print(c)
n = n+1
print(c)
Advertisements
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.
AcceptLearn more