(*********************************************************************** 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[ 15297, 561]*) (*NotebookOutlinePosition[ 16385, 596]*) (* CellTagsIndexPosition[ 16341, 592]*) (*WindowFrame->Normal*) Notebook[{ Cell[CellGroupData[{ Cell[TextData["Project 6"], "Title", Evaluatable->False, AspectRatioFixed->True], Cell["Last revision: April 15 1998", "SmallText", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData["Author: YourNameGoesHere"], "Subtitle", CellFrame->True, Evaluatable->False, AspectRatioFixed->True, Background->GrayLevel[0.899992]], Cell[CellGroupData[{ Cell[TextData[ "Part A (Individually Pledged or Pledged with One Partner): Determinants and \ Recursion"], "Section", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox[ "1. Given a square matrix, the determinant can be calculated via the \ following recipe. Write a recursive function implementing the recipe. \n\n\ First, the determinant of any matrix of size \"", Evaluatable->False, AspectRatioFixed->True], StyleBox["1,1", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox[ "\" is simply the value of the element inside, so that the determinant of \ \"", Evaluatable->False, AspectRatioFixed->True], StyleBox["{{1}}", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox["\" is ", Evaluatable->False, AspectRatioFixed->True], StyleBox["1", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox[". \n\nNow suppose the matrix is called \"", Evaluatable->False, AspectRatioFixed->True], StyleBox["a", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox["\" and has size \"", Evaluatable->False, AspectRatioFixed->True], StyleBox["n,n", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox["\", where \"", Evaluatable->False, AspectRatioFixed->True], StyleBox["n", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox["\" is greater than 1. For each column \"", Evaluatable->False, AspectRatioFixed->True], StyleBox["i", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox["\" (from ", Evaluatable->False, AspectRatioFixed->True], StyleBox["1", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox[" to \"", Evaluatable->False, AspectRatioFixed->True], StyleBox["n", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox["\"), form the product of \"", Evaluatable->False, AspectRatioFixed->True], StyleBox["a[[1,i]]", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox["\", \"", Evaluatable->False, AspectRatioFixed->True], StyleBox["(-1)^(1+i)", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox["\", and the determinant of the square matrix \"", Evaluatable->False, AspectRatioFixed->True], StyleBox["b", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox["\" of size \"", Evaluatable->False, AspectRatioFixed->True], StyleBox["n-1,n-1", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox["\" formed by the rule \n\n ", Evaluatable->False, AspectRatioFixed->True], StyleBox["b[[j,k]] = a[[j+1,k+1]] ", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox[", if \"", Evaluatable->False, AspectRatioFixed->True], StyleBox["k", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox["\" is greater than or equal to \"", Evaluatable->False, AspectRatioFixed->True], StyleBox["i", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox["\", or \n ", Evaluatable->False, AspectRatioFixed->True], StyleBox["b[[j,k]] = a[[j+1,k]] ", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox[", if \"", Evaluatable->False, AspectRatioFixed->True], StyleBox["k", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox["\" is less than \"", Evaluatable->False, AspectRatioFixed->True], StyleBox["i", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox["\", \n\nwhere \"", Evaluatable->False, AspectRatioFixed->True], StyleBox["j", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox["\" and \"", Evaluatable->False, AspectRatioFixed->True], StyleBox["k", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox["\" range over ", Evaluatable->False, AspectRatioFixed->True], StyleBox["1", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox[" to \"", Evaluatable->False, AspectRatioFixed->True], StyleBox["n-1", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox[ "\". The determinant is the sum of these products.\n\nNote that the matrix \ \"", Evaluatable->False, AspectRatioFixed->True], StyleBox["b", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox["\" is different for each \"", Evaluatable->False, AspectRatioFixed->True], StyleBox["i", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox["\", and that ", Evaluatable->False, AspectRatioFixed->True], StyleBox["Mathematica", Evaluatable->False, AspectRatioFixed->True, FontSlant->"Italic"], StyleBox[" has a function \"", Evaluatable->False, AspectRatioFixed->True], StyleBox["Det[]", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox[ "\", which you should not use but should mimic.\n\nHere is an example. Let \ \"", Evaluatable->False, AspectRatioFixed->True], StyleBox["a", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox["\" be the matrix \"", Evaluatable->False, AspectRatioFixed->True], StyleBox["{{1,2},{3,4}}", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox[ "\". Following our recipe, the products we form should be as follows:\n\ ...for ", Evaluatable->False, AspectRatioFixed->True], StyleBox["i=1", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox[": ", Evaluatable->False, AspectRatioFixed->True], StyleBox["a[[1,1]] * (-1)^(1+1) * determinant(b1)", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox[", where ", Evaluatable->False, AspectRatioFixed->True], StyleBox["b1 = {{4}}", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox[";\n...for ", Evaluatable->False, AspectRatioFixed->True], StyleBox["i=2", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox[": ", Evaluatable->False, AspectRatioFixed->True], StyleBox["a[[1,2]] * (-1)^(1+2) * determinant(b2)", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox[", where ", Evaluatable->False, AspectRatioFixed->True], StyleBox["b2 = {{3}}", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox[".\nSince ", Evaluatable->False, AspectRatioFixed->True], StyleBox["determinant(b1)=4", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox[" and ", Evaluatable->False, AspectRatioFixed->True], StyleBox["determinant(b2)=3", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox[", our products are ", Evaluatable->False, AspectRatioFixed->True], StyleBox["1*1*4", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox[" and ", Evaluatable->False, AspectRatioFixed->True], StyleBox["2*(-1)*3", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox[", and the sum is ", Evaluatable->False, AspectRatioFixed->True], StyleBox["4-6=-2", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox[".", Evaluatable->False, AspectRatioFixed->True] }], "Text", Evaluatable->False, AspectRatioFixed->True] }, Closed]], Cell[CellGroupData[{ Cell[TextData[ "Part B (Individually Pledged or Pledged with One Partner): Matrix \ Multiplication and Iteration"], "Section", Evaluatable->False, AspectRatioFixed->True], Cell[TextData[{ StyleBox["Given a matrix \"", Evaluatable->False, AspectRatioFixed->True], StyleBox["a", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox["\" of size \"", Evaluatable->False, AspectRatioFixed->True], StyleBox["m,n", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox["\" and another matrix \"", Evaluatable->False, AspectRatioFixed->True], StyleBox["b", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox["\" of size \"", Evaluatable->False, AspectRatioFixed->True], StyleBox["n,r", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox["\", the standard matrix product of \"", Evaluatable->False, AspectRatioFixed->True], StyleBox["a", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox["\" and \"", Evaluatable->False, AspectRatioFixed->True], StyleBox["b", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox["\" is defined as follows: the product \"", Evaluatable->False, AspectRatioFixed->True], StyleBox["c", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox["\" is a matrix of size \"", Evaluatable->False, AspectRatioFixed->True], StyleBox["m,r", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox["\", the elements of which satisfy the formula \n\n ", Evaluatable->False, AspectRatioFixed->True], StyleBox[ "c[[i,j]] = a[[i,1]]*b[[1,j]] \n + a[[i,2]]*b[[2,j]] \n \ + a[[i,3]]*b[[3,j]] \n + ... \n + \ a[[i,n]]*b[[n,j]]", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox["\n\nas \"", Evaluatable->False, AspectRatioFixed->True], StyleBox["i", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox["\" ranges from ", Evaluatable->False, AspectRatioFixed->True], StyleBox["1", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox[" to \"", Evaluatable->False, AspectRatioFixed->True], StyleBox["m", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox["\" and \"", Evaluatable->False, AspectRatioFixed->True], StyleBox["j", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox["\" ranges from ", Evaluatable->False, AspectRatioFixed->True], StyleBox["1", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox[" to \"", Evaluatable->False, AspectRatioFixed->True], StyleBox["r", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox["\". \n\nWrite a function using \"", Evaluatable->False, AspectRatioFixed->True], StyleBox["Do[]", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox["\", \"", Evaluatable->False, AspectRatioFixed->True], StyleBox["For[]", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox["\", \"", Evaluatable->False, AspectRatioFixed->True], StyleBox["While[]", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox[ "\", or a combination to perform the matrix product of two parameter \ matrices \"", Evaluatable->False, AspectRatioFixed->True], StyleBox["a", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox["\" and \"", Evaluatable->False, AspectRatioFixed->True], StyleBox["b", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox["\".\n\nNote that the \"", Evaluatable->False, AspectRatioFixed->True], StyleBox["Dot[]", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox["\" function or the dot operator \"", Evaluatable->False, AspectRatioFixed->True], StyleBox[".", Evaluatable->False, AspectRatioFixed->True, FontFamily->"Courier"], StyleBox["\" accomplishes matrix multiplication in ", Evaluatable->False, AspectRatioFixed->True], StyleBox["Mathematica", Evaluatable->False, AspectRatioFixed->True, FontSlant->"Italic"], StyleBox[ "; use these to check your answer, but do not use them in your program. ", Evaluatable->False, AspectRatioFixed->True] }], "Text", Evaluatable->False, AspectRatioFixed->True] }, Closed]] }, Open ]] }, Open ]] }, FrontEndVersion->"4.0 for Macintosh", ScreenRectangle->{{0, 1152}, {0, 850}}, WindowToolbars->{}, WindowSize->{643, 572}, WindowMargins->{{4, Automatic}, {Automatic, 1}}, PrintingCopies->1, PrintingPageRange->{1, Automatic}, PrivateNotebookOptions->{"ColorPalette"->{RGBColor, -1}}, ShowCellLabel->True, ShowCellTags->False, RenderingOptions->{"ObjectDithering"->True, "RasterDithering"->False}, MacintoshSystemPageSetup->"\<\ 00<0004/0B`000003809T?o>old" ] (*********************************************************************** 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->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[1739, 51, 84, 2, 98, "Title", Evaluatable->False], Cell[1826, 55, 98, 2, 26, "SmallText", Evaluatable->False], Cell[CellGroupData[{ Cell[1949, 61, 156, 4, 77, "Subtitle", Evaluatable->False], Cell[CellGroupData[{ Cell[2130, 69, 166, 4, 68, "Section", Evaluatable->False], Cell[2299, 75, 8033, 297, 400, "Text", Evaluatable->False] }, Closed]], Cell[CellGroupData[{ Cell[10369, 377, 175, 4, 48, "Section", Evaluatable->False], Cell[10547, 383, 4710, 173, 272, "Text", Evaluatable->False] }, Closed]] }, Open ]] }, Open ]] } ] *) (*********************************************************************** End of Mathematica Notebook file. ***********************************************************************)