.


- 10


begin

n := n + 1;

approach(a, b, n, x2, y2);

b := x2; x2 := x1; y2 := y1; goto 1

end;

if (x2 <= x1) and (y2 > y1)

then

begin

n := n + 1;

approach(a, b, n, x2, y2);

a := x2; x2 := x1; y2 := y1; goto 1

end;

if (x2 > x1) and (y2 < y1)

then

begin

n := n + 1;

approach(a, b, n, x2, y2);

a := x1; goto 1

end;

if (x2 <= x1) and (y2 <= y1)

then

begin

n := n + 1;

approach(a, b, n, x2, y2);

b := x1; goto 1

end;

n := n + 1;

approach(a, b, n, x2, y2);

1: end;

x := (a + b)/2;

end;

27. .

 

Procedure mingold(a, b, e : real; var

x : real);

var

x1, x2, y1, y2 : real;

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

Function func(x : real):real;

begin

func := ????????????

end;

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

Function f1(a, b : real) : real;

begin

f1 := 0.618*a + 0.382*b

end;

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

Function f2(a, b : real) : real;

begin

f2 := 0.382*a+0.618*b

end;

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

begin

x1 := f1(a, b); y1 := func(x1);

x2 := f2(a, b); y2 := func(x2);




- -  - -  - -