program main !*****************************************************************************80 ! !! MAIN is the main program for TEST_NINT_PRB. ! ! Discussion: ! ! TEST_NINT_PRB demonstrates the TEST_NINT integration test functions. ! ! Modified: ! ! 03 June 2007 ! ! Author: ! ! John Burkardt ! implicit none call timestamp ( ) write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'TEST_NINT_PRB' write ( *, '(a)' ) ' FORTRAN90 version' write ( *, '(a)' ) ' Test the routines in the TEST_NINT library.' call test03 write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'TEST_NINT_PRB' write ( *, '(a)' ) ' Normal end of execution.' write ( *, '(a)' ) ' ' call timestamp ( ) stop end subroutine test03 !*****************************************************************************80 ! !! TEST03 applies a Monte Carlo rule to box regions. ! ! Modified: ! ! 04 June 2007 ! ! Author: ! ! John Burkardt ! implicit none integer ( kind = 4 ) dim_num real ( kind = 8 ) error real ( kind = 8 ) exact integer ( kind = 4 ) i integer ( kind = 4 ) n integer ( kind = 4 ) problem integer ( kind = 4 ) problem_num integer ( kind = 4 ) point_num character ( len = 10 ) region real ( kind = 8 ) result integer ( kind = 4 ) seed write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'TEST03' write ( *, '(a)' ) ' Use a Monte Carlo rule on box regions.' write ( *, '(a)' ) ' Use a fixed spatial dimension.' write ( *, '(a)' ) ' ' write ( *, '(a)' ) ' Repeatedly multiply the number of points by 16.' call get_problem_num ( problem_num ) write ( *, '(a)' ) ' ' write ( *, '(a)' ) & ' Prob Dim Points Approx Exact Error' write ( *, '(a)' ) ' ' dim_num = 6 do problem = 28, 28 ! ! Set problem data to default values. ! call p00_default ( problem, dim_num ) ! ! Get region type. ! call p00_region ( problem, region ) if ( region(1:3) == 'box' ) then do i = 1, 12 if ( i == 1 ) then point_num = 1 else point_num = 4 * point_num end if seed = 123456789 call random_initialize ( seed ) call p00_box_mc ( problem, dim_num, point_num, result ) call p00_exact ( problem, dim_num, exact ) if ( exact == huge ( exact ) ) then write ( *, '(2x,i4,2x,i4,i10,g14.6,a14,2x,a14)' ) & problem, dim_num, point_num, result, & '--------------', '--------------' else error = abs ( result - exact ) write ( *, '(2x,i4,2x,i4,i10,g14.6,g14.6,2x,g14.6)' ) & problem, dim_num, point_num, result, exact, error end if end do write ( *, '(a)' ) ' ' end if end do return end