用于开发税务票据管理的软件

源代码在线查看: unit2.pas

软件大小: 36519 K
上传用户: jill
关键词: 软件
下载地址: 免注册下载 普通下载 VIP

相关代码

				unit Unit2;
				
				interface
				uses
				  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,unit1, Dialogs;
				
				procedure TRAPZD(A, B:real;var S:real; N:integer);
				procedure QTRAP(A, B:real; var S:real);
				
				implementation
				procedure TRAPZD(A, B:real;var S:real; N:integer);
				var
				    J,IT:integer;
				    TNM,DEL,X,SUM:real;
				begin
				    If N = 1 Then
				    begin
				        S:=0.5 * (B - A) * (FUNC(A) + FUNC(B));
				        IT:=1;
				    end
				    Else
				    begin
				        IT:=Trunc(exp((N - 2)*Ln(2)));
				        TNM:=IT;
				        DEL:=(B - A) / TNM;
				        X:=A + 0.5 * DEL;
				        Sum:=0;
				        For J:=1 To IT do
				        begin
				            Sum:=Sum + FUNC(X);
				            X:=X + DEL;
				        end;
				        S:=0.5 * (S + (B - A) * Sum / TNM);
				    end;
				end;
				
				procedure QTRAP(A, B:real; var S:real);
				const
				    EPS = 0.000001;    JMAX = 20;
				var
				    OLDS:real;  J:integer;
				begin
				    OLDS:= -1E+30;
				    For J:= 1 To JMAX do
				    begin
				        TRAPZD(A, B, S, J);
				        If (Abs(S - OLDS) < (EPS * Abs(OLDS))) Then Exit;
				        OLDS:= S;
				    end;
				    ShowMessage('Too many steps.');
				end;
				end.
				 			

相关资源