Notebook
INPUT endpoints a,b; tolerance TOL; maximum number of iterations Nmax OUTPUT approximate solution x of f(x) = 0; or failure message Step 1: Set n = 1; A = f(a); Step 2: While n <= Nmax do 3-6: Step 3: Set p = (a+b)/2; P = f(p); Step 4: If P = 0 or (b-a)/2 < TOL then Step 5: OUTPUT(p); STOP. Step 6: If A*P > 0 then set a = p; A = P; Else set b = p; Step 7: OUPUT('Method failed after Nmax iterations, Nmax = ', Nmax); STOP.