14-May-2025 15:57:09 eros_test(): MATLAB/Octave version 6.4.0 Test eros(). gauss_test1(): gauss() solves a 3x3 linear system with one right hand side. Matrix A: 0.039178 0.379826 0.376276 0.885555 0.446001 0.597897 0.998170 0.159978 0.770744 Exact solution x: 2 1 3 Right hand side b: 1.5870 4.0108 4.4685 Augmented matrix Ab, step 0 0.039178 0.379826 0.376276 1.587010 0.885555 0.446001 0.597897 4.010803 0.998170 0.159978 0.770744 4.468549 Augmented matrix Ab, after step 1 1.0000 0.1603 0.7722 4.4767 0 0.3041 -0.0859 0.0464 0 0.3735 0.3460 1.4116 Augmented matrix Ab, after step 2 1.0000 0 0.6237 3.8711 0 1.0000 0.9263 3.7790 0 0 -0.3676 -1.1027 Augmented matrix Ab, after step 3 1.0000 0 0 2.0000 0 1.0000 0 1.0000 0 0 1.0000 3.0000 Computed solution x 2.0000 1.0000 3.0000 gauss_test2(): gauss solves a random 3x3 linear system with two right hand sides. Matrix A: 2.4765e-01 8.1862e-01 3.0795e-01 4.6421e-01 8.2249e-01 8.9311e-01 1.9706e-01 1.3733e-03 3.4430e-01 Exact solution x: 2.0000 10.0000 1.0000 1.5000 3.0000 -2.0000 Right hand side b: 2.2378 3.0885 4.4302 4.0896 1.4284 1.2841 Augmented matrix Ab, step 0 2.4765e-01 8.1862e-01 3.0795e-01 2.2378e+00 3.0885e+00 4.6421e-01 8.2249e-01 8.9311e-01 4.4302e+00 4.0896e+00 1.9706e-01 1.3733e-03 3.4430e-01 1.4284e+00 1.2841e+00 Augmented matrix Ab, after step 1 1.0000 1.7718 1.9240 9.5437 8.8098 0 0.3798 -0.1685 -0.1257 0.9068 0 -0.3478 -0.0348 -0.4523 -0.4520 Augmented matrix Ab, after step 2 1.0000 0 2.7101 10.1302 4.5799 0 1.0000 -0.4437 -0.3310 2.3874 0 0 -0.1892 -0.5675 0.3783 Augmented matrix Ab, after step 3 1.0000 0 0 2.0000 10.0000 0 1.0000 0 1.0000 1.5000 0 0 1.0000 3.0000 -2.0000 Computed solution x 2.0000 10.0000 1.0000 1.5000 3.0000 -2.0000 gauss_det_test(): gauss_det() uses Gauss elimination to find the determinant of a matrix. Matrix A: 1 2 3 4 5 6 7 8 9 Computed determinant = 6.66134e-16: MATLAB det(A) = 0: Matrix A: 1.0000 -12.6955 -7.5492 15.2628 -0.3462 -8.6996 111.4459 86.0252 -128.2320 9.9370 -4.6826 52.1813 -111.5134 -108.4360 -57.1955 -12.2686 154.1183 50.6448 -159.7731 61.0536 -9.0501 117.6564 112.6391 -94.0038 204.9007 Computed determinant = 1: MATLAB det(A) = 1: gauss_inverse_test(): gauss_inverse() uses Gauss elimination to find the inverse of a matrix. Matrix A: 1 2 3 4 5 8 7 8 9 Computed inverse B: -1.583333 0.500000 0.083333 1.666667 -1.000000 0.333333 -0.250000 0.500000 -0.250000 MATLAB inverse B2 = inv(A): -1.583333 0.500000 0.083333 1.666667 -1.000000 0.333333 -0.250000 0.500000 -0.250000 Residual norm |A*B-I| = 1.93091e-15: Error norm |B2-B| = 4.6618e-16: Matrix A: 1.0000 -11.8261 -18.5841 14.8025 12.3944 30.9222 -364.6897 -596.3498 450.3669 396.4947 2.7639 -34.0999 -19.6964 44.9594 21.0990 -30.5320 363.0433 524.8710 -466.4230 -343.4969 -4.7227 63.7514 -97.1652 -56.6964 -148.7024 Computed inverse B: -1.7718e+07 3.4725e+05 -1.8333e+05 -2.4269e+05 -1.6296e+04 -1.4114e+06 2.7661e+04 -1.4604e+04 -1.9333e+04 -1.2982e+03 -6.1450e+04 1.2043e+03 -6.3583e+02 -8.4172e+02 -5.6523e+01 -8.6994e+03 1.7040e+02 -9.0339e+01 -1.1929e+02 -8.0168e+00 1.0974e+03 -2.1528e+01 1.1249e+01 1.5004e+01 1.0000e+00 MATLAB inverse B2 = inv(A): -1.7718e+07 3.4725e+05 -1.8333e+05 -2.4269e+05 -1.6296e+04 -1.4114e+06 2.7661e+04 -1.4604e+04 -1.9333e+04 -1.2982e+03 -6.1450e+04 1.2043e+03 -6.3583e+02 -8.4172e+02 -5.6523e+01 -8.6994e+03 1.7040e+02 -9.0339e+01 -1.1929e+02 -8.0168e+00 1.0974e+03 -2.1528e+01 1.1249e+01 1.5004e+01 1.0000e+00 Residual norm |A*B-I| = 3.91579e-08: Error norm |B2-B| = 0.00469447: gauss_plu_test(): gauss_plu() uses Gauss elimination to find the PLU factors of a matrix. Matrix A: 1 2 3 4 5 8 7 8 9 Permutation matrix P: 0 0 1 1 0 0 0 1 0 Unit lower triangular matrix L: 1.0000 0 0 0.1429 1.0000 0 0.5714 0.5000 1.0000 Upper triangular matrix U: 7.0000 8.0000 9.0000 0 0.8571 1.7143 0 0 2.0000 Residual norm |A-P'*L*U| = 0: Matrix A: 1.0000 -1.1835 -1.6003 6.7088 18.1727 1.3708 -0.6223 -9.6005 -1.9682 30.5744 3.9785 12.7414 -134.6163 -154.8569 169.1297 3.9788 7.7023 -112.4198 -298.2970 175.9558 -7.8596 24.2206 -103.5835 -303.9307 -93.4764 Permutation matrix P: 0 0 0 0 1 0 0 1 0 0 0 0 0 1 0 0 1 0 0 0 1 0 0 0 0 Unit lower triangular matrix L: 1.0000 0 0 0 0 -0.5062 1.0000 0 0 0 -0.5062 0.7985 1.0000 0 0 -0.1744 0.1441 0.0463 1.0000 0 -0.1272 0.0759 0.0373 0.8750 1.0000 Upper triangular matrix U: -7.8596 24.2206 -103.5835 -303.9307 -93.4764 0 25.0020 -187.0507 -308.7078 121.8116 0 0 -15.5006 -205.6601 31.3694 0 0 0 -0.9699 -4.7313 0 0 0 0 0.0003 Residual norm |A-P'*L*U| = 9.74757e-15: eros_test(): Normal end of execution 14-May-2025 15:57:09