iamjack
unread,Sep 16, 2012, 12:39:43 PM9/16/12You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
Hi,
I am trying to compute the Bessel function(s) using the SLATEC Amos library available on Netlib. Here is the code I use. The arguments for routine CBESY by Amos are explained in comments header.
c****************************************************************************
PROGRAM BESSELTEST
IMPLICIT NONE
C***BEGIN PROLOGUE CBESY
C***PURPOSE Compute a sequence of the Bessel functions Y(a,z) for
C complex argument z and real nonnegative orders a=b,b+1,
C b+2,... where b>0. A scaling option is available to
C help avoid overflow.
C***LIBRARY SLATEC
C***CATEGORY C10A4
C***TYPE COMPLEX (CBESY-C, ZBESY-C)
C***KEYWORDS BESSEL FUNCTIONS OF COMPLEX ARGUMENT,
C BESSEL FUNCTIONS OF SECOND KIND, WEBER'S FUNCTION,
C Y BESSEL FUNCTIONS
C***AUTHOR Amos, D. E., (SNL)
C***DESCRIPTION
C
C On KODE=1, CBESY computes an N member sequence of complex
C Bessel functions CY(L)=Y(FNU+L-1,Z) for real nonnegative
C orders FNU+L-1, L=1,...,N and complex Z in the cut plane
C -pi<arg(Z)<=pi. On KODE=2, CBESY returns the scaled
C functions
C
C CY(L) = exp(-abs(Y))*Y(FNU+L-1,Z), L=1,...,N, Y=Im(Z)
C
C which remove the exponential growth in both the upper and
C lower half planes as Z goes to infinity. Definitions and
C notation are found in the NBS Handbook of Mathematical
C Functions (Ref. 1).
C
C Input
C Z - Nonzero argument of type COMPLEX
C FNU - Initial order of type REAL, FNU>=0
C KODE - A parameter to indicate the scaling option
C KODE=1 returns
C CY(L)=Y(FNU+L-1,Z), L=1,...,N
C =2 returns
C CY(L)=Y(FNU+L-1,Z)*exp(-abs(Y)), L=1,...,N
C where Y=Im(Z)
C N - Number of terms in the sequence, N>=1
C CWRK - A work vector of type COMPLEX and dimension N
C
C Output
C CY - Result vector of type COMPLEX
C NZ - Number of underflows set to zero
C NZ=0 Normal return
C NZ>0 CY(L)=0 for NZ values of L, usually on
C KODE=2 (the underflows may not be in an
C uninterrupted sequence)
C IERR - Error flag
C IERR=0 Normal return - COMPUTATION COMPLETED
C IERR=1 Input error - NO COMPUTATION
C IERR=2 Overflow - NO COMPUTATION
C (abs(Z) too small and/or FNU+N-1
C too large)
C IERR=3 Precision warning - COMPUTATION COMPLETED
C (Result has half precision or less
C because abs(Z) or FNU+N-1 is large)
C IERR=4 Precision error - NO COMPUTATION
C (Result has no precision because
C abs(Z) or FNU+N-1 is too large)
C IERR=5 Algorithmic error - NO COMPUTATION
C (Termination condition not met)
REAL:: FNU
INTEGER, PARAMETER :: N = 2
COMPLEX :: Z, CY(N), CWRK(N)
INTEGER :: IERR, NZ, KODE
FNU = 0.0
KODE = 2
Z = CMPLX (0.3, 0.4)
CALL CBESY(Z, FNU, KODE, N, CY, NZ, CWRK, IERR)
WRITE(*,*) 'NZ: ', NZ
WRITE(*,*) 'IERR: ', IERR
WRITE(*,*) 'CY: ', CY
STOP
END PROGRAM
c****************************************************************************
For the arguments used in the program above, I get following output:
*****************************************************************************
NZ: 0
IERR: 4
CY: ( 0.0000000 , 0.0000000 ) ( 0.0000000 , 0.0000000 )
*****************************************************************************
Ierr = 4 meaning there is some problem with the input itself. Although I can't figure out what's the problem. Any clues? Much thanks for the suggestions.
J.