-
git-svn-id: https://lxsd.femto-st.fr/svn/fvn@59 b657c933-2333-4658-acf2-d3c7c2708721
dbesyn.f90
890 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
function dbesyn(n,x)
use fvn_common
implicit none
! This function compute the rank n Bessel Y function
! using recurrence relation :
! Yn+1(x)=2n/x * Yn(x) - Yn-1(x)
!
real(dp_kind) :: dbesyn
integer :: n
real(dp_kind) :: x
real(dp_kind),external :: dbesy0,dbesy1
real(dp_kind) :: two_on_x,bynm1,byn,bytmp
integer :: i
if (n==0) then
dbesyn=dbesy0(x)
return
end if
if (n==1) then
dbesyn=dbesy1(x)
return
end if
if (n < 0) then
write(*,*) "Error in dbesyn, n must be >= 0"
stop
end if
if (x <= 0.) then
write(*,*) "Error in dbesyn, x must be strictly positive"
end if
two_on_x=2./x
bynm1=dbesy0(x)
byn=dbesy1(x)
do i=1,n-1
bytmp=two_on_x*byn*i-bynm1
bynm1=byn
byn=bytmp
end do
dbesyn=bytmp
end function