Numeric Programs

源代码在线查看: rtbis.txt

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

相关代码

				Function RTBIS(X1, X2, XACC:real):real;
				Label 99;
				var
				    DX,FMID,F,XMID,RTB:real;   J,JMAX:integer;
				begin
				    JMAX:=40;
				    FMID:=FUN(X2);
				    F:=FUN(X1);
				    If F * FMID >= 0  Then
				        ShowMessage('Root must be bracketed for bisection.');
				    If F < 0  Then
				    begin
				        RTB:=X1;
				        DX:=X2 - X1;
				    end
				    Else
				    begin
				        RTB:=X2;
				        DX:=X1 - X2;
				    end;
				    For J:=1 To JMAX do
				    begin
				        DX:=DX * 0.5;
				        XMID:=RTB + DX;
				        FMID:=FUN(XMID);
				        If FMID 				        If (Abs(DX) < XACC) Or (FMID = 0) Then goto 99;
				    End; 
				    ShowMessage('too many bisections');
				99: RTBIS:=RTB;
				end;			

相关资源