Solve Ax=b where
A is a 10x10 tridiagonal matrix with 4's on its diagonal and -1's on its off
diagonal and vector b contains all ones.
You may use MatLab commands to initialize matrix A and b as
follows.
>> n=10;
>> A=4*diag(ones(n,1))-diag(ones(n-1,1),-1)-diag(ones(n-1,1),1);
>> b=ones(n,1);
Use help diag to learn more about diag and to use it
to initialize matrices L and U.
Let x(0)=0. Define
r(k)=Ax(k)-b. Find x(k) such that
the square root of (r(k))Tr(k) is less than
10-3 using (1) Jacobi iteration;
and (2) Gauss-Seidel iteration.
Print out x(k) and k for each method.