(*^ ::[paletteColors = 128; automaticGrouping; currentKernel; fontset = title, inactive, noPageBreakBelow, noPageBreakInGroup, nohscroll, preserveAspect, groupLikeTitle, center, M7, bold, L1, e8, 24, "Times"; ; fontset = subtitle, inactive, noPageBreakBelow, noPageBreakInGroup, nohscroll, preserveAspect, groupLikeTitle, center, M7, bold, L1, e6, 18, "Times"; ; fontset = subsubtitle, inactive, noPageBreakBelow, noPageBreakInGroup, nohscroll, preserveAspect, groupLikeTitle, center, M7, italic, L1, e6, 14, "Times"; ; fontset = section, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, grayBox, M22, bold, L1, a20, 18, "Times"; ; fontset = subsection, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, blackBox, M19, bold, L1, a15, 14, "Times"; ; fontset = subsubsection, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, whiteBox, M18, bold, L1, a12, 12, "Times"; ; fontset = text, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12; fontset = smalltext, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 10, "Times"; ; fontset = input, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeInput, M42, N23, bold, L1, 12, "Courier"; ; fontset = output, output, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L-5, 12, "Courier"; ; fontset = message, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L1, 12, "Courier"; ; fontset = print, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L1, 12, "Courier"; ; fontset = info, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L1, 12, "Courier"; ; fontset = postscript, PostScript, formatAsPostScript, output, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeGraphics, M7, l34, w282, h287, L1, 12, "Courier"; ; fontset = name, inactive, noPageBreakInGroup, nohscroll, preserveAspect, M7, italic, B65535, L1, 10, "Times"; ; fontset = header, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, italic, L1, 12, "Times"; ; fontset = Left Header, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, italic, L1, 12, "Times"; ; fontset = footer, inactive, nohscroll, noKeepOnOnePage, preserveAspect, center, M7, italic, L1, 12, "Times"; ; fontset = Left Footer, inactive, nohscroll, noKeepOnOnePage, preserveAspect, center, M7, italic, L1, 12, "Times"; ; fontset = help, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12; fontset = clipboard, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12; fontset = completions, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12, "Courier"; ; fontset = special1, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12; fontset = special2, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12; fontset = special3, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12; fontset = special4, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12; fontset = special5, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12; next21StandardFontEncoding; ] :[font = input; preserveAspect; center; ] Preliminaries ;[s] 1:0,0;13,-1; 1:1,16,12,Times,1,18,0,0,0; :[font = subsection; inactive; Cclosed; preserveAspect; startGroup; ] Matrix and Vector Formatting in Mathematica ;[s] 2:0,0;32,1;43,-1; 2:1,12,9,Times,1,14,0,0,0;1,13,10,Times,3,14,0,0,0; :[font = text; inactive; preserveAspect; ] We are going to cover several aspects of matrices today. But first, we need to understand how Mathematica handles matrices and vectors. This preliminary material (and much more!) is covered in the Mathematica book, pages 437-460. For example, here is how we would express a matrix from class notes that appeared as the augmented matrix of a linear system. Click on the next cell and press the key. ;[s] 5:0,0;96,1;108,2;201,3;212,4;415,-1; 5:1,11,8,Times,0,12,0,0,0;1,10,8,Times,2,12,0,0,0;1,11,8,Times,0,12,0,0,0;1,10,8,Times,2,12,0,0,0;1,11,8,Times,0,12,0,0,0; :[font = input; preserveAspect; ] a = {{1,1,1,2},{2,2,4,8},{0,0,2,2}} :[font = text; inactive; preserveAspect; ] This doesn't look very much like a matrix. To pretty it up a bit, click on the following cell. :[font = input; preserveAspect; ] MatrixForm[a] :[font = text; inactive; preserveAspect; ] Notice how a matrix consists of a list of lists (really rows), all of the same length. From a mathematical point of view vectors are merely special cases of matrices. However, Mathematica treats a vector as a different sort of object than a matrix. After all, it is rather inconvenient to define the right hand side vector b as follows: ;[s] 3:0,0;178,1;189,2;359,-1; 3:1,11,8,Times,0,12,0,0,0;1,10,8,Times,2,12,0,0,0;1,11,8,Times,0,12,0,0,0; :[font = input; preserveAspect; ] b = {{2},{8},{2}} :[font = input; preserveAspect; ] MatrixForm[b] :[font = text; inactive; preserveAspect; ] By the way, because Mathematica has been updated, you can click on and evaluate two cells at once (or drag the cursor over the right hand brackets on the cells above and hit ). ;[s] 3:0,0;20,1;31,2;188,-1; 3:1,11,8,Times,0,12,0,0,0;1,10,8,Times,2,12,0,0,0;1,11,8,Times,0,12,0,0,0; :[font = text; inactive; preserveAspect; ] Mathematica prefers to think of b as a simple list, without reference to row or column orientation. Thus, we could write: ;[s] 2:0,0;11,1;133,-1; 2:1,10,8,Times,2,12,0,0,0;1,11,8,Times,0,12,0,0,0; :[font = input; preserveAspect; ] b = {2,8,2} :[font = input; preserveAspect; endGroup; ] MatrixForm[b] ^*)