SPEED
GET_LEGENDRE_VALUE.f90 File Reference

Go to the source code of this file.

Functions/Subroutines

subroutine get_legendre_value (p2, p2der, p1, p1der, n, x)
 Computes Legendre polynomial and its derivative on a given point x.
 

Function/Subroutine Documentation

◆ get_legendre_value()

subroutine get_legendre_value (   p2,
  p2der,
  p1,
  p1der,
  n,
  x 
)

Computes Legendre polynomial and its derivative on a given point x.

Author
Ilario Mazzieri
Date
September, 2013
Version
1.0
Parameters
[in]ndegree of the polynomial
[in]xpoint
[out]p2Legendre polynomial of degree n evaluated in x
[out]p2derderivative of p2 evaluated in x
[out]p1Legendre polynomial of degree n-1 evaluated in x
[out]p1derderivative of p1 evaluated in x

Definition at line 31 of file GET_LEGENDRE_VALUE.f90.

32
33 implicit real*8 (a-h,o-z)
34
35 p2 = 1.d0
36 p2der = 0.d0
37 if (n .eq. 0) return
38 p1 = p2
39 p2 = x
40 p1der = p2der
41 p2der = 1.d0
42 if (n .eq. 1) return
43 do k = 1, n-1
44 p0 = p1
45 p1 = p2
46 p0der = p1der
47 p1der = p2der
48 dk = dfloat(k)
49 a1 = (2.d0*dk+1.d0) / (dk+1.d0)
50 a2 = -dk / (dk+1.d0)
51 p2 = a1*p1*x + a2*p0
52 p2der = a1*p1 + a1*p1der*x + a2*p0der
53 enddo
54
55 return

Referenced by find_root_pol(), make_lgl_nodes(), and make_lgl_nw().

Here is the caller graph for this function: