Prev Next dcsevl.f Headings

dcsevl.f
      double precision function dcsevl(x,a,n)
c***begin prologue  dcsevl
c***date written   770401   (yymmdd)
c***revision date  820801   (yymmdd)
c***category no.  c3a2
c***keywords  chebyshev,fnlib,special function
c***author  fullerton, w., (lanl)
c***purpose  evaluate the double precision n-term chebyshev series a
c            at x.
c***description
c
c evaluate the n-term chebyshev series a at x.  adapted from
c r. broucke, algorithm 446, c.a.c.m., 16, 254 (1973).
c w. fullerton, c-3, los alamos scientific laboratory.
c
c       input arguments --
c x    double precision value at which the series is to be evaluated.
c a    double precision array of n terms of a chebyshev series.  in
c      evaluating a, only half of the first coefficient is summed.
c n    number of terms in array a.
c***references  (none)
c***routines called  xerror
c***end prologue  dcsevl
c
       double precision a(n),x,twox,b0,b1,b2
c***first executable statement  dcsevl
       if(n.lt.1)call xerror( 'dcsevl  number of terms le 0', 28, 2,2)
       if(n.gt.1000) call xerror ( 'dcsevl  number of terms gt 1000',
     1   31, 3, 2)
       if ((x.lt.-1.d0) .or. (x.gt.1.d0)) call xerror ( 'dcsevl  x outsi
     1de (-1,+1)', 25, 1, 1)
c
       twox = 2.0d0*x
       b1 = 0.d0
       b0=0.d0
       do 10 i=1,n
         b2=b1
         b1=b0
         ni = n - i + 1
         b0 = twox*b1 - b2 + a(ni)
 10    continue
c
       dcsevl = 0.5d0 * (b0-b2)
c
       return
      end


Input File: omh/dcsevl.f.omh