SUNY Geneseo Department of Mathematics
Friday, November 14
Math 230 01
Fall 2014
Prof. Doug Baldwin
function bisection( f, x1, x2 )
εa = ... % estimated error
εs = ... % tolerance
xm = x1
while εa > εs
xlast = xm
xm = (x1 + x2)/2
εa = | xlast - xm | / xm
if f(xm)f(x1) < 0
x2 = xm
elseif f(xm)f(x1) > 0
x1 = xm
else
εa = 0
end
end
return xm