(***********************************************************************

                    Mathematica-Compatible Notebook

This notebook can be used on any computer system with Mathematica 4.0,
MathReader 4.0, or any compatible application. The data for the notebook 
starts with the line containing stars above.

To get the notebook into a Mathematica-compatible application, do one of 
the following:

* Save the data starting with the line of stars above into a file
  with a name ending in .nb, then open the file inside the application;

* Copy the data starting with the line of stars above to the
  clipboard, then use the Paste menu command inside the application.

Data for notebooks contains only printable 7-bit ASCII and can be
sent directly in email or through ftp in text mode.  Newlines can be
CR, LF or CRLF (Unix, Macintosh or MS-DOS style).

NOTE: If you modify the data for this notebook not in a Mathematica-
compatible application, you must delete the line below containing the 
word CacheID, otherwise Mathematica-compatible applications may try to 
use invalid cache data.

For more information on notebooks and Mathematica-compatible 
applications, contact Wolfram Research:
  web: http://www.wolfram.com
  email: info@wolfram.com
  phone: +1-217-398-0700 (U.S.)

Notebook reader applications are available free of charge from 
Wolfram Research.
***********************************************************************)

(*CacheID: 232*)


(*NotebookFileLineBreakTest
NotebookFileLineBreakTest*)
(*NotebookOptionsPosition[      7902,        261]*)
(*NotebookOutlinePosition[     11450,        373]*)
(*  CellTagsIndexPosition[     11147,        357]*)
(*WindowFrame->Normal*)



