f4 <- function ( x ) #*****************************************************************************80 # ## f4() evaluates a nonlinear system of 4 equations. # # Licensing: # # This code is distributed under the MIT license. # # Modified: # # 09 April 2021 # # Author: # # John Burkardt # # Input: # # double X[N], the variable values. # # Output: # # double FX[N], the function values. # { n <- length ( x ) fx <- c ( 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ) for ( i in 1 : n ) { fx[i] = ( 3.0 - 2.0 * x[i] ) * x[i] + 1.0 if ( 1 < i ) { fx[i] = fx[i] - x[i-1] } if ( i < n ) { fx[i] = fx[i] - 2.0 * x[i+1] } } return ( fx ) }