glomin_example <- function ( a, b, c, m, e, t, f, title ) #*****************************************************************************80 # ## glomin_example() tests glomin() on one test function. # # Licensing: # # This code is distributed under the MIT license. # # Modified: # # 13 June 2021 # # Author: # # John Burkardt # # Input: # # real A, B, the endpoints of the interval. # # real C, an initial guess for the global # minimizer. If no good guess is known, C = A or B is acceptable. # # real M, the bound on the second derivative. # # real E, a positive tolerance, a bound for the # absolute error in the evaluation of F(X) for any X in [A,B]. # # real T, a positive absolute error tolerance. # # function value = F ( X ), the name of a user-supplied # function whose global minimum is being sought. # # string TITLE, a title for the problem. # { source ( "/home/burkardt/public_html/r_src/glomin/glomin.R" ) output = glomin ( a, b, c, m, e, t, f ) x = output[1] fx = output[2] calls = output[3] fa = f ( a ) fb = f ( b ) cat ( "\n" ) cat ( " ", title, "\n" ) cat ( " M = ", m, "\n" ) cat ( "\n" ) cat ( " A X B\n" ) cat ( " F(A) F(X) F(B)\n" ) cat ( "\n" ) cat ( " ", a, " ", x, " ", b, "\n" ) cat ( " ", fa, " ", fx, " ", fb, "\n" ) cat ( " Number of calls to F = ", calls, "\n" ) return }