#*****************************************************************************80 # ## solvematrix_test tests solvematrix. # # Licensing: # # Copyright 2016 James P. Howard, II # # The computer code and data files on this web page are distributed under # https://opensource.org/licenses/BSD-2-Clause, the BSD-2-Clause license. # # Modified: # # 24 February 2020 # # Author: # # John Burkardt # cat ( date ( ), "\n" ) cat ( "\n" ) cat ( "solvematrix_test\n" ) cat ( " ", version$version.string, "\n" ) cat ( " solvematrix(A,b) solves A*x=b by transforming the linear system\n" ) cat ( " to row reduced echelon form (RREF)." ); source ( "/home/burkardt/public_html/r_src/rrefmatrix/rrefmatrix.R" ) source ( "/home/burkardt/public_html/r_src/solvematrix/solvematrix.R" ) cat ( "\n" ) A <- matrix ( c ( 5, 5, 5, 8, 2, 2, 6, 5, 4 ), 3 ) cat ( "\n" ) cat ( "The matrix A:\n" ) cat ( "\n" ) A Aref <- rrefmatrix ( A ) cat ( "\n" ) cat ( "The RREF of A:\n" ) cat ( "\n" ) Aref b <- c ( 39, 24, 21 ) cat ( "\n" ) cat ( "Right hand side b of A*x=b\n" ) cat ( "\n" ) b x <- solvematrix ( A, b ) cat ( "\n" ) cat ( "Solution x of A*x=b\n" ) cat ( "\n" ) x B <- matrix ( c ( 2, 4, 2, 4, 9, 4, 3, 6, 7, 7, 3, 9 ), 3 ) cat ( "\n" ) cat ( "The matrix B:\n" ) cat ( "\n" ) B Bref <- rrefmatrix ( B ) cat ( "\n" ) cat ( "The RREF of B:\n" ) cat ( "\n" ) Bref C <- matrix ( c ( 2, 8, 5, 5, 1, 2, 3, 8, 4 ), 3 ) cat ( "\n" ) cat ( "The matrix C:\n" ) cat ( "\n" ) C Cref <- rrefmatrix ( C ) cat ( "\n" ) cat ( "The RREF of C:\n" ) cat ( "\n" ) Cref # # Terminate. # cat ( "\n" ) cat ( "solvematrix_test\n" ) cat ( " Normal end of execution.\n" ) cat ( date ( ), "\n" ) quit ( )