home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
fortran
/
library
/
ssp
/
polyops
/
dpecn.for
next >
Wrap
Text File
|
1985-11-29
|
3KB
|
101 lines
C
C ..................................................................
C
C SUBROUTINE DPECN
C
C PURPOSE
C ECONOMIZE A POLYNOMIAL FOR SYMMETRIC RANGE
C
C USAGE
C CALL DPECN(P,N,BOUND,EPS,TOL,WORK)
C
C DESCRIPTION OF PARAMETERS
C P - DOUBLE PRECISION COEFFICIENT VECTOR OF GIVEN
C POLYNOMIAL
C ON RETURN P CONTAINS THE ECONOMIZED POLYNOMIAL
C N - DIMENSION OF COEFFICIENT VECTOR P
C ON RETURN N CONTAINS DIMENSION OF ECONOMIZED
C POLYNOMIAL
C BOUND - SINGLE PRECISION RIGHT HAND BOUNDARY OF RANGE
C EPS - SINGLE PRECISION INITIAL ERROR BOUND
C ON RETURN EPS CONTAINS AN ERROR BOUND FOR THE
C ECONOMIZED POLYNOMIAL
C TOL - SINGLE PRECISION TOLERANCE FOR ERROR
C FINAL VALUE OF EPS MUST BE LESS THAN TOL
C WORK - DOUBLE PRECISION WORKING STORAGE OF DIMENSION N
C (STARTING VALUE OF N RATHER THAN FINAL VALUE)
C
C REMARKS
C THE OPERATION IS BYPASSED IN CASE OF N LESS THAN 1.
C IN CASE OF AN ARBITRARY INTERVAL (XL,XR) IT IS NECESSARY
C FIRST TO CALCULATE THE EXPANSION OF THE GIVEN POLYNOMIAL
C WITH ARGUMENT X IN POWERS OF T = (X-(XR-XL)/2).
C THIS IS ACCOMPLISHED THROUGH SUBROUTINE DPCLD.
C
C SUBROUTINES AND FUNCTION SUBPROGRAMS REQUIRED
C NONE
C
C METHOD
C SUBROUTINE DPECN TAKES AN (N-1)ST DEGREE POLYNOMIAL
C APPROXIMATION TO A FUNCTION F(X) VALID WITHIN A TOLERANCE
C EPS OVER THE INTERVAL (-BOUND,BOUND) AND REDUCES IT IF
C POSSIBLE TO A POLYNOMIAL OF LOWER DEGREE VALID WITHIN
C THE GIVEN TOLERANCE TOL.
C THE INITIAL COEFFICIENT VECTOR P IS REPLACED BY THE FINAL
C VECTOR. THE INITIAL ERROR BOUND EPS IS REPLACED BY A FINAL
C ERROR BOUND.
C N IS REPLACED BY THE DIMENSION OF THE REDUCED POLYNOMIAL.
C THE COEFFICIENT VECTOR OF THE N-TH CHEBYSHEV POLYNOMIAL
C IS CALCULATED FROM THE RECURSION FORMULA
C A(K-1)=-A(K+1)*K*L*L*(K-1)/((N+K-2)*(N-K+2))
C REFERENCE
C K. A. BRONS, ALGORITHM 38, TELESCOPE 2, CACM VOL. 4, 1961,
C NO. 3, PP. 151-152.
C
C ..................................................................
C
SUBROUTINE DPECN(P,N,BOUND,EPS,TOL,WORK)
C
DIMENSION P(1),WORK(1)
DOUBLE PRECISION P,WORK
C
FL=BOUND*BOUND
C
C TEST OF DIMENSION
C
1 IF(N-1)2,3,6
2 RETURN
C
3 IF(EPS+ABS(SNGL(P(1)))-TOL)4,4,5
4 N=0
EPS=EPS+ABS(SNGL(P(1)))
5 RETURN
C
C CALCULATE EXPANSION OF CHEBYSHEV POLYNOMIAL
C
6 NEND=N-2
WORK(N)=-P(N)
DO 7 J=1,NEND,2
K=N-J
FN=(NEND-1+K)*(NEND+3-K)
FK=K*(K-1)
7 WORK(K-1)=-WORK(K+1)*DBLE(FK*FL/FN)
C
C TEST FOR FEASIBILITY OF REDUCTION
C
IF(K-2)8,8,9
8 FN=DABS(WORK(1))
GOTO 10
9 FN=N-1
FN=ABS(SNGL(WORK(2))/FN)
10 IF(EPS+FN-TOL)11,11,5
C
C REDUCE POLYNOMIAL
C
11 EPS=EPS+FN
N=N-1
DO 12 J=K,N,2
12 P(J-1)=P(J-1)+WORK(J-1)
GOTO 1
END