declare FindRootWithHalfInterwal
fun {FindRootWithHalfInterwal F A B}
Av = (A+B)/2.0
Temp = {F Av}
in
% Print things for debugging
%{Browse average}
%{Browse Av}
%{Browse temp}
%{Browse Temp}
if Temp<0.0 then {FindRootWithHalfInterwal F Av B}
elseif Temp>0.0 then {FindRootWithHalfInterwal F A Av}
else Av
end
end
%Test
{Browse {FindRootWithHalfInterwal
fun{$ X} 3.0*X-15.0 end 4.5 6.0}}
Thursday, January 29, 2009
Ch3, EX3
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment