PCOEF()

Fortran version:

    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

C version: none

Summary:

PCOEF() finds the array CN of coefficients for the polynomial P going through the sets of points <XN( k ), YN( k )>, k = 1,...,N. Must have N < 16; in practice, N should not exceed 8, and the points XN( k ) should be well-spaced-out, or numerical instabilities may arise. To evaluate P at X, evaluate the sum
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.

Fortran Usage:

!! under construction !!
Previous: NAMEVAL

Next: PMATVEC

Up: Utility Routines

To: Models-3/EDSS I/O API: The Help Pages