NAG Library Routine Document

s18gkf (bessel_j_seq_complex)


s18gkf returns a sequence of values for the Bessel functions Jα+n-1z or Jα-n+1z for complex z, non-negative α<1 and n=1,2,,N+1.


Fortran Interface
Subroutine s18gkf ( z, a, nl, b, ifail)
Integer, Intent (In):: nl
Integer, Intent (Inout):: ifail
Real (Kind=nag_wp), Intent (In):: a
Complex (Kind=nag_wp), Intent (In):: z
Complex (Kind=nag_wp), Intent (Out):: b(abs(nl)+1)
C Header Interface
#include <nagmk26.h>
void  s18gkf_ (const Complex *z, const double *a, const Integer *nl, Complex b[], Integer *ifail)


s18gkf evaluates a sequence of values for the Bessel function of the first kind Jαz, where z is complex and nonzero and α is the order with 0α<1. The N+1-member sequence is generated for orders α,α+1,,α+N when N0. Note that + is replaced by - when N<0. For positive orders the routine may also be called with z=0, since Jq0=0 when q>0. For negative orders the formula
is used to generate the required sequence. The appropriate values of Jqz and Yqz are obtained by calls to s17dcf and s17def.


NIST Digital Library of Mathematical Functions


1:     z – Complex (Kind=nag_wp)Input
On entry: the argument z of the function.
Constraint: z0.0,0.0 when nl<0.
2:     a – Real (Kind=nag_wp)Input
On entry: the order α of the first member in the required sequence of function values.
Constraint: 0.0a<1.0.
3:     nl – IntegerInput
On entry: the value of N.
Constraint: absnl101.
4:     babsnl+1 – Complex (Kind=nag_wp) arrayOutput
On exit: with ifail=0 or 3, the required sequence of function values: bn contains J α+n-1 z  if nl0 and J α-n+1 z  otherwise, for n=1,2,,absnl+1.
5:     ifail – IntegerInput/Output
On entry: ifail must be set to 0, -1 or 1. If you are unfamiliar with this argument you should refer to Section 3.4 in How to Use the NAG Library and its Documentation for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value -1 or 1 is recommended. If the output of error messages is undesirable, then the value 1 is recommended. Otherwise, if you are not familiar with this argument, the recommended value is 0. When the value -1 or 1 is used it is essential to test the value of ifail on exit.
On exit: ifail=0 unless the routine detects an error or a warning has been flagged (see Section 6).

Error Indicators and Warnings

If on entry ifail=0 or -1, explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
On entry, nl=value.
Constraint: nl101.
On entry, a=value.
Constraint: a<1.0.
On entry, a=value.
Constraint: a0.0.
On entry, nl=value.
Constraint: when nl<0, z0.0,0.0.
Computation abandoned due to the likelihood of overflow.
Computation completed but some precision has been lost.
Computation abandoned due to total loss of precision.
Computation abandoned due to failure to satisfy the termination condition.
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 3.9 in How to Use the NAG Library and its Documentation for further information.
Your licence key may have expired or may not have been installed correctly.
See Section 3.8 in How to Use the NAG Library and its Documentation for further information.
Dynamic memory allocation failed.
See Section 3.7 in How to Use the NAG Library and its Documentation for further information.


All constants in s17dcf and s17def are specified to approximately 18 digits of precision. If t denotes the number of digits of precision in the floating-point arithmetic being used, then clearly the maximum number of correct digits in the results obtained is limited by p=mint,18. Because of errors in argument reduction when computing elementary functions inside s17dcf and s17def, the actual number of correct digits is limited, in general, by p-s, where s max1,log10z,log10α  represents the number of digits lost due to the argument reduction. Thus the larger the values of z and α, the less the precision in the result.

Parallelism and Performance

s18gkf is not threaded in any implementation.

Further Comments



This example evaluates J0z,J1z,J2z and J3z at z=0.6-0.8i, and prints the results.

Program Text

Program Text (s18gkfe.f90)

Program Data

Program Data (s18gkfe.d)

Program Results

Program Results (s18gkfe.r)