SPEED
GET_LEGENDRE_VALUE_2DER.f90
Go to the documentation of this file.
1! Copyright (C) 2012 The SPEED FOUNDATION
2! Author: Ilario Mazzieri
3!
4! This file is part of SPEED.
5!
6! SPEED is free software; you can redistribute it and/or modify it
7! under the terms of the GNU Affero General Public License as
8! published by the Free Software Foundation, either version 3 of the
9! License, or (at your option) any later version.
10!
11! SPEED is distributed in the hope that it will be useful, but
12! WITHOUT ANY WARRANTY; without even the implied warranty of
13! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14! Affero General Public License for more details.
15!
16! You should have received a copy of the GNU Affero General Public License
17! along with SPEED. If not, see <http://www.gnu.org/licenses/>.
18
31
32 subroutine get_legendre_value_2der(p2der2,p2,p2der,p1,p1der,n,x)
33
34 implicit real*8 (a-h,o-z)
35
36 p2=1.d0
37 p2der=0.d0
38 p2der2=0.d0
39 if (n.eq.0) return
40 p1=p2
41 p2=x
42 p1der=p2der
43 p2der=1.d0
44 p2der2=0.d0
45 p1der2=0.d0
46 p0der2=0.d0
47 if (n.eq.1) return
48 k=1
49 p0=p1
50 p1=p2
51 p0der=p1der
52 p1der=p2der
53 p0der2 = p1der2
54 p1der2 = p2der2
55 dk=dfloat(k)
56 a1=(2.d0*dk+1.d0)/(dk+1.d0)
57 a2=-dk/(dk+1.d0)
58 p2=a1*p1*x+a2*p0
59 p2der=a1*p1+a1*p1der*x+a2*p0der
60 p2der2=a1*p1der2*x+2.d0*a1*p1der+a2*p0der2
61 if (n.eq.2) return
62 do k=2,n-1
63 p0=p1
64 p1=p2
65 p0der=p1der
66 p1der=p2der
67 p0der2=p1der2
68 p1der2=p2der2
69 dk=dfloat(k)
70 a1=(2.d0*dk+1.d0)/(dk+1.d0)
71 a2=-dk/(dk+1.d0)
72 p2=a1*p1*x+a2*p0
73 p2der=a1*p1+a1*p1der*x+a2*p0der
74 p2der2=a1*p1der2*x+2.d0*a1*p1der+a2*p0der2
75 enddo
76 return
77 end subroutine get_legendre_value_2der
subroutine get_legendre_value_2der(p2der2, p2, p2der, p1, p1der, n, x)
Computes Legendre polynomial and its first and second derivative on a given point x.