Wed Oct 8 07:44:30 2025 eros_test(): python version: 3.10.12 numpy version: 1.26.4 Test eros(). gauss_test1(): gauss() solves a 3x3 linear system with one right hand side. Matrix A: [[ 2. -1. 0.] [-1. 2. -1.] [ 0. -1. 2.]] Exact solution x: [[2.] [1.] [3.]] Right hand side b: [[ 3.] [-3.] [ 5.]] Augmented matrix Ab, step 0 [[ 2. -1. 0. 3.] [-1. 2. -1. -3.] [ 0. -1. 2. 5.]] Augmented matrix Ab, after step 0 [[ 1. -0.5 0. 1.5] [ 0. 1.5 -1. -1.5] [ 0. -1. 2. 5. ]] Augmented matrix Ab, after step 1 [[ 1. 0. -0.33333333 1. ] [ 0. 1. -0.66666667 -1. ] [ 0. 0. 1.33333333 4. ]] Augmented matrix Ab, after step 2 [[1. 0. 0. 2.] [0. 1. 0. 1.] [0. 0. 1. 3.]] Computed solution x [[2.] [1.] [3.]] gauss_test2(): gauss() solves a 3x3 linear system with two right hand sides. Random matrix A: [[ 1.00000000e+00 1.30476479e+01 2.41381885e+01] [ 1.95827882e-01 3.55509325e+00 1.53111147e+01] [-1.72120498e+01 -2.26322164e+02 -4.32941335e+02]] Exact solution x: [[ 2. 10. ] [ 1. 1.5] [ 3. -2. ]] Right hand side b: [[ 87.4622135 -18.70490532] [ 49.88009304 -23.33131065] [-1559.5702678 354.27892559]] Augmented matrix Ab, step 0 [[ 1.00000000e+00 1.30476479e+01 2.41381885e+01 8.74622135e+01 -1.87049053e+01] [ 1.95827882e-01 3.55509325e+00 1.53111147e+01 4.98800930e+01 -2.33313106e+01] [-1.72120498e+01 -2.26322164e+02 -4.32941335e+02 -1.55957027e+03 3.54278926e+02]] Augmented matrix Ab, after step 0 [[ 1. 13.14905354 25.15338616 90.60921201 -20.58319201] [ 0. 0.98014194 10.38538033 32.13628292 -19.30054774] [ 0. -0.10140568 -1.01519761 -3.14699851 1.87828669]] Augmented matrix Ab, after step 1 [[ 1.00000000e+00 0.00000000e+00 -1.14171253e+02 -3.40513758e+02 2.38342506e+02] [ 0.00000000e+00 1.00000000e+00 1.05957922e+01 3.27873766e+01 -1.96915844e+01] [ 0.00000000e+00 0.00000000e+00 5.92759378e-02 1.77827813e-01 -1.18551876e-01]] Augmented matrix Ab, after step 2 [[ 1. 0. 0. 2. 10. ] [ 0. 1. 0. 1. 1.5] [ 0. 0. 1. 3. -2. ]] Computed solution x [[ 2. 10. ] [ 1. 1.5] [ 3. -2. ]] 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.661338147750939e-16 np.lingalg.det(A) = 0.0 Matrix A: [[ 1. -1.75672466 -22.37044574 -4.1774864 14.0434205 ] [ -1.03747433 2.82255674 26.59176093 -8.72461453 -18.11086553] [ 12.84656434 -16.4476615 -265.67869822 -137.888227 157.90111896] [ 16.75301984 -23.28307938 -363.48512894 -108.37122006 228.45722991] [ -2.21868676 6.3751078 53.46342848 0.42652355 -7.50652081]] Computed determinant = 0.9999999999230246 np.lingalg.det(A) = 0.999999999886743 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.58333333 0.5 0.08333333] [ 1.66666667 -1. 0.33333333] [-0.25 0.5 -0.25 ]] np.linalg.inv B2 = inv(A): [[-1.58333333 0.5 0.08333333] [ 1.66666667 -1. 0.33333333] [-0.25 0.5 -0.25 ]] Residual norm |A*B-I| = 1.9860273225978185e-15 Error norm |B2-B| = 4.912423251631731e-16 Matrix A: [[ 1. 7.0111367 -8.80713531 -9.54707278 -2.37451998] [ -4.8323155 -32.88002455 50.09408303 49.1475993 4.02848484] [ 0.70797342 -3.52737621 -69.21738874 -14.56848674 56.50688646] [ -9.27305349 -82.29134776 -47.40511884 57.19895983 178.03394076] [ 11.47449483 81.83245885 -88.37602953 -73.14712672 -308.8073125 ]] Computed inverse B: [[ 9.52676009e+06 1.46334886e+06 -3.89232425e+05 2.78830579e+05 3.53637704e+04] [-1.17082172e+06 -1.79842819e+05 4.78361443e+04 -3.42678670e+04 -4.34616109e+03] [ 1.59197689e+05 2.44533824e+04 -6.50433904e+03 4.65943172e+03 5.90947889e+02] [-8.87712962e+03 -1.36342932e+03 3.62847766e+02 -2.59886995e+02 -3.29621113e+01] [ 2.70769722e+02 4.16018071e+01 -1.10416918e+01 7.91475377e+00 9.99999999e-01]] numpy linalg inverse: B2 = np.linalg.inv(A): [[ 9.52676009e+06 1.46334886e+06 -3.89232425e+05 2.78830579e+05 3.53637704e+04] [-1.17082172e+06 -1.79842819e+05 4.78361443e+04 -3.42678670e+04 -4.34616109e+03] [ 1.59197689e+05 2.44533824e+04 -6.50433904e+03 4.65943172e+03 5.90947889e+02] [-8.87712962e+03 -1.36342932e+03 3.62847766e+02 -2.59886995e+02 -3.29621113e+01] [ 2.70769722e+02 4.16018071e+01 -1.10416918e+01 7.91475377e+00 9.99999999e-01]] Residual norm |A*B-I| = 2.614935910175771e-08 Error norm |B2-B| = 0.00042648501727151554 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. 1. 0.] [0. 1. 0.] [0. 0. 1.]] Unit lower triangular matrix L: [[1. 0. 0. ] [1. 1. 0. ] [1.75 0. 1. ]] Upper triangular matrix U: [[ 4 5 8] [ 4 5 8] [ 0 0 -5]] Residual norm |A-P'*L*U| = 20.846162716432968 Matrix A: [[ 1.00000000e+00 -1.11637906e+00 -3.25062735e+00 1.35743603e+01 1.69592782e+01] [ 4.72727463e+00 -4.27743040e+00 9.88216508e-01 4.63594894e+01 7.21725095e+01] [-9.03040915e-01 -5.63630487e+00 -1.04733216e+02 1.06171525e+02 6.02653784e+01] [-3.93315441e+00 6.91313393e-01 -5.32093013e+01 1.30028023e+01 -1.54547574e+02] [ 3.68119263e+00 -6.85882887e-02 6.09262919e+01 -1.54902555e+01 2.17269944e+02]] Permutation matrix P: [[1. 0. 0. 0. 0.] [0. 1. 0. 0. 0.] [0. 0. 0. 1. 0.] [0. 0. 0. 1. 0.] [0. 0. 0. 0. 1.]] Unit lower triangular matrix L: [[ 1. 0. 0. 0. 0. ] [ 4.72727463 1. 0. 0. 0. ] [-0.90304091 -3.69957783 1. 0. 0. ] [-3.93315441 -3.69957783 1. 1. 0. ] [ 3.68119263 4.04101808 -1.23936297 0. 1. ]] Upper triangular matrix U: [[ 1. -1.11637906 -3.25062735 13.57436028 16.95927823] [ 0. 1. 16.35482471 -17.8102396 -7.99865623] [ 0. 0. -5.48857369 0.50248973 -117.43576549] [ 0. 0. 0. 0. 0. ] [ 0. 0. 0. 7.13417679 41.6167494 ]] Residual norm |A-P*L*U| = 208.47731747920486 golub_matrix_test(): golub_matrix() evaluates a random Golub matrix of order N. The Golub matrix: [[ 1. -7.15975904 -7.62306133 8.63663392 3.19505664] [ -2.05456697 15.71020442 -3.01633239 -15.33378066 4.38451728] [ 3.27161619 -12.53487463 -227.33110738 38.57725264 138.44253364] [ 1.94973778 -5.77153523 -182.16133436 266.28325108 -15.39985376] [ 7.75784406 -46.82546728 -218.5166519 38.31349863 234.13311777]] ref_test(): ref computes the row echelon form of a matrix. Matrix A: [[ 1. 3. 0. 2. 6. 3. 1.] [-2. -6. 0. -2. -8. 3. 1.] [ 3. 9. 0. 0. 6. 6. 2.] [-1. -3. 0. 1. 0. 9. 3.]] Pseudo-determinat = 48.0 REF(A): [[1. 3. 0. 2. 6. 3. 1. ] [0. 0. 0. 1. 2. 4.5 1.5 ] [0. 0. 0. 0. 0. 1. 0.33333333] [0. 0. 0. 0. 0. 0. 0. ]] rref_test(): rref computes the reduced row echelon form of a matrix. Matrix A: [[ 1. 3. 0. 2. 6. 3. 1.] [-2. -6. 0. -2. -8. 3. 1.] [ 3. 9. 0. 0. 6. 6. 2.] [-1. -3. 0. 1. 0. 9. 3.]] Pseudo-determinant = 48.0 RREF(A): [[1. 3. 0. 0. 2. 0. 0. ] [0. 0. 0. 1. 2. 0. 0. ] [0. 0. 0. 0. 0. 1. 0.33333333] [0. 0. 0. 0. 0. 0. 0. ]] eros_test(): Normal end of execution Wed Oct 8 07:44:30 2025