Professional Documents
Culture Documents
ASSIGNMENT 1
ANALYTICAL SOLUTION:-
FLOWCHART:-
PROGRAM:-
def f(x):
return x**3-x**2-x-62
if f(a)*f(b)>0:
print("invalid approximation.")
print("Try another values.")
elif f(a)>0:
temp = a
a=b
b=temp
for i in range(n):
x=(a+b)/2
if f(x)<0:
a=x
else:
b=x
print("iteration",i+1,"x=",x,"f(x)=",f(x))
RESULT:-