2
SUBROUTINE PVALUE (L, NDER, X, YFIT, YP, A)
3
C***BEGIN PROLOGUE PVALUE
4
C***PURPOSE Use the coefficients generated by POLFIT to evaluate the
5
C polynomial fit of degree L, along with the first NDER of
6
C its derivatives, at a specified point.
9
C***TYPE SINGLE PRECISION (PVALUE-S, DP1VLU-D)
10
C***KEYWORDS CURVE FITTING, LEAST SQUARES, POLYNOMIAL APPROXIMATION
11
C***AUTHOR Shampine, L. F., (SNLA)
12
C Davenport, S. M., (SNLA)
15
C Written by L. F. Shampine and S. M. Davenport.
19
C The subroutine PVALUE uses the coefficients generated by POLFIT
20
C to evaluate the polynomial fit of degree L , along with the first
21
C NDER of its derivatives, at a specified point. Computationally
22
C stable recurrence relations are used to perform this task.
24
C The parameters for PVALUE are
27
C L - the degree of polynomial to be evaluated. L may be
28
C any non-negative integer which is less than or equal
29
C to NDEG , the highest degree polynomial provided
31
C NDER - the number of derivatives to be evaluated. NDER
32
C may be 0 or any positive value. If NDER is less
33
C than 0, it will be treated as 0.
34
C X - the argument at which the polynomial and its
35
C derivatives are to be evaluated.
36
C A - work and output array containing values from last
40
C YFIT - value of the fitting polynomial of degree L at X
41
C YP - array containing the first through NDER derivatives
42
C of the polynomial of degree L . YP must be
43
C dimensioned at least NDER in the calling program.
45
C***REFERENCES L. F. Shampine, S. M. Davenport and R. E. Huddleston,
46
C Curve fitting by polynomials in one variable, Report
47
C SLA-74-0270, Sandia Laboratories, June 1974.
48
C***ROUTINES CALLED XERMSG
49
C***REVISION HISTORY (YYMMDD)
51
C 890531 Changed all specific intrinsics to generic. (WRB)
52
C 890531 REVISION DATE from Version 3.2
53
C 891214 Prologue converted to Version 4.0 format. (BAB)
54
C 900315 CALLs to XERROR changed to CALLs to XERMSG. (THJ)
55
C 900510 Convert XERRWV calls to XERMSG calls. (RWC)
56
C 920501 Reformatted the REFERENCES section. (WRB)
57
C***END PROLOGUE PVALUE
59
CHARACTER*8 XERN1, XERN2
60
C***FIRST EXECUTABLE STATEMENT PVALUE
61
IF (L .LT. 0) GO TO 12
69
IF (L .GT. NORD) GO TO 11
71
IF (NDER .LT. 1) GO TO 2
74
2 IF (L .GE. 2) GO TO 4
85
VAL = A(K2+1) + (X-A(2))*CC
86
IF (NDER .GE. 1) YP(1) = CC
103
A(K3P1) = A(KC-1) + DIF*A(K4P1)
106
C EVALUATE RECURRENCE RELATIONS FOR FUNCTION VALUE AND DERIVATIVES
114
VAL = A(IC) + DIF*A(K3P1) - A(K1I)*A(K4P1)
115
IF (NDO .LE. 0) GO TO 8
119
6 YP(N) = DIF*A(K3PN) + N*A(K3PN-1) - A(K1I)*A(K4PN)
121
C SAVE VALUES NEEDED FOR NEXT EVALUATION OF RECURRENCE RELATIONS
131
C NORMAL RETURN OR ABORT DUE TO ERROR
136
11 WRITE (XERN1, '(I8)') L
137
WRITE (XERN2, '(I8)') NORD
138
CALL XERMSG ('SLATEC', 'PVALUE',
139
* 'THE ORDER OF POLYNOMIAL EVALUATION, L = ' // XERN1 //
140
* ' REQUESTED EXCEEDS THE HIGHEST ORDER FIT, NORD = ' // XERN2 //
141
* ', COMPUTED BY POLFIT -- EXECUTION TERMINATED.', 8, 2)
144
12 CALL XERMSG ('SLATEC', 'PVALUE',
145
+ 'INVALID INPUT PARAMETER. ORDER OF POLYNOMIAL EVALUATION ' //
146
+ 'REQUESTED IS NEGATIVE -- EXECUTION TERMINATED.', 2, 2)