CSPICE_DVNORM returns the derivative of the vector norm of a 3vector.
For important details concerning this module's function, please refer to
the CSPICE routine dvnorm_c.
Given:
state a double precision 6vector, the second three components
of the vector 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.
the call:
dvnorm = cspice_dvnorm(state)
returns:
dvnorm the double precision value of dx corresponding

ds
to 'state'.
1/2 2 2 2 1/2
Where x = < x, x > = ( x1 + x2 + x3 )
v = ( dx1, dx2, dx3 )
  
ds ds ds
dx < x, v >
 =  = < xhat, v >
ds 1/2
< x, x >
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.
;;
;; Create several 6vectors (6x1 arrays) with the structure
;;
;; s =  x 
;;  
;;  dx 
;;   
;;  ds 
;;
;; where 'x' is a 3vector (3x1 array).
;;
;;
;; Create 's' with 'x' of varying magnitudes. Use 'x'
;; and 'x' to define the derivative as parallel and
;; antiparallel.
;;
mag = [ 4.D, 4, 12 ]
x = [ 1.D, sqrt(2.D), sqrt(3.D) ]
s1 = [ x * 10.D^mag[0], x]
s2 = [ x * 10.D^mag[1], x]
s3 = [ dblarr(3), x * 10.D^mag[2] ]
;;
;; Calculate the derivative of the vector norms with respect
;; to 's'.
;;
dvnorm1 = cspice_dvnorm( s1 )
dvnorm2 = cspice_dvnorm( s2 )
dvnorm3 = cspice_dvnorm( s3 )
print, 'Parallel x, dx/ds : ', dvnorm1
print, 'Antiparallel x, dx/ds : ', dvnorm2
print, 'Zero vector x, large dx/ds: ', dvnorm3
IDL outputs:
Parallel x, dx/ds : 2.4494897
Antiparallel x, dx/ds : 2.4494897
Zero vector x, large dx/ds: 0.0000000
None.
ICY.REQ
Icy Version 1.0.0, 10MAY2010, EDW (JPL)
derivative of 3vector norm
