(* 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[ 36039, 1295] NotebookOptionsPosition[ 29187, 1100] NotebookOutlinePosition[ 30693, 1153] CellTagsIndexPosition[ 30459, 1143] WindowFrame->Normal ContainsDynamic->False*) (* Beginning of Notebook Content *) Notebook[{ Cell["Beginning Mathematica", "Title"], Cell["Mark Senn", "Subtitle"], Cell["\<\ revised: September 28, 2008 created: December 5, 2006\ \>", "Subsubtitle", CellChangeTimes->{{3.431628900737224*^9, 3.431628946780631*^9}}], Cell[TextData[{ ButtonBox["Wolfram Research", BaseStyle->"Hyperlink", ButtonData:>{ URL["http://www.wolfram.com"], None}], StyleBox["'s ", "Text"], StyleBox[ButtonBox["Mathematica", BaseStyle->"Hyperlink", ButtonData:>{ URL["http://www.wolfram.com/products/mathematica"], None}], FontSlant->"Italic"], StyleBox[" is ", "Text"], StyleBox["the world's only fully integrated environment for technical \ computing. ", "Text", FontFamily->"Times"], StyleBox["It does symbolic mathematics, numeric mathematics, graphics, and \ interactive notebooks (you're reading one now). There is a separate grid", "Text"], StyleBox["Mathematica", "Text", FontSlant->"Italic"], StyleBox[" product for using ", "Text"], StyleBox["Mathematica", "Text", FontSlant->"Italic"], StyleBox[" on clustered computers, ", "Text"], Cell[BoxData[ FormBox[ RowBox[{"web", StyleBox[ AdjustmentBox["Mathematica", BoxMargins->{{-0.175, 0}, {0, 0}}], FontSlant->"Italic"]}], TextForm]]], StyleBox[" for using ", "Text"], StyleBox["Mathematica", "Text", FontSlant->"Italic"], StyleBox[" over the web, and a slew of application packages and programs.\n\n\ ", "Text"], StyleBox["Mathematica", "Text", FontSlant->"Italic"], StyleBox[" is built on the powerful unifying idea that ", "Text"], StyleBox["everything", "Text", FontSlant->"Italic"], StyleBox[" can be represented as a symbolic expression. For example, ", "Text"], Cell[BoxData[ FormBox[ RowBox[{"x", " ", "+", " ", "y"}], TraditionalForm]]], StyleBox[" is represented internally as ", "Text"], StyleBox["Plus[x,y]", "Text", FontFamily->"Courier New"], StyleBox[",", "Text", FontFamily->"Times New Roman"], StyleBox[" ", "Text"], StyleBox["{x, y, z}", "Text", FontSlant->"Italic"], StyleBox[" is represented internally as ", "Text"], StyleBox["List[x,y,z]", "Text", FontFamily->"Courier New"], StyleBox[",", "Text", FontFamily->"Times New Roman"], StyleBox[" ", "Text", FontFamily->"Courier"], StyleBox["etc. I", "Text", FontFamily->"Times New Roman"], StyleBox["n", "Text", FontFamily->"Times New Roman", FontVariations->{"CompatibilityType"->0}], StyleBox[" ", "Text", FontFamily->"Times", FontVariations->{"CompatibilityType"->0}], StyleBox["Mathematica", "Text", FontFamily->"Times", FontSlant->"Italic", FontVariations->{"CompatibilityType"->0}], StyleBox[" ", "Text", FontFamily->"Courier"], StyleBox["there are few concepts but they are used many different ways.\n\n", "Text"], StyleBox["Mathematica", "Text", FontSlant->"Italic"], StyleBox[" is a very comprehensive software package. This document just \ demonstrates a tiny fraction of ", "Text"], StyleBox["Mathematica", "Text", FontSlant->"Italic"], StyleBox[" and is meant to help people get started using it.", "Text", FontVariations->{"CompatibilityType"->0}] }], "Text", TextJustification->0], Cell["Table of Contents", "Section"], Cell[TextData[{ Cell[BoxData[ FormBox[ ButtonBox["Interfaces", BaseStyle->"Hyperlink", ButtonData:>"Interfaces"], TraditionalForm]]], "\n", Cell[BoxData[ FormBox[ ButtonBox[ ButtonBox["Help", BaseStyle->"Hyperlink", ButtonData:>"Help"], BaseStyle->"Hyperlink", ButtonData:>"Help"], TraditionalForm]]], "\n", Cell[BoxData[ FormBox[ ButtonBox["Notebooks", BaseStyle->"Hyperlink", ButtonData:>"Notebooks"], TraditionalForm]]], "\n", ButtonBox["Numeric Mathematics", BaseStyle->"Hyperlink", ButtonData:>"Numeric Mathematics"], "\n", ButtonBox["Symbolic Mathematics", BaseStyle->"Hyperlink", ButtonData:>"Symbolic Mathematics"], "\n", ButtonBox["Graphics", BaseStyle->"Hyperlink", ButtonData:>"Graphics"] }], "Text", GeneratedCell->False, CellAutoOverwrite->False], Cell["\<\ Interfaces\ \>", "Section", GeneratedCell->False, CellAutoOverwrite->False, CellTags->"Interfaces"], Cell[TextData[{ StyleBox["Mathematica", "Text", FontSlant->"Italic"], StyleBox[" comes with two interfaces: ", "Text"], StyleBox["math", "Text", FontFamily->"Courier New"], StyleBox[" and ", "Text"], StyleBox["mathematica", "Text", FontFamily->"Courier New"], StyleBox[". I ", "Text", FontFamily->"Times New Roman"], StyleBox["recommend people using ", "Text", FontFamily->"Times"], StyleBox["Mathematica", "Text", FontFamily->"Times", FontSlant->"Italic"], StyleBox[" interactively use the ", "Text", FontFamily->"Times"], StyleBox["mathematica", "Text", FontFamily->"Courier New", FontVariations->{"CompatibilityType"->0}], StyleBox[" ", "Text", FontFamily->"Times", FontSlant->"Italic"], StyleBox["interface and any other programs that use ", "Text", FontFamily->"Times"], StyleBox["Mathematica", "Text", FontFamily->"Times", FontSlant->"Italic"], StyleBox[" non-interactively use the ", "Text", FontFamily->"Times"], StyleBox["math", "Text", FontFamily->"Courier New"], StyleBox[" interface.", "Text", FontFamily->"Times"], "\n", StyleBox["The rest of this document is only applicable for the ", "Text", FontFamily->"Times"], StyleBox["mathematica", "Text", FontFamily->"Courier New"], StyleBox[" interface.", "Text", FontFamily->"Times"] }], "Text", GeneratedCell->False, CellAutoOverwrite->False], Cell["Help", "Section", GeneratedCell->False, CellAutoOverwrite->False, CellTags->"Help"], Cell[TextData[{ "For ", StyleBox["Mathematica", FontSlant->"Italic"], " help s", StyleBox["ee ", FontFamily->"Times"], StyleBox["Mathematica'", FontFamily->"Times", FontSlant->"Italic"], StyleBox["s on-", FontFamily->"Times"], "line help system (c", StyleBox["lick on the word ``Help'' on the top part of ", FontFamily->"Times"], StyleBox["Mathematica", FontFamily->"Times", FontSlant->"Italic"], StyleBox[" window), or see ", FontFamily->"Times"], ButtonBox["Wolfram Research's Documenation Center", BaseStyle->"Hyperlink", ButtonData:>{ URL["http://documents.wolfram.com"], None}], StyleBox[".", FontFamily->"Times"] }], "Text", GeneratedCell->False, CellAutoOverwrite->False], Cell["Notebooks", "Section", GeneratedCell->False, CellAutoOverwrite->False, CellTags->"Notebooks"], Cell[TextData[{ "Normally, when Mathematica starts up everything you type is in an \"input\" \ cell and when you type \"Shift Enter\" Mathematica evaluates what you type. \ If you type input followed by \";\" ", StyleBox["Mathematica", FontSlant->"Italic"], " evaluates it but doesn't print the result." }], "Text"], Cell[TextData[{ "You may be wondering how stuff like this paragraph was input. This is a \ \"text\" cell. Don't worry if this doesn't make much sense now, the \ important ideas are the appearance of a notebook is controlled by a style \ sheet and notebooks consist of cells. Notebooks are all represented \ internally in ", StyleBox["Mathematica", FontSlant->"Italic"], " with Notebook[\[Ellipsis]]. Sometimes notebooks are described after \ everything else in ", StyleBox["Mathematica", FontSlant->"Italic"], " training...I think it is better to at least have the information here so \ you know where to find it later." }], "Text", GeneratedCell->False, CellAutoOverwrite->False], Cell["Style Sheets", "Subsection"], Cell[TextData[{ "Notebooks are stored internally in ", StyleBox["Mathematica", FontSlant->"Italic"], " using the generic ", StyleBox["Notebook[\[Ellipsis]] ", FontFamily->"Courier New"], "function. The style used to display a notebook is controlled by the style \ sheet. This notebook uses the \"Textbook\" style sheet (", StyleBox["Format => Style Sheet => Textbook", FontFamily->"Courier New"], ")." }], "Text", GeneratedCell->False, CellAutoOverwrite->False], Cell["Cells", "Subsection"], Cell["Notebooks consist of cells. There are", "Text"], Cell["\<\ Title Subtitle Subsubtitle Section Subsection Subsubsection Text MathCaption Input etc.\ \>", "IndentedText", GeneratedCell->False, CellAutoOverwrite->False], Cell[TextData[{ "cell types. This subsection starts with a \"Cells\" Subsection cell, \ followed by a Text cell, and then (immediately above) an IndentedText cell. \ Input cells are evaluated by ", StyleBox["Mathematica", FontSlant->"Italic"], ".\nCell structure is shown using the blue brackets on the right hand side \ of the window. Cells can be nested. Cell types and cell structure can be \ changed.\nTo delete a cell left click on the cell bracket and type Back \ Space.\nTo change cell type left click on cell bracket and do ", StyleBox["Format => Style => \[Ellipsis]", FontFamily->"Courier New"], ".", StyleBox["\n", FontFamily->"Courier New"], "To combine multiple cells to make one, left click on first cell bracket, \ shift-left-click on other cells to combine, and then do ", StyleBox["Cell => Merge Cells", FontFamily->"Courier New"], ".\nTo divide an existing cell into two, left click in the text where you'd \ like to divide a cell and then do ", StyleBox["Cell => Divide Cell", FontFamily->"Courier New"], "." }], "Text", GeneratedCell->False, CellAutoOverwrite->False], Cell["Making External Links", "Subsection"], Cell[TextData[{ "To make a link like this one to ", ButtonBox["abbymath.com", BaseStyle->"Hyperlink", ButtonData:>{ URL["http://www.abbymath.com"], None}], " I did the following:" }], "Text"], Cell[TextData[{ "type above paragraph into text cell\nmove mouse to beginning of \ \"abbymath.com\" in above paragraph\nleft click and hold left mouse button \ down\nmove mouse to end of \"abbymath.com\"\nlet up on mouse button\ndo ", StyleBox["Input => Create Hyperlink...", FontFamily->"Courier"], "\nClick on \"Other notebook or URL:\"\nEnter \"http://www.abbymath.com\" in \ the top dialog box and click ok." }], "ItemizedText"], Cell["Making Internal Links", "Subsection"], Cell[TextData[{ "Ta make a link like this one to ", ButtonBox["Numeric Mathematics", BaseStyle->"Hyperlink", ButtonData:>"Numeric Mathematics"], " (the next section) I did the following. First set up the link:" }], "Text"], Cell[TextData[{ "type above paragraph into text cell\nmove mouse to beginning of \"Numeric \ Mathematics\" in above paragraph\nleft click and hold left mouse button down\n\ move mouse to end of \"Numeric Mathematics\"\nlet up on mouse button\ndo ", StyleBox["Input => Create Hyperlink...", FontFamily->"Courier"], "\nclick on \"Current notebook\"\nclick on \"Cells with the tag:\"\nfill in \ \"Numeric Mathemtics\" for the tag" }], "ItemizedText"], Cell["\<\ after putting in the link target cell, in this case the \"Numeric Mathematics\ \" cell, do\ \>", "Text"], Cell[TextData[{ "left click on the cell bracket\ndo ", StyleBox["Find => Add/Remove Cell Tags", FontFamily->"Courier"], "\nput in \"Numeric Mathematics\" for the cell tag\nclick Add" }], "ItemizedText"], Cell["Numeric Mathematics", "Section", GeneratedCell->False, CellAutoOverwrite->False, CellTags->"Numeric Mathematics"], Cell[TextData[{ "Let's have Mathematica add 2 + 2. I typed \"2 + 2\" followed by \ Shift-Enter in an input cell to do that. If you just type Enter, ", StyleBox["Mathematica", FontSlant->"Italic"], " won't do anything so be sure to type Shift-Enter when you want Mathematica \ to evaluate something." }], "Text"], Cell["2 + 2", "Input", GeneratedCell->False, CellAutoOverwrite->False, CellLabel->"In[183]:="], Cell["Sqrt[50 + 50]", "Input", GeneratedCell->False, CellAutoOverwrite->False, CellLabel->"In[184]:="], Cell["\<\ Mathematica can do numeric mathematics with an arbitrary number of digits:\ \>", "Text", GeneratedCell->False, CellAutoOverwrite->False], Cell["N[2 1/3, 20]", "Input", GeneratedCell->False, CellAutoOverwrite->False, CellLabel->"In[185]:="], Cell["N[Pi, 1000]", "Input", GeneratedCell->False, CellAutoOverwrite->False, CellLabel->"In[186]:="], Cell["Random Numbers", "Subsection", GeneratedCell->False, CellAutoOverwrite->False], Cell["\<\ Pseudorandom (from now on just called random) number between 0 and 1:\ \>", "Text", GeneratedCell->False, CellAutoOverwrite->False], Cell[BoxData[ RowBox[{"RandomReal", "[", "]"}]], "Input", GeneratedCell->False, CellAutoOverwrite->False, CellLabel->"In[187]:="], Cell["Return 0 or 1 with equal probabilty:", "Text", GeneratedCell->False, CellAutoOverwrite->False], Cell[BoxData[ RowBox[{"RandomInteger", "[", "]"}]], "Input", GeneratedCell->False, CellAutoOverwrite->False, CellLabel->"In[188]:="], Cell["Random integer between 1 and 12 inclusive:", "Text"], Cell[BoxData[ RowBox[{"RandomInteger", "[", RowBox[{"{", RowBox[{"1", ",", "12"}], "}"}], "]"}]], "Input", CellLabel->"In[189]:="], Cell["Throw two six sided dice:", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"RandomInteger", "[", RowBox[{"{", RowBox[{"1", ",", "6"}], "}"}], "]"}], "+", RowBox[{"RandomInteger", "[", RowBox[{"{", RowBox[{"1", ",", "6"}], "}"}], "]"}]}]], "Input", CellLabel->"In[190]:="], Cell[TextData[Cell[BoxData[ FormBox["Range", TraditionalForm]]]], "Subsection", GeneratedCell->False, CellAutoOverwrite->False], Cell["Return all numbers in a range:", "Text", GeneratedCell->False, CellAutoOverwrite->False], Cell["Range[1, 5]", "Input", GeneratedCell->False, CellAutoOverwrite->False, CellLabel->"In[191]:="], Cell["Range[3, 5]", "Input", GeneratedCell->False, CellAutoOverwrite->False, CellLabel->"In[192]:="], Cell["Range[3, 5, 0.2]", "Input", GeneratedCell->False, CellAutoOverwrite->False, CellLabel->"In[193]:="], Cell["Sets", "Subsection"], Cell["\<\ x = {a, b, c}; y = {a, c, d}; Union[x, y]\ \>", "Input", CellChangeTimes->{{3.431631610203622*^9, 3.431631687508194*^9}}, CellLabel->"In[266]:="], Cell["Intersection[x, y]", "Input", CellChangeTimes->{{3.431631694435973*^9, 3.431631698001676*^9}}, CellLabel->"In[269]:="], Cell["Complement[x, y]", "Input", CellChangeTimes->{{3.4316317013632*^9, 3.431631705986362*^9}}, CellLabel->"In[270]:="], Cell["Statistics", "Subsection"], Cell["data = {2, 3, 5, 17, 19, 31}", "Input", CellLabel->"In[199]:="], Cell[CellGroupData[{ Cell["Mean[data]", "Input", CellLabel->"In[200]:="], Cell["\"%\" gets replaced by the last evaluated result.", "Text"], Cell[BoxData[ RowBox[{"N", "[", "%", "]"}]], "Input", CellLabel->"In[201]:="] }, Open ]], Cell["Of course, one can use this:", "Text"], Cell["N[Mean[data]]", "Input", CellLabel->"In[202]:="], Cell["Variance[data]", "Input", CellLabel->"In[203]:="], Cell["StandardDeviation[data]", "Input", CellLabel->"In[204]:="], Cell["Median[data]", "Input", CellLabel->"In[205]:="], Cell["Quantile[data, 0]", "Input", CellLabel->"In[206]:="], Cell["Quantile[data, 0.5]", "Input", CellLabel->"In[207]:="], Cell["Quantile[data, 1]", "Input", CellLabel->"In[208]:="], Cell["Sum", "Subsection"], Cell["Add 1 + 2 + 3.", "Text"], Cell["Sum[i, {i,1,3}]", "Input", CellLabel->"In[209]:="], Cell["Unit Conversion", "Subsection", CellChangeTimes->{{3.431630024190246*^9, 3.431630032841028*^9}}], Cell["\<\ Usain Bolt set a world's record in the 2008 Olympics by running 100 meters in \ 9.69 seconds. What was his average speed in miles per hour?\ \>", "Text", GeneratedCell->False, CellAutoOverwrite->False, CellChangeTimes->{{3.431630040931264*^9, 3.431630107811502*^9}}, CellLabel->"In[1]:="], Cell[BoxData[ RowBox[{" ", RowBox[{"Convert", "[", RowBox[{ FractionBox[ RowBox[{"100", " ", "Meter"}], RowBox[{"9.69", " ", "Second"}]], ",", FractionBox["Mile", "Hour"]}], "]"}]}]], "Input", GeneratedCell->False, CellAutoOverwrite->False, CellChangeTimes->{{3.43162909990341*^9, 3.431629100893516*^9}, { 3.4316298126429243`*^9, 3.4316298157975607`*^9}, {3.431629983965967*^9, 3.431629988098015*^9}}, CellLabel->"In[210]:="], Cell["How many carats are in pound?", "Text", CellChangeTimes->{{3.4316301431645193`*^9, 3.4316301584272213`*^9}}], Cell[BoxData[ RowBox[{"Convert", "[", RowBox[{ RowBox[{"1", " ", "Pound"}], ",", " ", "Carat"}], "]"}]], "Input", CellChangeTimes->{{3.431630184454935*^9, 3.431630200571176*^9}}, FormatType->"InputForm", CellLabel->"In[211]:="], Cell["Symbolic Mathematics", "Section", GeneratedCell->False, CellAutoOverwrite->False, CellTags->"Symbolic Mathematics"], Cell["\<\ x = 3; y = 5; x + y\ \>", "Input", GeneratedCell->False, CellAutoOverwrite->False, CellLabel->"In[212]:="], Cell["Differentiation", "Subsection", GeneratedCell->False, CellAutoOverwrite->False], Cell[TextData[{ StyleBox["Clear[]", FontFamily->"Courier"], " variables in case they have values left over from earlier. Solving for ", StyleBox["knowns", FontSlant->"Italic"], " (instead of unknowns) causes weird problems and confusion. If you get \ really weird results when solving for unknowns double check that they don't \ already have a value." }], "Text", GeneratedCell->False, CellAutoOverwrite->False], Cell["\<\ Clear[a, b, x]; expr = 2 a x + b; D[expr, x]\ \>", "Input", GeneratedCell->False, CellAutoOverwrite->False, CellLabel->"In[214]:="], Cell["Integration", "Subsection", GeneratedCell->False, CellAutoOverwrite->False], Cell["Integrate[expr, x]", "Input", GeneratedCell->False, CellAutoOverwrite->False, CellLabel->"In[217]:="], Cell["Matrix and Vector Operations", "Subsection", GeneratedCell->False, CellAutoOverwrite->False, CellLabel->"In[7]:="], Cell[CellGroupData[{ Cell["\<\ Clear[a, b, c, d, x, y]; (* matrix *) m = {{a, b}, {c, d}}; (* vector *) v = {x, y};\ \>", "Input", GeneratedCell->False, CellAutoOverwrite->False, CellLabel->"In[218]:="], Cell["\<\ (* constant times matrix *) k m\ \>", "Input", GeneratedCell->False, CellAutoOverwrite->False, CellLabel->"In[223]:="], Cell["\<\ (* square each element of m *) m^2\ \>", "Input", GeneratedCell->False, CellAutoOverwrite->False, CellLabel->"In[225]:="], Cell["\<\ (* matrix multiplication *) m . m\ \>", "Input", GeneratedCell->False, CellAutoOverwrite->False, CellLabel->"In[227]:="], Cell["\<\ (* matrix times vector, v acts as column vector *) m . v\ \>", "Input", GeneratedCell->False, CellAutoOverwrite->False, CellLabel->"In[229]:="], Cell["\<\ (* vector times matrix, v acts as row vector *) v . m\ \>", "Input", GeneratedCell->False, CellAutoOverwrite->False, CellLabel->"In[231]:="], Cell["\<\ (* transpose matrix *) Transpose[m]\ \>", "Input", GeneratedCell->False, CellAutoOverwrite->False, CellLabel->"In[233]:="] }, Open ]], Cell["Solving Equations", "Subsection", GeneratedCell->False, CellAutoOverwrite->False], Cell[CellGroupData[{ Cell["\<\ Clear[x, y]; Solve[{x + y == 10, 2x - y == 5}, {x, y}]\ \>", "Input", GeneratedCell->False, CellAutoOverwrite->False, CellLabel->"In[235]:="], Cell["Solve[{a x^2 + b x + c == 0}, x]", "Input", GeneratedCell->False, CellAutoOverwrite->False, CellLabel->"In[237]:="], Cell[TextData[{ "Do the ", Cell[BoxData[ FormBox["a", TraditionalForm]]], ", ", Cell[BoxData[ FormBox["b", TraditionalForm]]], ", and ", Cell[BoxData[ FormBox["c", TraditionalForm]]], " replacements on the fly just for this one statement." }], "Text"], Cell["% /. {a->1, b->5, c->4}", "Input", GeneratedCell->False, CellAutoOverwrite->False, CellLabel->"In[238]:="], Cell[TextData[{ "Set ", Cell[BoxData[ FormBox["a", TraditionalForm]]], ", ", Cell[BoxData[ FormBox["b", TraditionalForm]]], ", and ", Cell[BoxData[ FormBox["c", TraditionalForm]]], " until they are reset." }], "Text"], Cell["a = 1; b = 5; c = 4;", "Input", GeneratedCell->False, CellAutoOverwrite->False, CellLabel->"In[239]:="], Cell["Solve[{a x^2 + b x + c == 0}, x]", "Input", GeneratedCell->False, CellAutoOverwrite->False, CellLabel->"In[240]:="], Cell[TextData[{ "Reset ", Cell[BoxData[ FormBox["b", TraditionalForm]]], " and ", Cell[BoxData[ FormBox["c", TraditionalForm]]], "." }], "Text"], Cell["\<\ b = 10; c = 9; Solve[{a x^2 + b x + c == 0}, x]\ \>", "Input", GeneratedCell->False, CellAutoOverwrite->False, CellLabel->"In[241]:="], Cell[TextData[{ "Reset just ", Cell[BoxData[ FormBox["c", TraditionalForm]]], "." }], "Text"], Cell[CellGroupData[{ Cell["\<\ c = 8; Solve[{a x^2 + b x + c == 0}, x]\ \>", "Input", GeneratedCell->False, CellAutoOverwrite->False, CellLabel->"In[243]:="], Cell["N[%,20]", "Input", GeneratedCell->False, CellAutoOverwrite->False, CellLabel->"In[245]:="], Cell[TextData[{ "After the following input is evaluated you may want to left click on the \ output cell bracket and do ", StyleBox["Cell => Convert To => ", FontFamily->"Courier"], StyleBox["and then", FontFamily->"Times New Roman"], StyleBox[" InputForm", FontFamily->"Courier"], StyleBox[", ", FontFamily->"Times New Roman"], StyleBox["OutputForm", FontFamily->"Courier"], StyleBox[", ", FontFamily->"Times New Roman"], StyleBox["StandardForm", FontFamily->"Courier"], StyleBox[", or ", FontFamily->"Times New Roman"], StyleBox["TraditionalForm ", FontFamily->"Courier"], StyleBox["to see the different ways the output can be displayed.", FontFamily->"Times New Roman"] }], "Text"], Cell["\<\ Clear[a, b, c, d, e]; Solve[{a x^4 + b x^3 + c x^2 + d x + e == 0}, x]\ \>", "Input", GeneratedCell->False, CellAutoOverwrite->False, CellLabel->"In[246]:="] }, Open ]] }, Open ]], Cell["Graphics", "Section", GeneratedCell->False, CellAutoOverwrite->False, CellTags->"Graphics"], Cell[TextData[{ "Plot ", Cell[BoxData[ FormBox[ RowBox[{"y", " ", "=", " "}], TraditionalForm]]], Cell[BoxData[ FormBox[ RowBox[{"sin", " ", "x", " ", "for", " ", Cell[TextData[Cell[BoxData[ FormBox[ RowBox[{"0", " ", "\[LessEqual]", " ", "x", " ", "\[LessEqual]", " ", RowBox[{"2", RowBox[{"\[Pi]", "."}]}]}], TraditionalForm]]]]]}], TraditionalForm]]] }], "Text"], Cell["p1 = Plot[Sin[x], {x, 0, 2Pi}]", "Input", CellChangeTimes->{{3.431630979004386*^9, 3.431630981615553*^9}}, CellLabel->"In[248]:="], Cell[TextData[{ "Plot ", Cell[BoxData[ FormBox[ RowBox[{"y", " ", "=", " ", RowBox[{"cos", " ", "x"}]}], TraditionalForm]]], " for ", Cell[BoxData[ FormBox[Cell[TextData[Cell[BoxData[ FormBox[ RowBox[{"0", " ", "\[LessEqual]", " ", "x", " ", "\[LessEqual]", " ", RowBox[{"2", RowBox[{"\[Pi]", "."}]}]}], TraditionalForm]]]]], TraditionalForm]]] }], "Text"], Cell["p2 = Plot[Cos[x], {x, 0, 2Pi}]", "Input", GeneratedCell->False, CellAutoOverwrite->False, CellChangeTimes->{{3.431630986015396*^9, 3.431630993382464*^9}}, CellLabel->"In[249]:="], Cell["Show both the plots on the same set of axes.", "Text"], Cell["Show[p1, p2]", "Input", CellLabel->"In[250]:="], Cell["Make an animation.", "Text", CellChangeTimes->{{3.4316305094969788`*^9, 3.431630525235836*^9}}], Cell["\<\ Animate[ Plot[Sin[x-t], {x, 0, 10}], {t, 0, Pi, Pi/10} ]\ \>", "Input", GeneratedCell->False, CellAutoOverwrite->False, CellChangeTimes->{{3.431630412795012*^9, 3.4316304191638517`*^9}, { 3.431630461787822*^9, 3.431630464856422*^9}}, AnimationDisplayTime->0.13, AnimationCycleOffset->12, AnimationCycleRepetitions->Infinity, CellLabel->"In[251]:="], Cell["Do a 3D plot.", "Text"], Cell["Plot3D[Sin[x] Cos[y], {x,-Pi,Pi}, {y,-Pi,Pi}]", "Input", GeneratedCell->False, CellAutoOverwrite->False, CellLabel->"In[252]:="], Cell["Make a set of 3D plots to do an animation.", "Text"], Cell[TextData[{ "Animate[\n Plot3D[\n Sin[t+x] + Cos[t+y],\n {x, -Pi, Pi},\n\ {y, -Pi, Pi},\n Axes \[Rule] False,\n Boxed \[Rule] \ False,\n Mesh \[Rule] True\n ],\n {t, -Pi, Pi ,Pi/10}\n", Cell[BoxData[ FormBox["]", TraditionalForm]]] }], "Input", GeneratedCell->False, CellAutoOverwrite->False, CellChangeTimes->{{3.4316305530598993`*^9, 3.431630654766467*^9}}, CellLabel->"In[253]:="], Cell[BoxData[ RowBox[{"Animate", "[", "\n", " ", RowBox[{ RowBox[{"Plot3D", "[", "\n", " ", RowBox[{ RowBox[{ RowBox[{ RowBox[{"Tan", "[", RowBox[{"t", " ", "x", " ", "y"}], "]"}], " ", RowBox[{"Sin", "[", "x", "]"}]}], " ", "+", " ", RowBox[{"Cos", "[", "y", "]"}], " ", "+", " ", "t"}], ",", "\n", " ", RowBox[{"{", RowBox[{"x", ",", RowBox[{"-", "Pi"}], ",", "Pi"}], "}"}], ",", "\n", " ", RowBox[{"{", RowBox[{"y", ",", RowBox[{"-", "Pi"}], ",", "Pi"}], "}"}], ",", "\n", " ", RowBox[{"Mesh", " ", "\[Rule]", " ", "True"}], ",", "\n", " ", RowBox[{"PlotRange", "->", RowBox[{"{", RowBox[{ RowBox[{"-", "10"}], ",", "10"}], "}"}]}]}], "\n", " ", "]"}], ",", "\n", " ", RowBox[{"{", RowBox[{"t", ",", RowBox[{"-", "Pi"}], ",", "Pi", ",", RowBox[{"Pi", "/", "100"}]}], "}"}]}], "\n", "]"}]], "Input", CellLabel->"In[7]:="], Cell["\<\ Compare throwing one twelve-sided die with two six-sided dice.\ \>", "Text"], Cell[BoxData[{ RowBox[{ RowBox[{"n", "=", "1000"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"die", "=", RowBox[{"RandomInteger", "[", RowBox[{ RowBox[{"{", RowBox[{"1", ",", "12"}], "}"}], ",", "n"}], "]"}]}], ";", RowBox[{"dice", " ", "=", " ", RowBox[{ RowBox[{"RandomInteger", "[", RowBox[{ RowBox[{"{", RowBox[{"1", ",", "6"}], "}"}], ",", " ", "n"}], "]"}], "+", RowBox[{"RandomInteger", "[", RowBox[{ RowBox[{"{", RowBox[{"1", ",", "6"}], "}"}], ",", "n"}], "]"}]}]}], ";"}]}], "Input",\ CellChangeTimes->{{3.4316293933491488`*^9, 3.4316294246598177`*^9}, { 3.431630732813073*^9, 3.431630746153356*^9}, {3.431632043870864*^9, 3.431632062846019*^9}}, CellLabel->"In[273]:="], Cell["Make some plots showing the individual dice throws.", "Text"], Cell[BoxData[ RowBox[{"pdie", " ", "=", " ", RowBox[{"ListPlot", "[", RowBox[{"die", ",", " ", RowBox[{"PlotStyle", "\[Rule]", "Red"}]}], "]"}]}]], "Input", CellLabel->"In[275]:="], Cell[BoxData[ RowBox[{"pdice", " ", "=", " ", RowBox[{"ListPlot", "[", RowBox[{"dice", ",", " ", RowBox[{"PlotStyle", "\[Rule]", "Blue"}]}], "]"}]}]], "Input", CellLabel->"In[276]:="], Cell["Put both plots on the same axes.", "Text"], Cell[BoxData[ RowBox[{"Show", "[", RowBox[{"pdie", ",", " ", "pdice"}], "]"}]], "Input", CellLabel->"In[277]:="], Cell["Add individual dice throws to get total distribution.", "Text", CellLabel->"In[252]:="], Cell[BoxData[{ RowBox[{ RowBox[{"tdie", " ", "=", " ", RowBox[{"Table", "[", RowBox[{"0", ",", " ", RowBox[{"{", "12", "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"tdice", " ", "=", " ", RowBox[{"Table", "[", RowBox[{"0", ",", RowBox[{"{", "12", "}"}]}], "]"}]}], ";"}]}], "Input", CellLabel->"In[278]:="], Cell[BoxData[{ RowBox[{ RowBox[{"Do", "[", " ", RowBox[{ RowBox[{ RowBox[{"tdie", "[", RowBox[{"[", RowBox[{"die", "[", RowBox[{"[", "i", "]"}], "]"}], "]"}], "]"}], "++"}], ",", " ", RowBox[{"{", RowBox[{"i", ",", "n"}], "}"}]}], "]"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"Do", "[", " ", RowBox[{ RowBox[{ RowBox[{"tdice", "[", RowBox[{"[", RowBox[{"dice", "[", RowBox[{"[", "i", "]"}], "]"}], "]"}], "]"}], "++"}], ",", " ", RowBox[{"{", RowBox[{"i", ",", "n"}], "}"}]}], "]"}], ";"}]}], "Input", CellLabel->"In[280]:="], Cell[BoxData[{ RowBox[{ RowBox[{"tdie", " ", "=", " ", RowBox[{"tdie", " ", "/", " ", "n"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"tdice", " ", "=", " ", RowBox[{"tdice", " ", "/", " ", "n"}]}], ";"}]}], "Input", CellLabel->"In[282]:="], Cell[BoxData[ RowBox[{"pdie", "=", RowBox[{"ListPlot", "[", RowBox[{"tdie", ",", RowBox[{"Joined", "\[Rule]", "True"}], ",", RowBox[{"PlotStyle", "\[Rule]", "Red"}]}], "]"}]}]], "Input", CellLabel->"In[285]:="], Cell[BoxData[ RowBox[{"pdice", "=", RowBox[{"ListPlot", "[", RowBox[{"tdice", ",", RowBox[{"Joined", "\[Rule]", "True"}], ",", RowBox[{"PlotStyle", "\[Rule]", "Blue"}]}], "]"}]}]], "Input", CellLabel->"In[286]:="], Cell[BoxData[ RowBox[{"Show", "[", RowBox[{"pdie", ",", "pdice"}], "]"}]], "Input", CellLabel->"In[265]:="] }, ScreenStyleEnvironment->"Presentation", CellGrouping->Manual, WindowSize->{968, 1482}, WindowMargins->{{6, Automatic}, {Automatic, 0}}, PrintingPageRange->{Automatic, Automatic}, PrintingOptions->{"Magnification"->1, "PaperOrientation"->"Portrait", "PaperSize"->{612, 792}, "PostScriptOutputFile":>FrontEnd`FileName[{ "home", "resolute", "a", "mds", "mathematica"}, "shortcourse.nb.ps", CharacterEncoding -> "MacintoshRoman"]}, ShowCellLabel->False, LanguageCategory->None, Magnification->1.5, FrontEndVersion->"6.0 for Mac OS X PowerPC (32-bit) (May 21, 2008)", StyleDefinitions->"Textbook.nb" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{ "Interfaces"->{ Cell[4602, 158, 113, 6, 221, "Section", CellTags->"Interfaces"]}, "Help"->{ Cell[6088, 212, 92, 3, 179, "Section", CellTags->"Help"]}, "Notebooks"->{ Cell[6906, 247, 102, 3, 179, "Section", CellTags->"Notebooks"]}, "Numeric Mathematics"->{ Cell[11679, 397, 122, 3, 179, "Section", CellTags->"Numeric Mathematics"]}, "Symbolic Mathematics"->{ Cell[16993, 610, 124, 3, 179, "Section", CellTags->"Symbolic Mathematics"]}, "Graphics"->{ Cell[22156, 860, 100, 3, 179, "Section", CellTags->"Graphics"]} } *) (*CellTagsIndex CellTagsIndex->{ {"Interfaces", 29903, 1122}, {"Help", 29985, 1125}, {"Notebooks", 30065, 1128}, {"Numeric Mathematics", 30161, 1131}, {"Symbolic Mathematics", 30269, 1134}, {"Graphics", 30366, 1137} } *) (*NotebookFileOutline Notebook[{ Cell[568, 21, 38, 0, 121, "Title"], Cell[609, 23, 29, 0, 66, "Subtitle"], Cell[641, 25, 150, 4, 97, "Subsubtitle"], Cell[794, 31, 2926, 86, 517, "Text"], Cell[3723, 119, 36, 0, 179, "Section"], Cell[3762, 121, 837, 35, 241, "Text"], Cell[4602, 158, 113, 6, 221, "Section", CellTags->"Interfaces"], Cell[4718, 166, 1367, 44, 171, "Text"], Cell[6088, 212, 92, 3, 179, "Section", CellTags->"Help"], Cell[6183, 217, 720, 28, 94, "Text"], Cell[6906, 247, 102, 3, 179, "Section", CellTags->"Notebooks"], Cell[7011, 252, 321, 7, 94, "Text"], Cell[7335, 261, 695, 16, 219, "Text"], Cell[8033, 279, 34, 0, 82, "Subsection"], Cell[8070, 281, 478, 14, 132, "Text"], Cell[8551, 297, 27, 0, 82, "Subsection"], Cell[8581, 299, 54, 0, 37, "Text"], Cell[8638, 301, 169, 13, 368, "IndentedText"], Cell[8810, 316, 1114, 26, 380, "Text"], Cell[9927, 344, 43, 0, 82, "Subsection"], Cell[9973, 346, 202, 7, 37, "Text"], Cell[10178, 355, 437, 8, 304, "ItemizedText"], Cell[10618, 365, 43, 0, 82, "Subsection"], Cell[10664, 367, 230, 6, 66, "Text"], Cell[10897, 375, 452, 8, 340, "ItemizedText"], Cell[11352, 385, 114, 3, 48, "Text"], Cell[11469, 390, 207, 5, 158, "ItemizedText"], Cell[11679, 397, 122, 3, 179, "Section", CellTags->"Numeric Mathematics"], Cell[11804, 402, 318, 7, 94, "Text"], Cell[12125, 411, 97, 3, 51, "Input"], Cell[12225, 416, 105, 3, 51, "Input"], Cell[12333, 421, 148, 4, 48, "Text"], Cell[12484, 427, 104, 3, 51, "Input"], Cell[12591, 432, 103, 3, 51, "Input"], Cell[12697, 437, 86, 2, 82, "Subsection"], Cell[12786, 441, 143, 4, 37, "Text"], Cell[12932, 447, 133, 4, 51, "Input"], Cell[13068, 453, 102, 2, 48, "Text"], Cell[13173, 457, 136, 4, 51, "Input"], Cell[13312, 463, 58, 0, 48, "Text"], Cell[13373, 465, 139, 4, 51, "Input"], Cell[13515, 471, 41, 0, 48, "Text"], Cell[13559, 473, 252, 8, 51, "Input"], Cell[13814, 483, 130, 3, 82, "Subsection"], Cell[13947, 488, 96, 2, 37, "Text"], Cell[14046, 492, 103, 3, 51, "Input"], Cell[14152, 497, 103, 3, 51, "Input"], Cell[14258, 502, 108, 3, 51, "Input"], Cell[14369, 507, 26, 0, 82, "Subsection"], Cell[14398, 509, 157, 6, 105, "Input"], Cell[14558, 517, 126, 2, 51, "Input"], Cell[14687, 521, 122, 2, 51, "Input"], Cell[14812, 525, 32, 0, 82, "Subsection"], Cell[14847, 527, 70, 1, 37, "Input"], Cell[CellGroupData[{ Cell[14942, 532, 52, 1, 51, "Input"], Cell[14997, 535, 65, 0, 48, "Text"], Cell[15065, 537, 79, 2, 51, "Input"] }, Open ]], Cell[15159, 542, 44, 0, 48, "Text"], Cell[15206, 544, 55, 1, 51, "Input"], Cell[15264, 547, 56, 1, 51, "Input"], Cell[15323, 550, 65, 1, 51, "Input"], Cell[15391, 553, 54, 1, 51, "Input"], Cell[15448, 556, 59, 1, 51, "Input"], Cell[15510, 559, 61, 1, 51, "Input"], Cell[15574, 562, 59, 1, 51, "Input"], Cell[15636, 565, 25, 0, 82, "Subsection"], Cell[15664, 567, 30, 0, 37, "Text"], Cell[15697, 569, 57, 1, 51, "Input"], Cell[15757, 572, 103, 1, 82, "Subsection"], Cell[15863, 575, 303, 7, 66, "Text"], Cell[16169, 584, 463, 13, 88, "Input"], Cell[16635, 599, 115, 1, 48, "Text"], Cell[16753, 602, 237, 6, 51, "Input"], Cell[16993, 610, 124, 3, 179, "Section", CellTags->"Symbolic Mathematics"], Cell[17120, 615, 119, 6, 71, "Input"], Cell[17242, 623, 87, 2, 82, "Subsection"], Cell[17332, 627, 423, 11, 123, "Text"], Cell[17758, 640, 144, 7, 119, "Input"], Cell[17905, 649, 83, 2, 82, "Subsection"], Cell[17991, 653, 110, 3, 37, "Input"], Cell[18104, 658, 123, 3, 82, "Subsection"], Cell[CellGroupData[{ Cell[18252, 665, 184, 9, 172, "Input"], Cell[18439, 676, 131, 6, 85, "Input"], Cell[18573, 684, 134, 6, 85, "Input"], Cell[18710, 692, 133, 6, 85, "Input"], Cell[18846, 700, 156, 6, 119, "Input"], Cell[19005, 708, 153, 6, 85, "Input"], Cell[19161, 716, 135, 6, 85, "Input"] }, Open ]], Cell[19311, 725, 89, 2, 82, "Subsection"], Cell[CellGroupData[{ Cell[19425, 731, 154, 6, 71, "Input"], Cell[19582, 739, 124, 3, 51, "Input"], Cell[19709, 744, 264, 11, 48, "Text"], Cell[19976, 757, 115, 3, 51, "Input"], Cell[20094, 762, 230, 11, 48, "Text"], Cell[20327, 775, 112, 3, 51, "Input"], Cell[20442, 780, 124, 3, 51, "Input"], Cell[20569, 785, 153, 8, 48, "Text"], Cell[20725, 795, 147, 6, 85, "Input"], Cell[20875, 803, 98, 5, 48, "Text"], Cell[CellGroupData[{ Cell[20998, 812, 139, 6, 85, "Input"], Cell[21140, 820, 99, 3, 51, "Input"], Cell[21242, 825, 714, 23, 145, "Text"], Cell[21959, 850, 170, 6, 85, "Input"] }, Open ]] }, Open ]], Cell[22156, 860, 100, 3, 179, "Section", CellTags->"Graphics"], Cell[22259, 865, 411, 13, 37, "Text"], Cell[22673, 880, 138, 2, 51, "Input"], Cell[22814, 884, 397, 13, 48, "Text"], Cell[23214, 899, 188, 4, 51, "Input"], Cell[23405, 905, 60, 0, 48, "Text"], Cell[23468, 907, 54, 1, 51, "Input"], Cell[23525, 910, 102, 1, 48, "Text"], Cell[23630, 913, 375, 13, 153, "Input"], Cell[24008, 928, 29, 0, 48, "Text"], Cell[24040, 930, 137, 3, 51, "Input"], Cell[24180, 935, 58, 0, 48, "Text"], Cell[24241, 937, 447, 10, 382, "Input"], Cell[24691, 949, 1030, 28, 358, "Input"], Cell[25724, 979, 86, 2, 48, "Text"], Cell[25813, 983, 778, 23, 154, "Input"], Cell[26594, 1008, 67, 0, 48, "Text"], Cell[26664, 1010, 194, 5, 51, "Input"], Cell[26861, 1017, 197, 5, 51, "Input"], Cell[27061, 1024, 48, 0, 48, "Text"], Cell[27112, 1026, 117, 3, 51, "Input"], Cell[27232, 1031, 94, 1, 48, "Text"], Cell[27329, 1034, 364, 11, 86, "Input"], Cell[27696, 1047, 638, 21, 86, "Input"], Cell[28337, 1070, 264, 7, 86, "Input"], Cell[28604, 1079, 229, 6, 86, "Input"], Cell[28836, 1087, 232, 6, 86, "Input"], Cell[29071, 1095, 112, 3, 51, "Input"] } ] *) (* End of internal cache information *)