Blame view
fvn_fnlib/beskn.f90
822 Bytes
e1aefab23 git-svn-id: https... |
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 |
real(4) function beskn(n,x) implicit none ! This function compute the rank n Bessel Y function ! using recurrence relation : ! Kn+1(x)=2n/x * Kn(x) + Kn-1(x) ! integer :: n real(4) :: x real(4),external :: besk0,besk1 real(4) :: two_on_x,bknm1,bkn,bktmp integer :: i if (n==0) then beskn=besk0(x) return end if if (n==1) then beskn=besk1(x) return end if if (n < 0) then write(*,*) "Error in beskn, n must be >= 0" stop end if if (x <= 0.) then write(*,*) "Error in beskn, x must be strictly positive" end if two_on_x=2./x bknm1=besk0(x) bkn=besk1(x) do i=1,n-1 bktmp=two_on_x*bkn*i+bknm1 bknm1=bkn bkn=bktmp end do beskn=bktmp end function |