.


- 4


: f(x) := sin(2*x) - ln(x)

, x,

d,

Program Division;

uses WinCrt;

var

a, b, c, e, x, d : real;

{----------------------------------------------------------------------------------------}

Function func(x : real) : real;

begin

func := sin(2*x) - ln(x)

end;

{----------------------------------------------------------------------------------------}

Procedure half(a, b, e : real; var x, d : real);

var

c : real;

begin

while abs(b - a) > e do

begin

c := (a + b)/2;

if func(a)*func(c) < 0 then b := c else a := c

end;

x := (a + b)/2;

d := abs(b - a)/2

end;

{----------------------------------------------------------------------------------------}

begin

write(' '); readln(a);

write(' '); readln(b);

write(' '); readln(e);

half(a, b, e, x, d);

writeln(' x = ', x:6:10);

writeln(' ', d:2:10)

end.

, .

 

Program Equation;

uses WinCrt;

var

a, b, h, x1, x2, y1, y2, e, x, d : real;

k : integer;

{----------------------------------------------------------------------------------------}

Function fx(x : real) : real;

begin

fx := cos(x) - 0.1*x

end;

{----------------------------------------------------------------------------------------}