0
$\begingroup$

I have to implement the SOR (Successive Over-Relaxation) method, using sparse matrices, to find the solution vector of these linear equations systems (for quite huge matrices):

linear equations system

What does that tridiag(-1,3,-1) or tridiag(1,2,1) mean? For the 1st example, what are the -1, 3 and -1? For the 2nd, what does the 1, 2 and 1 mean? Is it a matrix with a diagonal of (-1,3,1) or what could that be?

Thank you in advance!

$\endgroup$
0
$\begingroup$

A tridiagonal $(a,b,c)$ is a matrix with upper diagonal terms $a$ and the diagonal terms $b$ and lower diagonal terms $c$

$\endgroup$
0
$\begingroup$

A tridiagonal matrix $(a,b,c)$ very probably denotes a matrix with $b$s on the diagonal,$a$s on the first underdiagonal, $c$ on the first overdiagonal and $0$ everywhere else, like this: $$\begin{pmatrix} b&c&0&\dots &0&0&0 \\ a&b&c&\dots&0 &0&0\\ 0&a&b&\ddots&0&0 &0\\[-1ex] \vdots&\ddots&\ddots&\ddots&\ddots&\ddots&\vdots \\[-3ex] 0&0&0&\ddots&b&c&0 \\ 0&0&0&\dots&a&b&c \\ 0&0&0&\dots&0&a&b \end{pmatrix}$$

$\endgroup$
  • $\begingroup$ Thank you for the answer. But the matrix you've posted isn't what you described with text before: "𝑏's on the diagonal,𝑎's on the first underdiagonal, 𝑐's on the first overdiagonal and 0 everywhere else". What should I take as answer, the text or the matrix posted (the one posted says that a's are on the diagonal, b's on the underdiagonal and c's on the upperdiagonal)? $\endgroup$ – ZelelB May 20 at 18:16
  • 1
    $\begingroup$ @ZelelB In your case, the triples $(-1,3,-1)$ and $(1,2,1)$ are symmetric so it's more likely that the $3$ and $2$ (respectively) are intended to go on the diagonal. $\endgroup$ – Misha Lavrov May 20 at 18:18
  • $\begingroup$ @MishaLavrov Thanks, it makes sense! And same as what Mohammad Riazi said above. However, Bernard text and posted matrix are not concordant.. Just to be sure.. $\endgroup$ – ZelelB May 20 at 18:23
  • $\begingroup$ Oh! yes. I messed up typing. I'll fix it within seconds. $\endgroup$ – Bernard May 20 at 18:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.