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

                    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[      6396,        216]*)
(*NotebookOutlinePosition[      9580,        318]*)
(*  CellTagsIndexPosition[      9310,        303]*)
(*WindowFrame->Normal*)



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

Cell[TextData[{
  "There are various ways to decompose a matrix into the product of simpler \
matrices of special types. These decompositions are frequently useful in \
numerical matrix calculations. The most general of these decompositions can \
be computed using the built\[Hyphen]in functions ",
  StyleBox["QRDecomposition", "MR"],
  ", ",
  StyleBox["SchurDecomposition", "MR"],
  ", and ",
  StyleBox["SingularValues", "MR"],
  ". The Cholesky decomposition writes a symmetric positive definite matrix \
as the product of an upper\[Hyphen]triangular matrix and its transpose. "
}], "Text",
  CellTags->{"S5.46.1", "1.2"}],

Cell[BoxData[
    FormBox[
      StyleBox[
        FrameBox[
          StyleBox[GridBox[{
                {"\<\"\\!\\(\\*StyleBox[\\\"\\\\\\\"CholeskyDecomposition[m]\\\
\\\\\"\\\", \\\"MR\\\"]\\) \"\>", "\<\"find the Cholesky decomposition of the \
symmetric positive definite matrix \
\\!\\(\\*StyleBox[\\\"\\\\\\\"m\\\\\\\"\\\", \\\"TI\\\"]\\) \"\>"}
                },
              ColumnAlignments->{Right, Left}],
            GridBoxOptions->{RowLines->False}]],
        "2ColumnBox"], TraditionalForm]], "Text",
  CellTags->{"S5.46.1", "1.3"}],

Cell["Computing the Cholesky decomposition. ", "Caption",
  CellTags->"S5.46.1"],

Cell[TextData[{
  "A square matrix ",
  StyleBox["m", "MR"],
  " is symmetric if it is equal to its transpose. It is positive definite if \
",
  StyleBox["v", "TI"],
  StyleBox[".", "MR"],
  StyleBox["m", "TI"],
  StyleBox[".", "MR"],
  StyleBox["v", "TI"],
  " is positive for all nonzero vectors ",
  StyleBox["v", "MR"],
  ". Note that a symmetric positive definite matrix must always be real. The \
Cholesky decomposition gives an upper\[Hyphen]triangular matrix ",
  StyleBox["u", "MR"],
  " with the property such that ",
  StyleBox["m", "MR"],
  " can be written as ",
  StyleBox["Transpose[", "MR"],
  StyleBox["u", "TI"],
  StyleBox["].", "MR"],
  StyleBox["u", "TI"],
  ". "
}], "Text",
  CellTags->{"S5.46.1", "1.4"}],

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

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

Cell[TextData[{
  "Here is the ",
  Cell[BoxData[
      \(TraditionalForm\`4\[Cross]4\)], "InlineFormula"],
  " Hilbert matrix. It is obviously symmetric. "
}], "MathCaption",
  CellTags->{"S5.46.1", "1.6"}],

Cell[CellGroupData[{

Cell["\<\
hil = Table[
 1/(i + j - 1), {i, 1, 4}, {j, 1, 4}]\
\>", "Input",
  CellLabel->"In[2]:= ",
  CellTags->"S5.46.1"],

Cell[BoxData[
    \({{1, 1\/2, 1\/3, 1\/4}, {1\/2, 1\/3, 1\/4, 1\/5}, {1\/3, 1\/4, 1\/5, 
        1\/6}, {1\/4, 1\/5, 1\/6, 1\/7}}\)], "Output",
  CellLabel->"Out[2]= ",
  CellTags->"S5.46.1"]
}, Open  ]],

Cell[TextData[{
  "All of the eigenvalues of ",
  StyleBox["hil", "MR"],
  " are positive reals. This implies that the matrix is positive definite. "
}], "MathCaption",
  CellTags->{"S5.46.1", "1.7"}],

Cell[CellGroupData[{

Cell["Eigenvalues[ N[hil] ]", "Input",
  CellLabel->"In[3]:= ",
  CellTags->"S5.46.1"],

Cell[BoxData[
    \({1.5002142800592424`, 0.16914122022145014`, 0.006738273605760744`, 
      0.00009670230402260493`}\)], "Output",
  CellLabel->"Out[3]= ",
  CellTags->"S5.46.1"]
}, Open  ]],

Cell[TextData[{
  "Because the entries in ",
  StyleBox["hil", "MR"],
  " are fractions, you get an exact result. "
}], "MathCaption",
  CellTags->{"S5.46.1", "1.8"}],

Cell[CellGroupData[{

Cell["u =  CholeskyDecomposition[hil]", "Input",
  CellLabel->"In[4]:= ",
  CellTags->"S5.46.1"],

Cell[BoxData[
    \({{1, 1\/2, 1\/3, 1\/4}, {0, 1\/\(2\ \@3\), 
        1\/\(2\ \@3\), \(3\ \@3\)\/20}, {0, 0, 1\/\(6\ \@5\), 
        1\/\(4\ \@5\)}, {0, 0, 0, 1\/\(20\ \@7\)}}\)], "Output",
  CellLabel->"Out[4]= ",
  CellTags->"S5.46.1"]
}, Open  ]],

Cell[TextData[{
  "The product of ",
  StyleBox["u", "MR"],
  " and its transpose gives the original matrix ",
  StyleBox["hil", "MR"],
  ". "
}], "MathCaption",
  CellTags->{"S5.46.1", "1.9"}],

Cell[CellGroupData[{

Cell["MatrixForm[Transpose[u] . u]", "Input",
  CellLabel->"In[5]:= ",
  CellTags->"S5.46.1"],

Cell[BoxData[
    TagBox[
      RowBox[{"(", "\[NoBreak]", GridBox[{
            {"1", \(1\/2\), \(1\/3\), \(1\/4\)},
            {\(1\/2\), \(1\/3\), \(1\/4\), \(1\/5\)},
            {\(1\/3\), \(1\/4\), \(1\/5\), \(1\/6\)},
            {\(1\/4\), \(1\/5\), \(1\/6\), \(1\/7\)}
            }], "\[NoBreak]", ")"}],
      (MatrixForm[ #]&)]], "Output",
  CellLabel->"Out[5]//MatrixForm= ",
  CellTags->"S5.46.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.46.1"->{
    Cell[1717, 49, 143, 6, 70, "Subsection",
      CellTags->{"S5.46.1", "1.1"}],
    Cell[1863, 57, 627, 13, 70, "Text",
      CellTags->{"S5.46.1", "1.2"}],
    Cell[2493, 72, 551, 13, 70, "Text",
      CellTags->{"S5.46.1", "1.3"}],
    Cell[3047, 87, 80, 1, 70, "Caption",
      CellTags->"S5.46.1"],
    Cell[3130, 90, 728, 24, 70, "Text",
      CellTags->{"S5.46.1", "1.4"}],
    Cell[3861, 116, 79, 1, 70, "MathCaption",
      CellTags->{"S5.46.1", "1.5"}],
    Cell[3943, 119, 90, 2, 70, "Input",
      CellTags->"S5.46.1"],
    Cell[4036, 123, 207, 6, 70, "MathCaption",
      CellTags->{"S5.46.1", "1.6"}],
    Cell[4268, 133, 123, 5, 70, "Input",
      CellTags->"S5.46.1"],
    Cell[4394, 140, 192, 4, 70, "Output",
      CellTags->"S5.46.1"],
    Cell[4601, 147, 200, 5, 70, "MathCaption",
      CellTags->{"S5.46.1", "1.7"}],
    Cell[4826, 156, 86, 2, 70, "Input",
      CellTags->"S5.46.1"],
    Cell[4915, 160, 180, 4, 70, "Output",
      CellTags->"S5.46.1"],
    Cell[5110, 167, 166, 5, 70, "MathCaption",
      CellTags->{"S5.46.1", "1.8"}],
    Cell[5301, 176, 96, 2, 70, "Input",
      CellTags->"S5.46.1"],
    Cell[5400, 180, 239, 5, 70, "Output",
      CellTags->"S5.46.1"],
    Cell[5654, 188, 193, 7, 70, "MathCaption",
      CellTags->{"S5.46.1", "1.9"}],
    Cell[5872, 199, 93, 2, 70, "Input",
      CellTags->"S5.46.1"],
    Cell[5968, 203, 412, 10, 70, "Output",
      CellTags->"S5.46.1"]},
  "1.1"->{
    Cell[1717, 49, 143, 6, 70, "Subsection",
      CellTags->{"S5.46.1", "1.1"}]},
  "1.2"->{
    Cell[1863, 57, 627, 13, 70, "Text",
      CellTags->{"S5.46.1", "1.2"}]},
  "1.3"->{
    Cell[2493, 72, 551, 13, 70, "Text",
      CellTags->{"S5.46.1", "1.3"}]},
  "1.4"->{
    Cell[3130, 90, 728, 24, 70, "Text",
      CellTags->{"S5.46.1", "1.4"}]},
  "1.5"->{
    Cell[3861, 116, 79, 1, 70, "MathCaption",
      CellTags->{"S5.46.1", "1.5"}]},
  "1.6"->{
    Cell[4036, 123, 207, 6, 70, "MathCaption",
      CellTags->{"S5.46.1", "1.6"}]},
  "1.7"->{
    Cell[4601, 147, 200, 5, 70, "MathCaption",
      CellTags->{"S5.46.1", "1.7"}]},
  "1.8"->{
    Cell[5110, 167, 166, 5, 70, "MathCaption",
      CellTags->{"S5.46.1", "1.8"}]},
  "1.9"->{
    Cell[5654, 188, 193, 7, 70, "MathCaption",
      CellTags->{"S5.46.1", "1.9"}]}
  }
*)

(*CellTagsIndex
CellTagsIndex->{
  {"S5.46.1", 7021, 233},
  {"1.1", 8456, 272},
  {"1.2", 8550, 275},
  {"1.3", 8639, 278},
  {"1.4", 8728, 281},
  {"1.5", 8817, 284},
  {"1.6", 8912, 287},
  {"1.7", 9008, 290},
  {"1.8", 9104, 293},
  {"1.9", 9200, 296}
  }
*)

(*NotebookFileOutline
Notebook[{
Cell[1717, 49, 143, 6, 70, "Subsection",
  CellTags->{"S5.46.1", "1.1"}],
Cell[1863, 57, 627, 13, 70, "Text",
  CellTags->{"S5.46.1", "1.2"}],
Cell[2493, 72, 551, 13, 70, "Text",
  CellTags->{"S5.46.1", "1.3"}],
Cell[3047, 87, 80, 1, 70, "Caption",
  CellTags->"S5.46.1"],
Cell[3130, 90, 728, 24, 70, "Text",
  CellTags->{"S5.46.1", "1.4"}],
Cell[3861, 116, 79, 1, 70, "MathCaption",
  CellTags->{"S5.46.1", "1.5"}],
Cell[3943, 119, 90, 2, 70, "Input",
  CellTags->"S5.46.1"],
Cell[4036, 123, 207, 6, 70, "MathCaption",
  CellTags->{"S5.46.1", "1.6"}],

Cell[CellGroupData[{
Cell[4268, 133, 123, 5, 70, "Input",
  CellTags->"S5.46.1"],
Cell[4394, 140, 192, 4, 70, "Output",
  CellTags->"S5.46.1"]
}, Open  ]],
Cell[4601, 147, 200, 5, 70, "MathCaption",
  CellTags->{"S5.46.1", "1.7"}],

Cell[CellGroupData[{
Cell[4826, 156, 86, 2, 70, "Input",
  CellTags->"S5.46.1"],
Cell[4915, 160, 180, 4, 70, "Output",
  CellTags->"S5.46.1"]
}, Open  ]],
Cell[5110, 167, 166, 5, 70, "MathCaption",
  CellTags->{"S5.46.1", "1.8"}],

Cell[CellGroupData[{
Cell[5301, 176, 96, 2, 70, "Input",
  CellTags->"S5.46.1"],
Cell[5400, 180, 239, 5, 70, "Output",
  CellTags->"S5.46.1"]
}, Open  ]],
Cell[5654, 188, 193, 7, 70, "MathCaption",
  CellTags->{"S5.46.1", "1.9"}],

Cell[CellGroupData[{
Cell[5872, 199, 93, 2, 70, "Input",
  CellTags->"S5.46.1"],
Cell[5968, 203, 412, 10, 70, "Output",
  CellTags->"S5.46.1"]
}, Open  ]]
}
]
*)




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

