数学算法

源代码在线查看: d3r4.txt

软件大小: 1410 K
上传用户: xhaibo
关键词: 算法
下载地址: 免注册下载 普通下载 VIP

相关代码

				implementation
				//PROGRAM D3R4
				//Driver for routine QROMB
				uses
				  unit2;
				  {$R *.DFM}
				Function FUNC(X:real):real;
				begin
				    FUNC:= Sqr(X)*(Sqr(X) - 2) * Sin(X);
				end;
				
				Function FINT(X:real):real;
				//Integral of FUNC
				var
				    AAA:real;
				begin
				    AAA:= 4 * X * (Sqr(x) - 7) * Sin(X);
				    FINT:= AAA - (Sqr(Sqr(x)) - 14 * Sqr(x) + 28) * Cos(X);
				end;
				
				procedure TForm1.Button1Click(Sender: TObject);
				var
				  F:TextFile;
				  A,B,S:real;
				const
				  s3='%9.6f';   PIO2=1.5707963;
				begin
				  A:=0;
				  B:=PIO2;
				  //输出计算结果到文件
				  AssignFile(F, 'd:\delphi_shu\p3\d3r4.dat');
				  Rewrite(F);
				  Writeln(F, 'Integral of FUNC with QROMB is:');
				  Writeln(F, 'Actual value of integral is: ',
				                   format(s3,[(fint(b)-fint(a))]));
				  QROMB(A,B,S);
				  Writeln(F, 'Resualt from routine QROMB is: ',format(s3,[S]));
				  CloseFile(F);
				  //屏幕显示计算结果
				  memo1.Lines.LoadFromFile('d:\delphi_shu\p3\d3r4.dat');
				end;			

相关资源