test_simeq_newton5.py3 running test case 1, n= 2 , nlin= 2 equation X[0] + X[1] + X[0]*X[0] + X[1]*X[1] = Y var1[ 0 ]= 0 var1[ 1 ]= 1 var1[ 2 ]= 0 var1[ 3 ]= 1 var2[ 0 ]= -1 var2[ 1 ]= -1 var2[ 2 ]= 0 var2[ 3 ]= 1 var3[ 0 ]= -1 var3[ 1 ]= -1 var3[ 2 ]= -1 var3[ 3 ]= -1 vari1[ 0 ]= -1 vari1[ 1 ]= -1 vari1[ 2 ]= -1 vari1[ 3 ]= -1 vari2[ 0 ]= -1 vari2[ 1 ]= -1 vari2[ 2 ]= -1 vari2[ 3 ]= -1 A[ 0 ][ 0 ]= 1.0 A[ 0 ][ 1 ]= 2.0 A[ 0 ][ 2 ]= 1.0 A[ 0 ][ 3 ]= 0.0 A[ 1 ][ 0 ]= 1.0 A[ 1 ][ 1 ]= 1.0 A[ 1 ][ 2 ]= 0.0 A[ 1 ][ 3 ]= 1.0 X_soln should be X_soln[ 0 ]= 1.0 X_soln[ 1 ]= 2.0 X_soln[ 2 ]= 1.0 X_soln[ 3 ]= 4.0 Y[ 0 ]= 6.0 Y[ 1 ]= 7.0 solve system of equations A X = Y for X the equations are for Y[i]=0, 1 A[ 0 ][ 0 ]= 1.0 eqn X0 + A[ 1 ][ 0 ]= 2.0 eqn X1 + A[ 2 ][ 0 ]= 1.0 eqn X0 * X0 + = Y[ 0 ] A[ 0 ][ 1 ]= 1.0 eqn X0 + A[ 1 ][ 1 ]= 1.0 eqn X1 + A[ 3 ][ 1 ]= 1.0 eqn X1 * X1 = Y[ 1 ] simeq_newton5.py running n= 2 , nlin= 2 initial guess at solution, can be bad X[ 0 ]= 0.5 X[ 1 ]= 0.5 X[ 2 ]= 0.25 X[ 3 ]= 0.25 residual X_resid[ 0 ]= -4.25 residual X_resid[ 1 ]= -5.75 simeq_newton5 itr 0 , initial residual= 10.0 itr= 1 compute jacobian end jacobian Ja computed Ja[ 0 ][ 0 ]= 2.0 Ja[ 0 ][ 1 ]= 2.0 Ja[ 1 ][ 0 ]= 1.0 Ja[ 1 ][ 1 ]= 2.0 inverse Ja computed Ja[ 0 ][ 0 ]= 1.0 Ja[ 0 ][ 1 ]= -1.0 Ja[ 1 ][ 0 ]= -0.5 Ja[ 1 ][ 1 ]= 1.0 change X_tmp2[ 0 ]= 1.5 change X_tmp2[ 1 ]= -3.625 X_next[ 0 ]= -1.0 X_next[ 1 ]= 4.125 X_next[ 2 ]= 1.0 X_next[ 3 ]= 17.015625 residual X_resid[ 0 ]= -4.25 residual X_resid[ 1 ]= -5.75 simeq_newton5 itr 1 , prev= 10.0 , residual= 15.390625 b reduced to 0.5 itr= 2 compute jacobian end jacobian Ja computed Ja[ 0 ][ 0 ]= 2.0 Ja[ 0 ][ 1 ]= 2.0 Ja[ 1 ][ 0 ]= 1.0 Ja[ 1 ][ 1 ]= 2.0 inverse Ja computed Ja[ 0 ][ 0 ]= 1.0 Ja[ 0 ][ 1 ]= -1.0 Ja[ 1 ][ 0 ]= -0.5 Ja[ 1 ][ 1 ]= 1.0 change X_tmp2[ 0 ]= 1.5 change X_tmp2[ 1 ]= -3.625 X_next[ 0 ]= -0.25 X_next[ 1 ]= 2.3125 X_next[ 2 ]= 0.0625 X_next[ 3 ]= 5.34765625 residual X_resid[ 0 ]= -4.25 residual X_resid[ 1 ]= -5.75 simeq_newton5 itr 2 , prev= 10.0 , residual= 1.97265625 b increased to 0.70715 itr= 3 compute jacobian end jacobian Ja computed Ja[ 0 ][ 0 ]= 0.5 Ja[ 0 ][ 1 ]= 2.0 Ja[ 1 ][ 0 ]= 1.0 Ja[ 1 ][ 1 ]= 5.625 inverse Ja computed Ja[ 0 ][ 0 ]= 6.923076923076923 Ja[ 0 ][ 1 ]= -2.4615384615384617 Ja[ 1 ][ 0 ]= -1.2307692307692308 Ja[ 1 ][ 1 ]= 0.6153846153846154 change X_tmp2[ 0 ]= -11.826923076923078 change X_tmp2[ 1 ]= 2.175480769230769 X_next[ 0 ]= 8.113408653846154 X_next[ 1 ]= 0.7741087740384618 X_next[ 2 ]= 65.82739998430566 X_next[ 3 ]= 0.5992443940433303 residual X_resid[ 0 ]= -1.5625 residual X_resid[ 1 ]= 0.41015625 simeq_newton5 itr 3 , prev= 1.97265625 , residual= 71.97578800815667 b reduced to 0.353575 itr= 4 compute jacobian end jacobian Ja computed Ja[ 0 ][ 0 ]= 0.5 Ja[ 0 ][ 1 ]= 2.0 Ja[ 1 ][ 0 ]= 1.0 Ja[ 1 ][ 1 ]= 5.625 inverse Ja computed Ja[ 0 ][ 0 ]= 6.923076923076923 Ja[ 0 ][ 1 ]= -2.4615384615384617 Ja[ 1 ][ 0 ]= -1.2307692307692308 Ja[ 1 ][ 1 ]= 0.6153846153846154 change X_tmp2[ 0 ]= -11.826923076923078 change X_tmp2[ 1 ]= 2.175480769230769 X_next[ 0 ]= 3.931704326923077 X_next[ 1 ]= 1.543304387019231 X_next[ 2 ]= 15.458298914345646 X_next[ 3 ]= 2.381788430992804 residual X_resid[ 0 ]= -1.5625 residual X_resid[ 1 ]= 0.41015625 simeq_newton5 itr 4 , prev= 1.97265625 , residual= 17.333409160242294 b reduced to 0.1767875 itr= 5 compute jacobian end jacobian Ja computed Ja[ 0 ][ 0 ]= 0.5 Ja[ 0 ][ 1 ]= 2.0 Ja[ 1 ][ 0 ]= 1.0 Ja[ 1 ][ 1 ]= 5.625 inverse Ja computed Ja[ 0 ][ 0 ]= 6.923076923076923 Ja[ 0 ][ 1 ]= -2.4615384615384617 Ja[ 1 ][ 0 ]= -1.2307692307692308 Ja[ 1 ][ 1 ]= 0.6153846153846154 change X_tmp2[ 0 ]= -11.826923076923078 change X_tmp2[ 1 ]= 2.175480769230769 X_next[ 0 ]= 1.8408521634615385 X_next[ 1 ]= 1.9279021935096154 X_next[ 2 ]= 3.3887366877210265 X_next[ 3 ]= 3.716806867739187 residual X_resid[ 0 ]= -1.5625 residual X_resid[ 1 ]= 0.41015625 simeq_newton5 itr 5 , prev= 1.97265625 , residual= 3.5709544629121366 b reduced to 0.08839375 itr= 6 compute jacobian end jacobian Ja computed Ja[ 0 ][ 0 ]= 0.5 Ja[ 0 ][ 1 ]= 2.0 Ja[ 1 ][ 0 ]= 1.0 Ja[ 1 ][ 1 ]= 5.625 inverse Ja computed Ja[ 0 ][ 0 ]= 6.923076923076923 Ja[ 0 ][ 1 ]= -2.4615384615384617 Ja[ 1 ][ 0 ]= -1.2307692307692308 Ja[ 1 ][ 1 ]= 0.6153846153846154 change X_tmp2[ 0 ]= -11.826923076923078 change X_tmp2[ 1 ]= 2.175480769230769 X_next[ 0 ]= 0.7954260817307692 X_next[ 1 ]= 2.1202010967548075 X_next[ 2 ]= 0.6327026514975643 X_next[ 3 ]= 4.495252690680289 residual X_resid[ 0 ]= -1.5625 residual X_resid[ 1 ]= 0.41015625 simeq_newton5 itr 6 , prev= 1.97265625 , residual= 0.7423489424279177 b increased to 0.12501528062499997 itr= 7 compute jacobian end jacobian Ja computed Ja[ 0 ][ 0 ]= 2.5908521634615385 Ja[ 0 ][ 1 ]= 2.0 Ja[ 1 ][ 0 ]= 1.0 Ja[ 1 ][ 1 ]= 5.240402193509615 inverse Ja computed Ja[ 0 ][ 0 ]= 0.45265212028750224 Ja[ 0 ][ 1 ]= -0.17275472514232768 Ja[ 1 ][ 0 ]= -0.08637736257116384 Ja[ 1 ][ 1 ]= 0.22379097669160153 change X_tmp2[ 0 ]= -0.22102161768606587 change X_tmp2[ 1 ]= 0.1205826315458305 X_next[ 0 ]= 0.8230571612899842 X_next[ 1 ]= 2.1051264252336046 X_next[ 2 ]= 0.677423090750727 X_next[ 3 ]= 4.4315572662168154 residual X_resid[ 0 ]= -0.33146907326205177 residual X_resid[ 1 ]= 0.41087986916586594 simeq_newton5 itr 7 , prev= 0.7423489424279177 , residual= 0.6490077502324834 b increased to 0.17680911138793745 itr= 8 compute jacobian end jacobian Ja computed Ja[ 0 ][ 0 ]= 2.6461143225799684 Ja[ 0 ][ 1 ]= 2.0 Ja[ 1 ][ 0 ]= 1.0 Ja[ 1 ][ 1 ]= 5.210252850467209 inverse Ja computed Ja[ 0 ][ 0 ]= 0.4420366623750983 Ja[ 0 ][ 1 ]= -0.16967954341619348 Ja[ 1 ][ 0 ]= -0.08483977170809674 Ja[ 1 ][ 1 ]= 0.22449573504120957 change X_tmp2[ 0 ]= -0.1889072375441423 change X_tmp2[ 1 ]= 0.10530162470624596 X_next[ 0 ]= 0.856457682094914 X_next[ 1 ]= 2.0865081385415873 X_next[ 2 ]= 0.7335197612193928 X_next[ 3 ]= 4.3535162122002795 residual X_resid[ 0 ]= -0.28926689749207934 residual X_resid[ 1 ]= 0.359740852740404 simeq_newton5 itr 8 , prev= 0.6490077502324834 , residual= 0.5334883124393004 b increased to 0.25006112623595994 itr= 9 compute jacobian end jacobian Ja computed Ja[ 0 ][ 0 ]= 2.7129153641898283 Ja[ 0 ][ 1 ]= 2.0 Ja[ 1 ][ 0 ]= 1.0 Ja[ 1 ][ 1 ]= 5.173016277083175 inverse Ja computed Ja[ 0 ][ 0 ]= 0.42986832941350483 Ja[ 0 ][ 1 ]= -0.16619639544451142 Ja[ 1 ][ 0 ]= -0.08309819772225571 Ja[ 1 ][ 1 ]= 0.22543837733719171 change X_tmp2[ 0 ]= -0.15115573864477921 change X_tmp2[ 1 ]= 0.08653322307618234 X_next[ 0 ]= 0.894255856337456 X_next[ 1 ]= 2.0648695433223296 X_next[ 2 ]= 0.7996935365938367 X_next[ 3 ]= 4.263686230940166 residual X_resid[ 0 ]= -0.23700627960251897 residual X_resid[ 1 ]= 0.29648203283678143 simeq_newton5 itr 9 , prev= 0.5334883124393004 , residual= 0.39912315102399987 b increased to 0.35366145083551814 itr= 10 compute jacobian end jacobian Ja computed Ja[ 0 ][ 0 ]= 2.7885117126749117 Ja[ 0 ][ 1 ]= 2.0 Ja[ 1 ][ 0 ]= 1.0 Ja[ 1 ][ 1 ]= 5.129739086644659 inverse Ja computed Ja[ 0 ][ 0 ]= 0.41690493907322435 Ja[ 0 ][ 1 ]= -0.16254430567770656 Ja[ 1 ][ 0 ]= -0.08127215283885328 Ja[ 1 ][ 1 ]= 0.22662835010544793 change X_tmp2[ 0 ]= -0.10972190547308208 change X_tmp2[ 1 ]= 0.06482464906232546 X_next[ 0 ]= 0.9330602646155037 X_next[ 1 ]= 2.0419435638850443 X_next[ 2 ]= 0.8706014574043538 X_next[ 3 ]= 4.169533518091556 residual X_resid[ 0 ]= -0.17631152042404796 residual X_resid[ 1 ]= 0.2228116305999519 simeq_newton5 itr 10 , prev= 0.39912315102399987 , residual= 0.2569884968021574 b increased to 0.5001833899166732 itr= 11 compute jacobian end jacobian Ja computed Ja[ 0 ][ 0 ]= 2.8661205292310075 Ja[ 0 ][ 1 ]= 2.0 Ja[ 1 ][ 0 ]= 1.0 Ja[ 1 ][ 1 ]= 5.0838871277700886 inverse Ja computed Ja[ 0 ][ 0 ]= 0.4044128291224582 Ja[ 0 ][ 1 ]= -0.15909591183226882 Ja[ 1 ][ 0 ]= -0.07954795591613441 Ja[ 1 ][ 1 ]= 0.227994029509596 change X_tmp2[ 0 ]= -0.06847198874440966 change X_tmp2[ 1 ]= 0.041898911203786804 X_next[ 0 ]= 0.9673088160600188 X_next[ 1 ]= 2.0209864244453164 X_next[ 2 ]= 0.9356863456274354 X_next[ 3 ]= 4.084386127792264 residual X_resid[ 0 ]= -0.11245115021005336 residual X_resid[ 1 ]= 0.14453734659210404 simeq_newton5 itr 11 , prev= 0.2569884968021574 , residual= 0.12771335771951264 b increased to 0.7074093683591509 itr= 12 compute jacobian end jacobian Ja computed Ja[ 0 ][ 0 ]= 2.9346176321200375 Ja[ 0 ][ 1 ]= 2.0 Ja[ 1 ][ 0 ]= 1.0 Ja[ 1 ][ 1 ]= 5.041972848890633 inverse Ja computed Ja[ 0 ][ 0 ]= 0.39401918171186934 Ja[ 0 ][ 1 ]= -0.15629563804516083 Ja[ 1 ][ 0 ]= -0.07814781902258042 Ja[ 1 ][ 1 ]= 0.22933396761539016 change X_tmp2[ 0 ]= -0.03304344027206704 change X_tmp2[ 1 ]= 0.02096893651320019 X_next[ 0 ]= 0.9906840552712951 X_next[ 1 ]= 2.0061528023113504 X_next[ 2 ]= 0.9814548973687784 X_next[ 3 ]= 4.024649066221684 residual X_resid[ 0 ]= -0.0550319894219129 residual X_resid[ 1 ]= 0.07268136829759975 simeq_newton5 itr 12 , prev= 0.12771335771951264 , residual= 0.037041366541554765 b increased to 1.0 itr= 13 compute jacobian end jacobian Ja computed Ja[ 0 ][ 0 ]= 2.98136811054259 Ja[ 0 ][ 1 ]= 2.0 Ja[ 1 ][ 0 ]= 1.0 Ja[ 1 ][ 1 ]= 5.012305604622701 inverse Ja computed Ja[ 0 ][ 0 ]= 0.3872441555195191 Ja[ 0 ][ 1 ]= -0.15451737625988937 Ja[ 1 ][ 0 ]= -0.07725868812994469 Ja[ 1 ][ 1 ]= 0.23033658905297238 change X_tmp2[ 0 ]= -0.009343702859273991 change X_tmp2[ 1 ]= 0.0061507875008997796 X_next[ 0 ]= 1.000027758130569 X_next[ 1 ]= 2.0000020148104505 X_next[ 2 ]= 1.0000555170316519 X_next[ 3 ]= 4.000008059245862 residual X_resid[ 0 ]= -0.015555442737225533 residual X_resid[ 1 ]= 0.021485923804329232 simeq_newton5 itr 13 , prev= 0.037041366541554765 , residual= 0.00012513697000304802 itr= 14 compute jacobian end jacobian Ja computed Ja[ 0 ][ 0 ]= 3.000055516261138 Ja[ 0 ][ 1 ]= 2.0 Ja[ 1 ][ 0 ]= 1.0 Ja[ 1 ][ 1 ]= 5.000004029620901 inverse Ja computed Ja[ 0 ][ 0 ]= 0.38460712464033087 Ja[ 0 ][ 1 ]= -0.15384272587055964 Ja[ 1 ][ 0 ]= -0.07692136293527982 Ja[ 1 ][ 1 ]= 0.23076835919231126 change X_tmp2[ 0 ]= 2.775783484848707e-05 change X_tmp2[ 1 ]= 2.014868782676329e-06 X_next[ 0 ]= 1.0000000002957206 X_next[ 1 ]= 1.9999999999416678 X_next[ 2 ]= 1.0000000005914411 X_next[ 3 ]= 3.999999999766671 residual X_resid[ 0 ]= 8.730478312202195e-05 residual X_resid[ 1 ]= 3.7832186881026075e-05 simeq_newton5 itr 14 , prev= 0.00012513697000304802 , residual= 7.745555308247276e-10 converged last residual = 7.745555308247276e-10 simeq_newton5.py finished X_soln computed X_soln[ 0 ]= 1.0000000002957206 X_soln[ 1 ]= 1.9999999999416678 X_soln[ 2 ]= 1.0000000005914411 X_soln[ 3 ]= 3.999999999766671 check A*X_soln=Y error in Y[ 0 ]= 7.70496555446698e-10 error in Y[ 1 ]= 4.058975378029572e-12 test 1 finished test case 1 finished test_simeq_newton5.py3 finished