Numeric Programs

源代码在线查看: zbrac.txt

软件大小: 1570 K
上传用户: __catcher
关键词: Programs Numeric
下载地址: 免注册下载 普通下载 VIP

相关代码

				Procedure ZBRAC(var X1, X2:real; SUCCES:boolean);
				var
				    NTRY,J:integer;  FACTOR,F1,F2:real;
				begin
				    FACTOR:=1.6;
				    NTRY:=50;
				    If X1 = X2 Then ShowMessage('you have to guess an initial range');
				    F1:=FUN(X1);
				    F2:=FUN(X2);
				    SUCCES:=True;
				    For J:=1 To NTRY do
				    begin
				        If F1 * F2 < 0 Then Exit;
				        If Abs(F1) < Abs(F2) Then
				        begin
				            X1:=X1 + FACTOR * (X1 - X2);
				            F1:=FUN(X1);
				        end
				        Else
				        begin
				            X2:=X2 + FACTOR * (X2 - X1);
				            F2:=FUN(X2);
				        end;
				    end; 
				    SUCCES:=False;
				end;			

相关资源