Numeric Programs

源代码在线查看: d3r8.txt

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

相关代码

				implementation
				//PROGRAM D3R8
				//Driver for routine QGAUS
				uses
				  unit2;
				  {$R *.DFM}
				
				Function FUNC(X:real):real;
				begin
				    FUNC:= X * Exp(-X);
				end;
				
				procedure TForm1.Button1Click(Sender: TObject);
				var
				  F:TextFile;   I,NVAL:Integer;
				  A,B,S,SS,X,X1,X2,DX,AAA:real;
				const
				  s1='%16.6f'; s3='%9.2f';
				begin
				  X1:=0;
				  X2:=5;
				  NVAL:= 10;
				  DX:= (X2-X1)/NVAL;
				  //输出计算结果到文件
				  AssignFile(F, 'd:\delphi_shu\p3\d3r8.dat');
				  Rewrite(F);
				  Writeln(F, '     00 to         QGAUS         Expected');
				  For I:= 1 To NVAL do
				    begin
				      X:=X1 + I * DX;
				      QGAUS(X1,X,SS);
				      AAA:=-(1+X)*Exp(-X)+(1+X1)*Exp(-X1);
				      Writeln(F,Format(s3,[X]),Format(s1,[SS]),Format(s1,[AAA]));
				    end;
				  CloseFile(F);
				  //屏幕显示计算结果
				  memo1.Lines.LoadFromFile('d:\delphi_shu\p3\d3r8.dat');
				end;			

相关资源