dvnorm_c

 Procedure Abstract Required_Reading Keywords Brief_I/O Detailed_Input Detailed_Output Parameters Exceptions Files Particulars Examples Restrictions Literature_References Author_and_Institution Version Index_Entries

#### Procedure

```   SpiceDouble       dvnorm_c ( ConstSpiceDouble state )

```

#### Abstract

```   Function to calculate the derivative of the norm of a 3-vector.
```

```   None.
```

#### Keywords

```   DERIVATIVES
MATH
VECTOR

```

#### Brief_I/O

```   VARIABLE  I/O  DESCRIPTION
--------  ---  --------------------------------------------------
state      I   A 6-vector composed of three coordinates and their
derivatives.
```

#### Detailed_Input

```   state   A double precision 6-vector, the second three
components being the derivatives of the first three
with respect to some scalar.

state =  ( x, dx )
--
ds

A common form for 'state' would contain position and
velocity.
```

#### Detailed_Output

```   dvnorm_c   The value of d||x|| corresponding to 'state'.
------
ds

1/2         2    2    2  1/2
where ||x|| = < x, x >    =  ( x1 + x2 + x3 )

v = ( dx1, dx2, dx3 )
---  ---  ---
ds   ds   ds

d||x||   < x, v >
------ =  ------     =  < xhat, v >
ds            1/2
< x, x >
```

#### Parameters

```   None.
```

#### Exceptions

```   None.
```

#### Files

```   None.
```

#### Particulars

```   A common use for this routine is to calculate the time derivative
of the radius corresponding to a state vector.
```

#### 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.

#include "SpiceUsr.h"
#include <stdio.h>
#include <math.h>

int main()
{

SpiceDouble     mag   =
{ -4., 4., 12. };

SpiceDouble     x1    =
{ 1., sqrt(2.), sqrt(3.) };

SpiceDouble     y   ;

/.
Parallel...
./
y = x1 * pow(10., mag );
y = x1 * pow(10., mag );
y = x1 * pow(10., mag );
y = x1;
y = x1;
y = x1;

printf( "Parallel x, dx/ds         : %f\n", dvnorm_c( y ) );

/.
...anti-parallel...
./
y = x1 * pow(10., mag );
y = x1 * pow(10., mag );
y = x1 * pow(10., mag );
y = -x1;
y = -x1;
y = -x1;

printf( "Anti-parallel x, dx/ds    : %f\n", dvnorm_c( y ) );

/.
...'x' zero vector.
./
y = 0.;
y = 0.;
y = 0.;
y = x1 * pow(10., mag );
y = x1 * pow(10., mag );
y = x1 * pow(10., mag );

printf( "Zero vector x, large dx/ds: %f\n", dvnorm_c( y ) );

return 0;
}

The program outputs:

Parallel x, dx/ds         :  2.449490
Anti-parallel x, dx/ds    : -2.449490
Zero vector x, large dx/ds:  0.000000
```

#### Restrictions

```   Error free.

1) If the first three components of 'state' ("x") describes the
origin (zero vector) the routine returns zero as the
derivative of the vector norm.
```

#### Literature_References

```   None.
```

#### Author_and_Institution

```   Ed Wright     (JPL)
```

#### Version

```   -CSPICE Version 1.0.0, 04-MAY-2010 (EDW)
```

#### Index_Entries

```   derivative of 3-vector norm
```
`Wed Apr  5 17:54:33 2017`