Notebook[{
Cell[TextData[{
  "LinearAlgebra",
  StyleBox["`", "MB"],
  "Tridiagonal",
  StyleBox["`", "MB"]
}], "Subsection",
  CellTags->{"S5.50.1", "1.1"}],

Cell[TextData[{
  "There are many numerical techniques for working with matrices of specific \
forms. Often these routines are far more efficient than the general case. \
Frequently, the best way to get an efficient general routine is to reduce the \
problem systematically to a special case that can be solved efficiently. \nIn \
addition, special forms of matrices often come up naturally in solving \
certain classes of problems. One very useful special type of matrix is the ",
  StyleBox["tridiagonal", "MR"],
  ". In these matrices all elements are zero except for elements on the main, \
super\[Hyphen], and subdiagonal. More precisely, ",
  Cell[BoxData[
      \(TraditionalForm\`m\_\(i, j\) = 0\)], "InlineFormula"],
  " if ",
  Cell[BoxData[
      \(TraditionalForm\`\(\(\[VerticalSeparator]\)\(i\)\(-\)\(j\)\(\
\[VerticalSeparator]\)\(>\)\(1\)\)\)], "InlineFormula"],
  ". Tridiagonal matrices occur in a wide variety of applications, such as \
the construction of certain splines and the solution of boundary value \
problems. "
}], "Text",
  CellTags->{"S5.50.1", "1.2"}],

Cell[BoxData[
    FormBox[
      StyleBox[
        FrameBox[
          StyleBox[GridBox[{
                {"\<\"\\!\\(\\*StyleBox[\\\"\\\\\\\"TridiagonalSolve[\\\\\\\"\
\\\", \\\"MR\\\"]\\)\\!\\(\\*StyleBox[\\\"\\\\\\\"a\\\\\\\"\\\", \
\\\"TI\\\"]\\)\\!\\(\\*StyleBox[\\\"\\\\\\\",\\\\\\\"\\\", \\\"MR\\\"]\\) \\!\
\\(\\*StyleBox[\\\"\\\\\\\"b\\\\\\\"\\\", \
\\\"TI\\\"]\\)\\!\\(\\*StyleBox[\\\"\\\\\\\",\\\\\\\"\\\", \\\"MR\\\"]\\) \\!\
\\(\\*StyleBox[\\\"\\\\\\\"c\\\\\\\"\\\", \
\\\"TI\\\"]\\)\\!\\(\\*StyleBox[\\\"\\\\\\\",\\\\\\\"\\\", \\\"MR\\\"]\\) \\!\
\\(\\*StyleBox[\\\"\\\\\\\"r\\\\\\\"\\\", \\\"TI\\\"]\\)] \"\>", 
                  RowBox[{"\<\"solve the matrix equation \"\>", 
                    StyleBox[\(m . x = r\),
                      "InlineFormula"], "\<\" where \"\>", 
                    StyleBox["m",
                      
                      "InlineFormula"], "\<\" is tridiagonal with main, sub\
\[Hyphen], and superdiagonals given by the lists \"\>", 
                    StyleBox["a",
                      "InlineFormula"], "\<\", \"\>", 
                    StyleBox["b",
                      "InlineFormula"], "\<\", and \"\>", 
                    StyleBox["c",
                      "InlineFormula"], "\<\", respectively\"\>"}]}
                },
              ColumnAlignments->{Right, Left}],
            GridBoxOptions->{RowLines->False}]],
        "2ColumnBox"], TraditionalForm]], "Text",
  CellTags->{"S5.50.1", "1.3"}],

Cell["Solving matrix equations with tridiagonal matrices. ", "Caption",
  CellTags->"S5.50.1"],

Cell["This loads the package. ", "MathCaption",
  CellTags->{"S5.50.1", "1.4"}],

Cell["<<LinearAlgebra`Tridiagonal`", "Input",
  CellLabel->"In[1]:= ",
  CellTags->"S5.50.1"],

Cell["\<\
This defines the list that will give the nonzero diagonals of a \
matrix. \
\>", "MathCaption",
  CellTags->{"S5.50.1", "1.5"}],

Cell[CellGroupData[{

Cell["\<\
{a, b, c} =
    {{7, 1, 11}, {4, 8, 2, 12}, {5, 9, 3}}\
\>", "Input",
  CellLabel->"In[2]:= ",
  CellTags->"S5.50.1"],

Cell[BoxData[
    \({{7, 1, 11}, {4, 8, 2, 12}, {5, 9, 3}}\)], "Output",
  CellLabel->"Out[2]= ",
  CellTags->"S5.50.1"]
}, Open  ]],

Cell[TextData[{
  "Here is the matrix ",
  StyleBox["m", "MR"],
  " constructed from the list. "
}], "MathCaption",
  CellTags->{"S5.50.1", "1.6"}],

Cell[CellGroupData[{

Cell["\<\
m = Table[Switch[
  j-i, -1, a[[j]], 0, b[[j]], 1,
  c[[j-1]], _, 0], {i, 4}, {j, 4}]\
\>", "Input",
  CellLabel->"In[3]:= ",
  CellTags->"S5.50.1"],

Cell[BoxData[
    \({{4, 5, 0, 0}, {7, 8, 9, 0}, {0, 1, 2, 3}, {0, 0, 11, 12}}\)], "Output",\

  CellLabel->"Out[3]= ",
  CellTags->"S5.50.1"]
}, Open  ]],

Cell[TextData[{
  "This displays the matrix using ",
  StyleBox["MatrixForm", "MR"],
  ". "
}], "MathCaption",
  CellTags->{"S5.50.1", "1.7"}],

Cell[CellGroupData[{

Cell["MatrixForm[%]", "Input",
  CellLabel->"In[4]:= ",
  CellTags->"S5.50.1"],

Cell[BoxData[
    TagBox[
      RowBox[{"(", "\[NoBreak]", GridBox[{
            {"4", "5", "0", "0"},
            {"7", "8", "9", "0"},
            {"0", "1", "2", "3"},
            {"0", "0", "11", "12"}
            }], "\[NoBreak]", ")"}],
      (MatrixForm[ #]&)]], "Output",
  CellLabel->"Out[4]//MatrixForm= ",
  CellTags->"S5.50.1"]
}, Open  ]],

Cell[TextData[{
  "This gives the vector ",
  StyleBox["x", "MR"],
  " that solves the equation ",
  StyleBox["m.x", "MR"],
  " ",
  StyleBox["==", "MR"],
  " ",
  StyleBox["{2,", "MR"],
  " ",
  StyleBox["3,", "MR"],
  " ",
  StyleBox["4,", "MR"],
  " ",
  StyleBox["5}", "MR"],
  ". "
}], "MathCaption",
  CellTags->{"S5.50.1", "1.8"}],

Cell[CellGroupData[{

Cell["TridiagonalSolve[a, b, c, {2, 3, 4, 5}]", "Input",
  CellLabel->"In[5]:= ",
  CellTags->"S5.50.1"],

Cell[BoxData[
    \({\(-\(28\/9\)\), 26\/9, 5\/27, 20\/81}\)], "Output",
  CellLabel->"Out[5]= ",
  CellTags->"S5.50.1"]
}, Open  ]],

Cell[TextData[{
  StyleBox["TridiagonalSolve", "MR"],
  " uses Gaussian elimination and back substitution. No pivoting is done. If \
a pivot happens to be zero, this introduces an ",
  StyleBox["Infinity", "MR"],
  ". If the matrix is diagonally dominate, which is the case in certain \
applications, no pivoting is necessary. "
}], "Text",
  CellTags->{"S5.50.1", "1.9"}],

Cell["\<\
You can solve equations containing real and complex numbers as well \
as symbolic quantities. \
\>", "MathCaption",
  CellTags->{"S5.50.1", "1.10"}],

Cell[CellGroupData[{

Cell["\<\
TridiagonalSolve[
  {2.2, 5.2},
  {4.3, 3.22, 2.1},
  {8.1 + I, 3.4},
  {1, 2.3 I , 3}]\
\>", "Input",
  CellLabel->"In[6]:= ",
  CellTags->"S5.50.1"],

Cell[BoxData[
    \({\(-0.8856781544585755`\) + 
        0.3913128820828248`\ \[ImaginaryI], \(\(0.5594584105515094`\)\(\
\[InvisibleSpace]\)\) - 
        0.2768029387046489`\ \[ImaginaryI], \(\(0.043245840539119375`\)\(\
\[InvisibleSpace]\)\) + 0.6854168006019867`\ \[ImaginaryI]}\)], "Output",
  CellLabel->"Out[6]= ",
  CellTags->"S5.50.1"]
}, Open  ]]
},
FrontEndVersion->"4.0 for X",
ScreenRectangle->{{0, 800}, {0, 600}},
WindowSize->{520, 455},
WindowMargins->{{140, Automatic}, {Automatic, 72}},
StyleDefinitions -> "HelpBrowser.nb"
]


(***********************************************************************
Cached data follows.  If you edit this Notebook file directly, not using
Mathematica, you must remove the line containing CacheID at the top of 
the file.  The cache data will then be recreated when you save this file 
from within Mathematica.
***********************************************************************)

(*CellTagsOutline
CellTagsIndex->{
  "S5.50.1"->{
    Cell[1717, 49, 146, 6, 70, "Subsection",
      CellTags->{"S5.50.1", "1.1"}],
    Cell[1866, 57, 1084, 20, 70, "Text",
      CellTags->{"S5.50.1", "1.2"}],
    Cell[2953, 79, 1468, 30, 70, "Text",
      CellTags->{"S5.50.1", "1.3"}],
    Cell[4424, 111, 94, 1, 70, "Caption",
      CellTags->"S5.50.1"],
    Cell[4521, 114, 79, 1, 70, "MathCaption",
      CellTags->{"S5.50.1", "1.4"}],
    Cell[4603, 117, 93, 2, 70, "Input",
      CellTags->"S5.50.1"],
    Cell[4699, 121, 137, 4, 70, "MathCaption",
      CellTags->{"S5.50.1", "1.5"}],
    Cell[4861, 129, 127, 5, 70, "Input",
      CellTags->"S5.50.1"],
    Cell[4991, 136, 120, 3, 70, "Output",
      CellTags->"S5.50.1"],
    Cell[5126, 142, 147, 5, 70, "MathCaption",
      CellTags->{"S5.50.1", "1.6"}],
    Cell[5298, 151, 158, 6, 70, "Input",
      CellTags->"S5.50.1"],
    Cell[5459, 159, 142, 4, 70, "Output",
      CellTags->"S5.50.1"],
    Cell[5616, 166, 142, 5, 70, "MathCaption",
      CellTags->{"S5.50.1", "1.7"}],
    Cell[5783, 175, 78, 2, 70, "Input",
      CellTags->"S5.50.1"],
    Cell[5864, 179, 339, 10, 70, "Output",
      CellTags->"S5.50.1"],
    Cell[6218, 192, 337, 17, 70, "MathCaption",
      CellTags->{"S5.50.1", "1.8"}],
    Cell[6580, 213, 104, 2, 70, "Input",
      CellTags->"S5.50.1"],
    Cell[6687, 217, 120, 3, 70, "Output",
      CellTags->"S5.50.1"],
    Cell[6822, 223, 372, 8, 70, "Text",
      CellTags->{"S5.50.1", "1.9"}],
    Cell[7197, 233, 158, 4, 70, "MathCaption",
      CellTags->{"S5.50.1", "1.10"}],
    Cell[7380, 241, 160, 8, 70, "Input",
      CellTags->"S5.50.1"],
    Cell[7543, 251, 343, 7, 70, "Output",
      CellTags->"S5.50.1"]},
  "1.1"->{
    Cell[1717, 49, 146, 6, 70, "Subsection",
      CellTags->{"S5.50.1", "1.1"}]},
  "1.2"->{
    Cell[1866, 57, 1084, 20, 70, "Text",
      CellTags->{"S5.50.1", "1.2"}]},
  "1.3"->{
    Cell[2953, 79, 1468, 30, 70, "Text",
      CellTags->{"S5.50.1", "1.3"}]},
  "1.4"->{
    Cell[4521, 114, 79, 1, 70, "MathCaption",
      CellTags->{"S5.50.1", "1.4"}]},
  "1.5"->{
    Cell[4699, 121, 137, 4, 70, "MathCaption",
      CellTags->{"S5.50.1", "1.5"}]},
  "1.6"->{
    Cell[5126, 142, 147, 5, 70, "MathCaption",
      CellTags->{"S5.50.1", "1.6"}]},
  "1.7"->{
    Cell[5616, 166, 142, 5, 70, "MathCaption",
      CellTags->{"S5.50.1", "1.7"}]},
  "1.8"->{
    Cell[6218, 192, 337, 17, 70, "MathCaption",
      CellTags->{"S5.50.1", "1.8"}]},
  "1.9"->{
    Cell[6822, 223, 372, 8, 70, "Text",
      CellTags->{"S5.50.1", "1.9"}]},
  "1.10"->{
    Cell[7197, 233, 158, 4, 70, "MathCaption",
      CellTags->{"S5.50.1", "1.10"}]}
  }
*)

(*CellTagsIndex
CellTagsIndex->{
  {"S5.50.1", 8527, 278},
  {"1.1", 10192, 323},
  {"1.2", 10286, 326},
  {"1.3", 10376, 329},
  {"1.4", 10466, 332},
  {"1.5", 10561, 335},
  {"1.6", 10657, 338},
  {"1.7", 10753, 341},
  {"1.8", 10849, 344},
  {"1.9", 10946, 347},
  {"1.10", 11036, 350}
  }
*)

(*NotebookFileOutline
Notebook[{
Cell[1717, 49, 146, 6, 70, "Subsection",
  CellTags->{"S5.50.1", "1.1"}],
Cell[1866, 57, 1084, 20, 70, "Text",
  CellTags->{"S5.50.1", "1.2"}],
Cell[2953, 79, 1468, 30, 70, "Text",
  CellTags->{"S5.50.1", "1.3"}],
Cell[4424, 111, 94, 1, 70, "Caption",
  CellTags->"S5.50.1"],
Cell[4521, 114, 79, 1, 70, "MathCaption",
  CellTags->{"S5.50.1", "1.4"}],
Cell[4603, 117, 93, 2, 70, "Input",
  CellTags->"S5.50.1"],
Cell[4699, 121, 137, 4, 70, "MathCaption",
  CellTags->{"S5.50.1", "1.5"}],

Cell[CellGroupData[{
Cell[4861, 129, 127, 5, 70, "Input",
  CellTags->"S5.50.1"],
Cell[4991, 136, 120, 3, 70, "Output",
  CellTags->"S5.50.1"]
}, Open  ]],
Cell[5126, 142, 147, 5, 70, "MathCaption",
  CellTags->{"S5.50.1", "1.6"}],

Cell[CellGroupData[{
Cell[5298, 151, 158, 6, 70, "Input",
  CellTags->"S5.50.1"],
Cell[5459, 159, 142, 4, 70, "Output",
  CellTags->"S5.50.1"]
}, Open  ]],
Cell[5616, 166, 142, 5, 70, "MathCaption",
  CellTags->{"S5.50.1", "1.7"}],

Cell[CellGroupData[{
Cell[5783, 175, 78, 2, 70, "Input",
  CellTags->"S5.50.1"],
Cell[5864, 179, 339, 10, 70, "Output",
  CellTags->"S5.50.1"]
}, Open  ]],
Cell[6218, 192, 337, 17, 70, "MathCaption",
  CellTags->{"S5.50.1", "1.8"}],

Cell[CellGroupData[{
Cell[6580, 213, 104, 2, 70, "Input",
  CellTags->"S5.50.1"],
Cell[6687, 217, 120, 3, 70, "Output",
  CellTags->"S5.50.1"]
}, Open  ]],
Cell[6822, 223, 372, 8, 70, "Text",
  CellTags->{"S5.50.1", "1.9"}],
Cell[7197, 233, 158, 4, 70, "MathCaption",
  CellTags->{"S5.50.1", "1.10"}],

Cell[CellGroupData[{
Cell[7380, 241, 160, 8, 70, "Input",
  CellTags->"S5.50.1"],
Cell[7543, 251, 343, 7, 70, "Output",
  CellTags->"S5.50.1"]
}, Open  ]]
}
]
*)




(***********************************************************************
End of Mathematica Notebook file.
***********************************************************************)

