equation2_nl.c running solve system of nonlinear equations | 5.0000, 4.0000, 3.0000, 2.0000, 1.0000 | | x1 | |205.1488 | | 4.0000, 5.0000, 3.0000, 2.0000, 1.0000 | | x2^2 | |217.6888 | | 3.0000, 3.0000, 3.0000, 2.0000, 1.0000 | | x3^3 | |177.3088 | | 1.0000, 2.0000, 2.0000, 2.0000, 1.0000 | | 1/x4 | |113.5318 | | 2.0000, 3.0000, 1.0000, 1.0000, 2.0000 | |1/x5^2| |100.3626 | A * Xt = Y guess initial X(1,5) compute Xt = | x1 x2^2 x3^3 1/x4 1/x5^2 | compute derivative D = | 1 2*x2 3*x3^2 -1/x4^2 -2/x5^3 | compute the Jacobian Ja = A * D and invert into JI iterate X_next = X - fctr*(A*Xt-Y)*Ja^-1 inverse transpose no guarantee of solution or unique solution sum absolute value A*Xt-Y should go to zero initial fctr, for stability = 0.5 initial guess X(0)= 1.0000000 X(1)= 1.0000000 X(2)= 1.0000000 X(3)= 1.0000000 X(4)= 1.0000000 iteration 1, total error= 755.041 X(0)= 3.0500000 X(1)= 5.1600000 X(2)= 6.8228333 X(3)= 1.2916667 X(4)= 1.1388889 iteration 2, total error= 3507.26 X(0)= 3.9725000 X(1)= 4.7681860 X(2)= 5.9152070 X(3)= 1.5600911 X(4)= 1.2474173 iteration 3, total error= 2125.33 X(0)= 4.4291375 X(1)= 4.5517812 X(2)= 5.2553091 X(3)= 1.7812101 X(4)= 1.3253254 iteration 4, total error= 1354.79 X(0)= 4.6736669 X(1)= 4.4285118 X(2)= 4.7748853 X(3)= 1.9486059 X(4)= 1.3783046 iteration 5, total error= 903.622 X(0)= 4.8135255 X(1)= 4.3554826 X(2)= 4.4251109 X(3)= 2.0688348 X(4)= 1.4134998 iteration 6, total error= 627.819 X(0)= 4.9169012 X(1)= 4.3003774 X(2)= 4.1135886 X(3)= 2.1718478 X(4)= 1.4420657 iteration 7, total error= 416.43 X(0)= 4.9895805 X(1)= 4.2609985 X(2)= 3.8503040 X(3)= 2.2538014 X(4)= 1.4637471 iteration 8, total error= 261.212 X(0)= 5.0377935 X(1)= 4.2345551 X(2)= 3.6427283 X(3)= 2.3137482 X(4)= 1.4790071 iteration 9, total error= 153.039 X(0)= 5.0676712 X(1)= 4.2180261 X(2)= 3.4931185 X(3)= 2.3536859 X(4)= 1.4888793 iteration 10, total error= 82.4357 X(0)= 5.0847514 X(1)= 4.2085227 X(2)= 3.3966254 X(3)= 2.3776828 X(4)= 1.4946895 iteration 11, total error= 40.0448 X(0)= 5.0936133 X(1)= 4.2035747 X(2)= 3.3420529 X(3)= 2.3905321 X(4)= 1.4977594 iteration 12, total error= 17.1351 X(0)= 5.0976962 X(1)= 4.2012904 X(2)= 3.3155063 X(3)= 2.3965608 X(4)= 1.4991885 iteration 13, total error= 6.26571 X(0)= 5.0993162 X(1)= 4.2003831 X(2)= 3.3046531 X(3)= 2.3989758 X(4)= 1.4997587 iteration 14, total error= 1.8737 X(0)= 5.0998451 X(1)= 4.2000868 X(2)= 3.3010589 X(3)= 2.3997677 X(4)= 1.4999453 iteration 15, total error= 0.425885 X(0)= 5.0999769 X(1)= 4.2000129 X(2)= 3.3001582 X(3)= 2.3999653 X(4)= 1.4999918 iteration 16, total error= 0.0636057 X(0)= 5.0999985 X(1)= 4.2000008 X(2)= 3.3000101 X(3)= 2.3999978 X(4)= 1.4999995 iteration 17, total error= 0.0040756 X(0)= 5.1000000 X(1)= 4.2000000 X(2)= 3.3000000 X(3)= 2.4000000 X(4)= 1.5000000 iteration 18, total error= 1.22235e-08 X(0)= 5.1000000 X(1)= 4.2000000 X(2)= 3.3000000 X(3)= 2.4000000 X(4)= 1.5000000 iteration 19, total error= 2.27374e-13 final results should be X(0)= 5.1000000 5.1000000 X(1)= 4.2000000 4.2000000 X(2)= 3.3000000 3.3000000 X(3)= 2.4000000 2.4000000 X(4)= 1.5000000 1.5000000 increased error reduced fctr 4 times fctr increased due to reduced error 14 times final fctr=1 final total error=2.27374e-13 equation2_nl.c finished