#glomin_test <- function ( ) #*****************************************************************************80 # ## glomin_test() tests glomin(). # # Licensing: # # This code is distributed under the MIT license. # # Modified: # # 13 June 2021 # # Author: # # John Burkardt # cat ( date ( ), "\n" ) cat ( "\n" ) cat ( "glomin_test():\n" ) cat ( " ", version$version.string, "\n" ) cat ( " glomin() seeks a global minimizer of a\n" ) cat ( " function F(X) in an interval [A,B],\n" ) cat ( " given some upper bound M for the second derivative of F.\n" ) source ( "/home/burkardt/public_html/r_src/glomin_test/glomin_example.R" ) source ( "/home/burkardt/public_html/r_src/glomin_test/h_01.R" ) source ( "/home/burkardt/public_html/r_src/glomin_test/h_02.R" ) source ( "/home/burkardt/public_html/r_src/glomin_test/h_03.R" ) source ( "/home/burkardt/public_html/r_src/glomin_test/h_04.R" ) source ( "/home/burkardt/public_html/r_src/glomin_test/h_05.R" ) eps = .Machine$double.eps e = sqrt ( eps ) t = sqrt ( eps ) cat ( "\n" ) cat ( " Tolerances:\n" ) cat ( " e = ", e, "\n" ) cat ( " t = ", t, "\n" ) a = 7.0 b = 9.0 c = ( a + b ) / 2.0 m = 0.0 glomin_example ( a, b, c, m, e, t, h_01, "h_01(x) = 2 - x" ) a = 7.0 b = 9.0 c = ( a + b ) / 2.0 m = 100.0 glomin_example ( a, b, c, m, e, t, h_01, "h_01(x) = 2 - x" ) a = -1.0 b = +2.0 c = ( a + b ) / 2.0 m = 2.0 glomin_example ( a, b, c, m, e, t, h_02, "h_02(x) = x * x" ) a = -1.0 b = +2.0 c = ( a + b ) / 2.0 m = 2.1 glomin_example ( a, b, c, m, e, t, h_02, "h_02(x) = x * x" ) a = -0.5 b = +2.0 c = ( a + b ) / 2.0 m = 14.0 glomin_example ( a, b, c, m, e, t, h_03, "h_03(x) = x^3 + x^2" ) a = -0.5 b = +2.0 c = ( a + b ) / 2.0 m = 28.0 glomin_example ( a, b, c, m, e, t, h_03, "h_03(x) = x^3 + x^2" ) a = -10.0 b = +10.0 c = ( a + b ) / 2.0 m = 72.0 glomin_example ( a, b, c, m, e, t, h_04, "h_04(x) = ( x + sin(x) ) * exp(-x*x)" ) a = -10.0 b = +10.0 c = ( a + b ) / 2.0 m = 72.0 glomin_example ( a, b, c, m, e, t, h_05, "h_05(x) = ( x - sin(x) ) * exp(-x*x)" ) # # Terminate. # cat ( "\n" ) cat ( "glomin_test():\n" ) cat ( " Normal end of execution.\n" ) cat ( "\n" ) cat ( date ( ), "\n" ) quit ( )