subroutine p01_polynomial_value ( m, n, x, v ) !*****************************************************************************80 ! !! p01_polynomial_value*() evaluates the shifted Legendre polynomials P01(n,x). ! ! Discussion: ! ! The shifted Legendre polynomial P01(n,x) has the domain [0,1], and ! is related to the standard Legendre polynomial P(n,x) by ! P01(n,x) = P(n,2*x-1). ! ! Licensing: ! ! This code is distributed under the MIT license. ! ! Modified: ! ! 15 March 2016 ! ! Author: ! ! John Burkardt ! ! Reference: ! ! Milton Abramowitz, Irene Stegun, ! Handbook of Mathematical Functions, ! National Bureau of Standards, 1964, ! ISBN: 0-486-61272-4, ! LC: QA47.A34. ! ! Daniel Zwillinger, editor, ! CRC Standard Mathematical Tables and Formulae, ! 30th Edition, ! CRC Press, 1996. ! ! Parameters: ! ! Input, integer M, the number of evaluation points. ! ! Input, integer N, the highest order polynomial to evaluate. ! Note that polynomials 0 through N will be evaluated. ! ! Input, real ( kind = rk ) X(M), the evaluation points. ! ! Output, real ( kind = rk ) V(M,0:N), the values of the shifted Legendre ! polynomials of order 0 through N at the points X. ! implicit none integer, parameter :: rk = kind ( 1.0D+00 ) integer m integer n integer i real ( kind = rk ) v(m,0:n) real ( kind = rk ) x(m) if ( n < 0 ) then return end if v(1:m,0) = 1.0D+00 if ( n < 1 ) then return end if v(1:m,1) = 2.0D+00 * x(1:m) - 1.0D+00 do i = 2, n v(1:m,i) = ( real ( 2 * i - 1, kind = rk ) & * ( 2.0D+00 * x(1:m) - 1.0D+00 ) * v(1:m,i-1) & - real ( i - 1, kind = rk ) & * v(1:m,i-2) ) & / real ( i, kind = rk ) end do return end subroutine p01_polynomial_values ( n_data, n, x, fx ) !*****************************************************************************80 ! !! P01_POLYNOMIAL_VALUES: the shifted Legendre polynomials. ! ! Discussion: ! ! If we denote the Legendre polynomial by P(n)(x), and the shifted ! Legendre polynomial by P01(n)(x), then ! ! P01(n)(x) = P(n)(2*x-1) ! ! Licensing: ! ! This code is distributed under the MIT license. ! ! Modified: ! ! 14 March 2016 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Input/output, integer N_DATA. The user sets N_DATA to 0 ! before the first call. On each call, the routine increments N_DATA by 1, ! and returns the corresponding data; when there is no more data, the ! output value of N_DATA will be 0 again. ! ! Output, integer N, the order of the function. ! ! Output, real ( kind = rk ) X, the point where the function is evaluated. ! ! Output, real ( kind = rk ) FX, the value of the function. ! implicit none integer, parameter :: rk = kind ( 1.0D+00 ) integer, parameter :: n_max = 22 real ( kind = rk ) fx real ( kind = rk ), save, dimension ( n_max ) :: fx_vec = (/ & 0.1000000000000000D+01, & 0.2500000000000000D+00, & -0.4062500000000000D+00, & -0.3359375000000000D+00, & 0.1577148437500000D+00, & 0.3397216796875000D+00, & 0.2427673339843750D-01, & -0.2799186706542969D+00, & -0.1524540185928345D+00, & 0.1768244206905365D+00, & 0.2212002165615559D+00, & 0.0000000000000000D+00, & -0.1475000000000000D+00, & -0.2800000000000000D+00, & -0.3825000000000000D+00, & -0.4400000000000000D+00, & -0.4375000000000000D+00, & -0.3600000000000000D+00, & -0.1925000000000000D+00, & 0.8000000000000000D-01, & 0.4725000000000000D+00, & 0.1000000000000000D+01 /) integer n integer n_data integer, save, dimension ( n_max ) :: n_vec = (/ & 0, 1, 2, & 3, 4, 5, & 6, 7, 8, & 9, 10, 3, & 3, 3, 3, & 3, 3, 3, & 3, 3, 3, & 3 /) real ( kind = rk ) x real ( kind = rk ), save, dimension ( n_max ) :: x_vec = (/ & 0.625D+00, & 0.625D+00, & 0.625D+00, & 0.625D+00, & 0.625D+00, & 0.625D+00, & 0.625D+00, & 0.625D+00, & 0.625D+00, & 0.625D+00, & 0.625D+00, & 0.50D+00, & 0.55D+00, & 0.60D+00, & 0.65D+00, & 0.70D+00, & 0.75D+00, & 0.80D+00, & 0.85D+00, & 0.90D+00, & 0.95D+00, & 1.00D+00 /) if ( n_data < 0 ) then n_data = 0 end if n_data = n_data + 1 if ( n_max < n_data ) then n_data = 0 n = 0 x = 0.0D+00 fx = 0.0D+00 else n = n_vec(n_data) x = x_vec(n_data) fx = fx_vec(n_data) end if return end subroutine timestamp ( ) !*****************************************************************************80 ! !! TIMESTAMP prints the current YMDHMS date as a time stamp. ! ! Example: ! ! 31 May 2001 9:45:54.872 AM ! ! Licensing: ! ! This code is distributed under the MIT license. ! ! Modified: ! ! 18 May 2013 ! ! Author: ! ! John Burkardt ! implicit none character ( len = 8 ) ampm integer d integer h integer m integer mm character ( len = 9 ), parameter, dimension(12) :: month = (/ & 'January ', 'February ', 'March ', 'April ', & 'May ', 'June ', 'July ', 'August ', & 'September', 'October ', 'November ', 'December ' /) integer n integer s integer values(8) integer y call date_and_time ( values = values ) y = values(1) m = values(2) d = values(3) h = values(5) n = values(6) s = values(7) mm = values(8) if ( h < 12 ) then ampm = 'AM' else if ( h == 12 ) then if ( n == 0 .and. s == 0 ) then ampm = 'Noon' else ampm = 'PM' end if else h = h - 12 if ( h < 12 ) then ampm = 'PM' else if ( h == 12 ) then if ( n == 0 .and. s == 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