相关代码 |
|
Sub CHEBFT(A, B, C(), N) NMAX = 50 Dim F(50) PI = 3.14159265358979 BMA = 0.5 * (B - A) BPA = 0.5 * (B + A) For K = 1 To N Y = Cos(PI * (K - 0.5) / N) F(K) = FUNC(Y * BMA + BPA) Next K FAC = 2# / N For J = 1 To N Sum = 0# For K = 1 To N Sum = Sum + F(K) * Cos((PI * (J - 1)) * ((K - 0.5) / N)) Next K C(J) = FAC * Sum Next J End Sub