Numeric Programs

源代码在线查看: d8r8.txt

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

相关代码

				implementation
				//PROGRAM D8R8
				//Driver for routine RTSAFE
				uses
				  unit2;
				  {$R *.DFM}
				Function FUN(X:real):real;
				begin
				    FUN:= BESSJ0(X);
				end;
				
				procedure FUND(X:real;var FN,DF:real);
				begin
				    FN:= BESSJ0(X);
				    DF:= -BESSJ1(X);
				end;
				procedure TForm1.Button1Click(Sender: TObject);
				const
				  s1='.###0e+00';  s2='%12.6f';  s3='##';
				  N = 100; NBMAX = 20; X1 = 1; X2 = 50;
				var
				  F:TextFile;   XB1,XB2:array[0..20] of real;
				  I,NB:integer;  XACC,ROOT:real;
				begin
				  NB:=NBMAX;
				  ZBRAK(X1,X2,N,XB1,XB2,NB);
				  //输出计算结果到文件
				  AssignFile(F, 'd:\delphi_shu\p8\d8r8.dat');
				  Rewrite(F);
				  Writeln(F, '  Roots of BESSJ0:');
				  Writeln(F);
				  Writeln(F, '                x          F(x)');
				  Writeln(F);
				  For I:= 1 To NB do
				  begin
				    XACC:=0.000001*(XB1[I]+XB2[I])/2;
				    ROOT:=RTSAFE(XB1[I],XB2[I],XACC);
				    Writeln(F,'Root ',FormatFloat(s3,I),'  ',Format(s2,[ROOT]),
				                           '   ',FormatFloat(s1,BESSJ0(ROOT)));
				  end;
				  CloseFile(F);
				  //屏幕显示计算结果
				  memo1.Lines.LoadFromFile('d:\delphi_shu\p8\d8r8.dat');
				end;			

相关资源