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

Abstract
I/O
Examples
Particulars
Required Reading
Version
Index_Entries

Abstract


   CSPICE_RQUAD calculates the roots of a quadratic equation.

   For important details concerning this module's function, please refer to
   the CSPICE routine rquad_c.

I/O

   
   Given the coefficients of a quadratic equation, 'a', 'b', 'c',
   where:
   
         2 
       ax   +   bx   +   c = 0
   
   the call:
   
      cspice_rquad, a, b, c, root1, root2
   
   returns a double precision 2-vector to variable 'root1' 
   representing the first complex root of the equation, and a 
   second double precision vector to variable 'root2' representing 
   the second root.
   
   The returned  2-vectors represent complex numbers of the
   form root = a + bi. root[0] holds the real component of the 
   root, the root[1] holds the imaginary component.
   
   IDL native code to perform the same computation:
   
      root = fz_root( [c ,b, a] )
   

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.

   
      ;;
      ;;        2
      ;; Solve x  + 2x + 3 = 0
      ;;
      cspice_rquad, 1.d, 2.d, 3.d, root1, root2
      print, root1
      print, root2
   
   IDL outputs for root1:
         -1.0000000       1.4142136
   
   IDL outputs for root2:
         -1.0000000      -1.4142136
   
      ;;
      ;; Check the IDL function.
      ;;
      print, fz_roots([3,2,1])
      (  -1.00000,  -1.41421)(  -1.00000,  1.41421)
   
   Note the ordering of the roots differs between cspice_rquad
   and fx_roots.

Particulars


   None.

Required Reading


   ICY.REQ

Version


   -Icy Version 1.0.0, 16-JUN-2003, EDW (JPL)

Index_Entries

 
   roots of a quadratic equation 
 



Wed Apr  5 17:58:03 2017