Large Matrix Operation

I am having a problem on how will I create a large matrix to be solved using numerical methods. Say I have a 500 x 500 matrix and want to find these 500 equations. How will I do it? To be exact, here is a sample problem
| -2 1 . . . . . . . || x1 | |h^2|
| 1 -2 1 . . . . . . || x2 | |h^2|
| 0 1 -2 1 . . . . . || . | | . |
| 0 0 1 -2 1 . . . . || . | = | . |
| . . . . . . . . . 1 || . | | . |
| . . . . . . . . 1 -2||x500| |h^2|

Where h = 1/(n + 1)
Solutions on finding would be gauss elimination, Successive overrelaxation, Jacobi Iteration, biconjugate gradient method and Thomas algorithm. I want to compare the accuracy, with tolerance of 10^-6
500x500 is not that much in computing - just proceed it normally.

Gauss–Seidel method has been covered a lot - just google it for ready solutions.
I do not know how to insert L1, L2 and L-infinity as an exit criterion for the code. please tell me how to do it
Topic archived. No new replies allowed.