fsolve_test01 <- function ( ) #*****************************************************************************80 # ## fsolve_test01 tests fsolve() on 1 equation. # # Licensing: # # This code is distributed under the MIT license. # # Modified: # # 10 April 2021 # # Author: # # John Burkardt # { source ( "/home/burkardt/public_html/r_src/fsolve_test/f1.R" ) cat ( "\n" ) cat ( "fsolve_test01\n" ) cat ( " Use fsolve() to solve 1 nonlinear equation.\n" ) x0 <- c ( 0.0 ) cat ( "\n" ) cat ( "The initial vector x0:\n" ) cat ( "\n" ) print ( x0 ) fx0 <- f1 ( x0 ) cat ( "\n" ) cat ( "The function value f(x0):\n" ) cat ( "\n" ) print ( fx0 ) x <- fsolve ( f1, x0 ) cat ( "\n" ) cat ( "The final vector x:\n" ) cat ( "\n" ) print ( x ) fx <- f1 ( x ) cat ( "\n" ) cat ( "The function value f(x):\n" ) cat ( "\n" ) print ( fx ) }