c/* %W% latest revision %G% %U% */ subroutine legpol(x, Plofx, n) ************************************************************************ c *** Uses recurrence formula given in Jackson's E&M (pg. 90) c *** directly by dimensioning Plofx from l = zero to l = 49 c *** and thus differs significantly from the old code c *** c *** x = cos(theta) c *** Plofx's are the Legendre Polynomials c *** n = # of Pl's wanted implicit real*8 (a-h, o-z) dimension Plofx(0:99) c>>>> FIRST EXECUTABLE STATEMENT <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Plofx(0) = 1.0 Plofx(1) = x if (n .gt. 2) then nn = n - 2 do 100 l = 1,nn Plofx(l+1) = (2 * l + 1) * x * Plofx(l) - l * Plofx(l-1) Plofx(l+1) = Plofx(l+1)/(l+1) 100 continue endif return end