csevl.f

Go to the documentation of this file.
00001 *DECK CSEVL
00002       FUNCTION CSEVL (X, CS, N)
00003 C***BEGIN PROLOGUE  CSEVL
00004 C***PURPOSE  Evaluate a Chebyshev series.
00005 C***LIBRARY   SLATEC (FNLIB)
00006 C***CATEGORY  C3A2
00007 C***TYPE      SINGLE PRECISION (CSEVL-S, DCSEVL-D)
00008 C***KEYWORDS  CHEBYSHEV SERIES, FNLIB, SPECIAL FUNCTIONS
00009 C***AUTHOR  Fullerton, W., (LANL)
00010 C***DESCRIPTION
00011 C
00012 C  Evaluate the N-term Chebyshev series CS at X.  Adapted from
00013 C  a method presented in the paper by Broucke referenced below.
00014 C
00015 C       Input Arguments --
00016 C  X    value at which the series is to be evaluated.
00017 C  CS   array of N terms of a Chebyshev series.  In evaluating
00018 C       CS, only half the first coefficient is summed.
00019 C  N    number of terms in array CS.
00020 C
00021 C***REFERENCES  R. Broucke, Ten subroutines for the manipulation of
00022 C                 Chebyshev series, Algorithm 446, Communications of
00023 C                 the A.C.M. 16, (1973) pp. 254-256.
00024 C               L. Fox and I. B. Parker, Chebyshev Polynomials in
00025 C                 Numerical Analysis, Oxford University Press, 1968,
00026 C                 page 56.
00027 C***ROUTINES CALLED  R1MACH, XERMSG
00028 C***REVISION HISTORY  (YYMMDD)
00029 C   770401  DATE WRITTEN
00030 C   890831  Modified array declarations.  (WRB)
00031 C   890831  REVISION DATE from Version 3.2
00032 C   891214  Prologue converted to Version 4.0 format.  (BAB)
00033 C   900315  CALLs to XERROR changed to CALLs to XERMSG.  (THJ)
00034 C   900329  Prologued revised extensively and code rewritten to allow
00035 C           X to be slightly outside interval (-1,+1).  (WRB)
00036 C   920501  Reformatted the REFERENCES section.  (WRB)
00037 C***END PROLOGUE  CSEVL
00038       REAL B0, B1, B2, CS(*), ONEPL, TWOX, X
00039       LOGICAL FIRST
00040       SAVE FIRST, ONEPL
00041       DATA FIRST /.TRUE./
00042 C***FIRST EXECUTABLE STATEMENT  CSEVL
00043       IF (FIRST) ONEPL = 1.0E0 + R1MACH(4)
00044       FIRST = .FALSE.
00045       IF (N .LT. 1) CALL XERMSG ('SLATEC', 'CSEVL',
00046      +   'NUMBER OF TERMS .LE. 0', 2, 2)
00047       IF (N .GT. 1000) CALL XERMSG ('SLATEC', 'CSEVL',
00048      +   'NUMBER OF TERMS .GT. 1000', 3, 2)
00049       IF (ABS(X) .GT. ONEPL) CALL XERMSG ('SLATEC', 'CSEVL',
00050      +   'X OUTSIDE THE INTERVAL (-1,+1)', 1, 1)
00051 C
00052       B1 = 0.0E0
00053       B0 = 0.0E0
00054       TWOX = 2.0*X
00055       DO 10 I = 1,N
00056          B2 = B1
00057          B1 = B0
00058          NI = N + 1 - I
00059          B0 = TWOX*B1 - B2 + CS(NI)
00060    10 CONTINUE
00061 C
00062       CSEVL = 0.5E0*(B0-B2)
00063 C
00064       RETURN
00065       END
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines