program main c*********************************************************************72 c cc test_interp_1d_test() tests test_interp_1d(). c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 07 October 2012 c c Author: c c John Burkardt c implicit none integer nd call timestamp ( ) write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'test_interp_1d_test():' write ( *, '(a)' ) ' FORTRAN77 version' write ( *, '(a)' ) ' Test test_interp_1d().' call test01 ( ) nd = 11 call test02 ( nd ) c c Terminate. c write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'test_interp_1d_test():' write ( *, '(a)' ) ' Normal end of execution.' write ( *, '(a)' ) ' ' call timestamp ( ) return; end subroutine test01 ( ) c*********************************************************************72 c cc TEST01 simply prints the title of each function. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 28 August 2012 c c Author: c c John Burkardt c implicit none integer prob integer prob_num character * ( 80 ) title write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'TEST01' write ( *, '(a)' ) ' Print the title of each function.' call p00_prob_num ( prob_num ) write ( *, '(a)' ) ' ' write ( *, '(a,i2,a)' ) & ' There are ', prob_num, ' functions available:' write ( *, '(a)' ) ' Index Title' write ( *, '(a)' ) ' ' do prob = 1, prob_num call p00_title ( prob, title ) write ( *, '(2x,i2,2x,a)' ) prob, trim ( title ) end do return end subroutine test02 ( nd ) c*********************************************************************72 c cc TEST_INTERP_1D_TEST02 evaluates each test function at ND sample points. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 28 August 2012 c c Author: c c John Burkardt c c Parameters: c c Input, integer ND, the number of sample points. c implicit none integer nd double precision a double precision b integer prob integer prob_num character * ( 80 ) title double precision x(nd) double precision y(nd) write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'TEST_INTERP_1D_TEST02' write ( *, '(a)' ) ' Use P00_F to sample each function.' call p00_prob_num ( prob_num ) a = 0.0D+00 b = 1.0D+00 call r8vec_linspace ( nd, a, b, x ) write ( *, '(a)' ) ' ' do prob = 1, prob_num call p00_f ( prob, nd, x, y ) write ( title, '(a,i2)' ) 'X, Y for problem ', prob call r8vec2_print ( nd, x, y, trim ( title ) ) end do return end subroutine r8vec_linspace ( n, a, b, x ) c*********************************************************************72 c cc r8vec_linspace() creates a vector of linearly spaced values. c c Discussion: c c An R8VEC is a vector of R8's. c c 4 points evenly spaced between 0 and 12 will yield 0, 4, 8, 12. c c In other words, the interval is divided into N-1 even subintervals, c and the endpoints of intervals are used as the points. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 14 March 2011 c c Author: c c John Burkardt c c Parameters: c c Input, integer N, the number of entries in the vector. c c Input, double precision A, B, the first and last entries. c c Output, double precision X(N), a vector of linearly spaced data. c implicit none integer n double precision a double precision b integer i double precision x(n) if ( n .eq. 1 ) then x(1) = ( a + b ) / 2.0D+00 else do i = 1, n x(i) = ( dble ( n - i ) * a & + dble ( i - 1 ) * b ) & / dble ( n - 1 ) end do end if return end subroutine r8vec2_print ( n, a1, a2, title ) c*********************************************************************72 c cc r8vec2_print() prints an R8VEC2. c c Discussion: c c An R8VEC2 is a dataset consisting of N pairs of R8s, stored c as two separate vectors A1 and A2. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 06 February 2008 c c Author: c c John Burkardt c c Parameters: c c Input, integer N, the number of components of the vector. c c Input, double precision A1(N), A2(N), the vectors to be printed. c c Input, character * ( * ) TITLE, a title. c implicit none integer n double precision a1(n) double precision a2(n) integer i character * ( * ) title write ( *, '(a)' ) ' ' write ( *, '(a)' ) trim ( title ) write ( *, '(a)' ) ' ' do i = 1, n write ( *, '(2x,i8,a,1x,g14.6,2x,g14.6)' ) i, ':', a1(i), a2(i) end do 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