#*****************************************************************************80 # ## jacobi_test tests jacobi. # # 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: # # 16 February 2020 # # Author: # # John Burkardt # cat ( date ( ), "\n" ) cat ( "\n" ) cat ( "jacobi_test\n" ) cat ( " ", version$version.string, "\n" ) cat ( " jacobi uses Jacobi iteration to solve a linear system.\n" ) source ( "/home/burkardt/public_html/r_src/jacobi/jacobi.R" ) source ( "/home/burkardt/public_html/r_src/vecnorm/vecnorm.R" ) cat ( "\n" ) A <- matrix ( c ( 5, 2, 1, 2, 7, 3, 3, 4, 8 ), 3 ) cat ( "\n" ) cat ( "The matrix A:\n" ) cat ( "\n" ) A b <- c ( 40, 39, 55 ) cat ( "\n" ) cat ( "The right hand side b:\n" ) cat ( "\n" ) b tol = 1.0e-7 maxiter = 100 x <- jacobi ( A, b, tol, maxiter ) cat ( "\n" ) cat ( "The computed solution x:\n" ) cat ( "\n" ) x cat ( "\n" ) cat ( "The product A*x:\n" ) cat ( "\n" ) A %*% x # # Terminate. # cat ( "\n" ) cat ( "jacobi_test\n" ) cat ( " Normal end of execution.\n" ) cat ( date ( ), "\n" ) quit ( )