(* Content-type: application/mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 6.0' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 145, 7] NotebookDataLength[ 11833, 477] NotebookOptionsPosition[ 9469, 398] NotebookOutlinePosition[ 9878, 416] CellTagsIndexPosition[ 9835, 413] WindowFrame->Normal ContainsDynamic->False*) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell["Solutions Exercises (1)", "Title"], Cell["\<\ Assigned: January 17, 2006 Due: before class on January 24, 2006\ \>", "Subsubtitle"], Cell[BoxData[ RowBox[{ RowBox[{"Off", "[", RowBox[{"General", "::", "\"\\""}], "]"}], ";"}]], "Input"], Cell[CellGroupData[{ Cell["Getting Help", "Subsection"], Cell[TextData[{ "Use the ", StyleBox["?", FontWeight->"Bold"], " command to find all commands that begin with the letters ", StyleBox["P ", FontWeight->"Bold"], "and", StyleBox[" Q", FontWeight->"Bold"], "." }], "Text"], Cell[BoxData[ RowBox[{"?", "P*"}]], "Input"], Cell[BoxData[ RowBox[{"?", "Q*"}]], "Input"] }, Closed]], Cell[CellGroupData[{ Cell["Using the Help Browser", "Subsection"], Cell[TextData[{ "Use the Help Browser and describe the basic differences between ", StyleBox["Plot", FontWeight->"Bold"], " and ", StyleBox["ListPlot", FontWeight->"Bold"], ". In particular, describe the argument to each command in words." }], "Text"], Cell[BoxData[ RowBox[{"?", "Plot"}]], "Input"], Cell[BoxData[ RowBox[{"?", "ListPlot"}]], "Input"] }, Closed]], Cell[CellGroupData[{ Cell["Simple Evaluation", "Subsection"], Cell["\<\ Evaluate the following pairs of expressions and describe in words why they \ are different.\ \>", "Text"], Cell[BoxData[ RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"2", " ", "x"}], " ", "+", " ", RowBox[{"x", " ", "7"}]}], ",", " ", RowBox[{ RowBox[{"2", "x"}], " ", "+", " ", "x7"}]}], "}"}]], "Input"], Cell[TextData[{ "x7 ", StyleBox["is a symbolic name; whereas, ", FontSlant->"Plain"], "x ", StyleBox["7 (with a space in-between) is the same as ", FontSlant->"Plain"], "x", StyleBox["*7.", FontSlant->"Plain"] }], "Text", FontSlant->"Italic"], Cell[BoxData[ RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"2", " ", "meters"}], " ", "+", " ", RowBox[{"7", " ", "meters"}]}], ",", " ", RowBox[{ RowBox[{"1", " ", "meter"}], " ", "+", " ", RowBox[{"8", " ", "meters"}]}]}], "}"}]], "Input"], Cell["A \"meter\" is not a \"meters\". ", "Text"] }, Closed]], Cell[CellGroupData[{ Cell["Working with Real numbers", "Subsection"], Cell[TextData[{ "(1) Find the numerical value for", StyleBox[" Sin[53 \[Degree]]", FontWeight->"Bold"], " to six significant figures." }], "Text"], Cell[BoxData[ RowBox[{"N", "[", RowBox[{ RowBox[{"Sin", "[", RowBox[{"53", " ", "\[Degree]"}], "]"}], ",", " ", "6"}], "]"}]], "Input"], Cell[TextData[{ "(2) Find the 2001st significant figure of ", StyleBox["\[Pi]", FontWeight->"Bold"], "." }], "Text"], Cell[BoxData[ RowBox[{"?", "RealDigits"}]], "Input"], Cell[BoxData[ RowBox[{"Last", "[", RowBox[{"First", "[", RowBox[{"RealDigits", "[", RowBox[{"N", "[", RowBox[{"\[Pi]", ",", "2001"}], "]"}], "]"}], "]"}], "]"}]], "Input"], Cell[TextData[{ "(3) Find ", StyleBox["Tan[50] - 1", FontWeight->"Bold"], " to 10 significant figures." }], "Text"], Cell[BoxData[ RowBox[{"N", "[", RowBox[{ RowBox[{ RowBox[{"Tan", "[", "50", "]"}], " ", "-", " ", "1"}], ",", " ", "10"}], "]"}]], "Input"], Cell[TextData[{ "(4) Find the real and imaginary parts of the complex number ", StyleBox["z = Exp[2 + 9 I]", FontWeight->"Bold"], "." }], "Text"], Cell[BoxData[ RowBox[{"z", " ", "=", " ", SuperscriptBox["\[ExponentialE]", RowBox[{"2", " ", "+", " ", RowBox[{"9", " ", "\[ImaginaryI]"}]}]]}]], "Input"], Cell[BoxData[ RowBox[{"Re", "[", "z", "]"}]], "Input"], Cell[BoxData[ RowBox[{"Im", "[", "z", "]"}]], "Input"] }, Closed]], Cell[CellGroupData[{ Cell["Procedures", "Subsection"], Cell[TextData[{ "Construct a list of 30 random number using,", StyleBox[" \n", FontFamily->"Courier"], StyleBox["list = Table[Random[ Real, {0, 20} ], {i, 30}].", FontFamily->"Courier", FontWeight->"Bold"], " \nWrite a procedure that will retain only those elements having values \ between 6 and 15. Try sorting the list from largest to smallest." }], "Text"], Cell[BoxData[ RowBox[{"list1", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"RandomReal", "[", RowBox[{"{", RowBox[{"0", ",", "20"}], "}"}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", "30"}], "}"}]}], "]"}]}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"proc6To15", "[", "x_", "]"}], " ", ":=", " ", RowBox[{"Select", "[", RowBox[{"x", ",", " ", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"6", " ", "<", " ", "#"}], ")"}], " ", "&&", " ", RowBox[{"(", RowBox[{"#", " ", "<", " ", "15"}], ")"}]}], " ", "&"}]}], "]"}]}]], "Input"], Cell[BoxData[ RowBox[{"proc6To15", "[", "list1", "]"}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"sort6To15", "[", "x_", "]"}], " ", ":=", " ", RowBox[{"Sort", "[", RowBox[{ RowBox[{"proc6To15", "[", "x", "]"}], ",", "Less"}], "]"}]}]], "Input"], Cell[BoxData[ RowBox[{"sort6To15", "[", "list1", "]"}]], "Input"] }, Closed]], Cell[CellGroupData[{ Cell["Collision?", "Subsection"], Cell[TextData[{ "A train pulls out of a station. It moves along the tracks following the \ equation ", StyleBox["s = 0.1 t^2", FontWeight->"Bold"], ", where ", StyleBox["s", FontWeight->"Bold"], " is the distance along the track and ", StyleBox["t", FontWeight->"Bold"], " is time.\nAnother train arrives at the station at high-speed and moves \ along the track according to the equation", StyleBox[" s = -4 + 5 t - t^2 - t^3", FontWeight->"Bold"], ". The second train eventually comes to a stop and moves backwards." }], "Text"], Cell[TextData[{ "Question: Use ", StyleBox["Plot[\[Ellipsis]]", FontWeight->"Bold"], " to deter ine if the two trains collide." }], "Text"], Cell[BoxData[ RowBox[{"Plot", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"0.1`", " ", SuperscriptBox["t", "2"]}], ",", RowBox[{ RowBox[{"-", "4"}], "+", RowBox[{"5", " ", "t"}], "-", SuperscriptBox["t", "2"], "-", SuperscriptBox["t", "3"]}]}], "}"}], ",", RowBox[{"{", RowBox[{"t", ",", "0", ",", "4"}], "}"}]}], "]"}]], "Input"], Cell["Therefore, the two trains do not collide.", "Text"] }, Closed]], Cell[CellGroupData[{ Cell["Find the Function", "Subsection"], Cell[TextData[{ "Below you'll find four graphs generated using the ", StyleBox["Plot", FontWeight->"Bold"], " and ", StyleBox["ListPlot", FontWeight->"Bold"], " commands. In each case, the expression ploted (or \"list-plotted\") was a \ combination of polynomials (like ", StyleBox["x", FontWeight->"Bold"], ",", StyleBox[" x^2", FontWeight->"Bold"], ", ", StyleBox["x^3", FontWeight->"Bold"], ",\[Ellipsis]), basic trig functions (", StyleBox["Sin", FontWeight->"Bold"], " and ", StyleBox["Cos", FontWeight->"Bold"], "), and the ", StyleBox["If", FontWeight->"Bold"], " command (used for the last plot)." }], "Text"], Cell[TextData[{ "Can you duplicate these plots using either ", StyleBox["Plot[\[Ellipsis]]", FontWeight->"Bold"], " or", StyleBox[" ListPlot[Table[\[Ellipsis]]]", FontWeight->"Bold"], "?" }], "Text"], Cell[BoxData[ RowBox[{"Plot", "[", RowBox[{ RowBox[{"x", "+", RowBox[{"Sin", "[", RowBox[{"3", " ", "x"}], "]"}]}], ",", RowBox[{"{", RowBox[{"x", ",", "0", ",", "9"}], "}"}]}], "]"}]], "Input"], Cell[BoxData[ RowBox[{"ListPlot", "[", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{"x", ",", RowBox[{"1", "+", SuperscriptBox[ RowBox[{"(", RowBox[{ RowBox[{"Cos", "[", "x", "]"}], "+", "1"}], ")"}], "2"]}]}], "}"}], ",", RowBox[{"{", RowBox[{"x", ",", RowBox[{"-", "10"}], ",", "10", ",", "0.1`"}], "}"}]}], "]"}], ",", RowBox[{"PlotRange", "\[Rule]", RowBox[{"{", RowBox[{"0", ",", "6"}], "}"}]}]}], "]"}]], "Input"], Cell[BoxData[ RowBox[{"ListPlot", "[", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"Sin", "[", "y", "]"}], ",", RowBox[{"y", "+", RowBox[{"Sin", "[", RowBox[{"2", " ", "y"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"y", ",", "0", ",", RowBox[{"2", " ", "\[Pi]"}], ",", "0.1`"}], "}"}]}], "]"}], ",", RowBox[{"PlotRange", "\[Rule]", RowBox[{"{", RowBox[{"0", ",", "6"}], "}"}]}]}], "]"}]], "Input"], Cell[BoxData[ RowBox[{"Plot", "[", RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"x", ">", "0.5`"}], "&&", RowBox[{"x", "<", "1.5`"}]}], ",", RowBox[{"1.`", "\[InvisibleSpace]", "-", SuperscriptBox["x", "2"]}], ",", RowBox[{"2", "-", "x"}]}], "]"}], ",", RowBox[{"{", RowBox[{"x", ",", RowBox[{"-", "2"}], ",", "3"}], "}"}]}], "]"}]], "Input"] }, Closed]] }, Open ]] }, WindowSize->{837, 929}, WindowMargins->{{47, Automatic}, {Automatic, 0}}, PrintingCopies->1, PrintingPageRange->{1, Automatic}, ShowSelection->True, FrontEndVersion->"6.0 for Mac OS X x86 (32-bit) (May 21, 2008)", StyleDefinitions->"Default.nb" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[590, 23, 40, 0, 73, "Title"], Cell[633, 25, 95, 3, 45, "Subsubtitle"], Cell[731, 30, 118, 3, 28, "Input"], Cell[CellGroupData[{ Cell[874, 37, 34, 0, 33, "Subsection"], Cell[911, 39, 232, 11, 27, "Text"], Cell[1146, 52, 45, 1, 28, "Input"], Cell[1194, 55, 45, 1, 28, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[1276, 61, 44, 0, 25, "Subsection"], Cell[1323, 63, 260, 8, 27, "Text"], Cell[1586, 73, 47, 1, 28, "Input"], Cell[1636, 76, 51, 1, 28, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[1724, 82, 39, 0, 25, "Subsection"], Cell[1766, 84, 115, 3, 27, "Text"], Cell[1884, 89, 216, 7, 28, "Input"], Cell[2103, 98, 255, 11, 27, "Text"], Cell[2361, 111, 264, 8, 28, "Input"], Cell[2628, 121, 49, 0, 27, "Text"] }, Closed]], Cell[CellGroupData[{ Cell[2714, 126, 47, 0, 25, "Subsection"], Cell[2764, 128, 151, 5, 27, "Text"], Cell[2918, 135, 147, 4, 28, "Input"], Cell[3068, 141, 121, 5, 27, "Text"], Cell[3192, 148, 53, 1, 28, "Input"], Cell[3248, 151, 190, 5, 28, "Input"], Cell[3441, 158, 120, 5, 27, "Text"], Cell[3564, 165, 153, 5, 28, "Input"], Cell[3720, 172, 150, 5, 27, "Text"], Cell[3873, 179, 168, 4, 30, "Input"], Cell[4044, 185, 55, 1, 28, "Input"], Cell[4102, 188, 55, 1, 28, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[4194, 194, 32, 0, 25, "Subsection"], Cell[4229, 196, 369, 9, 59, "Text"], Cell[4601, 207, 264, 8, 28, "Input"], Cell[4868, 217, 356, 11, 28, "Input"], Cell[5227, 230, 66, 1, 28, "Input"], Cell[5296, 233, 193, 5, 28, "Input"], Cell[5492, 240, 66, 1, 28, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[5595, 246, 32, 0, 25, "Subsection"], Cell[5630, 248, 546, 16, 59, "Text"], Cell[6179, 266, 144, 5, 27, "Text"], Cell[6326, 273, 396, 13, 33, "Input"], Cell[6725, 288, 57, 0, 27, "Text"] }, Closed]], Cell[CellGroupData[{ Cell[6819, 293, 39, 0, 25, "Subsection"], Cell[6861, 295, 651, 27, 43, "Text"], Cell[7515, 324, 208, 8, 27, "Text"], Cell[7726, 334, 221, 7, 28, "Input"], Cell[7950, 343, 549, 18, 33, "Input"], Cell[8502, 363, 521, 16, 28, "Input"], Cell[9026, 381, 415, 13, 33, "Input"] }, Closed]] }, Open ]] } ] *) (* End of internal cache information *)