2
SUBROUTINE DP1VLU (L, NDER, X, YFIT, YP, A)
3
C***BEGIN PROLOGUE DP1VLU
4
C***PURPOSE Use the coefficients generated by DPOLFT 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 DOUBLE 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)
17
C The subroutine DP1VLU uses the coefficients generated by DPOLFT
18
C to evaluate the polynomial fit of degree L , along with the first
19
C NDER of its derivatives, at a specified point. Computationally
20
C stable recurrence relations are used to perform this task.
22
C The parameters for DP1VLU are
24
C Input -- ALL TYPE REAL variables are DOUBLE PRECISION
25
C L - the degree of polynomial to be evaluated. L may be
26
C any non-negative integer which is less than or equal
27
C to NDEG , the highest degree polynomial provided
29
C NDER - the number of derivatives to be evaluated. NDER
30
C may be 0 or any positive value. If NDER is less
31
C than 0, it will be treated as 0.
32
C X - the argument at which the polynomial and its
33
C derivatives are to be evaluated.
34
C A - work and output array containing values from last
37
C Output -- ALL TYPE REAL variables are DOUBLE PRECISION
38
C YFIT - value of the fitting polynomial of degree L at X
39
C YP - array containing the first through NDER derivatives
40
C of the polynomial of degree L . YP must be
41
C dimensioned at least NDER in the calling program.
43
C***REFERENCES L. F. Shampine, S. M. Davenport and R. E. Huddleston,
44
C Curve fitting by polynomials in one variable, Report
45
C SLA-74-0270, Sandia Laboratories, June 1974.
46
C***ROUTINES CALLED XERMSG
47
C***REVISION HISTORY (YYMMDD)
49
C 890531 Changed all specific intrinsics to generic. (WRB)
50
C 890911 Removed unnecessary intrinsics. (WRB)
51
C 891006 Cosmetic changes to prologue. (WRB)
52
C 891006 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 DP1VLU
58
IMPLICIT DOUBLE PRECISION (A-H,O-Z)
59
INTEGER I,IC,ILO,IN,INP1,IUP,K1,K1I,K2,K3,K3P1,K3PN,K4,K4P1,K4PN,
60
* KC,L,LM1,LP1,MAXORD,N,NDER,NDO,NDP1,NORD
61
DOUBLE PRECISION A(*),CC,DIF,VAL,X,YFIT,YP(*)
62
CHARACTER*8 XERN1, XERN2
63
C***FIRST EXECUTABLE STATEMENT DP1VLU
64
IF (L .LT. 0) GO TO 12
72
IF (L .GT. NORD) GO TO 11
74
IF (NDER .LT. 1) GO TO 2
77
2 IF (L .GE. 2) GO TO 4
88
VAL = A(K2+1) + (X-A(2))*CC
89
IF (NDER .GE. 1) YP(1) = CC
106
A(K3P1) = A(KC-1) + DIF*A(K4P1)
109
C EVALUATE RECURRENCE RELATIONS FOR FUNCTION VALUE AND DERIVATIVES
117
VAL = A(IC) + DIF*A(K3P1) - A(K1I)*A(K4P1)
118
IF (NDO .LE. 0) GO TO 8
122
6 YP(N) = DIF*A(K3PN) + N*A(K3PN-1) - A(K1I)*A(K4PN)
124
C SAVE VALUES NEEDED FOR NEXT EVALUATION OF RECURRENCE RELATIONS
134
C NORMAL RETURN OR ABORT DUE TO ERROR
139
11 WRITE (XERN1, '(I8)') L
140
WRITE (XERN2, '(I8)') NORD
141
CALL XERMSG ('SLATEC', 'DP1VLU',
142
* 'THE ORDER OF POLYNOMIAL EVALUATION, L = ' // XERN1 //
143
* ' REQUESTED EXCEEDS THE HIGHEST ORDER FIT, NORD = ' // XERN2 //
144
* ', COMPUTED BY DPOLFT -- EXECUTION TERMINATED.', 8, 2)
147
12 CALL XERMSG ('SLATEC', 'DP1VLU',
148
+ 'INVALID INPUT PARAMETER. ORDER OF POLYNOMIAL EVALUATION ' //
149
+ 'REQUESTED IS NEGATIVE.', 2, 2)