r8_agm_test <- function ( ) #*****************************************************************************80 # ## r8_agm_test() tests r8_agm(). # # Licensing: # # This code is distributed under the MIT license. # # Modified: # # 12 May 2021 # # Author: # # John Burkardt # { n_max = 14; a_vec = c ( 22.0, 83.0, 42.0, 26.0, 4.0, 6.0, 40.0, 80.0, 90.0, 9.0, 53.0, 1.0, 1.0, 1.0, 1.5 ) b_vec = c ( 96.0, 56.0, 7.0, 11.0, 63.0, 45.0, 75.0, 0.0, 35.0, 1.0, 53.0, 2.0, 4.0, 8.0, 8.0 ) fx_vec = c ( 52.274641198704240049, 68.836530059858524345, 20.659301196734009322, 17.696854873743648823, 23.867049721753300163, 20.717015982805991662, 56.127842255616681863, 0.000000000000000000, 59.269565081229636528, 3.9362355036495554780, 53.000000000000000000, 1.4567910310469068692, 2.2430285802876025701, 3.6157561775973627487, 4.0816924080221632670 ) source ( "/home/john/public_html/r_src/r8lib/r8_agm.R" ) cat ( '\n' ) cat ( 'r8_agm_test():\n' ) cat ( ' r8_agm() computes arithmetic-geometric mean of two numbers.\n' ) cat ( '\n' ) cat ( ' A B agm(a,b) r8_agm(a,b)\n' ) cat ( '\n' ) for ( i in 1 : 14 ) { a = a_vec[i] b = b_vec[i] fx1 = fx_vec[i] fx2 = r8_agm ( a, b ) cat ( ' ', a, ' ', b, ' ', fx1, ' ', fx2, '\n' ); } }