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

源代码在线查看: unit2.pas

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

相关代码

				unit Unit2;
				
				interface
				uses
				  Windows, Messages, SysUtils, Classes, Graphics, Controls,unit1, Forms, Dialogs;
				
				Function CHEBEV(A, B:real; C:array of real; M:integer; X:real):real;
				procedure CHEBFT(A, B:real; var C:array of real; N:integer);
				procedure CHDER(A,B:real;C:array of real;var CDER:array of real;N:integer);
				
				implementation
				Function CHEBEV(A, B:real; C:array of real; M:integer; X:real):real;
				var
				    D,DD,Y,Y2,SV:real;  J:integer;
				begin
				    If (X - A) * (X - B) > 0 Then ShowMessage('X not in range.');
				    D:=0; 
				    DD:=0; 
				    Y:=(2* X - A - B) / (B - A);
				    Y2:=2* Y;
				    For J:=M DownTo 2 do
				    begin
				        SV:=D;
				        D:=Y2 * D - DD + C[J];
				        DD:=SV;
				    end;
				    CHEBEV:=Y * D - DD + 0.5 * C[1];
				end;
				
				procedure CHEBFT(A, B:real; var C:array of real; N:integer);
				var
				    K,J:integer;  SUM,Y,BMA,BPA,FAC:real;
				    F:array[0..50] of real;
				const
				    NMAX = 50;    PI = 3.14159265358979;
				begin
				    BMA:=0.5 * (B - A);
				    BPA:=0.5 * (B + A);
				    For K:=1 To N do
				    begin
				        Y:=Cos(PI * (K - 0.5) / N);
				        F[K]:=FUNC(Y * BMA + BPA);
				    end;
				    FAC:=2/ N;
				    For J:=1 To N do
				    begin
				        Sum:=0 ;
				        For K:=1 To N do
				        begin
				            Sum:=Sum + F[K] * Cos((PI * (J - 1)) * ((K - 0.5) / N));
				        end;
				        C[J]:=FAC * Sum;
				    end;
				end;
				
				procedure CHDER(A,B:real;C:array of real;var CDER:array of real;N:integer);
				var
				    J:integer;    CON:real;
				begin
				    CDER[N]:=0; 
				    CDER[N - 1]:=2 * (N - 1) * C[N];
				    If N >= 3 Then
				    begin
				        For J:=N - 2 DownTo 1 do
				            CDER[J]:=CDER[J + 2] + 2 * J * C[J + 1];
				    end;
				    CON:=2/(B - A);
				    For J:=1 To N do
				        CDER[J]:=CDER[J] * CON;
				end;
				end.
							

相关资源