home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
fortran
/
library
/
ssp
/
polysptp
/
tcnp.for
< prev
next >
Wrap
Text File
|
1985-11-29
|
3KB
|
91 lines
C
C ..................................................................
C
C SUBROUTINE TCNP
C
C PURPOSE
C A SERIES EXPANSION IN CHEBYSHEV POLYNOMIALS WITH INDEPENDENT
C VARIABLE X IS TRANSFORMED TO A POLYNOMIAL WITH INDEPENDENT
C VARIABLE Z, WHERE X=A*Z+B.
C
C USAGE
C CALL TCNP(A,B,POL,N,C,WORK)
C
C DESCRIPTION OF PARAMETERS
C A - FACTOR OF LINEAR TERM IN GIVEN LINEAR TRANSFORMATION
C B - CONSTANT TERM IN GIVEN LINEAR TRANSFORMATION
C POL - COEFFICIENT VECTOR OF POLYNOMIAL (RESULTANT VALUE)
C COEFFICIENTS ARE ORDERED FROM LOW TO HIGH
C N - DIMENSION OF COEFFICIENT VECTORS POL AND C
C C - GIVEN COEFFICIENT VECTOR OF EXPANSION
C COEFFICIENTS ARE ORDERED FROM LOW TO HIGH
C POL AND C MAY BE IDENTICALLY LOCATED
C WORK - WORKING STORAGE OF DIMENSION 2*N
C
C REMARKS
C COEFFICIENT VECTOR C REMAINS UNCHANGED IF NOT COINCIDING
C WITH COEFFICIENT VECTOR POL.
C OPERATION IS BYPASSED IN CASE N LESS THAN 1.
C THE LINEAR TRANSFORMATION X=A*Z+B OR Z=(1/A)(X-B) TRANSFORMS
C THE RANGE (-1,+1) IN X TO THE RANGE (ZL,ZR) IN Z, WHERE
C ZL=-(1+B)/A AND ZR=(1-B)/A.
C FOR GIVEN ZL, ZR WE HAVE A=2/(ZR-ZL) AND B=-(ZR+ZL)/(ZR-ZL)
C
C SUBROUTINES AND FUNCTION SUBPROGRAMS REQUIRED
C NONE
C
C METHOD
C THE TRANSFORMATION IS BASED ON THE RECURRENCE EQUATION
C FOR CHEBYSHEV POLYNOMIALS T(N,X)
C T(N+1,X)=2*X*T(N,X)-T(N-1,X),
C WHERE THE FIRST TERM IN BRACKETS IS THE INDEX,
C THE SECOND IS THE ARGUMENT.
C STARTING VALUES ARE T(0,X)=1, T(1,X)=X.
C THE TRANSFORMATION IS IMPLICITLY DEFINED BY MEANS OF
C X = A*Z+B TOGETHER WITH
C SUM(POL(I)*Z**(I-1), SUMMED OVER I FROM 1 TO N)
C =SUM(C(I)*T(I-1,X), SUMMED OVER I FROM 1 TO N).
C
C ..................................................................
C
SUBROUTINE TCNP(A,B,POL,N,C,WORK)
C
DIMENSION POL(1),C(1),WORK(1)
C
C TEST OF DIMENSION
IF(N-1)2,1,3
C
C DIMENSION LESS THAN 2
1 POL(1)=C(1)
2 RETURN
C
3 POL(1)=C(1)+C(2)*B
POL(2)=C(2)*A
IF(N-2)2,2,4
C
C INITIALIZATION
4 WORK(1)=1.
WORK(2)=B
WORK(3)=0.
WORK(4)=A
XD=A+A
X0=B+B
C
C CALCULATE COEFFICIENT VECTOR OF NEXT CHEBYSHEV POLYNOMIAL
C AND ADD MULTIPLE OF THIS VECTOR TO POLYNOMIAL POL
DO 6 J=3,N
P=0.
C
DO 5 K=2,J
H=P-WORK(2*K-3)+X0*WORK(2*K-2)
P=WORK(2*K-2)
WORK(2*K-2)=H
WORK(2*K-3)=P
POL(K-1)=POL(K-1)+H*C(J)
5 P=XD*P
WORK(2*J-1)=0.
WORK(2*J)=P
6 POL(J)=C(J)*P
RETURN
END