18 April 2008 07:55:10 AM BRENT_PRB C++ version Tests for the Richard Brent routines. TEST_ZERO_ALL Test the Brent ZERO routine, which seeks a root of a function F(X) in an interval [A,B]. f_01(x) = sin ( x ) - x / 2 A Z B F(A) F(Z) F(B) 1 1.89549 2 0.341471 0 -0.0907026 f_02(x) = 2 * x - exp ( - x ) A Z B F(A) F(Z) F(B) 0 0.351734 1 -1 2.22045e-16 1.63212 f_03(x) = x * exp ( - x ) A Z B F(A) F(Z) F(B) -1 1.09766e-22 0.5 -2.71828 1.09766e-22 0.303265 f_04(x) = exp ( x ) - 1 / ( 100 * x * x ) A Z B F(A) F(Z) F(B) 0.0001 0.0953446 20 -999999 4.44089e-16 4.85165e+08 f_05(x) = (x+3) * (x-1) * (x-1) A Z B F(A) F(Z) F(B) -5 -3 2 -72 0 5 TEST_LOCALM_ALL Test the Brent LOCALM routine, which seeks a local minimizer of a function F(X) in an interval [A,B]. g_01(x) = ( x - 2 ) * ( x - 2 ) + 1 A X B F(A) F(X) F(B) 0 2 3.14159 5 1 2.30323 g_02(x) = x * x + exp ( - x ) A X B F(A) F(X) F(B) 0 0.351734 1 1 0.827184 1.36788 g_03(x) = x^4 + 2x^2 + x + 3 A X B F(A) F(X) F(B) -2 -0.236733 2 25 2.87849 29 g_04(x) = exp ( x ) + 1 / ( 100 x ) A X B F(A) F(X) F(B) 0.0001 0.0953446 1 101 1.20492 2.72828 g_05(x) = exp ( x ) - 2x + 1/(100x) - 1/(1000000x^2) A X B F(A) F(X) F(B) 0.0002 0.703205 2 25.9998 0.628026 3.39406 TEST_LOCAL_MIN_RC_ALL Test the reverse communication version of the Brent LOCALM routine, which seeks a local minimizer of a function F(X) in an interval [A,B]. Step X F(X) 0 0 5 0 3.141592653589793 2.303233786730186 1 1.199981614864327 1.640029416555091 2 1.941611038725466 1.003409270798719 3 2.399963229728653 1.159970585134975 4 2 1 5 2.000000029802322 1.000000000000001 6 1.999999970197678 1.000000000000001 7 1.999999970197678 1.000000000000001 Step X F(X) 0 0 1 0 1 1.367879441171442 1 0.3819660112501051 0.8284162845035989 2 0.6180339887498948 0.9209690939741497 3 0.2360679774997897 0.8454550784427712 4 0.3528496811495104 0.8271857093986708 5 0.3518917166104074 0.8271840598740323 6 0.3517320418182495 0.8271840261312916 7 0.3517337036958197 0.8271840261275244 8 0.3517337112615478 0.8271840261275243 9 0.3517337165027886 0.8271840261275244 10 0.3517337165027886 0.8271840261275244 Step X F(X) 0 -2 25 0 2 29 1 -0.4721359549995796 3.02337868524942 2 0.4721359549995792 3.967650595248578 3 -1.055728090000841 5.415643516089551 4 -0.1498138939889126 2.895578253916099 5 -0.2226817817160358 2.878951458114974 6 -0.2318072413850192 2.878549359863836 7 -0.237056101926344 2.878493033943844 8 -0.2367455245027443 2.878492790245848 9 -0.2367325704732761 2.878492789873986 10 -0.2367329046684402 2.878492789873726 11 -0.2367329011408449 2.878492789873726 12 -0.2367328976132497 2.878492789873726 13 -0.2367327726568989 2.878492789873766 14 -0.2367328498841708 2.878492789873733 15 -0.2367328793823638 2.878492789873727 16 -0.236732890649671 2.878492789873726 17 -0.236732890649671 2.878492789873726 Step X F(X) 0 0.0001 101.0001000050002 0 1 2.728281828459045 1 0.3820278146489801 1.491428944564399 2 0.6180721853510198 1.871527165190991 3 0.2361443707020397 1.308704097842649 4 0.1459834439469404 1.225677948134214 5 0.09026092675509928 1.205249730835979 6 0.06987608932080662 1.215485764492621 7 0.1020637327872526 1.205432046585031 8 0.09568202682193082 1.20492194401373 9 0.09551304332896546 1.204920914847202 10 0.09535723006160622 1.20492057445533 11 0.09534430133398021 1.204920572533846 12 0.09534460687029817 1.204920572532641 13 0.09534461723542657 1.20492057253264 14 0.09534461865617216 1.20492057253264 15 0.09534462007691777 1.20492057253264 16 0.09534462007691777 1.20492057253264 Step X F(X) 0 0.0002 25.99980002000133 0 2 3.39405584893065 1 0.7640556292979601 0.6319409659880333 2 1.23614437070204 0.9781158267720461 3 0.4722887414040793 0.680251882055913 4 0.6885274466075678 0.6282485878721349 5 0.7016460077946312 0.628028243845387 6 0.7030662791367996 0.6280257405372534 7 0.703208406706925 0.6280257206060759 8 0.7032048702467216 0.6280257205928642 9 0.7032048403471922 0.628025720592863 10 0.7032048298686234 0.628025720592863 11 0.7032048193900549 0.6280257205928637 12 0.7032048193900549 0.6280257205928637 TEST_GLOMIN_ALL Test the Brent GLOMIN routine, which seeks a global minimizer of a function F(X) in an interval [A,B], given some upper bound M for the second derivative of F. h_01(x) = 2 - x A X B F(A) F(X) F(B) 7 9 9 -5 -7 -7 h_01(x) = 2 - x A X B F(A) F(X) F(B) 7 9 9 -5 -7 -7 h_02(x) = x * x A X B F(A) F(X) F(B) -1 0 2 1 0 4 h_02(x) = x * x A X B F(A) F(X) F(B) -1 0 2 1 0 4 h_03(x) = x^3 + x^2 A X B F(A) F(X) F(B) -0.5 3.052184743027888e-09 2 0.125 9.315831734005855e-18 12 h_03(x) = x^3 + x^2 A X B F(A) F(X) F(B) -0.5 6.222617577075317e-09 2 0.125 3.872096975147248e-17 12 h_04(x) = ( x + sin(x) ) * exp(-x*x) A X B F(A) F(X) F(B) -10 -0.6795786584323555 10 -3.517695989514065e-43 -0.8242393984760767 3.517695989514065e-43 h_05(x) = ( x - sin(x) ) * exp(-x*x) A X B F(A) F(X) F(B) -10 -1.195136635808082 10 -3.922455962527607e-43 -0.06349052893643989 3.922455962527607e-43 BRENT_PRB Normal end of execution. 18 April 2008 07:55:10 AM