uses crt;
function F(x: real): real;
begin
F := 0.1 * x * x - x * ln(x);
end;
function F1(x: real): real;
begin
F1 := 0.2 * x - (ln(x) + 1);
end;
function Bisec(a, b, e: real; var i: integer): real;
var
x, c: real;
begin
i := 0;
repeat
c := (a + b) / 2;
if F(a) * F(c) < 0 then
b := c
else
a := c;
i := i + 1;
until b - a < e;
Bisec := (a + b) / 2;
end;
function Newton(x1, e: real; var i: integer): real;
var
x2: real;
begin
i := 0;
repeat
x2 := x1;
x1 := x1 - F(x1) / F1(x1);
i := i + 1;
until abs(x2 - x1) < e;
Newton := x1;
end;
var
x0, x1, x2, eps, x: real;
k: integer;
begin
clrscr;
x0 := 1.5;
x1 := 1;
x2 := 2;
eps := 0.0001;
x := Newton(x0, eps, k);
writeln('Xnewton=', x:0:5, ' Kiter=', k);
x := Bisec(x1, x2, eps, k);
writeln('Xbisec =', x:0:5, ' Kiter=', k);
readln
end.