Math 753-853 HW2 hints


Problem 1 bisection search. People seem to be having understanding this algorithm and expressing it algorithmically. So here is some pseudo-code to get you started. It is not ideal and not complete!

given a continuous function f(x) and interval a,b such that f(a) and f(b) have opposite signs

let n = 0 and nmax = some large number

while n is less than nmax
  
  let c = (a+b)/2

  if |f(c)| is less than some small number (i.e. f(c) is approx zero), return c

  else if the sign of f(c) is the same as the sign of f(a), replace a with c
  
  else replace b with c
  
  add 1 to n
  
end