program main c*********************************************************************72 c cc humps_test() tests humps(). c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 06 August 2019 c c Author: c c John Burkardt c implicit none call timestamp ( ) write ( *, '(a)' ) '' write ( *, '(a)' ) 'humps_test():' write ( *, '(a)' ) ' Fortran77 version' write ( *, '(a)' ) ' Test humps().' call humps_antideriv_test ( ) call humps_deriv_test ( ) call humps_deriv2_test ( ) call humps_fun_test ( ) c c Terminate. c write ( *, '(a)' ) '' write ( *, '(a)' ) 'humps_test():' write ( *, '(a)' ) ' Normal end of execution.' write ( *, '(a)' ) '' call timestamp ( ) stop 0 end subroutine humps_antideriv_test ( ) c*********************************************************************72 c cc humps_antideriv_test tests humps_antideriv. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 06 August 2019 c c Author: c c John Burkardt c implicit none double precision a double precision b double precision humps_antideriv integer i integer n double precision, allocatable :: x(:) double precision, allocatable :: y(:) write ( *, '(a)' ) '' write ( *, '(a)' ) 'humps_antideriv_test():' write ( *, '(a)' ) ' Test humps_antideriv().' a = -0.5D+00 b = 2.0D+00 n = 101 allocate ( x(1:n) ) allocate ( y(1:n) ) do i = 1, n x(i) = ( ( n - i ) * a + i * b ) / ( n - 1 ) y(i) = humps_antideriv ( x(i) ) end do call plot_xy ( n, x, y, 'humps_antideriv' ) deallocate ( x ) deallocate ( y ) return end subroutine humps_fun_test ( ) c*********************************************************************72 c cc humps_fun_test tests humps_fun. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 06 August 2019 c c Author: c c John Burkardt c implicit none integer, parameter :: rk = kind ( 1.0D+00 ) double precision a double precision b double precision humps_fun integer i integer n double precision, allocatable :: x(:) double precision, allocatable :: y(:) write ( *, '(a)' ) '' write ( *, '(a)' ) 'humps_fun_test():' write ( *, '(a)' ) ' Test humps_fun().' a = -0.5D+00 b = 2.0D+00 n = 101 allocate ( x(1:n) ) allocate ( y(1:n) ) do i = 1, n x(i) = ( ( n - i ) * a + i * b ) / ( n - 1 ) y(i) = humps_fun ( x(i) ) end do call plot_xy ( n, x, y, 'humps_fun' ) deallocate ( x ) deallocate ( y ) return end subroutine humps_deriv_test ( ) c*********************************************************************72 c cc humps_deriv_test tests humps_deriv. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 06 August 2019 c c Author: c c John Burkardt c implicit none integer, parameter :: rk = kind ( 1.0D+00 ) double precision a double precision b double precision humps_deriv integer i integer n double precision, allocatable :: x(:) double precision, allocatable :: y(:) write ( *, '(a)' ) '' write ( *, '(a)' ) 'humps_deriv_test():' write ( *, '(a)' ) ' Test humps_deriv().' a = -0.5D+00 b = 2.0D+00 n = 101 allocate ( x(1:n) ) allocate ( y(1:n) ) do i = 1, n x(i) = ( ( n - i ) * a + i * b ) / ( n - 1 ) y(i) = humps_deriv ( x(i) ) end do call plot_xy ( n, x, y, 'humps_deriv' ) deallocate ( x ) deallocate ( y ) return end subroutine humps_deriv2_test ( ) c*********************************************************************72 c cc humps_deriv2_test tests humps_deriv2. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 06 August 2019 c c Author: c c John Burkardt c implicit none integer, parameter :: rk = kind ( 1.0D+00 ) double precision a double precision b double precision humps_deriv2 integer i integer n double precision, allocatable :: x(:) double precision, allocatable :: y(:) write ( *, '(a)' ) '' write ( *, '(a)' ) 'humps_deriv2_test():' write ( *, '(a)' ) ' Test humps_deriv2().' a = -0.5D+00 b = 2.0D+00 n = 101 allocate ( x(1:n) ) allocate ( y(1:n) ) do i = 1, n x(i) = ( ( n - i ) * a + i * b ) / ( n - 1 ) y(i) = humps_deriv2 ( x(i) ) end do call plot_xy ( n, x, y, 'humps_deriv2' ) deallocate ( x ) deallocate ( y ) return end subroutine timestamp ( ) c*********************************************************************72 c cc timestamp() prints the YMDHMS date as a timestamp. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 12 June 2014 c c Author: c c John Burkardt c implicit none character * ( 8 ) ampm integer d character * ( 8 ) date integer h integer m integer mm character * ( 9 ) month(12) integer n integer s character * ( 10 ) time integer y save month data month / & 'January ', 'February ', 'March ', 'April ', & 'May ', 'June ', 'July ', 'August ', & 'September', 'October ', 'November ', 'December ' / call date_and_time ( date, time ) read ( date, '(i4,i2,i2)' ) y, m, d read ( time, '(i2,i2,i2,1x,i3)' ) h, n, s, mm if ( h .lt. 12 ) then ampm = 'AM' else if ( h .eq. 12 ) then if ( n .eq. 0 .and. s .eq. 0 ) then ampm = 'Noon' else ampm = 'PM' end if else h = h - 12 if ( h .lt. 12 ) then ampm = 'PM' else if ( h .eq. 12 ) then if ( n .eq. 0 .and. s .eq. 0 ) then ampm = 'Midnight' else ampm = 'AM' end if end if end if write ( *, & '(i2,1x,a,1x,i4,2x,i2,a1,i2.2,a1,i2.2,a1,i3.3,1x,a)' ) & d, trim ( month(m) ), y, h, ':', n, ':', s, '.', mm, & trim ( ampm ) return end