dvnorm_c |

Table of contents## Proceduredvnorm_c ( Derivative of vector norm ) SpiceDouble dvnorm_c ( ConstSpiceDouble state[6] ) ## AbstractCalculate the derivative of the norm of a 3-vector. ## Required_ReadingNone. ## KeywordsDERIVATIVES MATH VECTOR ## Brief_I/OVARIABLE I/O DESCRIPTION -------- --- -------------------------------------------------- state I A 6-vector composed of three coordinates and their derivatives. The function returns the derivative of the norm of the position component of the input `state' vector. ## Detailed_Inputstate is a double precision 6-vector, the second three components being the derivatives of the first three with respect to some scalar. dx state = ( x, -- ) ds A common form for `state' would contain position and velocity. ## Detailed_OutputThe function returns the derivative of the norm of the position component of the input `state' vector: d ||x|| ## ParametersNone. ## ExceptionsError free. 1) If the first three components of `state' ("x") describe the origin (zero vector) the routine returns zero as the derivative of the vector norm. ## FilesNone. ## ParticularsA common use for this routine is to calculate the time derivative of the radius corresponding to a state vector. ## 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) Compute the derivative of the norm of three vectors of different magnitudes. Use the first two vectors to define the derivatives as parallel and anti-parallel, and let the third be the zero vector Example code begins here. /. Program dvnorm_ex1 ./ #include <math.h> #include <stdio.h> #include "SpiceUsr.h" int main() { /. Local variables. ./ SpiceDouble mag [3] = { -4., 4., 12. }; SpiceDouble x1 [3]; SpiceDouble y [6]; /. Initialize `x1'. ./ vpack_c( 1., sqrt(2.), sqrt(3.), x1 ); /. Parallel... ./ y[0] = x1[0] * pow(10., mag[0] ); y[1] = x1[1] * pow(10., mag[0] ); y[2] = x1[2] * pow(10., mag[0] ); y[3] = x1[0]; y[4] = x1[1]; y[5] = x1[2]; printf( "Parallel x, dx/ds : %f\n", ## RestrictionsNone. ## Literature_ReferencesNone. ## Author_and_InstitutionJ. Diaz del Rio (ODC Space) E.D. Wright (JPL) ## Version-CSPICE Version 1.0.1, 27-AUG-2021 (JDR) Edited the header to comply with NAIF standard. Added example's problem statement. Moved the contents of the -Restrictions section to -Exceptions. Updated example code to remove non ANSI-C feature. -CSPICE Version 1.0.0, 04-MAY-2010 (EDW) ## Index_Entriesderivative of 3-vector norm |

Fri Dec 31 18:41:05 2021