function p=false_position(f,p0,p1,tol,max_iterations) % Method of false position: See section 2.3. % Use variables q0 and q1 to store f(p0) and f(p1). % This reduces the number of times we need to evaluate f. q0=f(p0); q1=f(p1); for i=1:max_iterations % Store the last two iterations in p0 and p1. p = p1 - q1 * (p1-p0)/(q1-q0); q = f(p); if abs(p-p1)