C+ C NAME: C Chebyshev C PURPOSE: C Evaluate value of Chebyshev polynomial in given point X C CATEGORY: C Math: orthogonal polynomials C CALLING SEQUENCE: function Chebyshev(X,N) C INPUTS: C X real the Chebyshev polynomial is evaluated in X C N integer degree of Chebyshev polynomial C OUTPUTS: C Chebyshev real value of n-th degree Chebyshev polynomial in XS C RESTRICTIONS: C The degree N must be larger/equal zero C PROCEDURE: C Evaluation is based three-term recurrence relation for Chebyshev C polynomials (T_0 = 1 ; T_1 = x) C T_i = 2xT_i-1 - T_i-2 ; i = 2,3,4, ... C MODIFICATION HISTORY: C DEC-1991; Paul Hick (UCSD) C- real X integer N Chebyshev = 1 ! N = 0 if (N .eq. 0) return Chebyshev = X ! N = 1 if (N .eq. 1) return X2 = 2*X CM1 = 1 do I=2,N CM2 = CM1 ! degree I-2 CM1 = Chebyshev ! degree I-1 Chebyshev = X2*CM1-CM2 ! degree I (by recursion) end do return end