LinearAlgebra`Tridiagonal`
Mathematica's built-in SparseArray function should be used to create tridiagonal matrices.
Mathematica kernel's built-in sparse solver LinearSolve has replaced TridiagonalSolve as a faster solver of tridiagonal matrices.
Suggestion for replacing Tridiagonal
This loads the package in Version 5.2:
Version 5.2
![<< LinearAlgebra`Tridiagonal`;](Files/Tridiagonal.en/legacy_1.gif)
This defines the list that will give the nonzero diagonals of a matrix:
Version 5.2
![{a, b, c} = {{7, 1, 11}, {4, 8, 2, 12}, {5, 9, 3}};](Files/Tridiagonal.en/legacy_2.gif)
Here is the matrix m constructed from the list:
Version 5.2
![m = Table[
Switch[j - i, -1, a[[j]], 0, b[[j]], 1, c[[j - 1]], _, 0], {i,
4}, {j, 4}];](Files/Tridiagonal.en/legacy_3.gif)
This displays the matrix using MatrixForm:
Version 5.2
![MatrixForm[m];](Files/Tridiagonal.en/legacy_4.gif)
Mathematica kernel's built-in sparse solver LinearSolve should be used in place of TridiagonalSolve:
Version 5.2
![TridiagonalSolve[a, b, c, {2, 3, 4, 5}];](Files/Tridiagonal.en/legacy_5.gif)