subroutine get_prob_num ( prob_num ) !*****************************************************************************80 ! !! GET_PROB_NUM returns the number of test integration problems. ! ! Modified: ! ! 20 April 2003 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, integer ( kind = 4 ) PROB_NUM, the number of test integration ! problems. ! implicit none integer ( kind = 4 ) prob_num prob_num = 76 return end function i4_huge ( ) !*****************************************************************************80 ! !! I4_HUGE returns a "huge" I4. ! ! Discussion: ! ! On an IEEE 32 bit machine, I4_HUGE should be 2**31 - 1, and its ! bit pattern should be ! ! 01111111111111111111111111111111 ! ! In this case, its numerical value is 2147483647. ! ! Using the Dec/Compaq/HP Alpha FORTRAN compiler FORT, I could ! use I4_HUGE() and HUGE interchangeably. ! ! However, when using the G95, the values returned by HUGE were ! not equal to 2147483647, apparently, and were causing severe ! and obscure errors in my random number generator, which needs to ! add I4_HUGE to the seed whenever the seed is negative. So I ! am backing away from invoking HUGE, whereas I4_HUGE is under ! my control. ! ! Explanation: because under G95 the default integer type is 64 bits! ! So HUGE ( 1 ) = a very very huge integer indeed, whereas ! I4_HUGE ( ) = the same old 32 bit big value. ! ! Modified: ! ! 26 January 2007 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, integer ( kind = 4 ) I4_HUGE, a "huge" I4. ! implicit none integer ( kind = 4 ) i4 integer ( kind = 4 ) i4_huge i4_huge = 2147483647 return end subroutine p00_even ( prob, int_num, result ) !*****************************************************************************80 ! !! P00_EVEN uses evenly spaced points to integrate a function. ! ! Modified: ! ! 21 April 2003 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Input, integer ( kind = 4 ) PROB, the problem index. ! ! Input, integer ( kind = 4 ) INT_NUM, the number of sample points. ! ! Output, real ( kind = 8 ) RESULT, the approximate integral. ! implicit none integer ( kind = 4 ) int_num real ( kind = 8 ) a real ( kind = 8 ) a_copy real ( kind = 8 ) b real ( kind = 8 ) b_copy integer ( kind = 4 ) i integer ( kind = 4 ) i4_log_int_2 integer ( kind = 4 ) prob real ( kind = 8 ) p00_fun real ( kind = 8 ) r8_huge real ( kind = 8 ) result real ( kind = 8 ) x(int_num) ! ! In case the interval is infinite or semi-infinite, try to ! handle it sensibly. ! call p00_lim ( prob, a, b ) if ( a /= -r8_huge ( ) ) then a_copy = a else if ( b /= r8_huge ( ) ) then a_copy = b - 2.0D+00**( i4_log_int_2 ( int_num ) / 2 ) else a_copy = 0.0D+00 - 2.0D+00**( i4_log_int_2 ( int_num ) / 2 - 1) end if if ( b /= r8_huge ( ) ) then b_copy = b else if ( a /= -r8_huge ( ) ) then b_copy = a + 2.0D+00**( i4_log_int_2 ( int_num ) / 2 ) else b_copy = 0.0D+00 + 2.0D+00**( i4_log_int_2 ( int_num ) / 2 - 1) end if if ( int_num == 1 ) then x(1) = ( a_copy + b_copy ) / 2.0D+00 else do i = 1, int_num x(i) = ( real ( int_num - i, kind = 8 ) * a_copy & + real ( i - 1, kind = 8 ) * b_copy ) & / real ( int_num - 1, kind = 8 ) end do end if result = 0.0D+00 do i = 1, int_num result = result + p00_fun ( prob, x(i) ) end do result = ( b_copy - a_copy ) * result / real ( int_num, kind = 8 ) return end subroutine p00_exact ( prob, exact ) !*****************************************************************************80 ! !! P00_EXACT returns the exact integral for any problem. ! ! Discussion: ! ! This routine provides a "generic" interface to the exact integral ! routines for the various problems, and allows a problem to be called ! by number (PROB) rather than by name. ! ! In some cases, the "exact" value of the integral is in fact ! merely a respectable approximation. ! ! Modified: ! ! 20 April 2003 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Input, integer ( kind = 4 ) PROB, the number of the desired test problem. ! ! Output, real ( kind = 8 ) EXACT, the exact value of the integral. ! implicit none real ( kind = 8 ) exact integer ( kind = 4 ) prob if ( prob == 1 ) then call p01_exact ( exact ) else if ( prob == 2 ) then call p02_exact ( exact ) else if ( prob == 3 ) then call p03_exact ( exact ) else if ( prob == 4 ) then call p04_exact ( exact ) else if ( prob == 5 ) then call p05_exact ( exact ) else if ( prob == 6 ) then call p06_exact ( exact ) else if ( prob == 7 ) then call p07_exact ( exact ) else if ( prob == 8 ) then call p08_exact ( exact ) else if ( prob == 9 ) then call p09_exact ( exact ) else if ( prob == 10 ) then call p10_exact ( exact ) else if ( prob == 11 ) then call p11_exact ( exact ) else if ( prob == 12 ) then call p12_exact ( exact ) else if ( prob == 13 ) then call p13_exact ( exact ) else if ( prob == 14 ) then call p14_exact ( exact ) else if ( prob == 15 ) then call p15_exact ( exact ) else if ( prob == 16 ) then call p16_exact ( exact ) else if ( prob == 17 ) then call p17_exact ( exact ) else if ( prob == 18 ) then call p18_exact ( exact ) else if ( prob == 19 ) then call p19_exact ( exact ) else if ( prob == 20 ) then call p20_exact ( exact ) else if ( prob == 21 ) then call p21_exact ( exact ) else if ( prob == 22 ) then call p22_exact ( exact ) else if ( prob == 23 ) then call p23_exact ( exact ) else if ( prob == 24 ) then call p24_exact ( exact ) else if ( prob == 25 ) then call p25_exact ( exact ) else if ( prob == 26 ) then call p26_exact ( exact ) else if ( prob == 27 ) then call p27_exact ( exact ) else if ( prob == 28 ) then call p28_exact ( exact ) else if ( prob == 29 ) then call p29_exact ( exact ) else if ( prob == 30 ) then call p30_exact ( exact ) else if ( prob == 31 ) then call p31_exact ( exact ) else if ( prob == 32 ) then call p32_exact ( exact ) else if ( prob == 33 ) then call p33_exact ( exact ) else if ( prob == 34 ) then call p34_exact ( exact ) else if ( prob == 35 ) then call p35_exact ( exact ) else if ( prob == 36 ) then call p36_exact ( exact ) else if ( prob == 37 ) then call p37_exact ( exact ) else if ( prob == 38 ) then call p38_exact ( exact ) else if ( prob == 39 ) then call p39_exact ( exact ) else if ( prob == 40 ) then call p40_exact ( exact ) else if ( prob == 41 ) then call p41_exact ( exact ) else if ( prob == 42 ) then call p42_exact ( exact ) else if ( prob == 43 ) then call p43_exact ( exact ) else if ( prob == 44 ) then call p44_exact ( exact ) else if ( prob == 45 ) then call p45_exact ( exact ) else if ( prob == 46 ) then call p46_exact ( exact ) else if ( prob == 47 ) then call p47_exact ( exact ) else if ( prob == 48 ) then call p48_exact ( exact ) else if ( prob == 49 ) then call p49_exact ( exact ) else if ( prob == 50 ) then call p50_exact ( exact ) else if ( prob == 51 ) then call p51_exact ( exact ) else if ( prob == 52 ) then call p52_exact ( exact ) else if ( prob == 53 ) then call p53_exact ( exact ) else if ( prob == 54 ) then call p54_exact ( exact ) else if ( prob == 55 ) then call p55_exact ( exact ) else if ( prob == 56 ) then call p56_exact ( exact ) else if ( prob == 57 ) then call p57_exact ( exact ) else if ( prob == 58 ) then call p58_exact ( exact ) else if ( prob == 59 ) then call p59_exact ( exact ) else if ( prob == 60 ) then call p60_exact ( exact ) else if ( prob == 61 ) then call p61_exact ( exact ) else if ( prob == 62 ) then call p62_exact ( exact ) else if ( prob == 63 ) then call p63_exact ( exact ) else if ( prob == 64 ) then call p64_exact ( exact ) else if ( prob == 65 ) then call p65_exact ( exact ) else if ( prob == 66 ) then call p66_exact ( exact ) else if ( prob == 67 ) then call p67_exact ( exact ) else if ( prob == 68 ) then call p68_exact ( exact ) else if ( prob == 69 ) then call p69_exact ( exact ) else if ( prob == 70 ) then call p70_exact ( exact ) else if ( prob == 71 ) then call p71_exact ( exact ) else if ( prob == 72 ) then call p72_exact ( exact ) else if ( prob == 73 ) then call p73_exact ( exact ) else if ( prob == 74 ) then call p74_exact ( exact ) else if ( prob == 75 ) then call p75_exact ( exact ) else if ( prob == 76 ) then call p76_exact ( exact ) else write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'P00_EXACT - Fatal error!' write ( *, '(a,i8)' ) ' Illegal problem number = ', prob stop end if return end function p00_fun ( prob, x ) !*****************************************************************************80 ! !! P00_FUN evaluates the integrand for any problem. ! ! Modified: ! ! 20 April 2003 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Input, integer ( kind = 4 ) PROB, the number of the desired test problem. ! ! Input, real ( kind = 8 ) X, the point at which the integrand ! is to be evaluated. ! ! Output, real ( kind = 8 ) P00_FUN, the value of the integrand at X. ! implicit none integer ( kind = 4 ) prob real ( kind = 8 ) p00_fun real ( kind = 8 ) p01_fun real ( kind = 8 ) p02_fun real ( kind = 8 ) p03_fun real ( kind = 8 ) p04_fun real ( kind = 8 ) p05_fun real ( kind = 8 ) p06_fun real ( kind = 8 ) p07_fun real ( kind = 8 ) p08_fun real ( kind = 8 ) p09_fun real ( kind = 8 ) p10_fun real ( kind = 8 ) p11_fun real ( kind = 8 ) p12_fun real ( kind = 8 ) p13_fun real ( kind = 8 ) p14_fun real ( kind = 8 ) p15_fun real ( kind = 8 ) p16_fun real ( kind = 8 ) p17_fun real ( kind = 8 ) p18_fun real ( kind = 8 ) p19_fun real ( kind = 8 ) p20_fun real ( kind = 8 ) p21_fun real ( kind = 8 ) p22_fun real ( kind = 8 ) p23_fun real ( kind = 8 ) p24_fun real ( kind = 8 ) p25_fun real ( kind = 8 ) p26_fun real ( kind = 8 ) p27_fun real ( kind = 8 ) p28_fun real ( kind = 8 ) p29_fun real ( kind = 8 ) p30_fun real ( kind = 8 ) p31_fun real ( kind = 8 ) p32_fun real ( kind = 8 ) p33_fun real ( kind = 8 ) p34_fun real ( kind = 8 ) p35_fun real ( kind = 8 ) p36_fun real ( kind = 8 ) p37_fun real ( kind = 8 ) p38_fun real ( kind = 8 ) p39_fun real ( kind = 8 ) p40_fun real ( kind = 8 ) p41_fun real ( kind = 8 ) p42_fun real ( kind = 8 ) p43_fun real ( kind = 8 ) p44_fun real ( kind = 8 ) p45_fun real ( kind = 8 ) p46_fun real ( kind = 8 ) p47_fun real ( kind = 8 ) p48_fun real ( kind = 8 ) p49_fun real ( kind = 8 ) p50_fun real ( kind = 8 ) p51_fun real ( kind = 8 ) p52_fun real ( kind = 8 ) p53_fun real ( kind = 8 ) p54_fun real ( kind = 8 ) p55_fun real ( kind = 8 ) p56_fun real ( kind = 8 ) p57_fun real ( kind = 8 ) p58_fun real ( kind = 8 ) p59_fun real ( kind = 8 ) p60_fun real ( kind = 8 ) p61_fun real ( kind = 8 ) p62_fun real ( kind = 8 ) p63_fun real ( kind = 8 ) p64_fun real ( kind = 8 ) p65_fun real ( kind = 8 ) p66_fun real ( kind = 8 ) p67_fun real ( kind = 8 ) p68_fun real ( kind = 8 ) p69_fun real ( kind = 8 ) p70_fun real ( kind = 8 ) p71_fun real ( kind = 8 ) p72_fun real ( kind = 8 ) p73_fun real ( kind = 8 ) p74_fun real ( kind = 8 ) p75_fun real ( kind = 8 ) p76_fun real ( kind = 8 ) x if ( prob == 1 ) then p00_fun = p01_fun ( x ) else if ( prob == 2 ) then p00_fun = p02_fun ( x ) else if ( prob == 3 ) then p00_fun = p03_fun ( x ) else if ( prob == 4 ) then p00_fun = p04_fun ( x ) else if ( prob == 5 ) then p00_fun = p05_fun ( x ) else if ( prob == 6 ) then p00_fun = p06_fun ( x ) else if ( prob == 7 ) then p00_fun = p07_fun ( x ) else if ( prob == 8 ) then p00_fun = p08_fun ( x ) else if ( prob == 9 ) then p00_fun = p09_fun ( x ) else if ( prob == 10 ) then p00_fun = p10_fun ( x ) else if ( prob == 11 ) then p00_fun = p11_fun ( x ) else if ( prob == 12 ) then p00_fun = p12_fun ( x ) else if ( prob == 13 ) then p00_fun = p13_fun ( x ) else if ( prob == 14 ) then p00_fun = p14_fun ( x ) else if ( prob == 15 ) then p00_fun = p15_fun ( x ) else if ( prob == 16 ) then p00_fun = p16_fun ( x ) else if ( prob == 17 ) then p00_fun = p17_fun ( x ) else if ( prob == 18 ) then p00_fun = p18_fun ( x ) else if ( prob == 19 ) then p00_fun = p19_fun ( x ) else if ( prob == 20 ) then p00_fun = p20_fun ( x ) else if ( prob == 21 ) then p00_fun = p21_fun ( x ) else if ( prob == 22 ) then p00_fun = p22_fun ( x ) else if ( prob == 23 ) then p00_fun = p23_fun ( x ) else if ( prob == 24 ) then p00_fun = p24_fun ( x ) else if ( prob == 25 ) then p00_fun = p25_fun ( x ) else if ( prob == 26 ) then p00_fun = p26_fun ( x ) else if ( prob == 27 ) then p00_fun = p27_fun ( x ) else if ( prob == 28 ) then p00_fun = p28_fun ( x ) else if ( prob == 29 ) then p00_fun = p29_fun ( x ) else if ( prob == 30 ) then p00_fun = p30_fun ( x ) else if ( prob == 31 ) then p00_fun = p31_fun ( x ) else if ( prob == 32 ) then p00_fun = p32_fun ( x ) else if ( prob == 33 ) then p00_fun = p33_fun ( x ) else if ( prob == 34 ) then p00_fun = p34_fun ( x ) else if ( prob == 35 ) then p00_fun = p35_fun ( x ) else if ( prob == 36 ) then p00_fun = p36_fun ( x ) else if ( prob == 37 ) then p00_fun = p37_fun ( x ) else if ( prob == 38 ) then p00_fun = p38_fun ( x ) else if ( prob == 39 ) then p00_fun = p39_fun ( x ) else if ( prob == 40 ) then p00_fun = p40_fun ( x ) else if ( prob == 41 ) then p00_fun = p41_fun ( x ) else if ( prob == 42 ) then p00_fun = p42_fun ( x ) else if ( prob == 43 ) then p00_fun = p43_fun ( x ) else if ( prob == 44 ) then p00_fun = p44_fun ( x ) else if ( prob == 45 ) then p00_fun = p45_fun ( x ) else if ( prob == 46 ) then p00_fun = p46_fun ( x ) else if ( prob == 47 ) then p00_fun = p47_fun ( x ) else if ( prob == 48 ) then p00_fun = p48_fun ( x ) else if ( prob == 49 ) then p00_fun = p49_fun ( x ) else if ( prob == 50 ) then p00_fun = p50_fun ( x ) else if ( prob == 51 ) then p00_fun = p51_fun ( x ) else if ( prob == 52 ) then p00_fun = p52_fun ( x ) else if ( prob == 53 ) then p00_fun = p53_fun ( x ) else if ( prob == 54 ) then p00_fun = p54_fun ( x ) else if ( prob == 55 ) then p00_fun = p55_fun ( x ) else if ( prob == 56 ) then p00_fun = p56_fun ( x ) else if ( prob == 57 ) then p00_fun = p57_fun ( x ) else if ( prob == 58 ) then p00_fun = p58_fun ( x ) else if ( prob == 59 ) then p00_fun = p59_fun ( x ) else if ( prob == 60 ) then p00_fun = p60_fun ( x ) else if ( prob == 61 ) then p00_fun = p61_fun ( x ) else if ( prob == 62 ) then p00_fun = p62_fun ( x ) else if ( prob == 63 ) then p00_fun = p63_fun ( x ) else if ( prob == 64 ) then p00_fun = p64_fun ( x ) else if ( prob == 65 ) then p00_fun = p65_fun ( x ) else if ( prob == 66 ) then p00_fun = p66_fun ( x ) else if ( prob == 67 ) then p00_fun = p67_fun ( x ) else if ( prob == 68 ) then p00_fun = p68_fun ( x ) else if ( prob == 69 ) then p00_fun = p69_fun ( x ) else if ( prob == 70 ) then p00_fun = p70_fun ( x ) else if ( prob == 71 ) then p00_fun = p71_fun ( x ) else if ( prob == 72 ) then p00_fun = p72_fun ( x ) else if ( prob == 73 ) then p00_fun = p73_fun ( x ) else if ( prob == 74 ) then p00_fun = p74_fun ( x ) else if ( prob == 75 ) then p00_fun = p75_fun ( x ) else if ( prob == 76 ) then p00_fun = p76_fun ( x ) else write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'P00_FUN - Fatal error!' write ( *, '(a,i8)' ) ' Illegal problem number = ', prob stop end if return end subroutine p00_gauss_legendre ( prob, int_num, result ) !*****************************************************************************80 ! !! P00_GAUSS_LEGENDRE applies a composite Gauss-Legendre rule. ! ! Discussion: ! ! A 4 point rule is used. ! ! Modified: ! ! 19 March 2002 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Input, integer ( kind = 4 ) PROB, the problem index. ! ! Input, integer ( kind = 4 ) INT_NUM, the number of subintervals. ! ! Output, real ( kind = 8 ) RESULT, the approximate integral. ! implicit none integer ( kind = 4 ), parameter :: gauss_num = 4 real ( kind = 8 ) a real ( kind = 8 ) a_copy real ( kind = 8 ) a_sub real ( kind = 8 ) b real ( kind = 8 ) b_copy real ( kind = 8 ) b_sub real ( kind = 8 ), parameter, dimension ( gauss_num ) :: gauss_abs = (/ & -0.8611363115D+00, -0.3399810435D+00, & 0.3399810435D+00, 0.8611363115D+00 /) real ( kind = 8 ), parameter, dimension ( gauss_num ) :: gauss_weight = (/ & 0.3478548451D+00, 0.6521451548D+00, & 0.6521451548D+00, 0.3478548451D+00 /) real ( kind = 8 ) h integer ( kind = 4 ) i integer ( kind = 4 ) i4_log_int_2 integer ( kind = 4 ) int_i integer ( kind = 4 ) int_num integer ( kind = 4 ) prob real ( kind = 8 ) p00_fun real ( kind = 8 ) r8_huge real ( kind = 8 ) result real ( kind = 8 ) x ! ! In case the interval is infinite or semi-infinite, try to ! handle it sensibly. ! call p00_lim ( prob, a, b ) if ( a /= -r8_huge ( ) ) then a_copy = a else if ( b /= r8_huge ( ) ) then a_copy = b - 2.0D+00**( i4_log_int_2 ( int_num ) / 2 ) else a_copy = 0.0D+00 - 2.0D+00**( i4_log_int_2 ( int_num ) / 2 - 1) end if if ( b /= r8_huge ( ) ) then b_copy = b else if ( a /= -r8_huge ( ) ) then b_copy = a + 2.0D+00**( i4_log_int_2 ( int_num ) / 2 ) else b_copy = 0.0D+00 + 2.0D+00**( i4_log_int_2 ( int_num ) / 2 - 1) end if h = ( b_copy - a_copy ) / real ( int_num, kind = 8 ) result = 0.0D+00 do int_i = 1, int_num a_sub = ( real ( int_num - int_i + 1, kind = 8 ) * a_copy & + real ( int_i - 1, kind = 8 ) * b_copy ) & / real ( int_num, kind = 8 ) b_sub = ( real ( int_num - int_i, kind = 8 ) * a_copy & + real ( int_i, kind = 8 ) * b_copy ) & / real ( int_num, kind = 8 ) do i = 1, gauss_num x = 0.5D+00 * ( ( 1.0D+00 - gauss_abs(i) ) * a_sub & + ( 1.0D+00 + gauss_abs(i) ) * b_sub ) result = result & + 0.5D+00 * gauss_weight(i) * h * p00_fun ( prob, x ) end do end do return end subroutine p00_halton ( prob, int_num, result ) !*****************************************************************************80 ! !! P00_HALTON applies a Halton sequence rule to integrate a function. ! ! Modified: ! ! 19 December 2002 ! ! Author: ! ! John Burkardt ! ! Reference: ! ! John Halton, ! On the efficiency of certain quasi-random sequences of points ! in evaluating multi-dimensional integrals, ! Numerische Mathematik, ! Volume 2, pages 84-90, 1960. ! ! Parameters: ! ! Input, integer ( kind = 4 ) PROB, the problem index. ! ! Input, integer ( kind = 4 ) INT_NUM, the number of sample points. ! ! Output, real ( kind = 8 ) RESULT, the approximate integral. ! implicit none integer ( kind = 4 ) int_num real ( kind = 8 ) a real ( kind = 8 ) a_copy real ( kind = 8 ) b real ( kind = 8 ) b_copy integer ( kind = 4 ) base integer ( kind = 4 ) i integer ( kind = 4 ) i4_log_int_2 integer ( kind = 4 ) prob real ( kind = 8 ) p00_fun real ( kind = 8 ) r8_huge real ( kind = 8 ) result integer ( kind = 4 ) seed real ( kind = 8 ) x(int_num) ! ! In case the interval is infinite or semi-infinite, try to ! handle it sensibly. ! call p00_lim ( prob, a, b ) if ( a /= -r8_huge ( ) ) then a_copy = a else if ( b /= r8_huge ( ) ) then a_copy = b - 2.0D+00**( i4_log_int_2 ( int_num ) / 2 ) else a_copy = 0.0D+00 - 2.0D+00**( i4_log_int_2 ( int_num ) / 2 - 1) end if if ( b /= r8_huge ( ) ) then b_copy = b else if ( a /= -r8_huge ( ) ) then b_copy = a + 2.0D+00**( i4_log_int_2 ( int_num ) / 2 ) else b_copy = 0.0D+00 + 2.0D+00**( i4_log_int_2 ( int_num ) / 2 - 1) end if seed = 1 base = 2 call i4_to_halton_number_sequence ( seed, base, int_num, x ) x(1:int_num) = a_copy + ( b_copy - a_copy ) * x(1:int_num) result = 0.0D+00 do i = 1, int_num result = result + p00_fun ( prob, x(i) ) end do result = ( b_copy - a_copy ) * result / real ( int_num, kind = 8 ) return end subroutine p00_lim ( prob, a, b ) !*****************************************************************************80 ! !! P00_LIM returns the integration limits for any problem. ! ! Modified: ! ! 01 October 2002 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Input, integer ( kind = 4 ) PROB, the number of the desired test problem. ! ! Output, real ( kind = 8 ) A, B, the lower and upper limits of integration. ! Note that if A = -R8_HUGE(), the lower limit is ! actually negative infinity, and if B = R8_HUGE(B), the upper limit ! is actually infinity. ! implicit none real ( kind = 8 ) a real ( kind = 8 ) b integer ( kind = 4 ) prob if ( prob == 1 ) then call p01_lim ( a, b ) else if ( prob == 2 ) then call p02_lim ( a, b ) else if ( prob == 3 ) then call p03_lim ( a, b ) else if ( prob == 4 ) then call p04_lim ( a, b ) else if ( prob == 5 ) then call p05_lim ( a, b ) else if ( prob == 6 ) then call p06_lim ( a, b ) else if ( prob == 7 ) then call p07_lim ( a, b ) else if ( prob == 8 ) then call p08_lim ( a, b ) else if ( prob == 9 ) then call p09_lim ( a, b ) else if ( prob == 10 ) then call p10_lim ( a, b ) else if ( prob == 11 ) then call p11_lim ( a, b ) else if ( prob == 12 ) then call p12_lim ( a, b ) else if ( prob == 13 ) then call p13_lim ( a, b ) else if ( prob == 14 ) then call p14_lim ( a, b ) else if ( prob == 15 ) then call p15_lim ( a, b ) else if ( prob == 16 ) then call p16_lim ( a, b ) else if ( prob == 17 ) then call p17_lim ( a, b ) else if ( prob == 18 ) then call p18_lim ( a, b ) else if ( prob == 19 ) then call p19_lim ( a, b ) else if ( prob == 20 ) then call p20_lim ( a, b ) else if ( prob == 21 ) then call p21_lim ( a, b ) else if ( prob == 22 ) then call p22_lim ( a, b ) else if ( prob == 23 ) then call p23_lim ( a, b ) else if ( prob == 24 ) then call p24_lim ( a, b ) else if ( prob == 25 ) then call p25_lim ( a, b ) else if ( prob == 26 ) then call p26_lim ( a, b ) else if ( prob == 27 ) then call p27_lim ( a, b ) else if ( prob == 28 ) then call p28_lim ( a, b ) else if ( prob == 29 ) then call p29_lim ( a, b ) else if ( prob == 30 ) then call p30_lim ( a, b ) else if ( prob == 31 ) then call p31_lim ( a, b ) else if ( prob == 32 ) then call p32_lim ( a, b ) else if ( prob == 33 ) then call p33_lim ( a, b ) else if ( prob == 34 ) then call p34_lim ( a, b ) else if ( prob == 35 ) then call p35_lim ( a, b ) else if ( prob == 36 ) then call p36_lim ( a, b ) else if ( prob == 37 ) then call p37_lim ( a, b ) else if ( prob == 38 ) then call p38_lim ( a, b ) else if ( prob == 39 ) then call p39_lim ( a, b ) else if ( prob == 40 ) then call p40_lim ( a, b ) else if ( prob == 41 ) then call p41_lim ( a, b ) else if ( prob == 42 ) then call p42_lim ( a, b ) else if ( prob == 43 ) then call p43_lim ( a, b ) else if ( prob == 44 ) then call p44_lim ( a, b ) else if ( prob == 45 ) then call p45_lim ( a, b ) else if ( prob == 46 ) then call p46_lim ( a, b ) else if ( prob == 47 ) then call p47_lim ( a, b ) else if ( prob == 48 ) then call p48_lim ( a, b ) else if ( prob == 49 ) then call p49_lim ( a, b ) else if ( prob == 50 ) then call p50_lim ( a, b ) else if ( prob == 51 ) then call p51_lim ( a, b ) else if ( prob == 52 ) then call p52_lim ( a, b ) else if ( prob == 53 ) then call p53_lim ( a, b ) else if ( prob == 54 ) then call p54_lim ( a, b ) else if ( prob == 55 ) then call p55_lim ( a, b ) else if ( prob == 56 ) then call p56_lim ( a, b ) else if ( prob == 57 ) then call p57_lim ( a, b ) else if ( prob == 58 ) then call p58_lim ( a, b ) else if ( prob == 59 ) then call p59_lim ( a, b ) else if ( prob == 60 ) then call p60_lim ( a, b ) else if ( prob == 61 ) then call p61_lim ( a, b ) else if ( prob == 62 ) then call p62_lim ( a, b ) else if ( prob == 63 ) then call p63_lim ( a, b ) else if ( prob == 64 ) then call p64_lim ( a, b ) else if ( prob == 65 ) then call p65_lim ( a, b ) else if ( prob == 66 ) then call p66_lim ( a, b ) else if ( prob == 67 ) then call p67_lim ( a, b ) else if ( prob == 68 ) then call p68_lim ( a, b ) else if ( prob == 69 ) then call p69_lim ( a, b ) else if ( prob == 70 ) then call p70_lim ( a, b ) else if ( prob == 71 ) then call p71_lim ( a, b ) else if ( prob == 72 ) then call p72_lim ( a, b ) else if ( prob == 73 ) then call p73_lim ( a, b ) else if ( prob == 74 ) then call p74_lim ( a, b ) else if ( prob == 75 ) then call p75_lim ( a, b ) else if ( prob == 76 ) then call p76_lim ( a, b ) else write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'P00_LIM - Fatal error!' write ( *, '(a,i8)' ) ' Illegal problem number = ', prob stop end if return end subroutine p00_midpoint ( prob, int_num, result ) !*****************************************************************************80 ! !! P00_MIDPOINT applies the composite midpoint rule to integrate a function. ! ! Modified: ! ! 19 March 2002 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Input, integer ( kind = 4 ) PROB, the problem index. ! ! Input, integer ( kind = 4 ) INT_NUM, the number of subintervals. ! ! Output, real ( kind = 8 ) RESULT, the approximate integral. ! implicit none real ( kind = 8 ) a real ( kind = 8 ) a_copy real ( kind = 8 ) a_sub real ( kind = 8 ) b real ( kind = 8 ) b_copy real ( kind = 8 ) b_sub real ( kind = 8 ) h integer ( kind = 4 ) i4_log_int_2 integer ( kind = 4 ) int_i integer ( kind = 4 ) int_num integer ( kind = 4 ) prob real ( kind = 8 ) p00_fun real ( kind = 8 ) r8_huge real ( kind = 8 ) result real ( kind = 8 ) x ! ! In case the interval is infinite or semi-infinite, try to ! handle it sensibly. ! call p00_lim ( prob, a, b ) if ( a /= -r8_huge ( a ) ) then a_copy = a else if ( b /= r8_huge ( ) ) then a_copy = b - 2.0D+00**( i4_log_int_2 ( int_num ) / 2 ) else a_copy = 0.0D+00 - 2.0D+00**( i4_log_int_2 ( int_num ) / 2 - 1) end if if ( b /= r8_huge ( ) ) then b_copy = b else if ( a /= -r8_huge ( ) ) then b_copy = a + 2.0D+00**( i4_log_int_2 ( int_num ) / 2 ) else b_copy = 0.0D+00 + 2.0D+00**( i4_log_int_2 ( int_num ) / 2 - 1) end if h = ( b_copy - a_copy ) / real ( int_num, kind = 8 ) result = 0.0D+00 do int_i = 1, int_num a_sub = ( real ( int_num - int_i + 1, kind = 8 ) * a_copy & + real ( int_i - 1, kind = 8 ) * b_copy ) & / real ( int_num, kind = 8 ) b_sub = ( real ( int_num - int_i, kind = 8 ) * a_copy & + real ( int_i, kind = 8 ) * b_copy ) & / real ( int_num, kind = 8 ) x = 0.5D+00 * ( a_sub + b_sub ) result = result + h * p00_fun ( prob, x ) end do return end subroutine p00_montecarlo ( prob, int_num, result ) !*****************************************************************************80 ! !! P00_MONTECARLO applies the Monte Carlo rule to integrate a function. ! ! Discussion: ! ! This routine originally used an automatic array for X. However, ! under the G95 compiler, this was causing bizarre errors. Replacing ! the automatic array by an allocatable array made the problems ! disappear. Not an entirely satisfactory conclusion! ! ! Modified: ! ! 17 May 2007 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Input, integer ( kind = 4 ) PROB, the problem index. ! ! Input, integer ( kind = 4 ) INT_NUM, the number of sample points. ! ! Output, real ( kind = 8 ) RESULT, the approximate integral. ! implicit none integer ( kind = 4 ) int_num real ( kind = 8 ) a real ( kind = 8 ) a_copy real ( kind = 8 ) b real ( kind = 8 ) b_copy integer ( kind = 4 ) i integer ( kind = 4 ) i4_log_int_2 integer ( kind = 4 ) prob real ( kind = 8 ) p00_fun real ( kind = 8 ) r8_huge real ( kind = 8 ) result real ( kind = 8 ), allocatable, dimension ( : ) :: x ! ! In case the interval is infinite or semi-infinite, try to ! handle it sensibly. ! call p00_lim ( prob, a, b ) if ( a /= -r8_huge ( ) ) then a_copy = a else if ( b /= r8_huge ( ) ) then a_copy = b - 2.0D+00**( i4_log_int_2 ( int_num ) / 2 ) else a_copy = 0.0D+00 - 2.0D+00**( i4_log_int_2 ( int_num ) / 2 - 1) end if if ( b /= r8_huge ( ) ) then b_copy = b else if ( a /= -r8_huge ( ) ) then b_copy = a + 2.0D+00**( i4_log_int_2 ( int_num ) / 2 ) else b_copy = 0.0D+00 + 2.0D+00**( i4_log_int_2 ( int_num ) / 2 - 1) end if allocate ( x(1:int_num) ) call random_number ( harvest = x(1:int_num) ) x(1:int_num) = a_copy + ( b_copy - a_copy ) * x(1:int_num) result = 0.0D+00 do i = 1, int_num result = result + p00_fun ( prob, x(i) ) end do result = ( b_copy - a_copy ) * result / real ( int_num, kind = 8 ) deallocate ( x ) return end subroutine p00_simpson ( prob, int_num, result ) !*****************************************************************************80 ! !! P00_SIMPSON applies the composite Simpson rule to integrate a function. ! ! Modified: ! ! 19 March 2002 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Input, integer ( kind = 4 ) PROB, the problem index. ! ! Input, integer ( kind = 4 ) INT_NUM, the number of subintervals. ! ! Output, real ( kind = 8 ) RESULT, the approximate integral. ! implicit none real ( kind = 8 ) a real ( kind = 8 ) a_copy real ( kind = 8 ) a_sub real ( kind = 8 ) b real ( kind = 8 ) b_copy real ( kind = 8 ) b_sub real ( kind = 8 ) h integer ( kind = 4 ) i4_log_int_2 integer ( kind = 4 ) int_i integer ( kind = 4 ) int_num integer ( kind = 4 ) prob real ( kind = 8 ) p00_fun real ( kind = 8 ) r8_huge real ( kind = 8 ) result real ( kind = 8 ) x1 real ( kind = 8 ) x2 real ( kind = 8 ) x3 ! ! In case the interval is infinite or semi-infinite, try to ! handle it sensibly. ! call p00_lim ( prob, a, b ) if ( a /= -r8_huge ( ) ) then a_copy = a else if ( b /= r8_huge ( ) ) then a_copy = b - 2.0D+00**( i4_log_int_2 ( int_num ) / 2 ) else a_copy = 0.0D+00 - 2.0D+00**( i4_log_int_2 ( int_num ) / 2 - 1) end if if ( b /= r8_huge ( ) ) then b_copy = b else if ( a /= -r8_huge ( ) ) then b_copy = a + 2.0D+00**( i4_log_int_2 ( int_num ) / 2 ) else b_copy = 0.0D+00 + 2.0D+00**( i4_log_int_2 ( int_num ) / 2 - 1) end if h = ( b_copy - a_copy ) / real ( int_num, kind = 8 ) result = 0.0D+00 do int_i = 1, int_num a_sub = ( real ( int_num - int_i + 1, kind = 8 ) * a_copy & + real ( int_i - 1, kind = 8 ) * b_copy ) & / real ( int_num, kind = 8 ) b_sub = ( real ( int_num - int_i ) * a_copy & + real ( int_i ) * b_copy ) / real ( int_num, kind = 8 ) x1 = a_sub x2 = 0.5D+00 * ( a_sub + b_sub ) x3 = b_sub result = result + h * ( & p00_fun ( prob, x1 ) & + 4.0D+00 * p00_fun ( prob, x2 ) & + p00_fun ( prob, x3 ) ) / 6.0D+00 end do return end subroutine p00_trapezoid ( prob, int_num, result ) !*****************************************************************************80 ! !! P00_TRAPEZOID applies the composite trapezoid rule to integrate a function. ! ! Modified: ! ! 01 October 2002 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Input, integer ( kind = 4 ) PROB, the problem index. ! ! Input, integer ( kind = 4 ) INT_NUM, the number of subintervals. ! ! Output, real ( kind = 8 ) RESULT, the approximate integral. ! implicit none real ( kind = 8 ) a real ( kind = 8 ) a_copy real ( kind = 8 ) a_sub real ( kind = 8 ) b real ( kind = 8 ) b_copy real ( kind = 8 ) b_sub real ( kind = 8 ) h integer ( kind = 4 ) i4_log_int_2 integer ( kind = 4 ) int_i integer ( kind = 4 ) int_num integer ( kind = 4 ) prob real ( kind = 8 ) p00_fun real ( kind = 8 ) r8_huge real ( kind = 8 ) result real ( kind = 8 ) x ! ! In case the interval is infinite or semi-infinite, try to ! handle it sensibly. ! call p00_lim ( prob, a, b ) if ( a /= -r8_huge ( ) ) then a_copy = a else if ( b /= r8_huge ( ) ) then a_copy = b - 2.0D+00**( i4_log_int_2 ( int_num ) / 2 ) else a_copy = 0.0D+00 - 2.0D+00**( i4_log_int_2 ( int_num ) / 2 - 1) end if if ( b /= r8_huge ( ) ) then b_copy = b else if ( a /= -r8_huge ( ) ) then b_copy = a + 2.0D+00**( i4_log_int_2 ( int_num ) / 2 ) else b_copy = 0.0D+00 + 2.0D+00**( i4_log_int_2 ( int_num ) / 2 - 1) end if h = ( b_copy - a_copy ) / real ( int_num, kind = 8 ) result = 0.0D+00 do int_i = 1, int_num a_sub = ( real ( int_num - int_i + 1, kind = 8 ) * a_copy & + real ( int_i - 1, kind = 8 ) * b_copy ) & / real ( int_num, kind = 8 ) b_sub = ( real ( int_num - int_i, kind = 8 ) * a_copy & + real ( int_i, kind = 8 ) * b_copy ) & / real ( int_num, kind = 8 ) x = 0.5D+00 * ( a_sub + b_sub ) result = result + 0.5D+00 * h * & ( p00_fun ( prob, a_sub ) + p00_fun ( prob, b_sub ) ) end do return end subroutine p01_exact ( exact ) !*****************************************************************************80 ! !! P01_EXACT returns the exact integral for problem 1. ! ! Modified: ! ! 18 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) EXACT, the value of the integral. ! implicit none real ( kind = 8 ) exact exact = exp ( 1.0D+00 ) - 1.0D+00 return end function p01_fun ( x ) !*****************************************************************************80 ! !! P01_FUN evaluates the integrand for problem 1. ! ! Dimension: ! ! n = 1 ! ! Interval: ! ! 0 <= x <= 1 ! ! Integrand: ! ! exp ( x ) ! ! Antiderivative: ! ! exp ( x ) ! ! Exact Integral: ! ! exp ( 1 ) - 1 ! ! Approximate Integral: ! ! 1.718281828459045235360287 ! ! Modified: ! ! 18 December 1998 ! ! Author: ! ! John Burkardt ! ! Reference: ! ! David Kahaner, ! Comparison of Numerical Quadrature Formulas, ! in Mathematical Software, edited by John R Rice, ! Academic Press, 1971. ! ! Parameters: ! ! Input, real ( kind = 8 ) X, the point at which the integrand ! is to be evaluated. ! ! Output, real ( kind = 8 ) P01_FUN, the value of the integrand at X. ! implicit none real ( kind = 8 ) p01_fun real ( kind = 8 ) x p01_fun = exp ( x ) return end subroutine p01_lim ( a, b ) !*****************************************************************************80 ! !! P01_LIM returns the integration limits for problem 1. ! ! Modified: ! ! 22 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) A, B, the lower and upper limits of integration. ! Note that if A = -R8_HUGE(), the lower limit is ! actually negative infinity, and if B = R8_HUGE(B), the upper limit ! is actually infinity. ! implicit none real ( kind = 8 ) a real ( kind = 8 ) b a = 0.0D+00 b = 1.0D+00 return end subroutine p02_exact ( exact ) !*****************************************************************************80 ! !! P02_EXACT returns the exact integral for problem 2. ! ! Modified: ! ! 18 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) EXACT, the value of the integral. ! implicit none real ( kind = 8 ) exact exact = 0.7D+00 return end function p02_fun ( x ) !*****************************************************************************80 ! !! P02_FUN evaluates the integrand for problem 2. ! ! Discussion: ! ! The integrand is discontinuous at X = 0.3. ! ! Dimension: ! ! n = 1 ! ! Interval: ! ! 0 <= x <= 1 ! ! Integrand: ! ! if ( x < 0.3 ) ! f(x) = 0 ! else ! f(x) = 1 ! ! Antiderivative: ! ! if ( x < 0.3 ) ! g(x) = 0 ! else ! g(x) = X - 0.3 ! ! Exact Integral: ! ! 0.7 ! ! Modified: ! ! 18 December 1998 ! ! Author: ! ! John Burkardt ! ! Reference: ! ! David Kahaner, ! Comparison of Numerical Quadrature Formulas, ! in Mathematical Software, edited by John R Rice, ! Academic Press, 1971. ! ! Parameters: ! ! Input, real ( kind = 8 ) X, the point at which the integrand ! is to be evaluated. ! ! Output, real ( kind = 8 ) P02_FUN, the value of the integrand at X. ! implicit none real ( kind = 8 ) p02_fun real ( kind = 8 ) x if ( x < 0.3D+00 ) then p02_fun = 0.0D+00 else p02_fun = 1.0D+00 end if return end subroutine p02_lim ( a, b ) !*****************************************************************************80 ! !! P02_LIM returns the integration limits for problem 2. ! ! Modified: ! ! 22 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) A, B, the lower and upper limits of integration. ! Note that if A = -R8_HUGE(), the lower limit is ! actually negative infinity, and if B = R8_HUGE(B), the upper limit ! is actually infinity. ! implicit none real ( kind = 8 ) a real ( kind = 8 ) b a = 0.0D+00 b = 1.0D+00 return end subroutine p03_exact ( exact ) !*****************************************************************************80 ! !! P03_EXACT returns the exact integral for problem 3. ! ! Modified: ! ! 18 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) EXACT, the value of the integral. ! implicit none real ( kind = 8 ) exact exact = 2.0D+00 / 3.0D+00 return end function p03_fun ( x ) !*****************************************************************************80 ! !! P03_FUN evaluates the integrand for problem 3. ! ! Discussion: ! ! The integrand is not differentiable at X = 0. ! ! Dimension: ! ! n = 1 ! ! Interval: ! ! 0 <= x <= 1 ! ! Integrand: ! ! sqrt ( x ) ! ! Antiderivative: ! ! ( 2 / 3 ) * x**(3/2) ! ! Exact Integral: ! ! 2 / 3 ! ! Modified: ! ! 31 October 2000 ! ! Author: ! ! John Burkardt ! ! Reference: ! ! David Kahaner, ! Comparison of Numerical Quadrature Formulas, ! in Mathematical Software, edited by John R Rice, ! Academic Press, 1971. ! ! Parameters: ! ! Input, real ( kind = 8 ) X, the point at which the integrand ! is to be evaluated. ! ! Output, real ( kind = 8 ) P03_FUN, the value of the integrand at X. ! implicit none real ( kind = 8 ) p03_fun real ( kind = 8 ) x p03_fun = sqrt ( x ) return end subroutine p03_lim ( a, b ) !*****************************************************************************80 ! !! P03_LIM returns the integration limits for problem 3. ! ! Modified: ! ! 22 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) A, B, the lower and upper limits of integration. ! Note that if A = -R8_HUGE(), the lower limit is ! actually negative infinity, and if B = R8_HUGE(B), the upper limit ! is actually infinity. ! implicit none real ( kind = 8 ) a real ( kind = 8 ) b a = 0.0D+00 b = 1.0D+00 return end subroutine p04_exact ( exact ) !*****************************************************************************80 ! !! P04_EXACT returns the estimated integral for problem 4. ! ! Modified: ! ! 18 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) EXACT, the estimated value of the integral. ! implicit none real ( kind = 8 ) exact exact = 0.479428226689D+00 return end function p04_fun ( x ) !*****************************************************************************80 ! !! P04_FUN evaluates the integrand for problem 4. ! ! Dimension: ! ! N = 1 ! ! Interval: ! ! -1 <= x <= 1 ! ! Integrand: ! ! 0.92 * cosh ( x ) - cos ( x ) ! ! Antiderivative: ! ! 0.92 * sinh ( x ) - sin ( x ) ! ! Exact Integral: ! ! 1.84 * sinh ( 1 ) - 2 * sin ( 1 ) ! ! Approximate Integral: ! ! 0.479428226689 ! ! Modified: ! ! 31 October 2000 ! ! Author: ! ! John Burkardt ! ! Reference: ! ! Charles Clenshaw, Alan Curtis, ! A Method for Numerical Integration on an Automatic Computer, ! Numerische Mathematik, ! Volume 2, Number 1, December 1960, pages 197-205. ! ! David Kahaner, ! Comparison of Numerical Quadrature Formulas, ! in Mathematical Software, edited by John R Rice, ! Academic Press, 1971. ! ! Parameters: ! ! Input, real ( kind = 8 ) X, the point at which the integrand ! is to be evaluated. ! ! Output, real ( kind = 8 ) P04_FUN, the value of the integrand at X. ! implicit none real ( kind = 8 ) p04_fun real ( kind = 8 ) x p04_fun = 0.92D+00 * cosh ( x ) - cos ( x ) return end subroutine p04_lim ( a, b ) !*****************************************************************************80 ! !! P04_LIM returns the integration limits for problem 4. ! ! Modified: ! ! 22 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) A, B, the lower and upper limits of integration. ! Note that if A = -R8_HUGE(), the lower limit is ! actually negative infinity, and if B = R8_HUGE(B), the upper limit ! is actually infinity. ! implicit none real ( kind = 8 ) a real ( kind = 8 ) b a = -1.0D+00 b = 1.0D+00 return end subroutine p05_exact ( exact ) !*****************************************************************************80 ! !! P05_EXACT returns the estimated integral for problem 5. ! ! Modified: ! ! 06 October 2006 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) EXACT, the estimated value of the integral. ! implicit none real ( kind = 8 ) exact exact = 1.5822329637296729331D+00 return end function p05_fun ( x ) !*****************************************************************************80 ! !! P05_FUN evaluates the integrand for problem 5. ! ! Dimension: ! ! n = 1 ! ! Interval: ! ! -1 <= x <= 1 ! ! Integrand: ! ! 1 / ( x**4 + x**2 + 0.9 ) ! ! Approximate Integral: ! ! 1.5822329637296729331 ! ! Modified: ! ! 06 October 2006 ! ! Author: ! ! John Burkardt ! ! Reference: ! ! Charles Clenshaw, Alan Curtis, ! A Method for Numerical Integration on an Automatic Computer, ! Numerische Mathematik, ! Volume 2, Number 1, December 1960, pages 197-205. ! ! Parameters: ! ! Input, real ( kind = 8 ) X, the point at which the integrand ! is to be evaluated. ! ! Output, real ( kind = 8 ) P05_FUN, the value of the integrand at X. ! implicit none real ( kind = 8 ) p05_fun real ( kind = 8 ) x p05_fun = 1.0D+00 / ( x**4 + x**2 + 0.9D+00 ) return end subroutine p05_lim ( a, b ) !*****************************************************************************80 ! !! P05_LIM returns the integration limits for problem 5. ! ! Modified: ! ! 06 October 2006 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) A, B, the lower and upper limits of integration. ! Note that if A = -R8_HUGE(), the lower limit is ! actually negative infinity, and if B = R8_HUGE(B), the upper limit ! is actually infinity. ! implicit none real ( kind = 8 ) a real ( kind = 8 ) b a = -1.0D+00 b = 1.0D+00 return end subroutine p06_exact ( exact ) !*****************************************************************************80 ! !! P06_EXACT returns the exact integral for problem 6. ! ! Modified: ! ! 06 October 2006 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) EXACT, the estimated value of the integral. ! implicit none real ( kind = 8 ) exact exact = 1.460447131787105D+00 return end function p06_fun ( x ) !*****************************************************************************80 ! !! P06_FUN evaluates the integrand for problem 6. ! ! Dimension: ! ! n = 1 ! ! Interval: ! ! -1 <= x <= 1 ! ! Integrand: ! ! sqrt ( abs ( x + 0.5 ) ) ! ! Exact Integral: ! ! ( sqrt ( 2 ) + 3 * sqrt ( 6 ) ) / 6 = 1.460447131787105 ! ! Modified: ! ! 06 October 2006 ! ! Author: ! ! John Burkardt ! ! Reference: ! ! Charles Clenshaw, Alan Curtis, ! A Method for Numerical Integration on an Automatic Computer, ! Numerische Mathematik, ! Volume 2, Number 1, December 1960, pages 197-205. ! ! Parameters: ! ! Input, real ( kind = 8 ) X, the point at which the integrand ! is to be evaluated. ! ! Output, real ( kind = 8 ) P06_FUN, the value of the integrand at X. ! implicit none real ( kind = 8 ) p06_fun real ( kind = 8 ) x p06_fun = sqrt ( abs ( x + 0.5D+00 ) ) return end subroutine p06_lim ( a, b ) !*****************************************************************************80 ! !! P06_LIM returns the integration limits for problem 6. ! ! Modified: ! ! 06 October 2006 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) A, B, the lower and upper limits of integration. ! Note that if A = -R8_HUGE(), the lower limit is ! actually negative infinity, and if B = R8_HUGE(B), the upper limit ! is actually infinity. ! implicit none real ( kind = 8 ) a real ( kind = 8 ) b a = -1.0D+00 b = 1.0D+00 return end subroutine p07_exact ( exact ) !*****************************************************************************80 ! !! P07_EXACT returns the exact integral for problem 7. ! ! Modified: ! ! 18 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) EXACT, the value of the integral. ! implicit none real ( kind = 8 ) exact exact = 2.0D+00 return end function p07_fun ( x ) !*****************************************************************************80 ! !! P07_FUN evaluates the integrand for problem 7. ! ! Discussion: ! ! The integrand is singular at X = 0. ! ! Dimension: ! ! N = 1 ! ! Interval: ! ! 0 <= X <= 1 ! ! Integrand: ! ! 1 / sqrt ( X ) ! ! Antiderivative: ! ! 2 * sqrt ( X ) ! ! Exact Integral: ! ! 2 ! ! Modified: ! ! 31 October 2000 ! ! Author: ! ! John Burkardt ! ! Reference: ! ! David Kahaner, ! Comparison of Numerical Quadrature Formulas, ! in Mathematical Software, edited by John R Rice, ! Academic Press, 1971 ! ! Parameters: ! ! Input, real ( kind = 8 ) X, the point at which the integrand ! is to be evaluated. ! ! Output, real ( kind = 8 ) P07_FUN, the value of the integrand at X. ! implicit none real ( kind = 8 ) p07_fun real ( kind = 8 ) x if ( 0.0D+00 < x ) then p07_fun = 1.0D+00 / sqrt ( x ) else p07_fun = 0.0D+00 end if return end subroutine p07_lim ( a, b ) !*****************************************************************************80 ! !! P07_LIM returns the integration limits for problem 7. ! ! Modified: ! ! 22 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) A, B, the lower and upper limits of integration. ! Note that if A = -R8_HUGE(), the lower limit is ! actually negative infinity, and if B = R8_HUGE(B), the upper limit ! is actually infinity. ! implicit none real ( kind = 8 ) a real ( kind = 8 ) b a = 0.0D+00 b = 1.0D+00 return end subroutine p08_exact ( exact ) !*****************************************************************************80 ! !! P08_EXACT returns the estimated integral for problem 8. ! ! Modified: ! ! 18 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) EXACT, the estimated value of the integral. ! implicit none real ( kind = 8 ) exact exact = 0.866972987D+00 return end function p08_fun ( x ) !*****************************************************************************80 ! !! P08_FUN evaluates the integrand for problem 8. ! ! Dimension: ! ! N = 1 ! ! Interval: ! ! 0 <= X <= 1 ! ! Integrand: ! ! 1 / ( 1 + X**4 ) ! ! Antiderivative: ! ! (1/8) * sqrt ( 2 ) ! * ln ( ( X**2 + sqrt ( 2 ) * X+ 1 ) / ( X**2 - sqrt ( 2 ) * X + 1 ) ) ! + (1/4) * sqrt ( 2 ) * arctan ( sqrt ( 2 ) * X / ( 1 - X**2 ) ) ! ! Approximate Integral: ! ! 0.8669729873... ! ! Modified: ! ! 31 October 2000 ! ! Author: ! ! John Burkardt ! ! Reference: ! ! David Kahaner, ! Comparison of Numerical Quadrature Formulas, ! in Mathematical Software, edited by John R Rice, ! Academic Press, 1971. ! ! Parameters: ! ! Input, real ( kind = 8 ) X, the point at which the integrand ! is to be evaluated. ! ! Output, real ( kind = 8 ) P08_FUN, the value of the integrand at X. ! implicit none real ( kind = 8 ) p08_fun real ( kind = 8 ) x p08_fun = 1.0D+00 / ( 1.0D+00 + x**4 ) return end subroutine p08_lim ( a, b ) !*****************************************************************************80 ! !! P08_LIM returns the integration limits for problem 8. ! ! Modified: ! ! 22 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) A, B, the lower and upper limits of integration. ! Note that if A = -R8_HUGE(), the lower limit is ! actually negative infinity, and if B = R8_HUGE(B), the upper limit ! is actually infinity. ! implicit none real ( kind = 8 ) a real ( kind = 8 ) b a = 0.0D+00 b = 1.0D+00 return end subroutine p09_exact ( exact ) !*****************************************************************************80 ! !! P09_EXACT returns the estimated integral for problem 9. ! ! Modified: ! ! 18 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) EXACT, the estimated value of the integral. ! implicit none real ( kind = 8 ) exact exact = 1.15470054D+00 return end function p09_fun ( x ) !*****************************************************************************80 ! !! P09_FUN evaluates the integrand for problem 9. ! ! Discussion: ! ! The integrand is oscillatory, going through 5 periods in [0,1]. ! ! Dimension: ! ! N = 1 ! ! Interval: ! ! 0 <= X <= 1 ! ! Integrand: ! ! 2 / ( 2 + sin ( 10 * pi * X ) ) ! ! Antiderivative: ! ! 1 / ( 5 * pi * sqrt ( 3 ) ) * ! arctan ( ( 1 + 2 * tan ( 5 * pi * X ) ) / sqrt ( 3 ) ) ! ! Exact Integral: ! ! 2 / sqrt ( 3 ) ! ! Approximate Integral: ! ! 1.154700538... ! ! Modified: ! ! 29 October 2000 ! ! Author: ! ! John Burkardt ! ! Reference: ! ! David Kahaner, ! Comparison of Numerical Quadrature Formulas, ! in Mathematical Software, edited by John R Rice, ! Academic Press, 1971. ! ! Parameters: ! ! Input, real ( kind = 8 ) X, the point at which the integrand ! is to be evaluated. ! ! Output, real ( kind = 8 ) P09_FUN, the value of the integrand at X. ! implicit none real ( kind = 8 ) p09_fun real ( kind = 8 ), parameter :: pi = 3.141592653589793D+00 real ( kind = 8 ) x p09_fun = 2.0D+00 / ( 2.0D+00 + sin ( 10.0D+00 * pi * x ) ) return end subroutine p09_lim ( a, b ) !*****************************************************************************80 ! !! P09_LIM returns the integration limits for problem 9. ! ! Modified: ! ! 22 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) A, B, the lower and upper limits of integration. ! Note that if A = -R8_HUGE(), the lower limit is ! actually negative infinity, and if B = R8_HUGE(B), the upper limit ! is actually infinity. ! implicit none real ( kind = 8 ) a real ( kind = 8 ) b a = 0.0D+00 b = 1.0D+00 return end subroutine p10_exact ( exact ) !*****************************************************************************80 ! !! P10_EXACT returns the estimated integral for problem 10. ! ! Modified: ! ! 18 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) EXACT, the estimated value of the integral. ! implicit none real ( kind = 8 ) exact exact = 0.6931471805599453094172321D+00 return end function p10_fun ( x ) !*****************************************************************************80 ! !! P10_FUN evaluates the integrand for problem 10. ! ! Dimension: ! ! N = 1 ! ! Interval: ! ! 0 <= X <= 1 ! ! Integrand: ! ! 1 / ( 1 + X ) ! ! Antiderivative: ! ! ln ( 1 + X ) ! ! Exact Integral: ! ! ln ( 2 ) ! ! Approximate Integral: ! ! 0.6931471805599453094172321 ! ! Modified: ! ! 31 October 2000 ! ! Author: ! ! John Burkardt ! ! Reference: ! ! David Kahaner, ! Comparison of Numerical Quadrature Formulas, ! in Mathematical Software, edited by John R Rice, ! Academic Press, 1971. ! ! Parameters: ! ! Input, real ( kind = 8 ) X, the point at which the integrand ! is to be evaluated. ! ! Output, real ( kind = 8 ) P10_FUN, the value of the integrand at X. ! implicit none real ( kind = 8 ) p10_fun real ( kind = 8 ) x p10_fun = 1.0D+00 / ( 1.0D+00 + x ) return end subroutine p10_lim ( a, b ) !*****************************************************************************80 ! !! P10_LIM returns the integration limits for problem 10. ! ! Modified: ! ! 22 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) A, B, the lower and upper limits of integration. ! Note that if A = -R8_HUGE(), the lower limit is ! actually negative infinity, and if B = R8_HUGE(B), the upper limit ! is actually infinity. ! implicit none real ( kind = 8 ) a real ( kind = 8 ) b a = 0.0D+00 b = 1.0D+00 return end subroutine p11_exact ( exact ) !*****************************************************************************80 ! !! P11_EXACT returns the estimated integral for problem 11. ! ! Modified: ! ! 18 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) EXACT, the estimated value of the integral. ! implicit none real ( kind = 8 ) exact exact = 0.37988549D+00 return end function p11_fun ( x ) !*****************************************************************************80 ! !! P11_FUN evaluates the integrand for problem 11. ! ! Dimension: ! ! N = 1 ! ! Interval: ! ! 0 <= X <= 1 ! ! Integrand: ! ! 1 / ( 1 + exp ( X ) ) ! ! Antiderivative: ! ! ln ( exp ( X ) / ( 1 + exp ( X ) ) ) ! ! Exact Integral: ! ! ln ( 2 * E / ( 1 + E ) ) ! ! Approximate Integral: ! ! 0.379885493... ! ! Modified: ! ! 18 December 1998 ! ! Author: ! ! John Burkardt ! ! Reference: ! ! David Kahaner, ! Comparison of Numerical Quadrature Formulas, ! in Mathematical Software, edited by John R Rice, ! Academic Press, 1971. ! ! Parameters: ! ! Input, real ( kind = 8 ) X, the point at which the integrand ! is to be evaluated. ! ! Output, real ( kind = 8 ) P11_FUN, the value of the integrand at X. ! implicit none real ( kind = 8 ) p11_fun real ( kind = 8 ) x p11_fun = 1.0D+00 / ( 1.0D+00 + exp ( x ) ) return end subroutine p11_lim ( a, b ) !*****************************************************************************80 ! !! P11_LIM returns the integration limits for problem 11. ! ! Modified: ! ! 22 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) A, B, the lower and upper limits of integration. ! Note that if A = -R8_HUGE(), the lower limit is ! actually negative infinity, and if B = R8_HUGE(B), the upper limit ! is actually infinity. ! implicit none real ( kind = 8 ) a real ( kind = 8 ) b a = 0.0D+00 b = 1.0D+00 return end subroutine p12_exact ( exact ) !*****************************************************************************80 ! !! P12_EXACT returns the estimated integral for problem 12. ! ! Modified: ! ! 18 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) EXACT, the estimated value of the integral. ! implicit none real ( kind = 8 ) exact exact = 0.77750463D+00 return end function p12_fun ( x ) !*****************************************************************************80 ! !! P12_FUN evaluates the integrand for problem 12. ! ! Discussion: ! ! The integrand has a removable singularity at X = 0. ! ! Dimension: ! ! N = 1 ! ! Interval: ! ! 0 <= X <= 1 ! ! Integrand: ! ! X / ( exp ( X ) - 1 ) ! ! Antiderivative: ! ! The Debye function. ! ! Approximate Integral: ! ! 0.777504635... ! ! Modified: ! ! 18 December 1998 ! ! Author: ! ! John Burkardt ! ! Reference: ! ! David Kahaner, ! Comparison of Numerical Quadrature Formulas, ! in Mathematical Software, edited by John R Rice, ! Academic Press, 1971. ! ! Parameters: ! ! Input, real ( kind = 8 ) X, the point at which the integrand ! is to be evaluated. ! ! Output, real ( kind = 8 ) P12_FUN, the value of the integrand at X. ! implicit none real ( kind = 8 ) p12_fun real ( kind = 8 ) x if ( x == 0.0D+00 ) then p12_fun = 1.0D+00 else p12_fun = x / ( exp ( x ) - 1.0D+00 ) end if return end subroutine p12_lim ( a, b ) !*****************************************************************************80 ! !! P12_LIM returns the integration limits for problem 12. ! ! Modified: ! ! 22 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) A, B, the lower and upper limits of integration. ! Note that if A = -R8_HUGE(), the lower limit is ! actually negative infinity, and if B = R8_HUGE(B), the upper limit ! is actually infinity. ! implicit none real ( kind = 8 ) a real ( kind = 8 ) b a = 0.0D+00 b = 1.0D+00 return end subroutine p13_exact ( exact ) !*****************************************************************************80 ! !! P13_EXACT returns the estimated integral for problem 13. ! ! Modified: ! ! 06 November 2000 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) EXACT, the estimated value of the integral. ! implicit none real ( kind = 8 ) a real ( kind = 8 ) b real ( kind = 8 ) exact real ( kind = 8 ) si call p13_lim ( a, b ) exact = si ( b ) - si ( a ) return end function p13_fun ( x ) !*****************************************************************************80 ! !! P13_FUN evaluates the integrand for problem 13. ! ! Dimension: ! ! N = 1 ! ! Interval: ! ! 0 <= X <= 10 ! ! Integrand: ! ! sin ( X ) / X ! ! Approximate Integral: ! ! 0.009098645256 ! ! Modified: ! ! 06 November 2000 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Input, real ( kind = 8 ) X, the point at which the integrand ! is to be evaluated. ! ! Output, real ( kind = 8 ) P13_FUN, the value of the integrand at X. ! implicit none real ( kind = 8 ) p13_fun real ( kind = 8 ) x if ( x == 0.0D+00 ) then p13_fun = 1.0D+00 else p13_fun = sin ( x ) / x end if return end subroutine p13_lim ( a, b ) !*****************************************************************************80 ! !! P13_LIM returns the integration limits for problem 13. ! ! Modified: ! ! 06 November 2000 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) A, B, the lower and upper limits of integration. ! Note that if A = -R8_HUGE(), the lower limit is ! actually negative infinity, and if B = R8_HUGE(B), the upper limit ! is actually infinity. ! implicit none real ( kind = 8 ) a real ( kind = 8 ) b a = 0.0D+00 b = 10.0D+00 return end subroutine p14_exact ( exact ) !*****************************************************************************80 ! !! P14_EXACT returns the estimated integral for problem 14. ! ! Modified: ! ! 18 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) EXACT, the estimated value of the integral. ! implicit none real ( kind = 8 ) exact exact = 0.500000211166D+00 return end function p14_fun ( x ) !*****************************************************************************80 ! !! P14_FUN evaluates the integrand for problem 14. ! ! Discussion: ! ! For X's that aren't actually very big, the function becomes very ! small. Some compilers may product code that fails in these cases. ! An attempt has been made to return a value of 0 when the computed ! value of F(X) would be extremely small. ! ! Dimension: ! ! N = 1 ! ! Interval: ! ! 0 <= X <= 10 ! ! Integrand: ! ! sqrt ( 50 ) * exp ( - 50 * pi * X**2 ) ! ! Exact Integral: ! ! 0.5 * erf ( 50 * sqrt ( 2 * pi ) ) ! ! Approximate Integral: ! ! 0.500000211166 ! ! Modified: ! ! 17 May 2007 ! ! Author: ! ! John Burkardt ! ! Reference: ! ! David Kahaner, ! Comparison of Numerical Quadrature Formulas, ! in Mathematical Software, edited by John R Rice, ! Academic Press, 1971. ! ! Parameters: ! ! Input, real ( kind = 8 ) X, the point at which the integrand ! is to be evaluated. ! ! Output, real ( kind = 8 ) P14_FUN, the value of the integrand at X. ! implicit none real ( kind = 8 ) p14_fun real ( kind = 8 ), parameter :: pi = 3.141592653589793D+00 real ( kind = 8 ) x real ( kind = 8 ), save :: x_max = 0.0D+00 if ( x_max == 0.0D+00 ) then x_max = sqrt ( log ( max ( epsilon ( x_max ), 1.0D-10 ) ) & / ( - 50.0D+00 * pi ) ) end if if ( x_max < abs ( x ) ) then p14_fun = 0.0D+00 else p14_fun = sqrt ( 50.0D+00 ) * exp ( - 50.0D+00 * pi * x * x ) end if return end subroutine p14_lim ( a, b ) !*****************************************************************************80 ! !! P14_LIM returns the integration limits for problem 14. ! ! Modified: ! ! 22 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) A, B, the lower and upper limits of integration. ! Note that if A = -R8_HUGE(), the lower limit is ! actually negative infinity, and if B = R8_HUGE(B), the upper limit ! is actually infinity. ! implicit none real ( kind = 8 ) a real ( kind = 8 ) b a = 0.0D+00 b = 10.0D+00 return end subroutine p15_exact ( exact ) !*****************************************************************************80 ! !! P15_EXACT returns the exact integral for problem 15. ! ! Modified: ! ! 18 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) EXACT, the value of the integral. ! implicit none real ( kind = 8 ) exact exact = 1.0D+00 return end function p15_fun ( x ) !*****************************************************************************80 ! !! P15_FUN evaluates the integrand for problem 15. ! ! Dimension: ! ! N = 1 ! ! Interval: ! ! 0 <= X <= 10 ! ! Integrand: ! ! 25 * exp ( - 25 * X ) ! ! Antiderivative: ! ! - exp ( - 25 * X ) ! ! Exact Integral: ! ! 1 - exp ( - 250 ) ! ! Approximate Integral: ! ! 1.00000000... ! ! Modified: ! ! 18 December 1998 ! ! Author: ! ! John Burkardt ! ! Reference: ! ! David Kahaner, ! Comparison of Numerical Quadrature Formulas, ! in Mathematical Software, edited by John R Rice, ! Academic Press, 1971. ! ! Parameters: ! ! Input, real ( kind = 8 ) X, the point at which the integrand ! is to be evaluated. ! ! Output, real ( kind = 8 ) P15_FUN, the value of the integrand at X. ! implicit none real ( kind = 8 ) p15_fun real ( kind = 8 ) x p15_fun = 25.0D+00 * exp ( - 25.0D+00 * x ) return end subroutine p15_lim ( a, b ) !*****************************************************************************80 ! !! P15_LIM returns the integration limits for problem 15. ! ! Modified: ! ! 22 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) A, B, the lower and upper limits of integration. ! Note that if A = -R8_HUGE(), the lower limit is ! actually negative infinity, and if B = R8_HUGE(B), the upper limit ! is actually infinity. ! implicit none real ( kind = 8 ) a real ( kind = 8 ) b a = 0.0D+00 b = 10.0D+00 return end subroutine p16_exact ( exact ) !*****************************************************************************80 ! !! P16_EXACT returns the exact integral for problem 16. ! ! Modified: ! ! 22 November 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) EXACT, the value of the integral. ! implicit none real ( kind = 8 ) exact exact = 0.49936380287D+00 return end function p16_fun ( x ) !*****************************************************************************80 ! !! P16_FUN evaluates the integrand for problem 16. ! ! Dimension: ! ! N = 1 ! ! Interval: ! ! 0 <= X <= 10 ! ! Integrand: ! ! 50.0 / ( PI * ( 2500.0 * X**2 + 1.0 ) ) ! ! Antiderivative: ! ! ( 1 / PI ) * arctan ( 50 * X ) ! ! Approximate Integral: ! ! 0.4993633811... ! ! Modified: ! ! 18 December 1998 ! ! Author: ! ! John Burkardt ! ! Reference: ! ! David Kahaner, ! Comparison of Numerical Quadrature Formulas, ! in Mathematical Software, edited by John R Rice, ! Academic Press, 1971. ! ! Parameters: ! ! Input, real ( kind = 8 ) X, the point at which the integrand ! is to be evaluated. ! ! Output, real ( kind = 8 ) P16_FUN, the value of the integrand at X. ! implicit none real ( kind = 8 ) p16_fun real ( kind = 8 ), parameter :: pi = 3.141592653589793D+00 real ( kind = 8 ) x p16_fun = 50.0D+00 / ( pi * ( 2500.0D+00 * x**2 + 1.0D+00 ) ) return end subroutine p16_lim ( a, b ) !*****************************************************************************80 ! !! P16_LIM returns the integration limits for problem 16. ! ! Modified: ! ! 22 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) A, B, the lower and upper limits of integration. ! Note that if A = -R8_HUGE(), the lower limit is ! actually negative infinity, and if B = R8_HUGE(B), the upper limit ! is actually infinity. ! implicit none real ( kind = 8 ) a real ( kind = 8 ) b a = 0.0D+00 b = 1.0D+00 return end subroutine p17_exact ( exact ) !*****************************************************************************80 ! !! P17_EXACT returns the estimated integral for problem 17. ! ! Modified: ! ! 09 May 2001 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) EXACT, the estimated value of the integral. ! implicit none real ( kind = 8 ) exact exact = 0.5D+00 return end function p17_fun ( x ) !*****************************************************************************80 ! !! P17_FUN evaluates the integrand for problem 17. ! ! Dimension: ! ! N = 1 ! ! Interval: ! ! 0 <= X <= 1 ! ! Integrand: ! ! ( sin ( 50 * PI * X ) )**2 ! ! Antiderivative: ! ! 1/2 X - sin ( 100 * PI * X ) / ( 200 * PI ) ! ! Approximate Integral: ! ! 0.5 ! ! Modified: ! ! 09 May 2001 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Input, real ( kind = 8 ) X, the point at which the integrand ! is to be evaluated. ! ! Output, real ( kind = 8 ) P17_FUN, the value of the integrand at X. ! implicit none real ( kind = 8 ) p17_fun real ( kind = 8 ), parameter :: pi = 3.141592653589793D+00 real ( kind = 8 ) x p17_fun = ( sin ( 50.0D+00 * pi * x ) )**2 return end subroutine p17_lim ( a, b ) !*****************************************************************************80 ! !! P17_LIM returns the integration limits for problem 17. ! ! Modified: ! ! 22 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) A, B, the lower and upper limits of integration. ! Note that if A = -R8_HUGE(), the lower limit is ! actually negative infinity, and if B = R8_HUGE(B), the upper limit ! is actually infinity. ! implicit none real ( kind = 8 ) a real ( kind = 8 ) b a = 0.0D+00 b = 1.0D+00 return end subroutine p18_exact ( exact ) !*****************************************************************************80 ! !! P18_EXACT returns the estimated integral for problem 18. ! ! Modified: ! ! 01 November 2000 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) EXACT, the estimated value of the integral. ! implicit none real ( kind = 8 ) exact exact = 0.1705573501D+00 return end function p18_fun ( x ) !*****************************************************************************80 ! !! P18_FUN evaluates the integrand for problem 18. ! ! Dimension: ! ! N = 1 ! ! Interval: ! ! 0 <= X <= 1 ! ! Integrand: ! ! X / ( exp ( X ) + 1 ) ! ! Approximate Integral: ! ! 0.1705573501 ! ! Modified: ! ! 01 November 2000 ! ! Author: ! ! John Burkardt ! ! Reference: ! ! Hermann Engels, ! Numerical Quadrature and Cubature, ! Academic Press, 1980. ! ! Parameters: ! ! Input, real ( kind = 8 ) X, the point at which the integrand ! is to be evaluated. ! ! Output, real ( kind = 8 ) P18_FUN, the value of the integrand at X. ! implicit none real ( kind = 8 ) p18_fun real ( kind = 8 ) x p18_fun = x / ( exp ( x ) + 1.0D+00 ) return end subroutine p18_lim ( a, b ) !*****************************************************************************80 ! !! P18_LIM returns the integration limits for problem 18. ! ! Modified: ! ! 01 November 2000 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) A, B, the lower and upper limits of integration. ! Note that if A = -R8_HUGE(), the lower limit is ! actually negative infinity, and if B = R8_HUGE(B), the upper limit ! is actually infinity. ! implicit none real ( kind = 8 ) a real ( kind = 8 ) b a = 0.0D+00 b = 1.0D+00 return end subroutine p19_exact ( exact ) !*****************************************************************************80 ! !! P19_EXACT returns the exact integral for problem 19. ! ! Modified: ! ! 18 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) EXACT, the value of the integral. ! implicit none real ( kind = 8 ) exact exact = - 1.0D+00 return end function p19_fun ( x ) !*****************************************************************************80 ! !! P19_FUN evaluates the integrand for problem 19. ! ! Discussion: ! ! The integrand is singular at X = 0. ! ! Dimension: ! ! N = 1 ! ! Interval: ! ! 0 <= X <= 1 ! ! Integrand: ! ! ln ( X ) ! ! Antiderivative: ! ! X * ln ( X ) - X ! ! Exact Integral: ! ! -1 ! ! Modified: ! ! 18 December 1998 ! ! Author: ! ! John Burkardt ! ! Reference: ! ! David Kahaner, ! Comparison of Numerical Quadrature Formulas, ! in Mathematical Software, edited by John R Rice, ! Academic Press, 1971. ! ! Parameters: ! ! Input, real ( kind = 8 ) X, the point at which the integrand ! is to be evaluated. ! ! Output, real ( kind = 8 ) P19_FUN, the value of the integrand at X. ! implicit none real ( kind = 8 ) p19_fun real ( kind = 8 ) x if ( x <= 1.0D-15 ) then p19_fun = 0.0D+00 else p19_fun = log ( x ) end if return end subroutine p19_lim ( a, b ) !*****************************************************************************80 ! !! P19_LIM returns the integration limits for problem 19. ! ! Modified: ! ! 22 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) A, B, the lower and upper limits of integration. ! Note that if A = -R8_HUGE(), the lower limit is ! actually negative infinity, and if B = R8_HUGE(B), the upper limit ! is actually infinity. ! implicit none real ( kind = 8 ) a real ( kind = 8 ) b a = 0.0D+00 b = 1.0D+00 return end subroutine p20_exact ( exact ) !*****************************************************************************80 ! !! P20_EXACT returns the estimated integral for problem 20. ! ! Modified: ! ! 18 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) EXACT, the estimated value of the integral. ! real ( kind = 8 ) exact exact = 1.564396443D+00 return end function p20_fun ( x ) !*****************************************************************************80 ! !! P20_FUN evaluates the integrand for problem 20. ! ! Dimension: ! ! N = 1 ! ! Interval: ! ! -1 <= X <= 1 ! ! Integrand: ! ! 1 / ( X**2 + 1.005 ) ! ! Antiderivative: ! ! ( 1 / sqrt ( 1.005 ) ) * arctan ( X / sqrt ( 1.005 ) ) ! ! Approximate Integral: ! ! 1.564396443 ! ! Modified: ! ! 18 December 1998 ! ! Author: ! ! John Burkardt ! ! Reference: ! ! David Kahaner, ! Comparison of Numerical Quadrature Formulas, ! in Mathematical Software, edited by John R Rice, ! Academic Press, 1971. ! ! Parameters: ! ! Input, real ( kind = 8 ) X, the point at which the integrand ! is to be evaluated. ! ! Output, real ( kind = 8 ) P20_FUN, the value of the integrand at X. ! implicit none real ( kind = 8 ) p20_fun real ( kind = 8 ) x p20_fun = 1.0D+00 / ( x**2 + 1.005D+00 ) return end subroutine p20_lim ( a, b ) !*****************************************************************************80 ! !! P20_LIM returns the integration limits for problem 20. ! ! Modified: ! ! 22 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) A, B, the lower and upper limits of integration. ! Note that if A = -R8_HUGE(), the lower limit is ! actually negative infinity, and if B = R8_HUGE(B), the upper limit ! is actually infinity. ! implicit none real ( kind = 8 ) a real ( kind = 8 ) b a = -1.0D+00 b = 1.0D+00 return end subroutine p21_exact ( exact ) !*****************************************************************************80 ! !! P21_EXACT returns the estimated integral for problem 21. ! ! Modified: ! ! 18 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) EXACT, the estimated value of the integral. ! implicit none real ( kind = 8 ) exact exact = 0.2108027354D+00 return end function p21_fun ( x ) !*****************************************************************************80 ! !! P21_FUN evaluates the integrand for problem 21. ! ! Dimension: ! ! N = 1 ! ! Interval: ! ! 0 <= X <= 1 ! ! Integrand: ! ! ( sech ( 10.0 * ( X - 0.2 ) ) )**2 ! + ( sech ( 100.0 * ( X - 0.4 ) ) )**4 ! + ( sech ( 1000.0 * ( X - 0.6 ) ) )**6 ! ! Exact Integral: ! ! ( tanh ( 8 ) * tanh ( 2 ) ) / 10.0 + 2 / 150 + 2 / 1875 ! ! Approximate Integral: ! ! 0.2108027355006... ! ! Modified: ! ! 29 August 2000 ! ! Author: ! ! John Burkardt ! ! Reference: ! ! David Kahaner, ! Comparison of Numerical Quadrature Formulas, ! in Mathematical Software, edited by John R Rice, ! Academic Press, 1971. ! ! Parameters: ! ! Input, real ( kind = 8 ) X, the point at which the integrand ! is to be evaluated. ! ! Output, real ( kind = 8 ) P21_FUN, the value of the integrand at X. ! implicit none real ( kind = 8 ) a real ( kind = 8 ) b real ( kind = 8 ) c real ( kind = 8 ) p21_fun real ( kind = 8 ) sech real ( kind = 8 ) x a = sech ( 10.0D+00 * ( x - 0.2D+00 ) ) b = sech ( 100.0D+00 * ( x - 0.4D+00 ) ) c = sech ( 1000.0D+00 * ( x - 0.6D+00 ) ) p21_fun = a**2 + b**4 + c**6 return end subroutine p21_lim ( a, b ) !*****************************************************************************80 ! !! P21_LIM returns the integration limits for problem 21. ! ! Modified: ! ! 22 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) A, B, the lower and upper limits of integration. ! Note that if A = -R8_HUGE(), the lower limit is ! actually negative infinity, and if B = R8_HUGE(B), the upper limit ! is actually infinity. ! implicit none real ( kind = 8 ) a real ( kind = 8 ) b a = 0.0D+00 b = 1.0D+00 return end subroutine p22_exact ( exact ) !*****************************************************************************80 ! !! P22_EXACT returns the estimated integral for problem 22. ! ! Modified: ! ! 30 October 2000 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) EXACT, the estimated value of the integral. ! implicit none real ( kind = 8 ) exact real ( kind = 8 ), parameter :: pi = 3.141592653589793D+00 exact = 0.125D+00 * log ( 9.0D+00 ) + pi / sqrt ( 48.0D+00 ) return end function p22_fun ( x ) !*****************************************************************************80 ! !! P22_FUN evaluates the integrand for problem 22. ! ! Dimension: ! ! N = 1 ! ! Interval: ! ! 0 <= X <= 1 ! ! Integrand: ! ! 1 / ( X**4 + X**2 + 1 ) ! ! Exact integral: ! ! ln ( 9 ) / 8 + pi / sqrt ( 48 ) ! ! Approximate Integral: ! ! 0.728102913... ! ! Modified: ! ! 30 October 2000 ! ! Author: ! ! John Burkardt ! ! Reference: ! ! Philip Davis, Philip Rabinowitz, ! Methods of Numerical Integration, ! Second Edition, ! Dover, 2007, ! ISBN: 0486453391, ! LC: QA299.3.D28. ! ! Parameters: ! ! Input, real ( kind = 8 ) X, the point at which the integrand ! is to be evaluated. ! ! Output, real ( kind = 8 ) P22_FUN, the value of the integrand at X. ! implicit none real ( kind = 8 ) p22_fun real ( kind = 8 ) x p22_fun = 1.0D+00 / ( x**4 + x**2 + 1.0D+00 ) return end subroutine p22_lim ( a, b ) !*****************************************************************************80 ! !! P22_LIM returns the integration limits for problem 22. ! ! Modified: ! ! 22 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) A, B, the lower and upper limits of integration. ! Note that if A = -R8_HUGE(), the lower limit is ! actually negative infinity, and if B = R8_HUGE(B), the upper limit ! is actually infinity. ! implicit none real ( kind = 8 ) a real ( kind = 8 ) b a = 0.0D+00 b = 1.0D+00 return end subroutine p23_exact ( exact ) !*****************************************************************************80 ! !! P23_EXACT returns the estimated integral for problem 23. ! ! Modified: ! ! 22 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) EXACT, the estimated value of the integral. ! implicit none real ( kind = 8 ) exact exact = 0.19524753D+00 return end function p23_fun ( x ) !*****************************************************************************80 ! !! P23_FUN evaluates the integrand for problem 23. ! ! Dimension: ! ! N = 1 ! ! Interval: ! ! 2 <= X <= Infinity ! ! Integrand: ! ! exp ( - 2 ) / ( X * ( ln ( X ) )**2 ) ! ! Approximate Integral: ! ! 0.19524753 ! ! Modified: ! ! 21 December 1998 ! ! Author: ! ! John Burkardt ! ! Reference: ! ! Philip Davis, Philip Rabinowitz, ! Methods of Numerical Integration, ! Second Edition, ! Dover, 2007, ! ISBN: 0486453391, ! LC: QA299.3.D28. ! ! Parameters: ! ! Input, real ( kind = 8 ) X, the point at which the integrand ! is to be evaluated. ! ! Output, real ( kind = 8 ) P23_FUN, the value of the integrand at X. ! implicit none real ( kind = 8 ) p23_fun real ( kind = 8 ) x p23_fun = exp ( - 2.0D+00 ) / ( x * ( log ( x ) )**2 ) return end subroutine p23_lim ( a, b ) !*****************************************************************************80 ! !! P23_LIM returns the integration limits for problem 23. ! ! Modified: ! ! 22 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) A, B, the lower and upper limits of integration. ! Note that if A = -R8_HUGE(), the lower limit is ! actually negative infinity, and if B = R8_HUGE(B), the upper limit ! is actually infinity. ! implicit none real ( kind = 8 ) a real ( kind = 8 ) b real ( kind = 8 ) r8_huge a = 2.0D+00 b = r8_huge ( ) return end subroutine p24_exact ( exact ) !*****************************************************************************80 ! !! P24_EXACT returns the estimated integral for problem 24. ! ! Modified: ! ! 22 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) EXACT, the estimated value of the integral. ! implicit none real ( kind = 8 ) exact exact = 0.32510855D+00 return end function p24_fun ( x ) !*****************************************************************************80 ! !! P24_FUN evaluates the integrand for problem 24. ! ! Dimension: ! ! N = 1 ! ! Interval: ! ! 2 <= X <= Infinity ! ! Integrand: ! ! exp ( - 2 ) / ( X * ( ln ( X ) )**(3/2) ) ! ! Approximate Integral: ! ! 0.32510855 ! ! Modified: ! ! 21 December 1998 ! ! Author: ! ! John Burkardt ! ! Reference: ! ! Philip Davis, Philip Rabinowitz, ! Methods of Numerical Integration, ! Second Edition, ! Dover, 2007, ! ISBN: 0486453391, ! LC: QA299.3.D28. ! ! Parameters: ! ! Input, real ( kind = 8 ) X, the point at which the integrand ! is to be evaluated. ! ! Output, real ( kind = 8 ) P24_FUN, the value of the integrand at X. ! implicit none real ( kind = 8 ) p24_fun real ( kind = 8 ) x p24_fun = exp ( - 2.0D+00 ) / ( x * ( log ( x ) )**1.5D+00 ) return end subroutine p24_lim ( a, b ) !*****************************************************************************80 ! !! P24_LIM returns the integration limits for problem 24. ! ! Modified: ! ! 22 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) A, B, the lower and upper limits of integration. ! Note that if A = -R8_HUGE(), the lower limit is ! actually negative infinity, and if B = R8_HUGE(B), the upper limit ! is actually infinity. ! implicit none real ( kind = 8 ) a real ( kind = 8 ) b real ( kind = 8 ) r8_huge a = 2.0D+00 b = r8_huge ( ) return end subroutine p25_exact ( exact ) !*****************************************************************************80 ! !! P25_EXACT returns the estimated integral for problem 25. ! ! Modified: ! ! 22 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) EXACT, the estimated value of the integral. ! implicit none real ( kind = 8 ) exact exact = 13.628D+00 return end function p25_fun ( x ) !*****************************************************************************80 ! !! P25_FUN evaluates the integrand for problem 93. ! ! Discussion: ! ! This integral is "something of a numerical joke, as it is ! scarcely distinguishable from the divergent integrand 1/x." ! ! Dimension: ! ! N = 1 ! ! Interval: ! ! 2 <= X <= Infinity ! ! Integrand: ! ! exp ( - 2 ) / X**1.01 ! ! Approximate Integral: ! ! 13.628 ! ! Modified: ! ! 21 December 1998 ! ! Author: ! ! John Burkardt ! ! Reference: ! ! Philip Davis, Philip Rabinowitz, ! Methods of Numerical Integration, ! Second Edition, ! Dover, 2007, ! ISBN: 0486453391, ! LC: QA299.3.D28. ! ! Parameters: ! ! Input, real ( kind = 8 ) X, the point at which the integrand ! is to be evaluated. ! ! Output, real ( kind = 8 ) P25_FUN, the value of the integrand at X. ! implicit none real ( kind = 8 ) p25_fun real ( kind = 8 ) x p25_fun = exp ( - 2.0D+00 ) / x**1.01D+00 return end subroutine p25_lim ( a, b ) !*****************************************************************************80 ! !! P25_LIM returns the integration limits for problem 25. ! ! Modified: ! ! 22 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) A, B, the lower and upper limits of integration. ! Note that if A = -R8_HUGE(), the lower limit is ! actually negative infinity, and if B = R8_HUGE(B), the upper limit ! is actually infinity. ! implicit none real ( kind = 8 ) a real ( kind = 8 ) b real ( kind = 8 ) r8_huge a = 2.0D+00 b = r8_huge ( ) return end subroutine p26_exact ( exact ) !*****************************************************************************80 ! !! P26_EXACT returns the estimated integral for problem 26. ! ! Modified: ! ! 22 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) EXACT, the estimated value of the integral. ! implicit none real ( kind = 8 ) exact exact = - 0.0046984D+00 return end function p26_fun ( x ) !*****************************************************************************80 ! !! P26_FUN evaluates the integrand for problem 26. ! ! Discussion: ! ! This is a version of the sine integral. ! ! Dimension: ! ! N = 1 ! ! Interval: ! ! 2 <= X <= Infinity ! ! Integrand: ! ! exp ( -2 ) * sin ( x ) / x ! ! Approximate Integral: ! ! - 0.0046984 ! ! Modified: ! ! 21 December 1998 ! ! Author: ! ! John Burkardt ! ! Reference: ! ! Philip Davis, Philip Rabinowitz, ! Methods of Numerical Integration, ! Second Edition, ! Dover, 2007, ! ISBN: 0486453391, ! LC: QA299.3.D28. ! ! Parameters: ! ! Input, real ( kind = 8 ) X, the point at which the integrand ! is to be evaluated. ! ! Output, real ( kind = 8 ) P26_FUN, the value of the integrand at X. ! implicit none real ( kind = 8 ) p26_fun real ( kind = 8 ) x p26_fun = exp ( - 2.0D+00 ) * sin ( x ) / x return end subroutine p26_lim ( a, b ) !*****************************************************************************80 ! !! P26_LIM returns the integration limits for problem 26. ! ! Modified: ! ! 22 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) A, B, the lower and upper limits of integration. ! Note that if A = -R8_HUGE(), the lower limit is ! actually negative infinity, and if B = R8_HUGE(B), the upper limit ! is actually infinity. ! implicit none real ( kind = 8 ) a real ( kind = 8 ) b real ( kind = 8 ) r8_huge a = 2.0D+00 b = r8_huge ( ) return end subroutine p27_exact ( exact ) !*****************************************************************************80 ! !! P27_EXACT returns the estimated integral for problem 27. ! ! Modified: ! ! 22 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) EXACT, the estimated value of the integral. ! implicit none real ( kind = 8 ) exact exact = 0.00158973D+00 return end function p27_fun ( x ) !*****************************************************************************80 ! !! P27_FUN evaluates the integrand for problem 27. ! ! Discussion: ! ! This is a version of the Fresnel integral. ! ! Dimension: ! ! N = 1 ! ! Interval: ! ! 2 <= X <= Infinity ! ! Integrand: ! ! exp ( -2 ) * cos ( 0.5 * pi * X**2 ) ! ! Approximate Integral: ! ! 0.00158973 ! ! Modified: ! ! 21 December 1998 ! ! Author: ! ! John Burkardt ! ! Reference: ! ! Philip Davis, Philip Rabinowitz, ! Methods of Numerical Integration, ! Second Edition, ! Dover, 2007, ! ISBN: 0486453391, ! LC: QA299.3.D28. ! ! Parameters: ! ! Input, real ( kind = 8 ) X, the point at which the integrand ! is to be evaluated. ! ! Output, real ( kind = 8 ) P27_FUN, the value of the integrand at X. ! implicit none real ( kind = 8 ) p27_fun real ( kind = 8 ), parameter :: pi = 3.141592653589793D+00 real ( kind = 8 ) x p27_fun = exp ( -2.0D+00 ) * cos ( 0.5D+00 * pi * x**2 ) return end subroutine p27_lim ( a, b ) !*****************************************************************************80 ! !! P27_LIM returns the integration limits for problem 27. ! ! Modified: ! ! 22 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) A, B, the lower and upper limits of integration. ! Note that if A = -R8_HUGE(), the lower limit is ! actually negative infinity, and if B = R8_HUGE(B), the upper limit ! is actually infinity. ! implicit none real ( kind = 8 ) a real ( kind = 8 ) b real ( kind = 8 ) r8_huge a = 2.0D+00 b = r8_huge ( ) return end subroutine p28_exact ( exact ) !*****************************************************************************80 ! !! P28_EXACT returns the estimated integral for problem 28. ! ! ! Modified: ! ! 22 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) EXACT, the estimated value of the integral. ! implicit none real ( kind = 8 ) exact exact = 0.0005610371D+00 return end function p28_fun ( x ) !*****************************************************************************80 ! !! P28_FUN evaluates the integrand for problem 28. ! ! Discussion: ! ! This is a version of the complementary error function. ! ! Dimension: ! ! N = 1 ! ! Interval: ! ! 2 <= X <= Infinity ! ! Integrand: ! ! exp ( -2 ) * exp ( - X**2 ) ! ! Approximate Integral: ! ! 0.0005610371 ! ! Modified: ! ! 17 May 2007 ! ! Author: ! ! John Burkardt ! ! Reference: ! ! Philip Davis, Philip Rabinowitz, ! Methods of Numerical Integration, ! Second Edition, ! Dover, 2007, ! ISBN: 0486453391, ! LC: QA299.3.D28. ! ! Parameters: ! ! Input, real ( kind = 8 ) X, the point at which the integrand ! is to be evaluated. ! ! Output, real ( kind = 8 ) P28_FUN, the value of the integrand at X. ! implicit none real ( kind = 8 ) p28_fun real ( kind = 8 ) x real ( kind = 8 ), save :: x_max = 0.0D+00 if ( x_max == 0.0D+00 ) then x_max = sqrt ( - log ( 1.0D-10 ) ) end if if ( x_max < x ) then p28_fun = 0.0D+00 else p28_fun = exp ( - 2.0D+00 ) * exp ( - x**2 ) end if return end subroutine p28_lim ( a, b ) !*****************************************************************************80 ! !! P28_LIM returns the integration limits for problem 28. ! ! Modified: ! ! 22 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) A, B, the lower and upper limits of integration. ! Note that if A = -R8_HUGE(A), the lower limit is ! actually negative infinity, and if B = R8_HUGE(B), the upper limit ! is actually infinity. ! implicit none real ( kind = 8 ) a real ( kind = 8 ) b real ( kind = 8 ) r8_huge a = 2.0D+00 b = r8_huge ( ) return end subroutine p29_exact ( exact ) !*****************************************************************************80 ! !! P29_EXACT returns the estimated integral for problem 29. ! ! Modified: ! ! 22 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) EXACT, the estimated value of the integral. ! implicit none real ( kind = 8 ) exact exact = 0.16266891D+00 return end function p29_fun ( x ) !*****************************************************************************80 ! !! P29_FUN evaluates the integrand for problem 29. ! ! Discussion: ! ! This is a version of a Bessel function. ! ! Dimension: ! ! N = 1 ! ! Interval: ! ! 2 <= X <= Infinity ! ! Integrand: ! ! exp ( - 2 ) * sin ( X - 1 ) / sqrt ( X * ( X - 2 ) ) ! ! Approximate Integral: ! ! 0.16266891 ! ! Modified: ! ! 21 April 2003 ! ! Author: ! ! John Burkardt ! ! Reference: ! ! Philip Davis, Philip Rabinowitz, ! Methods of Numerical Integration, ! Second Edition, ! Dover, 2007, ! ISBN: 0486453391, ! LC: QA299.3.D28. ! ! Parameters: ! ! Input, real ( kind = 8 ) X, the point at which the integrand ! is to be evaluated. ! ! Output, real ( kind = 8 ) P29_FUN, the value of the integrand at X. ! implicit none real ( kind = 8 ) p29_fun real ( kind = 8 ) r8_huge real ( kind = 8 ) x if ( x == 0.0D+00 .or. x == 2.0D+00 ) then p29_fun = r8_huge ( ) else p29_fun = exp ( - 2.0D+00 ) * sin ( x - 1.0D+00 ) & / sqrt ( x * ( x - 2.0D+00 ) ) end if return end subroutine p29_lim ( a, b ) !*****************************************************************************80 ! !! P29_LIM returns the integration limits for problem 29. ! ! Modified: ! ! 22 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) A, B, the lower and upper limits of integration. ! Note that if A = -R8_HUGE(), the lower limit is ! actually negative infinity, and if B = R8_HUGE(B), the upper limit ! is actually infinity. ! implicit none real ( kind = 8 ) a real ( kind = 8 ) b real ( kind = 8 ) r8_huge a = 2.0D+00 b = r8_huge ( ) return end subroutine p30_exact ( exact ) !*****************************************************************************80 ! !! P30_EXACT returns the estimated integral for problem 30. ! ! Modified: ! ! 22 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) EXACT, the estimated value of the integral. ! implicit none real ( kind = 8 ) exact exact = 0.0583349D+00 return end function p30_fun ( x ) !*****************************************************************************80 ! !! P30_FUN evaluates the integrand for problem 30. ! ! Discussion: ! ! This is a version of the Debye function. ! ! Dimension: ! ! N = 1 ! ! Interval: ! ! 2 <= X <= Infinity ! ! Integrand: ! ! exp ( - 2 ) * X / ( exp ( X ) - 1 ) ! ! Approximate Integral: ! ! 0.0583349 ! ! Modified: ! ! 21 December 1998 ! ! Author: ! ! John Burkardt ! ! Reference: ! ! Philip Davis, Philip Rabinowitz, ! Methods of Numerical Integration, ! Second Edition, ! Dover, 2007, ! ISBN: 0486453391, ! LC: QA299.3.D28. ! ! Parameters: ! ! Input, real ( kind = 8 ) X, the point at which the integrand ! is to be evaluated. ! ! Output, real ( kind = 8 ) P30_FUN, the value of the integrand at X. ! implicit none real ( kind = 8 ) p30_fun real ( kind = 8 ) x p30_fun = exp ( - 2.0D+00 ) * x / ( exp ( x ) - 1.0D+00 ) return end subroutine p30_lim ( a, b ) !*****************************************************************************80 ! !! P30_LIM returns the integration limits for problem 30. ! ! Modified: ! ! 22 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) A, B, the lower and upper limits of integration. ! Note that if A = -R8_HUGE(), the lower limit is ! actually negative infinity, and if B = R8_HUGE(B), the upper limit ! is actually infinity. ! implicit none real ( kind = 8 ) a real ( kind = 8 ) b real ( kind = 8 ) r8_huge a = 2.0D+00 b = r8_huge ( ) return end subroutine p31_exact ( exact ) !*****************************************************************************80 ! !! P31_EXACT returns the estimated integral for problem 31. ! ! Modified: ! ! 22 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) EXACT, the estimated value of the integral. ! implicit none real ( kind = 8 ) exact exact = 1.0634618101D+00 return end function p31_fun ( x ) !*****************************************************************************80 ! !! P31_FUN evaluates the integrand for problem 31. ! ! Dimension: ! ! N = 1 ! ! Interval: ! ! 0 <= X <= Infinity ! ! Integrand: ! ! sin ( exp ( - X ) + exp ( - 4 * X ) ) ! ! Approximate Integral: ! ! 1.0634618101 ! ! Modified: ! ! 21 December 1998 ! ! Author: ! ! John Burkardt ! ! Reference: ! ! Arthur Stroud, Don Secrest, ! Gaussian Quadrature Formulas, ! Prentice Hall, 1966, page 54. ! ! Parameters: ! ! Input, real ( kind = 8 ) X, the point at which the integrand ! is to be evaluated. ! ! Output, real ( kind = 8 ) P31_FUN, the value of the integrand at X. ! implicit none real ( kind = 8 ) p31_fun real ( kind = 8 ) x p31_fun = sin ( exp ( - x ) + exp ( - 4.0D+00 * x ) ) return end subroutine p31_lim ( a, b ) !*****************************************************************************80 ! !! P31_LIM returns the integration limits for problem 31. ! ! Modified: ! ! 22 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) A, B, the lower and upper limits of integration. ! Note that if A = -R8_HUGE(), the lower limit is ! actually negative infinity, and if B = R8_HUGE(B), the upper limit ! is actually infinity. ! implicit none real ( kind = 8 ) a real ( kind = 8 ) b real ( kind = 8 ) r8_huge a = 0.0D+00 b = r8_huge ( ) return end subroutine p32_exact ( exact ) !*****************************************************************************80 ! !! P32_EXACT returns the exact integral for problem 32. ! ! Modified: ! ! 22 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) EXACT, the value of the integral. ! implicit none real ( kind = 8 ) exact real ( kind = 8 ), parameter :: pi = 3.141592653589793D+00 exact = 0.5D+00 * pi return end function p32_fun ( x ) !*****************************************************************************80 ! !! P32_FUN evaluates the integrand for problem 32. ! ! Dimension: ! ! N = 1 ! ! Interval: ! ! 0 <= X <= Infinity ! ! Integrand: ! ! 1 / ( 1 + X**2 ) ! ! Antiderivative: ! ! arctan ( X ) ! ! Exact Integral: ! ! pi / 2 ! ! Modified: ! ! 21 December 1998 ! ! Author: ! ! John Burkardt ! ! Reference: ! ! Arthur Stroud, Don Secrest, ! Gaussian Quadrature Formulas, ! Prentice Hall, 1966, page 54. ! ! Parameters: ! ! Input, real ( kind = 8 ) X, the point at which the integrand ! is to be evaluated. ! ! Output, real ( kind = 8 ) P32_FUN, the value of the integrand at X. ! implicit none real ( kind = 8 ) p32_fun real ( kind = 8 ) x p32_fun = 1.0D+00 / ( 1.0D+00 + x**2 ) return end subroutine p32_lim ( a, b ) !*****************************************************************************80 ! !! P32_LIM returns the integration limits for problem 32. ! ! Modified: ! ! 22 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) A, B, the lower and upper limits of integration. ! Note that if A = -R8_HUGE(), the lower limit is ! actually negative infinity, and if B = R8_HUGE(B), the upper limit ! is actually infinity. ! implicit none real ( kind = 8 ) a real ( kind = 8 ) b real ( kind = 8 ) r8_huge a = 0.0D+00 b = r8_huge ( ) return end subroutine p33_exact ( exact ) !*****************************************************************************80 ! !! P33_EXACT returns the exact integral for problem 33. ! ! Modified: ! ! 22 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) EXACT, the value of the integral. ! real ( kind = 8 ) exact real ( kind = 8 ), parameter :: pi = 3.141592653589793D+00 exact = pi return end function p33_fun ( x ) !*****************************************************************************80 ! !! P33_FUN evaluates the integrand for problem 33. ! ! Discussion: ! ! The integrand tends to infinity at X = 0, when approached from ! the positive X side. ! ! Dimension: ! ! N = 1 ! ! Interval: ! ! 0 <= X <= Infinity ! ! Integrand: ! ! 1 / ( sqrt ( X ) * ( 1 + X ) ) ! ! Exact Integral: ! ! pi ! ! Modified: ! ! 22 December 1998 ! ! Author: ! ! John Burkardt ! ! Reference: ! ! Arthur Stroud, Don Secrest, ! Gaussian Quadrature Formulas, ! Prentice Hall, 1966, page 54. ! ! Parameters: ! ! Input, real ( kind = 8 ) X, the point at which the integrand ! is to be evaluated. ! ! Output, real ( kind = 8 ) P33_FUN, the value of the integrand at X. ! implicit none real ( kind = 8 ) p33_fun real ( kind = 8 ) x if ( 0.0D+00 < x ) then p33_fun = 1.0D+00 / ( sqrt ( x ) * ( 1.0D+00 + x ) ) else p33_fun = 0.0D+00 end if return end subroutine p33_lim ( a, b ) !*****************************************************************************80 ! !! P33_LIM returns the integration limits for problem 33. ! ! Modified: ! ! 22 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) A, B, the lower and upper limits of integration. ! Note that if A = -R8_HUGE(), the lower limit is ! actually negative infinity, and if B = R8_HUGE(B), the upper limit ! is actually infinity. ! implicit none real ( kind = 8 ) a real ( kind = 8 ) b real ( kind = 8 ) r8_huge a = 0.0D+00 b = r8_huge ( ) return end subroutine p34_exact ( exact ) !*****************************************************************************80 ! !! P34_EXACT returns the exact integral for problem 34. ! ! Modified: ! ! 22 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) EXACT, the value of the integral. ! implicit none real ( kind = 8 ) exact exact = 0.5D+00 return end function p34_fun ( x ) !*****************************************************************************80 ! !! P34_FUN evaluates the integrand for problem 84. ! ! Dimension: ! ! N = 1 ! ! Interval: ! ! 0 <= X <= Infinity ! ! Integrand: ! ! exp ( - X ) * cos ( X ) ! ! Antiderivative: ! ! 0.5 * exp ( -X ) * ( sin ( X ) - cos ( X ) ) ! ! Exact Integral: ! ! 1 / 2 ! ! Modified: ! ! 21 December 1998 ! ! Author: ! ! John Burkardt ! ! Reference: ! ! Arthur Stroud, Don Secrest, ! Gaussian Quadrature Formulas, ! Prentice Hall, 1966, page 54. ! ! Parameters: ! ! Input, real ( kind = 8 ) X, the point at which the integrand ! is to be evaluated. ! ! Output, real ( kind = 8 ) P34_FUN, the value of the integrand at X. ! implicit none real ( kind = 8 ) p34_fun real ( kind = 8 ) x p34_fun = exp ( - x ) * cos ( x ) return end subroutine p34_lim ( a, b ) !*****************************************************************************80 ! !! P34_LIM returns the integration limits for problem 34. ! ! Modified: ! ! 22 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) A, B, the lower and upper limits of integration. ! Note that if A = -R8_HUGE(), the lower limit is ! actually negative infinity, and if B = R8_HUGE(B), the upper limit ! is actually infinity. ! implicit none real ( kind = 8 ) a real ( kind = 8 ) b real ( kind = 8 ) r8_huge a = 0.0D+00 b = r8_huge ( ) return end subroutine p35_exact ( exact ) !*****************************************************************************80 ! !! P35_EXACT returns the exact integral for problem 35. ! ! Modified: ! ! 22 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) EXACT, the value of the integral. ! implicit none real ( kind = 8 ) exact real ( kind = 8 ), parameter :: pi = 3.141592653589793D+00 exact = 0.5D+00 * pi return end function p35_fun ( x ) !*****************************************************************************80 ! !! P35_FUN evaluates the integrand for problem 35. ! ! Discussion: ! ! The integrand has a removable singularity at X = 0. ! ! Dimension: ! ! N = 1 ! ! Interval: ! ! 0 <= x <= Infinity ! ! Integrand: ! ! sin ( x ) / x ! ! Exact Integral: ! ! Si(Infinity) = pi / 2 ! ! Modified: ! ! 22 December 1998 ! ! Author: ! ! John Burkardt ! ! Reference: ! ! Arthur Stroud, Don Secrest, ! Gaussian Quadrature Formulas, ! Prentice Hall, 1966, page 54. ! ! Parameters: ! ! Input, real ( kind = 8 ) X, the point at which the integrand ! is to be evaluated. ! ! Output, real ( kind = 8 ) P35_FUN, the value of the integrand at X. ! implicit none real ( kind = 8 ) p35_fun real ( kind = 8 ) x if ( x /= 0.0D+00 ) then p35_fun = sin ( x ) / x else p35_fun = 1.0D+00 end if return end subroutine p35_lim ( a, b ) !*****************************************************************************80 ! !! P35_LIM returns the integration limits for problem 35. ! ! Modified: ! ! 22 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) A, B, the lower and upper limits of integration. ! Note that if A = -R8_HUGE(), the lower limit is ! actually negative infinity, and if B = R8_HUGE(B), the upper limit ! is actually infinity. ! implicit none real ( kind = 8 ) a real ( kind = 8 ) b real ( kind = 8 ) r8_huge a = 0.0D+00 b = r8_huge ( ) return end subroutine p36_exact ( exact ) !*****************************************************************************80 ! !! P36_EXACT returns the estimated integral for problem 36. ! ! Modified: ! ! 23 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) EXACT, the estimated value of the integral. ! implicit none real ( kind = 8 ) exact exact = 0.624713D+00 return end function p36_fun ( x ) !*****************************************************************************80 ! !! P36_FUN evaluates the integrand for problem 36. ! ! Discussion: ! ! The integrand has a singularity at X = 0. ! The integrand is discontinuous at X = 0. ! The integrand is arbitrarily oscillatory as X decreases to 0. ! The integrand becomes unbounded as X decreases to 0. ! ! Integral ( 0 < X < 1 ) ( 1 / X ) sin ( 1 / X ) dX ! = Integral ( 1 < X < Infinity ) ( 1 / X ) * sin ( X ) dX. ! ! Dimension: ! ! N = 1 ! ! Interval: ! ! 0 <= X <= 1 ! ! Integrand: ! ! ( 1 / x ) sin ( 1 / x ) ! ! Approximate Integral: ! ! 0.624713 ! ! Modified: ! ! 23 December 1998 ! ! Author: ! ! John Burkardt ! ! Reference: ! ! Philip Davis, Philip Rabinowitz, ! Methods of Numerical Integration, ! Second Edition, ! Dover, 2007, ! ISBN: 0486453391, ! LC: QA299.3.D28. ! ! Parameters: ! ! Input, real ( kind = 8 ) X, the point at which the integrand ! is to be evaluated. ! ! Output, real ( kind = 8 ) P36_FUN, the value of the integrand at X. ! implicit none real ( kind = 8 ) p36_fun real ( kind = 8 ) x if ( x == 0.0D+00 ) then p36_fun = 0.0D+00 else p36_fun = ( 1.0D+00 / x ) * sin ( 1.0D+00 / x ) end if return end subroutine p36_lim ( a, b ) !*****************************************************************************80 ! !! P36_LIM returns the integration limits for problem 36. ! ! Modified: ! ! 23 December 1998 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) A, B, the lower and upper limits of integration. ! Note that if A = -R8_HUGE(), the lower limit is ! actually negative infinity, and if B = R8_HUGE(B), the upper limit ! is actually infinity. ! implicit none real ( kind = 8 ) a real ( kind = 8 ) b a = 0.0D+00 b = 1.0D+00 return end subroutine p37_exact ( exact ) !*****************************************************************************80 ! !! P37_EXACT returns the estimated integral for problem 37. ! ! Modified: ! ! 09 January 1999 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) EXACT, the estimated value of the integral. ! implicit none real ( kind = 8 ) exact exact = - 0.0067547455D+00 return end function p37_fun ( x ) !*****************************************************************************80 ! !! P37_FUN evaluates the integrand for problem 37. ! ! Discussion: ! ! The integrand is continuous, but nowhere differentiable. ! ! Dimension: ! ! N = 1 ! ! Interval: ! ! 0 <= X <= 0.5 ! ! Integrand: ! ! ( 1 / pi ) * sum ( 1 <= I < Infinity ) 2**(-I) * cos ( 7**I * pi * X ) ! ! Approximate Integral: ! ! - 0.0067547455 ! ! Antiderivative: ! ! ( 1 / pi**2 ) * sum ( 1 <= I < Infinity ) 14**(-I) * sin ( 7**I * pi * X ) ! ! Modified: ! ! 22 November 1999 ! ! Author: ! ! John Burkardt ! ! Reference: ! ! Philip Davis, Philip Rabinowitz, ! Methods of Numerical Integration, ! Second Edition, ! Dover, 2007, ! ISBN: 0486453391, ! LC: QA299.3.D28. ! ! Herbert Salzer, Norman Levine, ! Table of a Weierstrass Continuous Nondifferentiable Function, ! Mathematics of Computation, ! Volume 15, pages 120 - 130, 1961. ! ! Parameters: ! ! Input, real ( kind = 8 ) X, the point at which the integrand ! is to be evaluated. ! ! Output, real ( kind = 8 ) P37_FUN, the value of the integrand at X. ! implicit none integer ( kind = 4 ) i integer ( kind = 4 ), parameter :: n_term = 40 real ( kind = 8 ) p37_fun real ( kind = 8 ), parameter :: pi = 3.141592653589793D+00 real ( kind = 8 ) x p37_fun = 0.0D+00 do i = 1, n_term p37_fun = p37_fun + cos ( 7.0D+00**i * pi * x ) / 2.0D+00**i end do p37_fun = p37_fun / pi return end subroutine p37_lim ( a, b ) !*****************************************************************************80 ! !! P37_LIM returns the integration limits for problem 37. ! ! Modified: ! ! 09 January 1999 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) A, B, the lower and upper limits of integration. ! Note that if A = -R8_HUGE(), the lower limit is ! actually negative infinity, and if B = R8_HUGE(B), the upper limit ! is actually infinity. ! implicit none real ( kind = 8 ) a real ( kind = 8 ) b a = 0.0D+00 b = 0.5D+00 return end subroutine p38_exact ( exact ) !*****************************************************************************80 ! !! P38_EXACT returns the estimated integral for problem 38. ! ! Modified: ! ! 22 November 1999 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) EXACT, the estimated value of the integral. ! implicit none real ( kind = 8 ) exact exact = 0.3D+00 * log ( 0.3D+00 ) + 0.7D+00 * log ( 0.7D+00 ) - 1.0D+00 return end function p38_fun ( x ) !*****************************************************************************80 ! !! P38_FUN evaluates the integrand for problem 38. ! ! Dimension: ! ! N = 1 ! ! Interval: ! ! 0 <= X <= 1. ! ! Integrand: ! ! ln ( abs ( x - 0.7 ) ) ! ! Exact Integral: ! ! 0.3 * ln ( 0.3 ) + 0.7 * ln ( 0.7 ) - 1 ! ! Approximate Integral: ! ! - 1.610864400 ! ! Modified: ! ! 22 November 1999 ! ! Author: ! ! John Burkardt ! ! Reference: ! ! Kendall Atkinson, ! An Introduction to Numerical Analysis, ! Prentice Hall, 1984, page 303. ! ! Parameters: ! ! Input, real ( kind = 8 ) X, the point at which the integrand ! is to be evaluated. ! ! Output, real ( kind = 8 ) P38_FUN, the value of the integrand at X. ! implicit none real ( kind = 8 ) p38_fun real ( kind = 8 ) x p38_fun = log ( abs ( x - 0.7D+00 ) ) return end subroutine p38_lim ( a, b ) !*****************************************************************************80 ! !! P38_LIM returns the integration limits for problem 38. ! ! Modified: ! ! 22 November 1999 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) A, B, the lower and upper limits of integration. ! Note that if A = -R8_HUGE(), the lower limit is ! actually negative infinity, and if B = R8_HUGE(B), the upper limit ! is actually infinity. ! implicit none real ( kind = 8 ) a real ( kind = 8 ) b a = 0.0D+00 b = 1.0D+00 return end subroutine p39_exact ( exact ) !*****************************************************************************80 ! !! P39_EXACT returns the exact integral for problem 39. ! ! Modified: ! ! 22 November 1999 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) EXACT, the value of the integral. ! implicit none real ( kind = 8 ) exact exact = 7.95492652101284D+00 return end function p39_fun ( x ) !*****************************************************************************80 ! !! P39_FUN evaluates the integrand for problem 39. ! ! Dimension: ! ! n = 1 ! ! Interval: ! ! 0 <= x <= 2 pi ! ! Integrand: ! ! exp ( cos ( x ) ) ! ! Approximate Integral: ! ! 7.95492652101284 ! ! Modified: ! ! 22 November 1999 ! ! Author: ! ! John Burkardt ! ! Reference: ! ! Kendall Atkinson, ! An Introduction to Numerical Analysis, ! Prentice Hall, 1984, page 262. ! ! Parameters: ! ! Input, real ( kind = 8 ) X(2), the point at which the integrand ! is to be evaluated. ! ! Output, real ( kind = 8 ) P39_FUN, the value of the integrand at X. ! implicit none real ( kind = 8 ) p39_fun real ( kind = 8 ) x p39_fun = exp ( cos ( x ) ) return end subroutine p39_lim ( a, b ) !*****************************************************************************80 ! !! P39_LIM returns the integration limits for problem 39. ! ! Modified: ! ! 22 November 1999 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) A, B, the lower and upper limits of integration. ! Note that if A = -R8_HUGE(), the lower limit is ! actually negative infinity, and if B = R8_HUGE(B), the upper limit ! is actually infinity. ! implicit none real ( kind = 8 ) a real ( kind = 8 ) b real ( kind = 8 ), parameter :: pi = 3.141592653589793D+00 a = 0.0D+00 b = 2.0D+00 * pi return end subroutine p40_exact ( exact ) !*****************************************************************************80 ! !! P40_EXACT returns the exact integral for problem 40. ! ! Modified: ! ! 09 January 1999 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) EXACT, the value of the integral. ! implicit none real ( kind = 8 ) exact exact = 5.0D+00 - 6.0D+00 * log ( 2.0D+00 ) return end function p40_fun ( x ) !*****************************************************************************80 ! !! P40_FUN evaluates the integrand for problem 40. ! ! Dimension: ! ! N = 1 ! ! Interval: ! ! 0 <= X <= 1 ! ! Integrand: ! ! 1 / ( X**(1/2) + X**(1/3) ) ! ! Exact Integral: ! ! 5 - 6 * ln ( 2 ) ! ! Approximate Integral: ! ! 0.8411169 ! ! Modified: ! ! 22 November 1999 ! ! Author: ! ! John Burkardt ! ! Reference: ! ! Philip Davis, Philip Rabinowitz, ! Methods of Numerical Integration, ! Second Edition, ! Dover, 2007, ! ISBN: 0486453391, ! LC: QA299.3.D28. ! ! Parameters: ! ! Input, real ( kind = 8 ) X, the point at which the integrand ! is to be evaluated. ! ! Output, real ( kind = 8 ) P40_FUN, the value of the integrand at X. ! implicit none real ( kind = 8 ) p40_fun real ( kind = 8 ) x if ( x == 0.0D+00 ) then p40_fun = 0.0D+00 else p40_fun = 1.0D+00 / ( sqrt ( x ) + x**(1.0D+00/3.0D+00) ) end if return end subroutine p40_lim ( a, b ) !*****************************************************************************80 ! !! P40_LIM returns the integration limits for problem 40. ! ! Modified: ! ! 09 January 1999 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) A, B, the lower and upper limits of integration. ! Note that if A = -R8_HUGE(), the lower limit is ! actually negative infinity, and if B = R8_HUGE(B), the upper limit ! is actually infinity. ! implicit none real ( kind = 8 ) a real ( kind = 8 ) b a = 0.0D+00 b = 1.0D+00 return end subroutine p41_exact ( exact ) !*****************************************************************************80 ! !! P41_EXACT returns the exact integral for problem 41. ! ! Modified: ! ! 22 November 1999 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) EXACT, the value of the integral. ! implicit none real ( kind = 8 ) exact real ( kind = 8 ), parameter :: pi = 3.141592653589793D+00 exact = ( 50.0D+00 / 2501.0D+00 ) * ( 1.0D+00 - exp ( - 2.0D+00 * pi ) ) return end function p41_fun ( x ) !*****************************************************************************80 ! !! P41_FUN evaluates the integrand for problem 41. ! ! Dimension: ! ! N = 1 ! ! Interval: ! ! 0 <= X <= 2 PI ! ! Integrand: ! ! exp ( - X ) * sin ( 50 * X ) ! ! Exact Integral: ! ! 50 / ( 2501 ) * ( 1 - exp ( - 2 * PI ) ) ! ! Approximate Integral: ! ! 0.019954669278 ! ! Reference: ! ! Kendall Atkinson, ! An Introduction to Numerical Analysis, ! Prentice Hall, 1984, page 303. ! ! Modified: ! ! 22 November 1999 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Input, real ( kind = 8 ) X, the point at which the integrand ! is to be evaluated. ! ! Output, real ( kind = 8 ) P41_FUN, the value of the integrand at X. ! implicit none real ( kind = 8 ) p41_fun real ( kind = 8 ) x p41_fun = exp ( - x ) * sin ( 50.0D+00 * x ) return end subroutine p41_lim ( a, b ) !*****************************************************************************80 ! !! P41_LIM returns the integration limits for problem 41. ! ! Modified: ! ! 22 November 1999 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) A, B, the lower and upper limits of integration. ! Note that if A = -R8_HUGE(), the lower limit is ! actually negative infinity, and if B = R8_HUGE(B), the upper limit ! is actually infinity. ! implicit none real ( kind = 8 ) a real ( kind = 8 ) b real ( kind = 8 ), parameter :: pi = 3.141592653589793D+00 a = 0.0D+00 b = 2.0D+00 * pi return end subroutine p42_exact ( exact ) !*****************************************************************************80 ! !! P42_EXACT returns the exact integral for problem 42. ! ! Modified: ! ! 11 January 1999 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) EXACT, the value of the integral. ! implicit none real ( kind = 8 ) exact exact = 1.0D+00 - log ( 2.0D+00 ) return end function p42_fun ( x ) !*****************************************************************************80 ! !! P42_FUN evaluates the integrand for problem 42. ! ! Dimension: ! ! N = 1 ! ! Interval: ! ! 0 <= X <= 1 ! ! Integrand: ! ! F ( X ) = 1 / ( X + 2 ) for 0 < X < E - 2 ! = 0 otherwise ! ! Exact Integral: ! ! 1 - ln ( 2 ) ! ! Approximate Integral: ! ! 0.30685282 ! ! Reference: ! ! Philip Davis, Philip Rabinowitz, ! Methods of Numerical Integration, ! Second Edition, ! Dover, 2007, ! ISBN: 0486453391, ! LC: QA299.3.D28. ! ! Modified: ! ! 11 January 1999 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Input, real ( kind = 8 ) X, the point at which the integrand ! is to be evaluated. ! ! Output, real ( kind = 8 ) P42_FUN, the value of the integrand at X. ! implicit none real ( kind = 8 ) p42_fun real ( kind = 8 ) x if ( 0.0D+00 <= x .and. x <= exp ( 1.0D+00 ) - 2.0D+00 ) then p42_fun = 1.0D+00 / ( x + 2.0D+00 ) else p42_fun = 0.0D+00 end if return end subroutine p42_lim ( a, b ) !*****************************************************************************80 ! !! P42_LIM returns the integration limits for problem 42. ! ! Modified: ! ! 11 January 1999 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) A, B, the lower and upper limits of integration. ! Note that if A = -R8_HUGE(), the lower limit is ! actually negative infinity, and if B = R8_HUGE(B), the upper limit ! is actually infinity. ! implicit none real ( kind = 8 ) a real ( kind = 8 ) b a = 0.0D+00 b = 1.0D+00 return end subroutine p43_exact ( exact ) !*****************************************************************************80 ! !! P43_EXACT returns the estimated integral for problem 43. ! ! Modified: ! ! 21 November 1999 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) EXACT, the value of the integral. ! implicit none real ( kind = 8 ) exact exact = 7.95492652101284D+00 return end function p43_fun ( x ) !*****************************************************************************80 ! !! P43_FUN evaluates the integrand for problem 43. ! ! Dimension: ! ! N = 1 ! ! Interval: ! ! 0 <= X <= 2 pi ! ! Integrand: ! ! exp ( cos ( x ) ) ! ! Approximate Integral: ! ! 7.95492652101284 ! ! Reference: ! ! Kendall Atkinson, ! An Introduction to Numerical Analysis, ! Prentice Hall, 1984, page 262. ! ! Modified: ! ! 21 November 1999 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Input, real ( kind = 8 ) X, the point at which the integrand ! is to be evaluated. ! ! Output, real ( kind = 8 ) P43_FUN, the value of the integrand at X. ! implicit none real ( kind = 8 ) p43_fun real ( kind = 8 ) x p43_fun = exp ( cos ( x ) ) return end subroutine p43_lim ( a, b ) !*****************************************************************************80 ! !! P43_LIM returns the integration limits for problem 43. ! ! Modified: ! ! 21 November 1999 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) A, B, the lower and upper limits of integration. ! Note that if A = -R8_HUGE(), the lower limit is ! actually negative infinity, and if B = R8_HUGE(B), the upper limit ! is actually infinity. ! implicit none real ( kind = 8 ) a real ( kind = 8 ) b real ( kind = 8 ), parameter :: pi = 3.141592653589793D+00 a = 0.0D+00 b = 2.0D+00 * pi return end subroutine p44_exact ( exact ) !*****************************************************************************80 ! !! P44_EXACT returns the exact integral for problem 44. ! ! Modified: ! ! 21 November 1999 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) EXACT, the value of the integral. ! implicit none real ( kind = 8 ) exact exact = 2.0D+00 * atan ( 4.0D+00 ) return end function p44_fun ( x ) !*****************************************************************************80 ! !! P44_FUN evaluates the integrand for problem 44. ! ! Discussion: ! ! A simple Newton-Cotes quadrature rule, in which the order of the ! rule is increased, but the interval is not subdivided, diverges ! for this integrand. ! ! This is Runge's function, a standard example of the perils of ! using high order polynomial interpolation at equally spaced nodes. ! Since this is exactly what is really going on in a Newton Cotes ! rule, it is little wonder that the result is so poor. ! ! Dimension: ! ! n = 1 ! ! Interval: ! ! -4 <= x <= 4 ! ! Integrand: ! ! 1 / ( 1 + x**2 ) ! ! Antiderivative: ! ! arctan ( x ) ! ! Exact Integral: ! ! 2 * arctan ( 4 ) ! ! Approximate Integral: ! ! 2.6516 ! ! Reference: ! ! Kendall Atkinson, ! An Introduction to Numerical Analysis, ! Prentice Hall, 1984, page 266. ! ! Modified: ! ! 21 November 1999 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Input, real ( kind = 8 ) X, the point at which the integrand ! is to be evaluated. ! ! Output, real ( kind = 8 ) P44_FUN, the value of the integrand at X. ! implicit none real ( kind = 8 ) p44_fun real ( kind = 8 ) x p44_fun = 1.0D+00 / ( 1.0D+00 + x**2 ) return end subroutine p44_lim ( a, b ) !*****************************************************************************80 ! !! P44_LIM returns the integration limits for problem 44. ! ! Modified: ! ! 21 November 1999 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) A, B, the lower and upper limits of integration. ! Note that if A = -R8_HUGE(), the lower limit is ! actually negative infinity, and if B = R8_HUGE(B), the upper limit ! is actually infinity. ! implicit none real ( kind = 8 ) a real ( kind = 8 ) b a = - 4.0D+00 b = 4.0D+00 return end subroutine p45_exact ( exact ) !*****************************************************************************80 ! !! P45_EXACT returns the exact integral for problem 45. ! ! Modified: ! ! 21 November 1999 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) EXACT, the value of the integral. ! implicit none real ( kind = 8 ) exact real ( kind = 8 ), parameter :: pi = 3.141592653589793D+00 exact = - 0.5D+00 * ( exp ( pi ) + 1.0D+00 ) return end function p45_fun ( x ) !*****************************************************************************80 ! !! P45_FUN evaluates the integrand for problem 45. ! ! Dimension: ! ! N = 1 ! ! Interval: ! ! 0 <= X <= PI ! ! Integrand: ! ! exp ( X ) * cos ( X ) ! ! Antiderivative: ! ! 0.5 * exp ( X ) * ( sin ( X ) + cos ( X ) ) ! ! Exact Integral: ! ! - 0.5 * ( exp ( PI ) + 1 ) ! ! Approximate Integral: ! ! - 12.0703463164 ! ! Reference: ! ! Kendall Atkinson, ! An Introduction to Numerical Analysis, ! Prentice Hall, 1984, page 254, 277, 297. ! ! Modified: ! ! 21 November 1999 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Input, real ( kind = 8 ) X, the point at which the integrand ! is to be evaluated. ! ! Output, real ( kind = 8 ) P45_FUN, the value of the integrand at X. ! implicit none real ( kind = 8 ) p45_fun real ( kind = 8 ) x p45_fun = exp ( x ) * cos ( x ) return end subroutine p45_lim ( a, b ) !*****************************************************************************80 ! !! P45_LIM returns the integration limits for problem 45. ! ! Modified: ! ! 21 November 1999 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) A, B, the lower and upper limits of integration. ! Note that if A = -R8_HUGE(), the lower limit is ! actually negative infinity, and if B = R8_HUGE(B), the upper limit ! is actually infinity. ! implicit none real ( kind = 8 ) a real ( kind = 8 ) b real ( kind = 8 ), parameter :: pi = 3.141592653589793D+00 a = 0.0D+00 b = pi return end subroutine p46_exact ( exact ) !*****************************************************************************80 ! !! P46_EXACT returns the exact integral for problem 46. ! ! Modified: ! ! 21 November 1999 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) EXACT, the value of the integral. ! implicit none real ( kind = 8 ) exact real ( kind = 8 ), parameter :: pi = 3.141592653589793D+00 exact = 0.5D+00 * sqrt ( pi ) return end function p46_fun ( x ) !*****************************************************************************80 ! !! P46_FUN evaluates the integrand for problem 46. ! ! Discussion: ! ! The integrand is singular at both endpoints of the interval. ! ! Dimension: ! ! N = 1 ! ! Interval: ! ! 0 <= X <= 1 ! ! Integrand: ! ! sqrt ( - ln ( X ) ) ! ! Exact Integral: ! ! sqrt ( pi ) / 2 ! ! Approximate Integral: ! ! 0.8862269 ! ! Reference: ! ! Kendall Atkinson, ! An Introduction to Numerical Analysis, ! Prentice Hall, 1984, page 307. ! ! Modified: ! ! 22 November 1999 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Input, real ( kind = 8 ) X, the point at which the integrand ! is to be evaluated. ! ! Output, real ( kind = 8 ) P46_FUN, the value of the integrand at X. ! implicit none real ( kind = 8 ) p46_fun real ( kind = 8 ) x if ( x <= 0.0D+00 ) then p46_fun = 0.0D+00 else p46_fun = sqrt ( - log ( x ) ) end if return end subroutine p46_lim ( a, b ) ! !*****************************************************************************80 ! !! P46_LIM returns the integration limits for problem 46. ! ! ! Modified: ! ! 21 November 1999 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = 8 ) A, B, the lower and upper limits of integration. ! Note that if A = -R8_HUGE(), the lower limit is ! actually negative infinity, and if B = R8_HUGE(B), the upper limit ! is actually infinity. ! implicit none real ( kind = 8 ) a real ( kind = 8 ) b a = 0.0D+