30-May-2023 18:43:28 eros_test(): MATLAB/Octave version 5.2.0 Test eros(). gauss_test1(): gauss() solves a 3x3 linear system with one right hand side. Matrix A: 0.38069 0.19339 0.36092 0.28624 0.10679 0.66643 0.53894 0.20264 0.98165 Exact solution x: 2 1 3 Right hand side b: 2.0375 2.6786 4.2255 Augmented matrix Ab, step 0 0.38069 0.19339 0.36092 2.03753 0.28624 0.10679 0.66643 2.67858 0.53894 0.20264 0.98165 4.22547 Augmented matrix Ab, after step 1 1.00000 0.37600 1.82146 7.84038 0.00000 -0.00084 0.14506 0.43433 0.00000 0.05025 -0.33248 -0.94720 Augmented matrix Ab, after step 2 1.00000 0.00000 4.30930 14.92790 0.00000 1.00000 -6.61661 -18.84982 0.00000 0.00000 0.13951 0.41854 Augmented matrix Ab, after step 3 1.00000 0.00000 0.00000 2.00000 0.00000 1.00000 0.00000 1.00000 0.00000 0.00000 1.00000 3.00000 Computed solution x 2.00000 1.00000 3.00000 gauss_test2(): gauss solves a random 3x3 linear system with two right hand sides. Matrix A: 0.83263 0.69893 0.21688 0.96461 0.67419 0.15251 0.47159 0.46948 0.98357 Exact solution x: 2.0000 10.0000 1.0000 1.5000 3.0000 -2.0000 Right hand side b: 3.0148 8.9409 3.0609 10.3524 4.3634 3.4529 Augmented matrix Ab, step 0 0.83263 0.69893 0.21688 3.01483 8.94092 0.96461 0.67419 0.15251 3.06094 10.35237 0.47159 0.46948 0.98357 4.36337 3.45293 Augmented matrix Ab, after step 1 1.00000 0.69893 0.15811 3.17325 10.73218 0.00000 0.11698 0.08524 0.37269 0.00500 0.00000 0.13987 0.90901 2.86691 -1.60822 Augmented matrix Ab, after step 2 1.00000 0.00000 -4.38419 -11.15258 18.76839 0.00000 1.00000 6.49895 20.49684 -11.49790 0.00000 0.00000 -0.67502 -2.02506 1.35004 Augmented matrix Ab, after step 3 1.00000 0.00000 0.00000 2.00000 10.00000 0.00000 1.00000 0.00000 1.00000 1.50000 -0.00000 -0.00000 1.00000 3.00000 -2.00000 Computed solution x 2.00000 10.00000 1.00000 1.50000 3.00000 -2.00000 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.00000 4.47903 -0.43126 23.04231 -18.39771 -5.31280 -22.79622 8.74838 -118.97053 113.06099 5.00093 28.56515 38.65720 131.39795 12.30310 -8.73982 -30.98949 49.91154 -138.98367 221.13877 -2.59119 -14.49859 -14.94733 -98.96446 33.78104 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| = 2.56332e-15: Error norm |B2-B| = 4.6618e-16: Matrix A: 1.0000 5.0755 4.9725 1.3775 23.7341 -1.3863 -6.0361 -24.8873 -11.8589 -42.8409 -4.3984 -24.1269 11.5752 -4.9128 -84.0977 -15.9435 -62.9606 -398.4474 -266.9712 -550.9831 4.8721 25.3507 17.5823 -69.1741 96.4953 Computed inverse B: -1196947.80963 -921053.73457 -128248.58956 38608.91860 -5833.24835 222996.45551 171599.22081 23893.14504 -7193.18745 1086.95495 11866.44242 9131.78960 1271.44381 -382.80006 57.87100 736.60191 566.94515 78.91144 -23.76845 3.58707 215.55345 165.07414 23.11626 -6.90492 1.00000 MATLAB inverse B2 = inv(A): -1196947.80985 -921053.73473 -128248.58959 38608.91861 -5833.24835 222996.45555 171599.22084 23893.14505 -7193.18745 1086.95495 11866.44242 9131.78960 1271.44381 -382.80006 57.87100 736.60191 566.94515 78.91144 -23.76845 3.58707 215.55345 165.07414 23.11626 -6.90492 1.00000 Residual norm |A*B-I| = 7.70269e-10: Error norm |B2-B| = 0.000272416: 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.00000 0.00000 0.00000 0.14286 1.00000 0.00000 0.57143 0.50000 1.00000 Upper triangular matrix U: 7.00000 8.00000 9.00000 0.00000 0.85714 1.71429 0.00000 0.00000 2.00000 Residual norm |A-P'*L*U| = 0: Matrix A: 1.00000 5.83253 5.64733 -7.48728 7.64396 0.97503 6.68688 -3.63440 -4.89245 5.90683 -4.59480 -34.17513 42.47194 16.90906 -16.41888 -6.05144 -42.96877 30.77603 26.44839 -86.71321 12.32766 81.88144 -3.81200 -52.93109 56.76396 Permutation matrix P: 0 0 0 0 1 0 0 1 0 0 1 0 0 0 0 0 0 0 1 0 0 1 0 0 0 Unit lower triangular matrix L: 1.00000 0.00000 0.00000 0.00000 0.00000 -0.37272 1.00000 0.00000 0.00000 0.00000 0.08112 0.22143 1.00000 0.00000 0.00000 -0.49088 0.75890 0.71768 1.00000 0.00000 0.07909 -0.05762 0.30881 -0.01687 1.00000 Upper triangular matrix U: 12.32766 81.88144 -3.81200 -52.93109 56.76396 0.00000 -3.65604 41.05112 -2.81957 4.73835 0.00000 0.00000 -3.13350 -2.56925 1.99014 0.00000 0.00000 0.00000 4.44910 -63.87296 0.00000 0.00000 0.00000 0.00000 -0.00159 Residual norm |A-P'*L*U| = 3.55271e-15: eros_test(): Normal end of execution 30-May-2023 18:43:28