SUBROUTINE PCOEF( N, XN, YN, CN ) INTEGER N ! length of input vector REAL XN( N ) ! input vector of X-values REAL YN( N ) ! input vector of Y-values REAL CN( N ) ! output vector of polynomial coefficients
SUM( CN( K ) * X**(K-1) ; K = 1,...,N )Note that the following code ( the "Horner trick") is an efficient way to evaluate this in Fortran:
... Y = CN( N ) DO 11 K = N-1, 1, -1 Y = X * Y + CN( K ) 11 CONTINUE ...
See also POLY.
To: Models-3/EDSS I/O API: The Help Pages