GNU Octave 10.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 
Loading...
Searching...
No Matches
csevl.f
Go to the documentation of this file.
1*DECK CSEVL
2 FUNCTION csevl (X, CS, N)
3C***BEGIN PROLOGUE CSEVL
4C***PURPOSE Evaluate a Chebyshev series.
5C***LIBRARY SLATEC (FNLIB)
6C***CATEGORY C3A2
7C***TYPE SINGLE PRECISION (CSEVL-S, DCSEVL-D)
8C***KEYWORDS CHEBYSHEV SERIES, FNLIB, SPECIAL FUNCTIONS
9C***AUTHOR Fullerton, W., (LANL)
10C***DESCRIPTION
11C
12C Evaluate the N-term Chebyshev series CS at X. Adapted from
13C a method presented in the paper by Broucke referenced below.
14C
15C Input Arguments --
16C X value at which the series is to be evaluated.
17C CS array of N terms of a Chebyshev series. In evaluating
18C CS, only half the first coefficient is summed.
19C N number of terms in array CS.
20C
21C***REFERENCES R. Broucke, Ten subroutines for the manipulation of
22C Chebyshev series, Algorithm 446, Communications of
23C the A.C.M. 16, (1973) pp. 254-256.
24C L. Fox and I. B. Parker, Chebyshev Polynomials in
25C Numerical Analysis, Oxford University Press, 1968,
26C page 56.
27C***ROUTINES CALLED R1MACH, XERMSG
28C***REVISION HISTORY (YYMMDD)
29C 770401 DATE WRITTEN
30C 890831 Modified array declarations. (WRB)
31C 890831 REVISION DATE from Version 3.2
32C 891214 Prologue converted to Version 4.0 format. (BAB)
33C 900315 CALLs to XERROR changed to CALLs to XERMSG. (THJ)
34C 900329 Prologued revised extensively and code rewritten to allow
35C X to be slightly outside interval (-1,+1). (WRB)
36C 920501 Reformatted the REFERENCES section. (WRB)
37C***END PROLOGUE CSEVL
38 REAL b0, b1, b2, cs(*), onepl, twox, x
39 LOGICAL first
40 SAVE first, onepl
41 DATA first /.true./
42C***FIRST EXECUTABLE STATEMENT CSEVL
43 IF (first) onepl = 1.0e0 + r1mach(4)
44 first = .false.
45 IF (n .LT. 1) CALL xermsg ('SLATEC', 'CSEVL',
46 + .LE.'NUMBER OF TERMS 0', 2, 2)
47 IF (n .GT. 1000) CALL xermsg ('SLATEC', 'CSEVL',
48 + .GT.'NUMBER OF TERMS 1000', 3, 2)
49 IF (abs(x) .GT. onepl) CALL xermsg ('SLATEC', 'CSEVL',
50 + 'X OUTSIDE THE INTERVAL (-1,+1)', 1, 1)
51C
52 b1 = 0.0e0
53 b0 = 0.0e0
54 twox = 2.0*x
55 DO 10 i = 1,n
56 b2 = b1
57 b1 = b0
58 ni = n + 1 - i
59 b0 = twox*b1 - b2 + cs(ni)
60 10 CONTINUE
61C
62 csevl = 0.5e0*(b0-b2)
63C
64 RETURN
65 END
function csevl(x, cs, n)
Definition csevl.f:3
real function r1mach(i)
Definition r1mach.f:23
subroutine xermsg(librar, subrou, messg, nerr, level)
Definition xermsg.f:3