The secant method may be programmed in Maple:
eps_step := 1e-5;
eps_abs := 1e-5;
f := x -> sin(x);
x[0] := 1.0;
x[1] := 1.1;
for i from 2 to 100 do
x[i] := (x[i - 2]*f(x[i - 1]) - x[i - 1]*f(x[i - 2]))/(f(x[i - 1]) - f(x[i - 2]));
if abs( x[i] - x[i - 1] ) < eps_step and abs( f( x[i] ) ) < eps_abs then
break;
elif i = 100 then
error "method did not converge";
end if;
end do:
x[i];
Copyright ©2005 by Douglas Wilhelm Harder. All rights reserved.


