(*^ ::[ Information = "This is a Mathematica Notebook file. It contains ASCII text, and can be transferred by email, ftp, or other text-file transfer utility. It should be read or edited using a copy of Mathematica or MathReader. If you received this as email, use your mail application or copy/paste to save everything from the line containing (*^ down to the line containing ^*) into a plain text file. On some systems you may have to give the file a name ending with ".ma" to allow Mathematica to recognize it as a Notebook. The line below identifies what version of Mathematica created this file, but it can be opened using any other version as well."; FrontEndVersion = "Macintosh Mathematica Notebook Front End Version 2.2"; MacintoshStandardFontEncoding; fontset = title, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, bold, e8, 24, "Times"; fontset = subtitle, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, bold, e6, 18, "Times"; fontset = subsubtitle, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, italic, e6, 14, "Times"; fontset = section, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, grayBox, M22, bold, a20, 18, "Times"; fontset = subsection, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, blackBox, M19, bold, a15, 14, "Times"; fontset = subsubsection, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, whiteBox, M18, bold, a12, 12, "Times"; fontset = text, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = smalltext, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 10, "Times"; fontset = input, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeInput, M42, N23, bold, L-5, 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, R65535, L-5, 12, "Courier"; fontset = print, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L-5, 12, "Courier"; fontset = info, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, B65535, L-5, 12, "Courier"; fontset = postscript, PostScript, formatAsPostScript, output, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeGraphics, M7, l34, w282, h287, 12, "Courier"; fontset = name, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, italic, 10, "Geneva"; fontset = header, inactive, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = leftheader, inactive, L2, 12, "Times"; fontset = footer, inactive, noKeepOnOnePage, preserveAspect, center, M7, 12, "Times"; fontset = leftfooter, inactive, L2, 12, "Times"; fontset = help, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 10, "Times"; fontset = clipboard, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = completions, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = special1, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = special2, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = special3, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = special4, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = special5, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; paletteColors = 128; currentKernel; ] :[font = subtitle; inactive; preserveAspect; startGroup] Linear Methods of Applied Mathematics Linear equations and linear operators ;[s] 3:0,0;38,1;39,0;77,-1; 2:2,19,14,Times,1,18,0,0,0;1,13,9,Times,1,12,0,0,0; :[font = text; inactive; preserveAspect; plain; bold] (c) Copyright 1994-1997 by Evans M. Harrell II and James V. Herod. All rights reserved. :[font = text; inactive; Cclosed; preserveAspect; fontSize = 18; startGroup] Instructions :[font = text; inactive; preserveAspect; endGroup] This notebook uses Mathematica to perform calculations for Harrell and Herod's hypertext book, Linear Methods of Applied Mathematics. The student needs only a basic knowledge of Mathematica to use the notebook, which is designed both to show how to work problems in the text and to provide a template for using Mathematica to work other problems of the student's own design. Calculations will be performed when the reader presses enter in a given calculation cell (bold print). It is best to activate the cells in order, so that Mathematica will be able to call on operators and functions defined in earlier cells. Red color coding is used to warn the reader when a given calculation relies on an earlier one. ;[s] 11:0,0;19,1;30,0;96,1;133,0;181,1;192,0;315,1;326,0;538,1;549,0;721,-1; 2:6,13,9,Times,0,12,0,0,0;5,13,9,Times,2,12,0,0,0; :[font = text; inactive; preserveAspect] In this notebook we review how Mathematica handles vectors. In Mathematica's notation, vectors are represented as lists, that is, a string of items within braces: {2,3}. Mathematica manipulates them in a straightforward way. ;[s] 3:0,0;31,1;43,0;227,-1; 2:2,13,9,Times,0,12,0,0,0;1,13,9,Times,2,12,0,0,0; :[font = subsection; inactive; Cclosed; preserveAspect; startGroup] Examples of basic vector operations :[font = text; inactive; preserveAspect] Addition of possibly complex-valued vectors (the square-root of -1 is denoted I): :[font = input; preserveAspect] {2,3} + {4 + I, 2} ;[s] 2:0,2;18,1;19,-1; 3:0,7,10,Courier,1,12,0,0,0;1,7,9,Times,0,12,0,0,0;1,7,9,Times,1,12,0,0,0; :[font = text; inactive; preserveAspect] The dot product: :[font = input; preserveAspect] {2,3}.{1,2} :[font = text; inactive; preserveAspect] Alternative syntax for the dot product: :[font = input; preserveAspect] Dot[{2,3},{1,2}] :[font = text; inactive; preserveAspect] Some examples for 4-component vectors, in the space C4. ;[s] 3:0,0;53,1;54,0;56,-1; 2:2,13,9,Times,0,12,0,0,0;1,13,9,Times,32,12,0,0,0; :[font = input; preserveAspect] {1,2,3,4} +{1,0,-1,-2} ;[s] 1:0,1;23,-1; 2:0,7,10,Courier,1,12,0,0,0;1,7,9,Times,1,12,0,0,0; :[font = input; preserveAspect] {1,2,3,4}.{1,0,-1,-2} ;[s] 1:0,1;22,-1; 2:0,7,10,Courier,1,12,0,0,0;1,7,9,Times,1,12,0,0,0; :[font = input; preserveAspect] % == 1 * 1 + 2 * 0 + 3 *(-1) + 4 *(-2) ;[s] 1:0,1;39,-1; 2:0,7,10,Courier,1,12,0,0,0;1,7,9,Times,1,12,0,0,0; :[font = text; inactive; preserveAspect; endGroup] (% refers to the result of the previous calculation in Mathematica, and you need double == to indicate that the entire expression is regarded as a logical variable.) :[font = subsection; inactive; Cclosed; preserveAspect; startGroup] Matrices in Mathematica ;[s] 2:0,0;12,1;24,-1; 2:1,16,12,Times,1,14,0,0,0;1,16,12,Times,3,14,0,0,0; :[font = text; inactive; preserveAspect; endGroup; endGroup] In Mathematica a matrix is a list of lists - after all it consists of a string of row vectors: In:= m1 := {{1,0,I},{-1,Pi,2+I}} In:= m2 := {{2,-I,0},{-1,-Pi,2-I}} In:= m1 + m2 Out= {{3, -I, I}, {-2, 0, 4}} In:= MatrixForm[%] Out//MatrixForm= 3 -I I -2 0 4 (A useful display option particularly for big matrices.) In:= 5 m1 Out= {{5, 0, 5 I}, {-5, 5 Pi, 10 + 5 I}} ^*)