It is an open method and it is very similar to a false rule because it takes two values, evaluates them and compares them with the same equation, however, this does not need a given interval.
PSEUDOCODE
Input x, a, b, tol
e=tol+1
while e>tol
pnew=a-((f(a)*(a-b))/(f(a)-f(b)))
e=abs(pnew-a)
a=b
b=pnew
end
CODE
clc, clear
x = input ('enter the function with clear x:', 's');
f = inline (x);
a = input ('Enter first value:');
b = input ('Enter first second value:');
tol = input ('Enter the tolerance:');
e = tol + 1;
i = 0;
while e> tol
i = i + 1;
pnew = a - ((f (a) * (a-b)) / (f (a) -f (b)));
e = abs (pnew-a);
fprintf ('iter =% 2i \ t root =% f \ ta =% f \ tb =% f \ tf (root) =% f \ te =% f \ n', i, pnew, a, b, f ( pnew), e)
a = b;
b = pnew;
end