unit Unit2;
interface
USES
UNIT1;
procedure CHEBFT(A, B:real; var C:array of real; N:integer);
implementation
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;
end.