Index of Functions: A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X 
Index Page
cspice_polyds

Table of contents
Abstract
I/O
Parameters
Examples
Particulars
Exceptions
Files
Restrictions
Required_Reading
Literature_References
Author_and_Institution
Version
Index_Entries


Abstract


   CSPICE_POLYDS computes the value of a polynomial and its first
   `nderiv' derivatives at the value `t'.

I/O


   Given:

      coeffs   the coefficients of the polynomial that is to be evaluated.

               help, coeffs
                  DOUBLE = Array[deg+1]

               The first element of this array should be the constant term,
               the second element the linear coefficient, the third term the
               quadratic coefficient, and so on. The number of coefficients
               supplied should be one more than `deg'.

                  f(x) =   coeffs[0] + coeffs[1]*x + coeffs[2]*x^2

                         + coeffs[3]*x^4 + ... + coeffs[deg]*x^deg

      deg      the degree of the polynomial to be evaluated.

               help, deg
                  LONG = Scalar

               `deg' should be one less than the number of coefficients
               supplied.

      nderiv   the number of derivatives to compute.

               help, nderiv
                  LONG = Scalar

               If `nderiv' is zero, only the polynomial will be evaluated.
               If nderiv = 1, then the polynomial and its first derivative
               will be evaluated, and so on. If the value of `nderiv' is
               negative, the routine signals an error.

      t        the point at which the polynomial and its derivatives should
               be evaluated.

               help, t
                  DOUBLE = Scalar

   the call:

      cspice_polyds, coeffs, deg, nderiv, t, p

   returns:

      p        an array containing the value of the polynomial and its
               derivatives evaluated at `t'.

               help, p
                  DOUBLE = Array[nderiv+1]

               The first element of the array contains the value of `p' at
               `t'. The second element of the array contains the value of
               the first derivative of `p' at `t' and so on. The `nderiv' +
               1'st element of the array contains the NDERIV'th derivative
               of `p' evaluated at `t'.

Parameters


   None.

Examples


   Any numerical results shown for this example may differ between
   platforms as the results depend on the SPICE kernels used as input
   and the machine specific arithmetic implementation.

   1) For the polynomial

         f(x) = 1 + 3*x + 0.5*x^2 + x^3 + 0.5*x^4 - x^5 + x^6

      the coefficient set

         Degree  coeffs
         ------  ------
         0       1
         1       3
         2       0.5
         3       1
         4       0.5
         5      -1
         6       1

      Compute the value of the polynomial and it's first
      3 derivatives at the value t = 1.0. We expect:

         Derivative Number     t = 1
         ------------------    -----
         f(x)         0        6
         f'(x)        1        10
         f''(x)       2        23
         f'''(x)      3        78


      Example code begins here.


      PRO polyds_ex1

         ;;
         ;; Local constants.
         ;;
         NDERIV =   3L

         coeffs = [1.D0,3.D0,0.5D0,1.D0,0.5D0,-1.D0,1.D0]

         t      = 1.D0
         deg    = 6L

         cspice_polyds, coeffs, deg, NDERIV, t, p

         for i=0L, NDERIV do begin

            print, 'P = ', p[i]

         endfor

      END


      When this program was executed on a Mac/Intel/IDL8.x/64-bit
      platform, the output was:


      P =        6.0000000
      P =        10.000000
      P =        23.000000
      P =        78.000000


Particulars


   This routine uses the user supplied coefficients (coeffs)
   to evaluate a polynomial (having these coefficients) and its
   derivatives at the point `t'. The zero'th derivative of the
   polynomial is regarded as the polynomial itself.

Exceptions


   1)  If `nderiv' is less than zero, an error is signaled by the Icy
       interface.

   2)  If the degree of the polynomial is less than 0, the routine
       returns the first nderiv+1 elements of `p' set to 0.

   3)  If any of the input arguments, `coeffs', `deg', `nderiv' or
       `t', is undefined, an error is signaled by the IDL error
       handling system.

   4)  If any of the input arguments, `coeffs', `deg', `nderiv' or
       `t', is not of the expected type, or it does not have the
       expected dimensions and size, an error is signaled by the Icy
       interface.

   5)  If the output argument `p' is not a named variable, an error
       is signaled by the Icy interface.

   6)  If the number of elements in `coeffs' is less than deg+1, an error
       is signaled by the Icy interface.

Files


   None.

Restrictions


   1)  Depending on the coefficients the user should be careful when
       taking high order derivatives. As the example shows, these
       can get big in a hurry. In general the coefficients of the
       derivatives of a polynomial grow at a rate greater
       than N! (N factorial).

Required_Reading


   ICY.REQ

Literature_References


   None.

Author_and_Institution


   J. Diaz del Rio     (ODC Space)

Version


   -Icy Version 1.0.0, 16-JUL-2021 (JDR)

Index_Entries


   compute a polynomial and its derivatives



Fri Dec 31 18:43:06 2021