Direct and Iterative methods (GEPP and Jacobi)

Hello I need some advice.

Here is my problem:

enter image description here

I wrote Gaussian elimination algorithm in python for Direct method and for iterative method I used Jacobi method. In this problem we have three questions I can't answer the second one. Theoretically I know that when we have a big linear system direct method will give us errors because of calculations of floating point. while iterative method will return the right answer. So is it possible to show error for smaller matrix? between $3 \times 3$ and $10 \times 10$

Thank you in advance.


Solution 1:

I don't think you are expected to use Jacobi's method... The iterative refinement is something different. Let's say you used GEPP to solve the system and got $\tilde x$ as the solution. If the exact solution is instead $x = \tilde x + r$, you can compute $r$ solving the system $Ar = b- A \tilde x$, i.e. you solve a new system, with the current residual as rhs to compute another approximation of $x$. Obviously, since this system will not be exact for the computation of $r$, this is to be applied iteratively.