%Program 1. Bisection Method %Computes approximate solution of f(x)=0 %Input: inline function f; a,b such that f(a)*f(b)<0, % and iterartion number n positive integer %Output: Bracketing interval [an,bn] and approximate solution cn. function [an,cn,bn] = bisect(f,a,b,n) if sign(f(a))*sign(f(b)) >= 0 error('f(a)f(b)<0 not satisfied!') %ceases execution end an=a; bn=b; c=(a+b)/2; fa=f(a); fb=f(b); k = 1; while k