#*****************************************************************************80 # ## newton_test tests newton. # # 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: # # 13 March 2020 # # Author: # # John Burkardt # cat ( date ( ), "\n" ) cat ( "\n" ) cat ( "newton_test\n" ) cat ( " ", version$version.string, "\n" ) cat ( " newton seeks the root of an equation using the newton method.\n" ) cat ( "\n" ) source ( "/home/burkardt/public_html/r_src/newton/newton.R" ) f <- function ( x ) { x^2 - 1.0 } fp <- function ( x ) {2*x} x <- 1.25 value <- newton ( f, fp, x, tol = 1.0e-3 ) cat ( " newton(x^2-1, 2*x, x, 1.0-3) = ", value, "\n" ) # # Terminate. # cat ( "\n" ) cat ( "newton_test\n" ) cat ( " Normal end of execution.\n" ) cat ( date ( ), "\n" ) quit ( )