    PROGRAM nag_bessel_fun_ex01

      ! Example Program Text for nag_bessel_fun
      ! NAG fl90, Release 4. NAG Copyright 2000.

      ! .. Use Statements ..
      USE nag_examples_io, ONLY : nag_std_out
      USE nag_bessel_fun, ONLY : nag_bessel_y0, nag_bessel_y1, nag_bessel_i0, &
       nag_bessel_i1, nag_bessel_j0, nag_bessel_j1, nag_bessel_k0, &
       nag_bessel_k1
      ! .. Implicit None Statement ..
      IMPLICIT NONE
      ! .. Intrinsic Functions ..
      INTRINSIC KIND
      ! .. Parameters ..
      INTEGER, PARAMETER :: n = 8
      INTEGER, PARAMETER :: wp = KIND(1.0D0)
      ! .. Local Scalars ..
      INTEGER :: i
      REAL (wp) :: i0, i1, j0, j1, k0, k1, y0, y1
      ! .. Local Arrays ..
      REAL (wp) :: x(n)
      ! .. Executable Statements ..
      WRITE (nag_std_out,*) 'Example Program Results for nag_bessel_fun_ex01'

      WRITE (nag_std_out,*)
      WRITE (nag_std_out,*) '       x         Y0(x)       Y1(x)'

      x = (/ 0.5_wp, 1.0_wp, 3.0_wp, 6.0_wp, 8.0_wp, 10.0_wp, 100.0_wp, &
       1000.0_wp/)
      DO i = 1, n

        y0 = nag_bessel_y0(x(i))
        y1 = nag_bessel_y1(x(i))

        WRITE (nag_std_out,'(1X,1P,3E12.3)') x(i), y0, y1
      END DO

      WRITE (nag_std_out,*)
      WRITE (nag_std_out,*) '       x         J0(x)       J1(x)'
      x = (/ -1.0_wp, 0.0_wp, 0.5_wp, 1.0_wp, 3.0_wp, 6.0_wp, 10.0_wp, &
       1000.0_wp/)

      DO i = 1, n

        j0 = nag_bessel_j0(x(i))
        j1 = nag_bessel_j1(x(i))

        WRITE (nag_std_out,'(1X,1P,3E12.3)') x(i), j0, j1
      END DO

      WRITE (nag_std_out,*)
      WRITE (nag_std_out,*) '       x         K0(x)       K1(x)'
      x = (/ 0.4_wp, 0.6_wp, 1.6_wp, 2.5_wp, 3.5_wp, 8.0_wp, 10.0_wp, &
       1000.0_wp/)

      DO i = 1, n

        k0 = nag_bessel_k0(x(i))
        k1 = nag_bessel_k1(x(i))

        WRITE (nag_std_out,'(1X,1P,3E12.3)') x(i), k0, k1
      END DO

      WRITE (nag_std_out,*)
      WRITE (nag_std_out,*) '                scaled      scaled'
      WRITE (nag_std_out,*) '       x         K0(x)       K1(x)'
      x = (/ 0.4_wp, 0.6_wp, 1.6_wp, 2.5_wp, 3.5_wp, 8.0_wp, 10.0_wp, &
       1000.0_wp/)

      DO i = 1, n

        k0 = nag_bessel_k0(x(i),scale=.TRUE.)
        k1 = nag_bessel_k1(x(i),scale=.TRUE.)

        WRITE (nag_std_out,'(1X,1P,3E12.3)') x(i), k0, k1
      END DO

      WRITE (nag_std_out,*)
      WRITE (nag_std_out,*) '       x         I0(x)       I1(x)'
      x = (/ -1.0_wp, 0.0_wp, 0.5_wp, 1.0_wp, 6.0_wp, 10.0_wp, 15.0_wp, &
       20.0_wp/)

      DO i = 1, n

        i0 = nag_bessel_i0(x(i))
        i1 = nag_bessel_i1(x(i))

        WRITE (nag_std_out,'(1X,1P,3E12.3)') x(i), i0, i1
      END DO

      WRITE (nag_std_out,*)
      WRITE (nag_std_out,*) '                scaled      scaled'
      WRITE (nag_std_out,*) '       x         I0(x)       I1(x)'
      x = (/ -1.0_wp, 0.0_wp, 0.5_wp, 1.0_wp, 6.0_wp, 10.0_wp, 20.0_wp, &
       1000.0_wp/)

      DO i = 1, n

        i0 = nag_bessel_i0(x(i),scale=.TRUE.)
        i1 = nag_bessel_i1(x(i),scale=.TRUE.)

        WRITE (nag_std_out,'(1X,1P,3E12.3)') x(i), i0, i1
      END DO

    END PROGRAM nag_bessel_fun_ex01
