    PROGRAM nag_ell_intg_ex04

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

      ! .. Use Statements ..
      USE nag_examples_io, ONLY : nag_std_out
      USE nag_ell_intg, ONLY : nag_ell_rj
      ! .. Implicit None Statement ..
      IMPLICIT NONE
      ! .. Intrinsic Functions ..
      INTRINSIC KIND
      ! .. Parameters ..
      INTEGER, PARAMETER :: wp = KIND(1.0D0)
      ! .. Local Scalars ..
      INTEGER :: ix, iy, iz
      REAL (wp) :: r, rj, x, y, z
      ! .. Executable Statements ..
      WRITE (nag_std_out,*) 'Example Program Results for nag_ell_intg_ex04'

      WRITE (nag_std_out,*)
      WRITE (nag_std_out,*) '     x      y      z      r         rj'

      r = 2.0_wp
      DO ix = 1, 3
        x = ix*0.5_wp
        DO iy = ix, 3
          y = iy*0.5_wp
          DO iz = iy, 3
            z = iz*0.5_wp

            rj = nag_ell_rj(x,y,z,r)

            WRITE (nag_std_out,fmt='(1X,4F7.2,F12.4)') x, y, z, r, rj
          END DO
        END DO
      END DO

    END PROGRAM nag_ell_intg_ex04
