LEGENDRE(3)



Name

     legendre,  legendre_by_l,  legendre_by_m,  legendre_by_x   -
     Associated Legendre Functions


Library

     (ROOT)/usr/local/lib/libM.a


Syntax

     #include ~soi/(version)/include/soi_util.h

     double legendre (x, l, m, phase)
     double x;
     int l, m, phase;

     int legendre_by_l (Plm, x, l_max, m,
     double *Plm;
     double x;
     int l_max, m, phase;

     int legendre_by_m (Plm, x, l, phase)
     double *Plm;
     double x;
     int l, phase;

     int legendre_by_x (Plm, X, nx, l,
     double *Plm, *X;
     int nx, l, m, phase;


Description

     These functions  calculate  normalized  Associated  Legendre
     Functions  for  real arguments and integer order and degree.
     If phase is non-zero the Condon-Shortley phase, with  alter-
     nating  sign for positive m is used.  Otherwise the standard
     phase is used, with alternating sign for negative m.


Return Value

     When abs (m) > l and the  other  arguments  are  valid,  the
     functions  return 0.0 for Plm.  Arguments outside the ranges
     abs (x) <= 1 and l >=0, abs (m) > l cause the  functions  to
     return NaN.

     legendre returns the single value Plm (x).

     legendre_by_l places values of all Plm (x) with m  <=  l  <=
     l_max in the array Plm, which must be malloc'd to be of suf-
     ficient length (l_max - m + 1). The  function  returns  a  0
     unless x or l_max is out of range.

     legendre_by_m places values of all Plm (x) with 0 <= m <=  l
     in the array Plm, which must be malloc'd to be of sufficient
     length (l + 1). The function returns a 0 unless x  or  l  is
     out of range.
     legendre_by_x places values of Plm (x) for all values  of  x
     in  the  nx-length  array  X in the array Plm, which must be
     malloc'd to be  of  sufficient  length  (nx).  The  function
     returns a 0 unless l or m is out of range.


Author

     Rick Bogart


Bugs

     legendre_by_x may return slightly different results from the
     other  routines for values of m near 0 and for values of |x|
     near, but not at  unity,  presumably  because  of  round-off
     error.   The  differences  are small, never exceeding 1e-10,
     but they are machine- and/or compiler-dependent.

     legendre_by_m returns slightly  different  values  from  the
     other  routines  for  small  m and |x| near unity because it
     uses a different algorithm.   It  does  not  produce  useful
     values on a DEC RISC machine for the case m = 0 when l > 200
     and |x| > 0.9997.  On a NeXT the values are accurate (within
     1e-10) for all x up to l of about 2000.


HISTORY

     1993-09-29
     1994-02-08 SOI Version 0.8