Problem 7: Muller's Method
Problem 7: Muller's Method
localhost:8891/nbconvert/html/Problem7MullerMethod.ipynb?download=false 1/3
22/10/2019 Problem7MullerMethod
MAX_ITERATIONS = 10000;
res = 0;
i = 0;
while (True):
if (abs(f(res))<0.000075):
break;
a = b;
b = c;
localhost:8891/nbconvert/html/Problem7MullerMethod.ipynb?download=false 2/3
22/10/2019 Problem7MullerMethod
c = res;
if (i > MAX_ITERATIONS):
print("Root cannot be found using",
"Muller's method");
break;
i += 1;
print('iteration = {}| a = {}| b = {}| c = {}| function, f = {}'.forma
t(i, round(a,4), round(b,4), round(res,4), round(f(res),4)))
if (i <= MAX_ITERATIONS):
print('iteration = {}| c = {}| function,f = {}'.format(i+1, res, f(res
)))
print("The value of the root is",
round(res, 4));
# Driver Code
a = -15;
b = -8;
c = -2;
Muller(a, b, c);
iteration = 1| a = -8| b = -2| c = -2.4635| function, f = 3.8506
iteration = 2| a = -2| b = -2.4635| c = 19.8573| function, f = 410.3471
iteration = 3| a = -2.4635| b = 19.8573| c = -3.405| function, f = -1.5371
iteration = 4| a = 19.8573| b = -3.405| c = -3.1188| function, f = 0.1945
iteration = 5| a = -3.405| b = -3.1188| c = -3.1503| function, f = 0.0078
iteration = 6| a = -3.1188| b = -3.1503| c = 9.686| function, f = -3.3323
iteration = 7| a = -3.1503| b = 9.686| c = 9.1493| function, f = -4.2467
iteration = 8| a = 9.686| b = 9.1493| c = 11.3123| function, f = 5.8243
iteration = 9| a = 9.1493| b = 11.3123| c = 10.491| function, f = -0.1536
iteration = 10| a = 11.3123| b = 10.491| c = 10.5178| function, f = -0.0052
iteration = 11| c = 10.518756854245318| function,f = -3.703213712569209e-06
The value of the root is 10.5188
localhost:8891/nbconvert/html/Problem7MullerMethod.ipynb?download=false 3/3