Previous Up Next

5.61.7  Solving a linear system using the Jacobi iteration method: jacobi_linsolve

The jacobi_linsolve command takes two mandatory arguments and two optional arguments. The mandatory arguments are the matrix of coefficients of a system and the right hand side of the system as a list. The optional arguments are an integer indicating the maximum number of iterations (by default maxiter) and a positive number indicating the error tolerance (by default epsilon).
jacobi_linsolve uses the Jacobi iteration method to solve and return the solution of the system.
Input:

A:=[[100,2],[2,100]];
jacobi_linsolve(A,[0,1],1e-12);

Output:

[-0.000200080032,0.0100040016006]

Input:

evalf(linsolve(A,[0,1]))

Output:

[-0.000200080032013,0.0100040016006]

Previous Up Next