chbval_c |

Table of contents## Procedurechbval_c ( Value of a Chebyshev polynomial expansion ) void chbval_c ( ConstSpiceDouble cp [], SpiceInt degp, ConstSpiceDouble x2s [2], SpiceDouble x, SpiceDouble * p ) ## AbstractReturn the value of a polynomial evaluated at the input `x' using the coefficients for the Chebyshev expansion of the polynomial. ## Required_ReadingNone. ## KeywordsINTERPOLATION MATH POLYNOMIAL ## Brief_I/OVARIABLE I/O DESCRIPTION -------- --- -------------------------------------------------- cp I degp+1 Chebyshev polynomial coefficients. degp I Degree of polynomial. x2s I Transformation parameters of polynomial. x I Value for which the polynomial is to be evaluated. p O Value of the polynomial at `x'. ## Detailed_Inputcp is an array of coefficients a polynomial with respect to the Chebyshev basis. The polynomial to be evaluated is assumed to be of the form: cp[degp]*T(degp,s) + cp[degp-1]*T(degp-1,s) + ... + cp[1]*T(1,s) + cp[0]*T(0,s) where T(i,s) is the i'th Chebyshev polynomial evaluated at a number `s' whose double precision value lies between -1 and 1. The value of `s' is computed from the input variables x2s[0], x2s[1] and `x'. degp is the degree of the Chebyshev polynomial to be evaluated. x2s is an array of two parameters. These parameters are used to transform the domain of the input variable `x' into the standard domain of the Chebyshev polynomial. x2s[0] should be a reference point in the domain of `x'; x2s[1] should be the radius by which points are allowed to deviate from the reference point and while remaining within the domain of `x'. The value of `x' is transformed into the value `s' given by s = ( x - x2s[0] ) / x2s[1] Typically x2s[0] is the midpoint of the interval over which `x' is allowed to vary and x2s[1] is the radius of the interval. The main reason for doing this is that a Chebyshev expansion is usually fit to data over a span from A to B where A and B are not -1 and 1 respectively. Thus to get the "best fit" the data was transformed to the interval [-1,1] and coefficients generated. These coefficients are not rescaled to the interval of the data so that the numerical "robustness" of the Chebyshev fit will not be lost. Consequently, when the "best fitting" polynomial needs to be evaluated at an intermediate point, the point of evaluation must be transformed in the same way that the generating points were transformed. x is the value for which the polynomial is to be evaluated. ## Detailed_Outputp is the value of the polynomial to be evaluated. It is given by cp[degp]*T(degp,s) + cp[degp-1]*T(degp-1,s) + ... + cp[1]*T(1,s) + cp[0]*T(0,s) where T(i,s) is the i'th Chebyshev polynomial evaluated at a number s = ( x - x2s[0] )/x2s[1] ## ParametersNone. ## ExceptionsError free. 1) No tests are performed for exceptional values (`degp' negative, etc.). This routine is expected to be used at a low level in ephemeris evaluations. For that reason it has been elected as a routine that will not participate in error handling. ## FilesNone. ## ParticularsThis routine computes the value `p' given by cp[degp]*T(degp,s) + cp[degp-1]*T(degp-1,s) + ... + cp[1]*T(1,s) + cp[0]*T(0,s) where s = ( x - x2s[0] ) / x2s[1] and T(i,s) is the i'th Chebyshev polynomial of the first kind evaluated at `s'. ## ExamplesThe numerical results shown for this example may differ across platforms. The results depend on the SPICE kernels used as input, the compiler and supporting libraries, and the machine specific arithmetic implementation. 1) Depending upon the user's needs, there are 3 routines available for evaluating Chebyshev polynomials. ## Restrictions1) One needs to be careful that the value (x-x2s[0]) / x2s[1] lies between -1 and 1. Otherwise, the routine may fail spectacularly (for example with a floating point overflow). ## Literature_References[1] W. Press, B. Flannery, S. Teukolsky and W. Vetterling, "Numerical Recipes -- The Art of Scientific Computing," chapter 5.4, "Recurrence Relations and Clenshaw's Recurrence Formula," p 161, Cambridge University Press, 1986. [2] T. Rivlin, "The Chebyshev Polynomials," Wisley, 1974. [3] R. Weast and S. Selby, "CRC Handbook of Tables for Mathematics," 4th Edition, CRC Press, 1976. ## Author_and_InstitutionJ. Diaz del Rio (ODC Space) ## Version-CSPICE Version 1.0.0, 16-JUL-2021 (JDR) ## Index_Entriesvalue of a chebyshev polynomial expansion |

Fri Dec 31 18:41:02 2021