function line01_length ( ) !*****************************************************************************80 ! !! line01_length(): length of the unit line in 1D. ! ! Licensing: ! ! This code is distributed under the MIT license. ! ! Modified: ! ! 16 January 2014 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Output, real ( kind = rk ) LINE01_LENGTH, the length. ! implicit none integer, parameter :: rk = kind ( 1.0D+00 ) real ( kind = rk ) line01_length line01_length = 1.0D+00 return end subroutine line01_monomial_integral ( e, integral ) !*****************************************************************************80 ! !! LINE01_MONOMIAL_INTEGRAL: monomial integral over the unit line in 1D. ! ! Discussion: ! ! The integration region is ! ! 0 <= X <= 1. ! ! The monomial is F(X) = X^E. ! ! Licensing: ! ! This code is distributed under the MIT license. ! ! Modified: ! ! 16 January 2014 ! ! Author: ! ! John Burkardt ! ! Reference: ! ! Philip Davis, Philip Rabinowitz, ! Methods of Numerical Integration, ! Second Edition, ! Academic Press, 1984, page 263. ! ! Parameters: ! ! Input, integer E, the exponent. ! E must not equal -1. ! ! Output, real ( kind = rk ) INTEGRAL, the integral. ! implicit none integer, parameter :: rk = kind ( 1.0D+00 ) integer e real ( kind = rk ) integral if ( e == -1 ) then write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'LINE01_MONOMIAL_INTEGRAL - Fatal error!' write ( *, '(a)' ) ' Exponent E = -1 is not allowed!' stop 1 end if integral = 1.0D+00 / real ( e + 1, kind = rk ) return end subroutine line01_sample_ergodic ( n, shift, x ) !*****************************************************************************80 ! !! LINE01_SAMPLE_ERGODIC samples the unit line in 1D. ! ! Licensing: ! ! This code is distributed under the MIT license. ! ! Modified: ! ! 07 June 2017 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Input, integer N, the number of points. ! ! Input/output, real ( kind = rk ) SHIFT, a value between 0 and 1. ! ! Output, real ( kind = rk ) X(N), the points. ! implicit none integer, parameter :: rk = kind ( 1.0D+00 ) integer n real ( kind = rk ) golden integer j real ( kind = rk ) shift real ( kind = rk ) x(n) golden = ( 1.0D+00 + sqrt ( 5.0D+00 ) ) / 2.0D+00 shift = mod ( shift, 1.0D+00 ) do j = 1, n x(j) = shift shift = mod ( shift + golden, 1.0D+00 ) end do return end subroutine line01_sample_random ( n, x ) !*****************************************************************************80 ! !! LINE01_SAMPLE_RANDOM samples the unit line in 1D. ! ! Licensing: ! ! This code is distributed under the MIT license. ! ! Modified: ! ! 16 January 2014 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Input, integer N, the number of points. ! ! Output, real ( kind = rk ) X(N), the points. ! implicit none integer, parameter :: rk = kind ( 1.0D+00 ) integer n real ( kind = rk ) x(n) call random_number ( harvest = x(1:n) ) return end subroutine monomial_value_1d ( n, e, x, value ) !*****************************************************************************80 ! !! MONOMIAL_VALUE_1D evaluates a monomial in 1D. ! ! Discussion: ! ! This routine evaluates a monomial of the form ! ! x^e ! ! Licensing: ! ! This code is distributed under the MIT license. ! ! Modified: ! ! 16 January 2014 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Input, integer N, the number of points. ! ! Input, integer E, the exponent. ! ! Input, real ( kind = rk ) X(N), the point coordinates. ! ! Output, real ( kind = rk ) VALUE(N), the value of the monomial. ! implicit none integer, parameter :: rk = kind ( 1.0D+00 ) integer n integer e real ( kind = rk ) value(n) real ( kind = rk ) x(n) value(1:n) = x(1:n) ** e return end