SkeelKeiper Naive Bisection (p. 79)

Bisection[f_,a0_,b0_] :=
Module[{},
a=N[a0]; (* Slight change -- use a local variable (so as not to alter passed arguments *)
b=N[b0];
fa = f[a];  
fb = f[b];  
c = a+0.5(b-a); 
fc=f[c]; (* Slight change -- moved first evaluation of fc above the while, immediately after c is defined.*)
output={{a,c,b,fc}}; (* Let's collect the output, since we've gone to the trouble of computing it. *)
While[a < c && c<b,
If[ Sign[fa] ==  Sign[fc], 
a = c;fa=fc, 
b = c;fb=fc
];
c = a+0.5(b-a);
fc=f[c];
output=Append[output,{a,c,b,fc}];  (* once again, collect output. *)
]; 
(* Now let's augment the naive function to include printing some nice formatted output: *)
Print[NumberForm[TableForm[output,
TableHeadings->{None,{"(Subscript[a, k])","(Subscript[c, k])","(Subscript[b, k])","f[(Subscript[c, k])]"}}],16]]; 
Print["  c  = ",NumberForm[c,16] ]; 
Print[" Δc  = ±",((b-a)/2)]; 
Print["f[c] = ",NumberForm[fc,16] ]; 
Return[Transpose[output]]; (* Now I'll actually return the output, so that it can be plotted, etc. *)
]

We first illustrate that the naive method works (to some extent!):

f[x_]:=Cos[x]-x
results=Bisection[f,0,Pi/2];
ListPlot[{results[[2]],results[[4]]},PlotStyle->{Thick,PointSize[Large]}]

Now show that it can be used to find quotients, using only multiplication, addition, and subtraction:

f[x_]:=3x-1
results=Bisection[f,.1,1];
ListPlot[{results[[2]],results[[4]]},PlotStyle->{Thick,PointSize[Large]}]

Our interval enpoints are roots, but we miss them -- because we don’t check for f[x]==0 (and neither do we check for

f[x_]:=Sin[x]
results=Bisection[f,0,Pi];
ListPlot[{results[[2]],results[[4]]},PlotStyle->{Thick,PointSize[Large]}]

Our first step is onto a root, but we miss it -- because we don’t check for f[x]==0:

f[x_]:=Cos[x]
results=Bisection[f,0,Pi];
ListPlot[{results[[2]],results[[4]]},PlotStyle->{Thick,PointSize[Large]}]