Blame view
fvn_fnlib/dbeskn.f90
891 Bytes
f6bacaf83 ChW 11/09: ANSI c... |
1 |
function dbeskn(n,x) |
8d883e8a1 Integration of ki... |
2 |
use fvn_common |
e1aefab23 git-svn-id: https... |
3 4 5 6 7 |
implicit none ! This function compute the rank n Bessel Y function ! using recurrence relation : ! Kn+1(x)=2n/x * Kn(x) + Kn-1(x) ! |
f6bacaf83 ChW 11/09: ANSI c... |
8 |
real(dp_kind) :: dbeskn |
e1aefab23 git-svn-id: https... |
9 |
integer :: n |
f6bacaf83 ChW 11/09: ANSI c... |
10 |
real(dp_kind) :: x |
e1aefab23 git-svn-id: https... |
11 |
|
f6bacaf83 ChW 11/09: ANSI c... |
12 13 |
real(dp_kind),external :: dbesk0,dbesk1 real(dp_kind) :: two_on_x,bknm1,bkn,bktmp |
e1aefab23 git-svn-id: https... |
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 43 |
integer :: i if (n==0) then dbeskn=dbesk0(x) return end if if (n==1) then dbeskn=dbesk1(x) return end if if (n < 0) then write(*,*) "Error in dbeskn, n must be >= 0" stop end if if (x <= 0.) then write(*,*) "Error in dbeskn, x must be strictly positive" end if two_on_x=2./x bknm1=dbesk0(x) bkn=dbesk1(x) do i=1,n-1 bktmp=two_on_x*bkn*i+bknm1 bknm1=bkn bkn=bktmp end do dbeskn=bktmp end function |