seidel | R Documentation |
Gauss-Seidel method is an iterative algorithm for solving a system of linear equations.
seidel(a, b, start, maxiter = 200, tol = 1e-7)
a |
a square numeric matrix containing the coefficients of the linear system. |
b |
a vector of right-hand sides of the linear system. |
start |
a vector for initial starting point. |
maxiter |
the maximum number of iterations. Defaults to |
tol |
tolerance level for stopping iterations. |
Let \bold{D}
, \bold{L}
, and \bold{U}
denote the diagonal, lower
triangular and upper triangular parts of a matrix \bold{A}
. Gauss-Seidel method
solve the equation \bold{Ax} = \bold{b}
, iteratively by rewriting (\bold{L}
+ \bold{D})\bold{x} + \bold{Ux} = \bold{b}
. Assuming that \bold{L} + \bold{D}
is
nonsingular leads to the iteration formula
\bold{x}^{(k+1)} = -(\bold{L} + \bold{D})^{-1}\bold{U}\bold{x}^{(k)} + (\bold{L}
+ \bold{D})^{-1}\bold{b}
a vector with the approximate solution, the iterations performed are returned as the attribute 'iterations'.
Golub, G.H., Van Loan, C.F. (1996). Matrix Computations, 3rd Edition. John Hopkins University Press.
jacobi
a <- matrix(c(5,-3,2,-2,9,-1,3,1,-7), ncol = 3)
b <- c(-1,2,3)
start <- c(1,1,1)
z <- seidel(a, b, start)
z # converged in 10 iterations
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.