{* * @(#) s_triang.pas - Program for the Square calculation * of the specified curve triangle (problem 1). * (c) 1995 Ivan Maidanski http://ivmai.chat.ru * Freeware program source. All rights reserved. ** * Language: Turbo Pascal * Tested with: Turbo Pascal v6.0 * Last modified: 1995-02-28 16:00:00 GMT+03:00 *} program S_of_Triangle; { y1(x)=exp(-x)+3; y2(x)=2*x-2; y3(x)=1/x } { result_eps=1e-3; method: 3.2.1 } const Eps= 1e-4; type TReal= Real; type TFunc= function (X: TReal): TReal; function Root(F: TFunc; L,H: TReal): TReal; var B: Boolean; var X,FL,FH,FX: TReal; begin FL:=F(L); FH:=F(H); repeat X:=(L*FH-H*FL)/(FH-FL); FX:=F(X); B:=Abs(FX)0 then begin if B then B:=Abs(X-L)