#*****************************************************************************80 # ## graddsc_test tests graddsc. # # Licensing: # # Copyright 2016 James P. Howard, II # # The computer code and data files on this web page are distributed under # https://opensource.org/licenses/BSD-2-Clause, the BSD-2-Clause license. # # Modified: # # 14 March 2020 # # Author: # # John Burkardt # cat ( date ( ), "\n" ) cat ( "\n" ) cat ( "graddsc_test\n" ) cat ( " ", version$version.string, "\n" ) cat ( " graddsc seeks the minimum of a function using gradient descent.\n" ) cat ( "\n" ) source ( "/home/burkardt/public_html/r_src/graddsc/graddsc.R" ) fp <- function ( x ) { x^3 + 3*x^2 - 1 } x = - 2.0 h = 0.01 value <- graddsc ( fp, x, h ) cat ( " graddsc(x^3+3x^2-1,-2.0,0.01) = ", value, "\n" ) # # Terminate. # cat ( "\n" ) cat ( "graddsc_test\n" ) cat ( " Normal end of execution.\n" ) cat ( date ( ), "\n" ) quit ( )