'**************************************************** '* Program to demonstrate Chebyser subroutine * '* ------------------------------------------------ * '* Reference: BASIC Scientific Subroutines, Vol. II * '* by F.R. Ruckdeschel, BYTE/McGRAWW-HILL, 1981 [1].* '* ------------------------------------------------ * '* SAMPLE RUN: * '* * '* Chebyshev polynomial coefficients for degree 2 * '* A( 0) = -1 * '* A( 1) = 0 * '* A( 2) = 2 * '* * '* Chebyshev polynomial coefficients for degree 3 * '* A( 0) = 0 * '* A( 1) = -3 * '* A( 2) = 0 * '* A( 3) = 4 * '* * '* Chebyshev polynomial coefficients for degree 4 * '* A( 0) = 1 * '* A( 1) = 0 * '* A( 2) = -8 * '* A( 3) = 0 * '* A( 4) = 8 * '* * '* Chebyshev polynomial coefficients for degree 5 * '* A( 0) = 0 * '* A( 1) = 5 * '* A( 2) = 0 * '* A( 3) = -20 * '* A( 4) = 0 * '* A( 5) = 16 * '* * '* Chebyshev polynomial coefficients for degree 6 * '* A( 0) = -1 * '* A( 1) = 0 * '* A( 2) = 18 * '* A( 3) = 0 * '* A( 4) = -48 * '* A( 5) = 0 * '* A( 6) = 32 * '* * '* Chebyshev polynomial coefficients for degree 7 * '* A( 0) = 0 * '* A( 1) = -7 * '* A( 2) = 0 * '* A( 3) = 56 * '* A( 4) = 0 * '* A( 5) = -112 * '* A( 6) = 0 * '* A( 7) = 64 * '* * '* Chebyshev polynomial coefficients for degree 8 * '* A( 0) = 1 * '* A( 1) = 0 * '* A( 2) = -32 * '* A( 3) = 0 * '* A( 4) = 160 * '* A( 5) = 0 * '* A( 6) = -256 * '* A( 7) = 0 * '* A( 8) = 128 * '* * '* Chebyshev polynomial coefficients for degree 9 * '* A( 0) = 0 * '* A( 1) = 9 * '* A( 2) = 0 * '* A( 3) = -120 * '* A( 4) = 0 * '* A( 5) = 432 * '* A( 6) = 0 * '* A( 7) = -576 * '* A( 8) = 0 * '* A( 9) = 256 * '* * '* Chebyshev polynomial coefficients for degree 10 * '* A( 0) = -1 * '* A( 1) = 0 * '* A( 2) = 50 * '* A( 3) = 0 * '* A( 4) = -400 * '* A( 5) = 0 * '* A( 6) = 1120 * '* A( 7) = 0 * '* A( 8) = -1280 * '* A( 9) = 0 * '* A( 10) = 512 * '* * '**************************************************** DEFINT I-N DEFDBL A-H, O-Z CLS PRINT DIM B(10, 10) FOR n = 2 TO 10 GOSUB 1000 PRINT " Chebyshev polynomial coefficients for degree "; n PRINT FOR i = 0 TO n PRINT " A("; i; ") = "; B(n, i) NEXT i PRINT : IF n < 10 THEN INPUT A$ NEXT n PRINT END '******************************************************** '* Chebyshev series coefficients evaluation subroutine * '* ---------------------------------------------------- * '* The order of the polynomial is n. The coefficients * '* are returned in the array B(i,j), i is the degree of * '* the polynomial, j is the coefficient order. * '******************************************************** 1000 'Establish t0 and t1 coefficients B(0, 0) = 1: B(1, 0) = 0: B(1, 1) = 1 'Return if order is less than two IF n < 2 THEN RETURN FOR i = 2 TO n FOR j = 1 TO i 'Basic recursion relation B(i, j) = 2 * B(i - 1, j - 1) - B(i - 2, j) NEXT j B(i, 0) = -B(i - 2, 0) NEXT i RETURN 'End of file Chebyser.bas