(* Content-type: application/mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 7.0' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 145, 7] NotebookDataLength[ 58324, 1798] NotebookOptionsPosition[ 41770, 1381] NotebookOutlinePosition[ 50068, 1582] CellTagsIndexPosition[ 48370, 1543] WindowTitle->Lecture 03 MIT 3.016 (Fall 2009) \251 W. Craig Carter \ 2003--2009 WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell["Introduction to Mathematica, Part II", "Title"], Cell[CellGroupData[{ Cell[TextData[{ "Elements of ", StyleBox["Mathematica", FontSlant->"Italic"], " Programs" }], "Subtitle"], Cell["\<\ Mathematica can be used in the same fashion as a traditional programming \ language, such a fortran or C. For frequently used programs or \ computationally intensive applications, Mathematica is not the best \ programming language choice, but it can be very effective as a way to test \ out ideas or generate a single numerical result.\ \>", "Text"], Cell["Evaluating a sequence of instrutions (;;;)", "Section", CellTags->{ "mmtag:03:mutliple_instructions_in_same_cell", "mmtag:03:hiding_output"}], Cell[BoxData[{ RowBox[{ RowBox[{"a", " ", "=", " ", "1"}], ";"}], "\[IndentingNewLine]", RowBox[{" ", RowBox[{ RowBox[{"a", " ", "=", " ", RowBox[{"a", "+", "a"}]}], ";", " ", RowBox[{"a", "=", RowBox[{"a", "^", "a"}]}]}]}], "\[IndentingNewLine]", RowBox[{" ", RowBox[{ RowBox[{"a", "=", " ", RowBox[{"a", "+", "a"}]}], ";", " ", RowBox[{"a", "=", RowBox[{"a", "^", "a"}]}]}]}]}], "Input"], Cell["\<\ Note above that line breaks without \";\" are points where the instructions \ get executed. This three-line sequence has five executions and produces two \ lines of output and the instructions get executed sequentially.\ \>", "Text", CellChangeTimes->{{3.395199728194615*^9, 3.395199735922614*^9}}], Cell[BoxData[ RowBox[{"Clear", "[", "a", "]"}]], "Input"], Cell["Loops", "Section", CellTags->{"mmtag:03:loops__Do[]", "mmtag:03:Do[]"}], Cell[TextData[{ "In ", StyleBox["Mathematica", FontSlant->"Italic"], ", it is generally ", StyleBox["not a good idea", FontVariations->{"Underline"->True}], " to use looping constructions such as Do, For, and While. The preferred \ method to construct and operate on lists---however, it is ok to use looping \ constructions as beginners." }], "Subsubsection"], Cell[BoxData[ RowBox[{"?", "Do"}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"a", "=", "1"}], ";", " ", RowBox[{"Do", "[", RowBox[{ RowBox[{ RowBox[{"a", "=", RowBox[{"2", "a"}]}], ";", RowBox[{"a", "=", RowBox[{"a", "^", "a"}]}]}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", "2"}], "}"}]}], "]"}]}]], "Input"], Cell[BoxData["a"], "Input"], Cell[TextData[{ "In this case, ", StyleBox["Do", FontWeight->"Bold"], " does not produce screen output. The following will and is a simple \ illustration of how formatted output can be programmed:" }], "Text"], Cell[BoxData[ RowBox[{ RowBox[{"a", "=", "0.1"}], ";", " ", RowBox[{"Do", "[", RowBox[{ RowBox[{ RowBox[{"a", "=", RowBox[{"2", "a"}]}], ";", RowBox[{"a", "=", RowBox[{"a", "^", "a"}]}], ";", " ", RowBox[{"Print", "[", RowBox[{ "\"\\"", ",", " ", "i", ",", " ", "\"\< and a is \>\"", ",", " ", "a"}], "]"}]}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", "4"}], "}"}]}], "]"}]}]], "Input", CellTags->{"mmtag:03:Print[]", "mmtag:03:printing_intermediate_output"}], Cell[BoxData[ RowBox[{"Clear", "[", "a", "]"}]], "Input"], Cell[BoxData[ RowBox[{"?", "For"}]], "Input"], Cell[BoxData[ RowBox[{"For", "[", RowBox[{ StyleBox[ RowBox[{ RowBox[{"a", "=", "0.1"}], ";", " ", RowBox[{"i", "=", "1"}]}], FontColor->RGBColor[1, 0, 0]], ",", StyleBox[" ", FontColor->RGBColor[1, 0, 1]], StyleBox[ RowBox[{"i", " ", "\[LessEqual]", " ", "4"}], FontColor->RGBColor[1, 0, 1]], ",", StyleBox[" ", FontColor->RGBColor[0, 0, 1]], StyleBox[ RowBox[{"i", "++"}], FontColor->RGBColor[0, 0, 1]], ",", StyleBox[" ", FontColor->RGBColor[0, 1, 1], Background->GrayLevel[0.900008]], StyleBox[ RowBox[{ RowBox[{"a", "=", RowBox[{"2", "a"}]}], ";", RowBox[{"a", "=", RowBox[{"a", "^", "a"}]}], ";", " ", RowBox[{"Print", "[", RowBox[{ "\"\\"", ",", " ", "i", ",", " ", "\"\< and a is \>\"", ",", " ", "a"}], "]"}]}], FontColor->RGBColor[0.0152895, 0.334096, 0.0062562], Background->GrayLevel[0.900008]]}], StyleBox["]", FontColor->RGBColor[0.0152895, 0.334096, 0.0062562], Background->GrayLevel[0.900008]]}]], "Input"], Cell[BoxData[ RowBox[{"?", "While"}]], "Input"], Cell[BoxData[ RowBox[{"?", "Table"}]], "Input"], Cell[BoxData[ RowBox[{"Clear", "[", "a", "]"}]], "Input"], Cell[BoxData[{ RowBox[{ RowBox[{"a", "=", "0.25"}], ";"}], "\[IndentingNewLine]", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{"i", ",", RowBox[{ RowBox[{"a", "=", RowBox[{"2", "a"}]}], ";", RowBox[{"a", "=", RowBox[{"a", "^", "a"}]}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", "4"}], "}"}]}], "]"}]}], "Input", CellTags->"mmtag:03:Table[]"], Cell[TextData[{ "Note above that we have asked ", StyleBox["Mathematica", FontSlant->"Italic"], " to create a list of two-element lists..." }], "Text"], Cell[BoxData[{ RowBox[{ RowBox[{"a", "=", "0.75"}], ";"}], "\[IndentingNewLine]", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{"i", ",", RowBox[{ RowBox[{"a", "=", RowBox[{"2", "a"}]}], ";", RowBox[{"a", "=", RowBox[{"a", "^", "a"}]}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", "4"}], "}"}]}], "]"}]}], "Input"], Cell[BoxData[ RowBox[{"datatable", " ", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{"dx", ",", RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{ RowBox[{"a", "=", "dx"}], ";", RowBox[{"i", "=", "1"}]}], ",", " ", RowBox[{"i", " ", "\[LessEqual]", " ", "4"}], ",", " ", RowBox[{"i", "++"}], ",", " ", RowBox[{ RowBox[{"a", "=", RowBox[{"2", "a"}]}], ";", " ", RowBox[{"a", "=", RowBox[{"a", "^", "a"}]}]}]}], "]"}], ";", RowBox[{"Log", "[", "a", "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"dx", ",", "0.01", ",", "0.5", ",", "0.01"}], "}"}]}], "]"}]}]], "Input"], Cell[TextData[{ "In the instruction above, note that the variable \"datatable\" is a list. \ In ", StyleBox["Mathematica", FontSlant->"Italic"], ", variables can be numbers, expressions, lists, plots, ... We will see \ that this feature is very useful." }], "Text"] }, Closed]], Cell[CellGroupData[{ Cell[TextData[{ "Plotting Data from Lists, Using More ", StyleBox["Mathematica", FontSlant->"Italic"], " Functions" }], "Subtitle", CellChangeTimes->{{3.395199821225089*^9, 3.395199821952939*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"ListPlot", "[", "datatable", "]"}], "\[IndentingNewLine]"}]], "Input", CellTags->"mmtag:03:ListPlot[]"], Cell[BoxData[ RowBox[{"Options", "[", "ListPlot", "]"}]], "Input"], Cell[TextData[{ "Note that the options are written as ", StyleBox["Rules", FontWeight->"Bold"], "." }], "Text"], Cell[BoxData[ RowBox[{"ListPlot", "[", RowBox[{"datatable", ",", RowBox[{"PlotRange", "\[Rule]", RowBox[{"{", RowBox[{"250", ",", "500"}], "}"}]}], ",", RowBox[{"PlotStyle", "\[Rule]", RowBox[{"PointSize", "[", "0.025", "]"}]}]}], "]"}]], "Input", CellChangeTimes->{ 3.395200325533225*^9, {3.395200600054303*^9, 3.395200622615919*^9}}], Cell[BoxData[ RowBox[{"?", "*Minimum*"}]], "Input"], Cell[BoxData[ RowBox[{"FindMinimum", "[", RowBox[{ RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{ RowBox[{"a", "=", "xvalue"}], ";", RowBox[{"i", "=", "1"}]}], ",", " ", RowBox[{"i", " ", "\[LessEqual]", " ", "4"}], ",", " ", RowBox[{"i", "++"}], ",", " ", RowBox[{ RowBox[{"a", "=", RowBox[{"2", "a"}]}], ";", " ", RowBox[{"a", "=", RowBox[{"a", "^", "a"}]}]}]}], "]"}], ";", RowBox[{"Log", "[", "a", "]"}]}], ",", RowBox[{"{", RowBox[{"xvalue", ",", "0.15", ",", "0.25"}], "}"}]}], "]"}]], "Input", CellChangeTimes->{{3.395219788616866*^9, 3.395219807847314*^9}}, CellTags->"mmtag:03:FindMinimum[]"], Cell[TextData[{ "By going into the Help Browser, you can see that the output of FindMinimum \ is a list, the first element of which is the functions minimum value, and the \ second is a ", StyleBox["Rule", FontWeight->"Bold"], " specifing where the minimum occurs." }], "Text"], Cell[TextData[{ "Lets try and do the above the hard way. I will use ", StyleBox["Nest", FontWeight->"Bold"], " to recursively apply the function 4 times (I am just using a shorthand \ here, we can ignore the use of ", StyleBox["Nest", FontWeight->"Bold"], " for this course...). You can see that it works. Don't worry about it, but \ if you want to know about it, use the Help Browser to get information about ", StyleBox["Nest ", FontWeight->"Bold"], "and", StyleBox[" Pure Functions.", FontWeight->"Bold"] }], "Text"], Cell[BoxData[ RowBox[{"Clear", "[", "x", "]"}]], "Input"], Cell[BoxData[ RowBox[{"fx", " ", "=", " ", RowBox[{"Nest", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"2", "#"}], ")"}], "^", RowBox[{"(", RowBox[{"2", "#"}], ")"}]}], "&"}], ",", "x", ",", "4"}], "]"}]}]], "Input", CellTags->{"mmtag:03:Nest[]", "mmtag:03:pure_functions"}], Cell["Take it derivative and set equal to zero...", "Text"], Cell[BoxData[ RowBox[{"dfx", " ", "=", RowBox[{ RowBox[{"D", "[", RowBox[{"fx", ",", "x"}], "]"}], "//", "Simplify"}]}]], "Input"], Cell[TextData[{ "Finding the zero of this will not be easy.... but ", StyleBox["FindRoot", FontWeight->"Bold"], " claims it can do it..." }], "Text"], Cell[BoxData[ RowBox[{"FindRoot", "[", RowBox[{"dfx", ",", RowBox[{"{", RowBox[{"x", ",", ".1", ",", ".3"}], "}"}]}], "]"}]], "Input", CellTags->"mmtag:03:FindRoot[]"] }, Closed]], Cell[CellGroupData[{ Cell["Localized Variables and Switches", "Subtitle"], Cell["Local Variables", "Section"], Cell[TextData[{ "In the above, the values of ", StyleBox["a ", FontWeight->"Bold"], "and ", StyleBox["xvalue", FontWeight->"Bold"], " are used repeatly\[LongDash]however, if we are only interested in the \ resulting minimum, their final values have little meaning or importance. \ Suppose, we use the value of ", StyleBox["a", FontWeight->"Bold"], " or ", StyleBox["xvalue", FontWeight->"Bold"], " without clearing\[LongDash]what will the value be?" }], "Text", CellChangeTimes->{{3.395219927026965*^9, 3.395219934333641*^9}}], Cell[BoxData[{"xvalue", "\[IndentingNewLine]", "a"}], "Input", CellChangeTimes->{{3.3952199197654448`*^9, 3.395219921377365*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"CurrentValueofA", " ", "=", " ", "a"}], ";"}]], "Input"], Cell[TextData[{ "As this could cause problems if ", StyleBox["a", FontWeight->"Bold"], " is used in a function call, say ", StyleBox["Sin[2 \[Pi] a]", FontWeight->"Bold"], ", it is a good idea to localize variables." }], "Text"], Cell[BoxData[ RowBox[{"?", "Module"}]], "Input"], Cell[BoxData[{ RowBox[{ RowBox[{"xvalue", " ", "=", " ", "SnickerDoodle"}], ";", " ", RowBox[{"a", " ", "=", " ", "HappyGoLucky"}], ";"}], "\[IndentingNewLine]", RowBox[{"Module", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{"{", RowBox[{"xvalue", ",", "a", ",", RowBox[{"maxiteration", "=", "4"}], ",", "solution", ",", "i"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"solution", " ", "=", " ", "\[IndentingNewLine]", " ", RowBox[{"FindMinimum", "[", RowBox[{ RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{ RowBox[{"a", "=", "xvalue"}], ";", RowBox[{"i", "=", "1"}]}], ",", " ", RowBox[{"i", " ", "\[LessEqual]", " ", "maxiteration"}], ",", " ", RowBox[{"i", "++"}], ",", " ", RowBox[{ RowBox[{"a", "=", RowBox[{"2", "a"}]}], ";", " ", RowBox[{"a", "=", RowBox[{"a", "^", "a"}]}]}]}], "]"}], ";", RowBox[{"Log", "[", "a", "]"}]}], ",", " ", RowBox[{"{", RowBox[{"xvalue", ",", "0.15", ",", "0.25"}], "}"}]}], "]"}]}], ";", RowBox[{"Print", "[", RowBox[{"xvalue", "/.", RowBox[{"solution", "[", RowBox[{"[", "2", "]"}], "]"}]}], "]"}]}]}], "\[IndentingNewLine]", "]"}], "\[IndentingNewLine]"}], "Input", CellChangeTimes->{{3.395220018742426*^9, 3.39522004294464*^9}}, CellTags->{ "mmtag:03:Module[]", "mmtag:03:local_variables__use_in_Module[]", "mmtag:03:pure_functions"}], Cell[BoxData[{"xvalue", "\[IndentingNewLine]", "a", "\[IndentingNewLine]", \ "solution", "\[IndentingNewLine]"}], "Input", CellChangeTimes->{{3.395220063625146*^9, 3.395220064537361*^9}}], Cell["Switches: If, Which", "Section", CellTags->{ "mmtag:03:switches__If[]_and_Which[]", "mmtag:03:If[]", "mmtag:03:Which[]"}], Cell[BoxData[ RowBox[{"?", "If"}]], "Input"], Cell[BoxData[ RowBox[{"a", " ", "=", " ", RowBox[{ RowBox[{"Prime", "[", "23", "]"}], " ", "+", " ", RowBox[{"Prime", "[", "62", "]"}], " ", "+", " ", RowBox[{"Prime", "[", "104", "]"}]}]}]], "Input"], Cell[BoxData[ RowBox[{"?", "PrimeQ"}]], "Input", CellTags->"mmtag:03:PrimeQ[]_query_for_prime_number"], Cell[BoxData[ RowBox[{"If", "[", RowBox[{ RowBox[{"PrimeQ", "[", "a", "]"}], ",", "\[IndentingNewLine]", RowBox[{"Print", "[", RowBox[{"a", " ", ",", " ", "\"\< is a Prime Number\>\""}], "]"}], ",", "\[IndentingNewLine]", RowBox[{"Print", "[", RowBox[{ "a", ",", " ", "\"\< is not Prime, its divisors are \>\"", ",", " ", RowBox[{"Divisors", "[", "a", "]"}]}], "]"}], ",", "\[IndentingNewLine]", RowBox[{ "Print", "[", "\"\\"", "]"}]}], "\[IndentingNewLine]", "]"}]], "Input"], Cell[TextData[{ "The above program is ok, but not very useful because it only works for the \ current value of ", StyleBox["a", FontWeight->"Bold"], ". It would be more useful to have something that worked for any value of ", StyleBox["a ", FontWeight->"Bold"], "and could use it over again\[LongDash]that is, turn it into a tool", ". This involves patterns and function definitions." }], "Text"] }, Closed]], Cell[CellGroupData[{ Cell["Patterns and ``Placeholder Variables''", "Subtitle"], Cell["Patterns (_)", "Section"], Cell[TextData[{ "Patterns and Pattern Replacement are probably one of the most powerful \ features of ", StyleBox["Mathematica. ", FontSlant->"Italic"], "The underscore _ stands for a pattern, a symbol ", StyleBox["x", FontWeight->"Bold"], " with an underscore (", StyleBox["x_", FontWeight->"Bold"], ") is recognized as anypattern that matches ", StyleBox["x", FontWeight->"Bold"], ". Here are some examples." }], "Text", CellTags->"mmtag:03:patterns"], Cell[BoxData[ RowBox[{"AList", " ", "=", " ", RowBox[{"{", RowBox[{"first", ",", " ", "second", ",", " ", RowBox[{"third", " ", "=", " ", RowBox[{"2", " ", "first"}]}], ",", " ", RowBox[{"fourth", " ", "=", " ", RowBox[{"2", " ", "second"}]}]}], "}"}]}]], "Input"], Cell[BoxData[ RowBox[{"AList", "/.", RowBox[{"{", RowBox[{ RowBox[{"2", " ", "a_"}], " ", "\[Rule]", " ", "a"}], "}"}]}]], "Input"], Cell[TextData[{ "Here's a way to put the last input command into words: Search list ", StyleBox["AList", FontWeight->"Bold"], " for any pattern that matches \"2 \[Times] anything\" and replace \"2 \ \[Times] anything\" with ", StyleBox["a", FontWeight->"Bold"], ", then output the new ", StyleBox["AList", FontWeight->"Bold"], ". Study the following examples carefully:" }], "Subsubsection"], Cell[BoxData[ RowBox[{"Clear", "[", "a", "]"}]], "Input"], Cell[BoxData[ RowBox[{"AList", "/.", RowBox[{"{", RowBox[{ RowBox[{"2", " ", "a_"}], " ", "\[Rule]", " ", "a"}], "}"}]}]], "Input"], Cell[BoxData[ RowBox[{"AList", "/.", RowBox[{ RowBox[{"{", RowBox[{ "p_", " ", ",", " ", "q_", " ", ",", " ", "r_", " ", ",", " ", "s_"}], "}"}], " ", "\[Rule]", " ", RowBox[{"{", RowBox[{"p", " ", ",", " ", RowBox[{"p", " ", "q"}], ",", " ", RowBox[{"p", " ", "q", " ", "r"}], ",", " ", RowBox[{"p", " ", "q", " ", "r", " ", "s"}]}], "}"}]}]}]], "Input"], Cell["\<\ A qualifier on a pattern can be used to restrict which expressions will match \ the pattern:\ \>", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"{", RowBox[{"2", ",", "0.667", ",", " ", RowBox[{"a", "/", "b"}], ",", " ", "Pi"}], "}"}], "/.", RowBox[{"{", RowBox[{"p_Integer", " ", "\[Rule]", " ", RowBox[{"p", " ", "One"}]}], "}"}]}]], "Input", CellTags->"mmtag:03:pattern_restrictions"], Cell[TextData[{ "The third member of this result may be a bit surprising; it has to do with \ the way ", StyleBox["Mathematica", FontSlant->"Italic"], " internalizes expressions. In this case it represents the fraction as ", Cell[BoxData[ FormBox[ RowBox[{ StyleBox["a", FontWeight->"Bold"], " ", StyleBox[ SuperscriptBox["b", RowBox[{"-", "1"}]], FontWeight->"Bold"]}], TraditionalForm]]], "and it performs the replacement on the exponent (note that it must treat \ the \"-\" sign independently of the \"1\", as it returns \"-One\" rather than \ \"One\"\[Ellipsis])." }], "Subsubsection"], Cell[TextData[{ "_ all by itself stands for anything. ", StyleBox["x_", FontWeight->"Bold"], " also stands for anything, but gives anything a name for later use." }], "Text"], Cell[BoxData[ RowBox[{"AList", "/.", RowBox[{"_", " ", "\[Rule]", " ", "AppleDumplings"}]}]], "Input"], Cell[TextData[{ "This is not very useful and it really is doing what you asked \ for\[LongDash]the first thing it found was ", StyleBox["AList ", FontWeight->"Bold"], "itself and replaced ", StyleBox["AList ", FontWeight->"Bold"], "with ", StyleBox["AppleDumplings. \nx^n_ ", FontWeight->"Bold"], "stands for x to any power, and the power can be refered to as", StyleBox[" n; x_^n_ ", FontWeight->"Bold"], "stands for any expression raised to a power. We can use these ideas to \ find rules that look like derivatives (", StyleBox["this is not a good way to make a symbolic derivative, but it is \ illustrative", FontSlant->"Italic"], "):" }], "Text"], Cell[BoxData[ RowBox[{"PaulieNoMealX", " ", "=", " ", RowBox[{"Sum", "[", RowBox[{ RowBox[{ RowBox[{"b", "[", "i", "]"}], " ", RowBox[{"x", "^", "i"}]}], ",", RowBox[{"{", RowBox[{"i", ",", "2", ",", "6"}], "}"}]}], "]"}]}]], "Input"], Cell[BoxData[ RowBox[{"PaulieNoMealX", "/.", RowBox[{ RowBox[{"x", "^", "n_"}], " ", "\[Rule]", " ", RowBox[{"n", " ", RowBox[{"x", "^", RowBox[{"(", RowBox[{"n", "-", "1"}], ")"}]}]}]}]}]], "Input"], Cell["\<\ This is ok, but it has least two problems. The first is that it would be \ nice to have the rule work for any polynomial...\ \>", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"DerivRule", " ", "=", " ", RowBox[{ RowBox[{"q_", "^", "n_"}], " ", "\[Rule]", " ", RowBox[{"n", " ", RowBox[{"q", "^", RowBox[{"(", RowBox[{"n", "-", "1"}], ")"}]}]}]}]}], ";"}]], "Input"], Cell[BoxData[ RowBox[{"PaulineOMealY", " ", "=", " ", RowBox[{"Sum", "[", RowBox[{ RowBox[{ RowBox[{"c", "[", "i", "]"}], " ", RowBox[{"z", "^", "i"}]}], ",", RowBox[{"{", RowBox[{"i", ",", "2", ",", "6"}], "}"}]}], "]"}]}]], "Input"], Cell[BoxData[{ RowBox[{"PaulineOMealY", "/.", "DerivRule"}], "\[IndentingNewLine]", RowBox[{"PaulieNoMealX", "/.", "DerivRule"}]}], "Input"], Cell["\<\ Another problem is that it will not work for first-order and zeroeth-order \ terms...\ \>", "Text"], Cell[BoxData[ RowBox[{"PaulENoMiel", " ", "=", " ", RowBox[{"Sum", "[", RowBox[{ RowBox[{ RowBox[{"c", "[", "i", "]"}], " ", RowBox[{"HoneyBee", "^", "i"}]}], ",", RowBox[{"{", RowBox[{"i", ",", "0", ",", "6"}], "}"}]}], "]"}]}]], "Input"], Cell[BoxData[ RowBox[{"PaulENoMiel", "/.", "DerivRule"}]], "Input"], Cell["\<\ This could be fixed, but it would be much easier to do so by defining \ functions of a pattern.\ \>", "Text"], Cell["\<\ It is also possible to have a pattern apply conditionally using a condition. \ Here is an example that pulls out cases where the first member of a pair of \ numbers is less than the second.\ \>", "Text"], Cell[BoxData[ RowBox[{"?", "Cases"}]], "Input", CellTags->{"mmtag:03:switches__Cases[]", "mmtag:03:Cases[]"}], Cell[BoxData[ RowBox[{"Cases", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"1", ",", "2"}], "}"}], ",", " ", RowBox[{"{", RowBox[{"2", ",", "1"}], "}"}], ",", " ", RowBox[{"{", RowBox[{"a", ",", "b"}], "}"}], ",", " ", RowBox[{"{", RowBox[{"2", ",", " ", "84"}], "}"}], ",", " ", "5"}], "}"}], ",", RowBox[{ RowBox[{"{", RowBox[{"first_", ",", " ", "second_"}], "}"}], "/;", RowBox[{"first", "<", "second"}]}]}], "]"}]], "Input"] }, Closed]], Cell[CellGroupData[{ Cell["Immediate (=) and Delayed (:=) Assignment", "Subtitle"], Cell["\<\ When an \"=\" is used in an assignment, the current value of the \ right-hand-side is assigned to the left-hand-side.\ \>", "Subsubsection"], Cell[BoxData[ RowBox[{"theFixedDate", " ", "=", " ", RowBox[{"DateString", "[", "]"}]}]], "Input"], Cell["\<\ This assignment may not be very useful if we wanted to use the \"current time\ \" as a variable some time later.\ \>", "Subsubsection"], Cell[BoxData[ RowBox[{"TableForm", "[", RowBox[{"Table", "[", RowBox[{"theFixedDate", ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", "12"}], "}"}]}], "]"}], "]"}]], "Input"], Cell[TextData[{ "Instead, what we probably want is to have the right-hand-side evaluated ", StyleBox["when it is used. ", FontSlant->"Italic", FontVariations->{"Underline"->True}], " This is ", StyleBox["delayed assignment (:=)", FontSlant->"Italic", FontVariations->{"Underline"->True}] }], "Subsubsection"], Cell[BoxData[ RowBox[{"theFlexibleDate", " ", ":=", " ", RowBox[{"DateString", "[", "]"}]}]], "Input"], Cell[BoxData["theFlexibleDate"], "Input"], Cell["\<\ Below, Pause is used in a compound statement to show that the value \ associated with theFlexibleDate is updating\ \>", "Text"], Cell[BoxData[ RowBox[{"TableForm", "[", RowBox[{"Table", "[", RowBox[{ RowBox[{ RowBox[{"Pause", "[", "i", "]"}], ";", "theFlexibleDate"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", "4"}], "}"}]}], "]"}], "]"}]], "Input"] }, Closed]], Cell[CellGroupData[{ Cell["Functions: Using Patterns in Delayed Assignment (:=)", "Subtitle", CellChangeTimes->{{3.395225500310974*^9, 3.395225504465025*^9}}], Cell["\<\ Defining Functions with Patterns (This is an important section to understand \ well)\ \>", "Section", CellTags->"mmtag:03:functions__defining_with_patterns"], Cell[TextData[{ "Defining functions with patterns probably combines the most useful aspects \ of Mathematica. Define a function that takes patten matching x as its first \ argument and an argument matching n as its second argument and returns x to \ the ", Cell[BoxData[ FormBox[ SuperscriptBox["n", "th"], TraditionalForm]]], " power:" }], "Text", CellTags->"mmtag:03:functions__errors_with_immediate_assignment_(=)"], Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{ RowBox[{"f", "[", RowBox[{"x_", " ", ",", " ", "a_"}], "]"}], " ", "=", " ", RowBox[{"x", "^", "a"}]}], ";"}], " ", StyleBox[ RowBox[{"(*", RowBox[{ RowBox[{ "This", " ", "is", " ", "not", " ", "a", " ", "good", " ", "way", " ", "to", " ", "define", " ", "a", " ", "function"}], ",", " ", RowBox[{"we", " ", "will", " ", "see", " ", "why", " ", "later"}]}], "*)"}], "Alert"]}]], "Input"], Cell[BoxData[ StyleBox[ RowBox[{ RowBox[{ "What", " ", "happens", " ", "above", " ", "is", " ", "the", " ", "right\[Dash]hand\[Dash]side", " ", "is", " ", "evaluated", " ", "immediately"}], ",", " ", RowBox[{ "and", " ", "its", " ", "value", " ", "is", " ", "assigned", " ", "to", " ", RowBox[{ StyleBox[ RowBox[{"f", "[", RowBox[{"a", ",", "b"}], "]"}], FontWeight->"Bold"], ".", " ", "It"}], " ", "was", " ", "probably", " ", "intended", " ", "that", " ", StyleBox[ RowBox[{"f", "[", RowBox[{"2", ",", "3"}], "]"}], FontWeight->"Bold"], " ", "should", " ", "always", " ", "return", " ", StyleBox["8", FontWeight->"Bold"], " ", "and", " ", "that", " ", StyleBox[ RowBox[{"f", "[", RowBox[{"y", ",", "z"}], "]"}], FontWeight->"Bold"], " ", "should", " ", "always", " ", "return", " ", StyleBox[ SuperscriptBox["y", "z"], FontWeight->"Bold"]}], ",", " ", RowBox[{ "but", " ", "this", " ", "is", " ", "not", " ", "what", " ", "Mathematica", " ", "was", " ", "asked", " ", "to", " ", RowBox[{"do", ":"}]}]}], FontFamily->"Helvetica"]], "Text"], Cell[BoxData[{ RowBox[{"f", "[", RowBox[{"2", ",", "3"}], "]"}], "\[IndentingNewLine]", RowBox[{"f", "[", RowBox[{"y", ",", "z"}], "]"}]}], "Input"], Cell[TextData[{ "This works fine, but suppose we had defined ", StyleBox["x", FontWeight->"Bold"], " ahead of time " }], "Text"], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"x", " ", "=", " ", "4"}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{ RowBox[{"f", "[", RowBox[{"x_", " ", ",", " ", "a_"}], "]"}], " ", "=", " ", RowBox[{"x", "^", "a"}]}], ";"}], " ", StyleBox[ RowBox[{"(*", RowBox[{ RowBox[{ "This", " ", "is", " ", "not", " ", "a", " ", "good", " ", "way", " ", "to", " ", "define", " ", "a", " ", "function", " ", "because", " ", "it", " ", "does", " ", "immediate", " ", "assignment"}], ",", " ", RowBox[{"we", " ", "will", " ", "see", " ", "why", " ", "later"}]}], "*)"}], "Alert"], "\[IndentingNewLine]"}]], "Input"] }, Open ]], Cell["\<\ RHS evaluated, it is x^(second argument) which is currently 4^(second \ argument)\ \>", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"f", "[", RowBox[{"2", ",", "3"}], "]"}], " ", StyleBox[ RowBox[{"(*", RowBox[{ RowBox[{"should", " ", "now", " ", "be", " ", RowBox[{"4", "^", "3"}]}], ",", " ", RowBox[{ "which", " ", "is", " ", "probably", " ", "not", " ", "what", " ", "the", " ", "programmer", " ", "had", " ", "in", " ", "mind"}]}], "*)"}], "Alert"]}]], "Input"], Cell[BoxData[ RowBox[{"f", "[", RowBox[{"y", ",", "z"}], "]"}]], "Input"], Cell["Delayed Assignmet (:=)", "Subsection", CellTags->{ "mmtag:03:functions__using_delayed_assignment_(:=)", "mmtag:03:delayed_assignment_(:=)", "mmtag:03:(:=)_delayed_assignment"}], Cell[TextData[{ "The problem with the above functions is that the evaluation is made \ immediately. For a function, the argument serves as a placeholder for a \ future calculation. You do not wish to have the right\[Dash]hand\[Dash]side \ evaluated until the actual values of left\[Dash]hand\[Dash]side are \ specified. The remedy is to use ", StyleBox["delayed assignment :=", FontSlant->"Italic"] }], "Text"], Cell[BoxData[{ RowBox[{"x", "=", "4"}], "\[IndentingNewLine]", RowBox[{"a", " ", "=", " ", "ScoobyDoo"}]}], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"f", "[", RowBox[{"x_", " ", ",", " ", "a_"}], "]"}], " ", ":=", " ", RowBox[{"x", "^", "a"}]}]], "Input"], Cell[BoxData[ RowBox[{"f", "[", RowBox[{"2", ",", "5"}], "]"}]], "Input"], Cell[BoxData[ RowBox[{"f", "[", RowBox[{"y", ",", "z"}], "]"}]], "Input"], Cell[BoxData[ RowBox[{"f", "[", RowBox[{"x", ",", "a"}], "]"}]], "Input"], Cell[BoxData[ RowBox[{"f", "[", RowBox[{"a", ",", "x"}], "]"}]], "Input"], Cell[BoxData[ RowBox[{"Clear", "[", "f", "]"}]], "Input"], Cell[TextData[{ "This is the paradigm for defining functions: ", StyleBox["A Pattern with a Delayed Assignment with that Pattern:", FontSlant->"Italic"], "\nmyFunction[pattern_] := pattern^2" }], "Subsubsection"] }, Closed]], Cell[CellGroupData[{ Cell["Using Recursion to Program ", "Subtitle", CellChangeTimes->{{3.395225528080545*^9, 3.395225549001005*^9}, 3.3953182332117033`*^9}], Cell["\<\ Functions that call themselves... (It is a good idea to review and review \ this example until you understand it.\ \>", "Section", CellTags->{ "mmtag:03:programming__using_rules", "mmtag:03:functional_programming", "mmtag:03:Factorial[]", "mmtag:03:programming__example_factorial"}], Cell["\<\ The canonical programming example is the factorial function n! = \ (n)\[Times](n-1) \[Times](n-2)\[Times]\[TripleDot]\[Times](1) where 0! \ \[Congruent] 1; here is a reasonably clever way to use the fact that (n+1)! \ = (n+1)\[Times]n!\ \>", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"factorial", "[", "n_", "]"}], " ", ":=", " ", RowBox[{"n", " ", RowBox[{"factorial", "[", RowBox[{"n", "-", "1"}], "]"}]}]}]], "Input"], Cell[" try it out...", "Text", CellChangeTimes->{3.395224215702908*^9}], Cell[BoxData[ RowBox[{"factorial", "[", "8", "]"}]], "Input"], Cell["\<\ Ooops, This isn't what was expected, but upon reflection it is correct--we \ forgot to define a part of the rule. (Note also that the message window \ produced an error about recursion limits) Add the second part of the \ definition. Here, we don't use delayed evaluation (:=) because we want to \ assign a value immediately.\ \>", "Text", CellChangeTimes->{{3.395224272852865*^9, 3.395224352257407*^9}, { 3.395224420278631*^9, 3.395224444013743*^9}}], Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{"factorial", "[", "0", "]"}], " ", "=", " ", "1"}], ";"}]], "Input"], Cell[BoxData[ RowBox[{"factorial", "[", "120", "]"}]], "Input"], Cell[BoxData[ RowBox[{"factorial", "[", "257", "]"}]], "Input"], Cell[TextData[{ "Here is where the recursion limit comes in : our function keeps on calling \ itself (i.e., recursively). Unless a limit is set the program would keep \ running forever. ", StyleBox["Mathematica", FontSlant->"Italic"], " builds in a limit to how many times a function will call itself:" }], "Text", CellChangeTimes->{{3.395224497244986*^9, 3.395224608036577*^9}}], Cell[BoxData["$RecursionLimit"], "Input", CellTags->"mmtag:03:recursion_limit"], Cell[BoxData[ RowBox[{"$RecursionLimit", " ", "=", RowBox[{"2", "^", "11"}]}]], "Input", CellChangeTimes->{{3.3953243643684807`*^9, 3.3953243646760807`*^9}, { 3.39532461103126*^9, 3.395324633824604*^9}}], Cell["Speed versus Memory in Functions", "Section", CellChangeTimes->{{3.39522465870443*^9, 3.395224681311573*^9}}], Cell[BoxData[ RowBox[{"?", "Timing"}]], "Input", CellChangeTimes->{{3.395200404782721*^9, 3.395200406963374*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"Timing", "[", RowBox[{"factorial", "[", "2000", "]"}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}]], "Input", CellChangeTimes->{ 3.395200178683155*^9, {3.395200426767624*^9, 3.395200427888217*^9}}], Cell["\<\ Using immediate assignment in a function: spending memory to buy time: Each \ time the function is called, it makes an extra assignment so that previous \ values can be recalled if needed.\ \>", "Text", CellChangeTimes->{{3.3952247379496307`*^9, 3.395224811641713*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"factorial", "[", "n_", "]"}], " ", ":=", " ", RowBox[{ RowBox[{"factorial", "[", "n", "]"}], " ", "=", " ", RowBox[{"n", "*", RowBox[{"factorial", "[", RowBox[{"n", "-", "1"}], "]"}]}]}]}]], "Input"], Cell["\<\ This version takes a bit longer the first time, because we are storing data \ in memory ...\ \>", "Text", CellChangeTimes->{{3.395224842394722*^9, 3.395224879752397*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"Timing", "[", RowBox[{"factorial", "[", "2000", "]"}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}]], "Input", CellChangeTimes->{ 3.395200183710204*^9, {3.395200438228407*^9, 3.395200440759227*^9}}, CellTags->"mmtag:03:Timing[]"], Cell["But, the next time it is called, the result is much faster.", "Text", CellChangeTimes->{{3.3952248875613003`*^9, 3.3952249020581617`*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"Timing", "[", RowBox[{"factorial", "[", "2001", "]"}], "]"}], "[", RowBox[{"[", "1", "]"}], "]"}]], "Input", CellChangeTimes->{ 3.395200188488657*^9, {3.3952004490599947`*^9, 3.3952004515502853`*^9}}], Cell[BoxData[ RowBox[{"Clear", "[", "factorial", "]"}]], "Input"] }, Closed]], Cell[CellGroupData[{ Cell["\<\ Smarter Functions: Further Restriction on Patterns and Conditions\ \>", "Subtitle", CellChangeTimes->{{3.395225528080545*^9, 3.395225549001005*^9}, { 3.395318113810546*^9, 3.3953181210764008`*^9}, {3.395321510146782*^9, 3.3953215156353607`*^9}}], Cell["Restrictions on Patterns", "Section", CellChangeTimes->{{3.395321484821829*^9, 3.395321507538034*^9}, { 3.395321539152659*^9, 3.3953215450272083`*^9}, {3.395321601290213*^9, 3.395321625274972*^9}, 3.3953233618480263`*^9}], Cell["\<\ The factorial function is pretty good, but not foolproof as the next few \ lines will show.\ \>", "Text", CellChangeTimes->{{3.3952249288771133`*^9, 3.395224935367466*^9}}], Cell[BoxData[ RowBox[{"Clear", "[", "factorial", "]"}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{"factorial", "[", "0", "]"}], " ", "=", " ", "1"}], ";", " ", RowBox[{ RowBox[{"factorial", "[", "n_", "]"}], " ", ":=", " ", RowBox[{"n", "*", RowBox[{"factorial", "[", RowBox[{"n", "-", "1"}], "]"}]}]}]}]], "Input"], Cell["\<\ The next line will cause an error to appear on the message screen.\ \>", "Text", CellChangeTimes->{{3.3952249722523327`*^9, 3.395225004198551*^9}}], Cell[BoxData[ RowBox[{"factorial", "[", "Pi", "]"}]], "Input"], Cell["The remedy is to restrict the pattern:", "Text"], Cell[BoxData[ RowBox[{"Clear", "[", "factorial", "]"}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{"factorial", "[", "0", "]"}], " ", "=", " ", "1"}], ";", " ", RowBox[{ RowBox[{"factorial", "[", "n_Integer", "]"}], " ", ":=", " ", RowBox[{"n", "*", RowBox[{"factorial", "[", RowBox[{"n", "-", "1"}], "]"}]}]}]}]], "Input"], Cell["\<\ This time it doesn' t produce an error, and returns a value indicating that \ it is leaving the function in symbolic form for values it doesn' t know about.\ \>", "Text", CellChangeTimes->{{3.3952250376805563`*^9, 3.395225107618655*^9}}], Cell[BoxData[ RowBox[{"factorial", "[", "Pi", "]"}]], "Input"], Cell["Functions and Patterns with Tests", "Section", CellChangeTimes->{{3.395225249079851*^9, 3.3952252566335917`*^9}, { 3.395321564673216*^9, 3.3953215670705023`*^9}, 3.395321647089425*^9}], Cell["\<\ However, the definition of factorial still needs some improvement--the next \ line will cause an error.\ \>", "Text", CellChangeTimes->{{3.39532338900639*^9, 3.395323438934319*^9}}], Cell[BoxData[ RowBox[{"factorial", "[", RowBox[{"-", "5"}], "]"}]], "Input"], Cell[BoxData[ RowBox[{"Clear", "[", "factorial", "]"}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{"factorial", "[", "0", "]"}], " ", "=", " ", "1"}], ";", " ", RowBox[{ RowBox[{"factorial", "[", RowBox[{"n_Integer", "?", "Positive"}], "]"}], " ", ":=", " ", RowBox[{"n", "*", RowBox[{"factorial", "[", RowBox[{"n", "-", "1"}], "]"}]}]}]}]], "Input"], Cell[BoxData[ RowBox[{"factorial", "[", "12", "]"}]], "Input"], Cell[BoxData[ RowBox[{"factorial", "[", "Pi", "]"}]], "Input"] }, Closed]], Cell[CellGroupData[{ Cell["Examples with Graphics and Conditional Definitions", "Subtitle", CellChangeTimes->{{3.395225528080545*^9, 3.395225549001005*^9}, { 3.395318113810546*^9, 3.3953181210764008`*^9}, {3.395321510146782*^9, 3.3953215156353607`*^9}, {3.395323536946664*^9, 3.395323571637991*^9}}], Cell["\<\ As a another example, let's define the Sign function. It should be -1 when \ its argument is negative, 0 when its argument is zero, and +1 when its \ argument is positive. There are lots of ways to write this function, there \ is no best way. Whatever works is good.\ \>", "Text", CellChangeTimes->{{3.395323890465972*^9, 3.395323891512186*^9}}, CellTags->{ "mmtag:03:sign_example", "mmtag:03:programming__example_step_function"}], Cell[BoxData[ RowBox[{"?", "Sign"}]], "Input"], Cell["\<\ Here we write our own version, we don' t \"name'' the pattern because it is \ not needed in the function definition. It is a bit harder to read this way, \ but I use it here to be instructive.\ \>", "Text", CellChangeTimes->{{3.395225298208849*^9, 3.395225396870875*^9}, { 3.395225428992559*^9, 3.395225434183264*^9}}], Cell[BoxData[{ RowBox[{ RowBox[{ RowBox[{"HeyWhatsYourSign", "[", "0", "]"}], " ", "=", " ", "0"}], ";", " ", RowBox[{ RowBox[{"HeyWhatsYourSign", "[", "0.0", "]"}], "=", "0"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"HeyWhatsYourSign", "[", RowBox[{"_", "?", "Positive"}], "]"}], " ", ":=", " ", "1"}], ";", " ", RowBox[{ RowBox[{"HeyWhatsYourSign", "[", RowBox[{"_", "?", "Negative"}], "]"}], " ", ":=", " ", RowBox[{"-", "1"}]}], ";"}]}], "Input", CellChangeTimes->{{3.395468631040056*^9, 3.395468646482214*^9}}], Cell[BoxData[ RowBox[{"Plot", "[", RowBox[{ RowBox[{"HeyWhatsYourSign", "[", "argument", "]"}], ",", RowBox[{"{", RowBox[{"argument", ",", RowBox[{"-", "\[Pi]"}], ",", "\[ExponentialE]"}], "}"}], ",", RowBox[{"PlotStyle", "\[Rule]", "Thick"}]}], "]"}]], "Input", CellChangeTimes->{{3.395225576938519*^9, 3.395225588473716*^9}}], Cell[BoxData[ RowBox[{"Plot", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"1", "/", "x"}], ",", RowBox[{ RowBox[{"HeyWhatsYourSign", "[", "x", "]"}], "/", "x"}]}], "}"}], ",", RowBox[{"{", RowBox[{"x", ",", RowBox[{"-", "1"}], ",", "1"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"BaseStyle", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{"FontSize", "\[Rule]", "18"}], ",", RowBox[{"FontFamily", "\[Rule]", "\"\\""}]}], "}"}]}], ",", RowBox[{"PlotStyle", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"Hue", "[", "1", "]"}], ",", RowBox[{"Thickness", "[", "0.02", "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"Hue", "[", "0.66", "]"}], ",", RowBox[{"Thickness", "[", "0.01", "]"}]}], "}"}]}], "}"}]}]}], "]"}]], "Input", CellChangeTimes->{{3.3952256311055317`*^9, 3.395225664712763*^9}, { 3.395225753553701*^9, 3.3952257906717052`*^9}}], Cell["Functions with Conditional Definitions", "Section", CellChangeTimes->{{3.395225249079851*^9, 3.3952252566335917`*^9}, { 3.395321564673216*^9, 3.3953215670705023`*^9}, {3.395321647089425*^9, 3.395321682798929*^9}}], Cell["\<\ In thermodynamics, x ln(x) appears frequently in expressions that involve \ entropy. The variable x is restricted to 0 \[LessEqual]x\[LessEqual]1.\ \>", "Text", CellChangeTimes->{{3.395323155953289*^9, 3.395323246057218*^9}}], Cell[BoxData[{ RowBox[{ RowBox[{"XLogX", "[", "x_", "]"}], " ", ":=", " ", RowBox[{ RowBox[{"x", " ", RowBox[{"Log", "[", "x", "]"}]}], "/;", RowBox[{"(", RowBox[{ RowBox[{"x", ">", "0"}], " ", "&&", " ", RowBox[{"x", " ", "\[LessEqual]", "1"}]}], ")"}]}]}], "\[IndentingNewLine]", RowBox[{ RowBox[{"XLogX", "[", "0", "]"}], " ", "=", RowBox[{ RowBox[{"XLogX", "[", "0.0", "]"}], "=", " ", RowBox[{"Limit", "[", RowBox[{ RowBox[{"xsmall", " ", RowBox[{"Log", "[", "xsmall", "]"}]}], ",", " ", RowBox[{"xsmall", "\[Rule]", "0"}]}], "]"}]}]}]}], "Input", CellChangeTimes->{{3.395319664017136*^9, 3.3953196776521*^9}, { 3.395319846644018*^9, 3.3953200004971046`*^9}, 3.395320160183312*^9, { 3.395320219272038*^9, 3.395320273772078*^9}, 3.39532035724107*^9, { 3.395320444378417*^9, 3.3953204450552597`*^9}, {3.395322803035679*^9, 3.395322804302512*^9}, {3.3953228672335377`*^9, 3.395322884609366*^9}, { 3.395322933141477*^9, 3.395323045642695*^9}, {3.395468666505865*^9, 3.395468689341592*^9}, {3.395469830330447*^9, 3.39546983720039*^9}}], Cell[BoxData[ RowBox[{"XLogX", "[", "1.2", "]"}]], "Input", CellChangeTimes->{{3.395323049081662*^9, 3.3953230561026373`*^9}}], Cell[BoxData[ RowBox[{"Plot", "[", RowBox[{ RowBox[{ RowBox[{"XLogX", "[", "x", "]"}], "+", " ", RowBox[{"XLogX", "[", RowBox[{"1", "-", "x"}], "]"}]}], ",", RowBox[{"{", RowBox[{"x", ",", RowBox[{"-", "1"}], ",", "2"}], "}"}], ",", RowBox[{"PlotStyle", "\[Rule]", "Thick"}]}], "]"}]], "Input", CellChangeTimes->{{3.395323067451283*^9, 3.395323129588562*^9}}] }, Closed]] }, ScreenStyleEnvironment->"Presentation", PrintingStyleEnvironment->"FullPageBWPrint", WindowToolbars->{}, CellGrouping->Manual, WindowSize->{1123, 681}, WindowMargins->{{Automatic, 349}, {Automatic, 149}}, WindowTitle->"Lecture 03 MIT 3.016 (Fall 2009) \[Copyright] W. Craig Carter \ 2003--2009", PrintingCopies->1, PrintingPageRange->{1, Automatic}, PrintingOptions->{"PaperOrientation"->"Portrait"}, ShowSelection->True, ShowCellLabel->False, CellLabelAutoDelete->True, FrontEndVersion->"7.0 for Mac OS X x86 (32-bit) (November 11, 2008)", StyleDefinitions->"3016-Carter.nb" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{ "mmtag:03:mutliple_instructions_in_same_cell"->{ Cell[1183, 41, 150, 2, 70, "Section", CellTags->{ "mmtag:03:mutliple_instructions_in_same_cell", "mmtag:03:hiding_output"}]}, "mmtag:03:hiding_output"->{ Cell[1183, 41, 150, 2, 70, "Section", CellTags->{ "mmtag:03:mutliple_instructions_in_same_cell", "mmtag:03:hiding_output"}]}, "mmtag:03:loops__Do[]"->{ Cell[2149, 71, 78, 1, 70, "Section", CellTags->{"mmtag:03:loops__Do[]", "mmtag:03:Do[]"}]}, "mmtag:03:Do[]"->{ Cell[2149, 71, 78, 1, 70, "Section", CellTags->{"mmtag:03:loops__Do[]", "mmtag:03:Do[]"}]}, "mmtag:03:Print[]"->{ Cell[3216, 112, 557, 16, 70, "Input", CellTags->{"mmtag:03:Print[]", "mmtag:03:printing_intermediate_output"}]}, "mmtag:03:printing_intermediate_output"->{ Cell[3216, 112, 557, 16, 70, "Input", CellTags->{"mmtag:03:Print[]", "mmtag:03:printing_intermediate_output"}]}, "mmtag:03:Table[]"->{ Cell[5145, 182, 424, 14, 70, "Input", CellTags->"mmtag:03:Table[]"]}, "mmtag:03:ListPlot[]"->{ Cell[7384, 264, 142, 4, 70, "Input", CellTags->"mmtag:03:ListPlot[]"]}, "mmtag:03:FindMinimum[]"->{ Cell[8142, 294, 709, 20, 70, "Input", CellTags->"mmtag:03:FindMinimum[]"]}, "mmtag:03:Nest[]"->{ Cell[9739, 345, 334, 11, 70, "Input", CellTags->{"mmtag:03:Nest[]", "mmtag:03:pure_functions"}]}, "mmtag:03:pure_functions"->{ Cell[9739, 345, 334, 11, 70, "Input", CellTags->{"mmtag:03:Nest[]", "mmtag:03:pure_functions"}], Cell[11818, 426, 1542, 38, 70, "Input", CellTags->{ "mmtag:03:Module[]", "mmtag:03:local_variables__use_in_Module[]", "mmtag:03:pure_functions"}]}, "mmtag:03:FindRoot[]"->{ Cell[10440, 373, 181, 5, 70, "Input", CellTags->"mmtag:03:FindRoot[]"]}, "mmtag:03:Module[]"->{ Cell[11818, 426, 1542, 38, 70, "Input", CellTags->{ "mmtag:03:Module[]", "mmtag:03:local_variables__use_in_Module[]", "mmtag:03:pure_functions"}]}, "mmtag:03:local_variables__use_in_Module[]"->{ Cell[11818, 426, 1542, 38, 70, "Input", CellTags->{ "mmtag:03:Module[]", "mmtag:03:local_variables__use_in_Module[]", "mmtag:03:pure_functions"}]}, "mmtag:03:switches__If[]_and_Which[]"->{ Cell[13554, 470, 130, 2, 70, "Section", CellTags->{ "mmtag:03:switches__If[]_and_Which[]", "mmtag:03:If[]", "mmtag:03:Which[]"}]}, "mmtag:03:If[]"->{ Cell[13554, 470, 130, 2, 70, "Section", CellTags->{ "mmtag:03:switches__If[]_and_Which[]", "mmtag:03:If[]", "mmtag:03:Which[]"}]}, "mmtag:03:Which[]"->{ Cell[13554, 470, 130, 2, 70, "Section", CellTags->{ "mmtag:03:switches__If[]_and_Which[]", "mmtag:03:If[]", "mmtag:03:Which[]"}]}, "mmtag:03:PrimeQ[]_query_for_prime_number"->{ Cell[13953, 484, 104, 2, 70, "Input", CellTags->"mmtag:03:PrimeQ[]_query_for_prime_number"]}, "mmtag:03:patterns"->{ Cell[15178, 522, 474, 16, 70, "Text", CellTags->"mmtag:03:patterns"]}, "mmtag:03:pattern_restrictions"->{ Cell[17237, 596, 299, 8, 70, "Input", CellTags->"mmtag:03:pattern_restrictions"]}, "mmtag:03:switches__Cases[]"->{ Cell[21274, 737, 111, 2, 70, "Input", CellTags->{"mmtag:03:switches__Cases[]", "mmtag:03:Cases[]"}]}, "mmtag:03:Cases[]"->{ Cell[21274, 737, 111, 2, 70, "Input", CellTags->{"mmtag:03:switches__Cases[]", "mmtag:03:Cases[]"}]}, "mmtag:03:functions__defining_with_patterns"->{ Cell[23661, 822, 168, 4, 70, "Section", CellTags->"mmtag:03:functions__defining_with_patterns"]}, "mmtag:03:functions__errors_with_immediate_assignment_(=)"->{ Cell[23832, 828, 428, 10, 70, "Text", CellTags->"mmtag:03:functions__errors_with_immediate_assignment_(=)"]}, "mmtag:03:functions__using_delayed_assignment_(:=)"->{ Cell[27551, 950, 189, 3, 70, "Subsection", CellTags->{ "mmtag:03:functions__using_delayed_assignment_(:=)", "mmtag:03:delayed_assignment_(:=)", "mmtag:03:(:=)_delayed_assignment"}]}, "mmtag:03:delayed_assignment_(:=)"->{ Cell[27551, 950, 189, 3, 70, "Subsection", CellTags->{ "mmtag:03:functions__using_delayed_assignment_(:=)", "mmtag:03:delayed_assignment_(:=)", "mmtag:03:(:=)_delayed_assignment"}]}, "mmtag:03:(:=)_delayed_assignment"->{ Cell[27551, 950, 189, 3, 70, "Subsection", CellTags->{ "mmtag:03:functions__using_delayed_assignment_(:=)", "mmtag:03:delayed_assignment_(:=)", "mmtag:03:(:=)_delayed_assignment"}]}, "mmtag:03:programming__using_rules"->{ Cell[29214, 1008, 300, 6, 70, "Section", CellTags->{ "mmtag:03:programming__using_rules", "mmtag:03:functional_programming", "mmtag:03:Factorial[]", "mmtag:03:programming__example_factorial"}]}, "mmtag:03:functional_programming"->{ Cell[29214, 1008, 300, 6, 70, "Section", CellTags->{ "mmtag:03:programming__using_rules", "mmtag:03:functional_programming", "mmtag:03:Factorial[]", "mmtag:03:programming__example_factorial"}]}, "mmtag:03:Factorial[]"->{ Cell[29214, 1008, 300, 6, 70, "Section", CellTags->{ "mmtag:03:programming__using_rules", "mmtag:03:functional_programming", "mmtag:03:Factorial[]", "mmtag:03:programming__example_factorial"}]}, "mmtag:03:programming__example_factorial"->{ Cell[29214, 1008, 300, 6, 70, "Section", CellTags->{ "mmtag:03:programming__using_rules", "mmtag:03:functional_programming", "mmtag:03:Factorial[]", "mmtag:03:programming__example_factorial"}]}, "mmtag:03:recursion_limit"->{ Cell[31211, 1067, 80, 1, 70, "Input", CellTags->"mmtag:03:recursion_limit"]}, "mmtag:03:Timing[]"->{ Cell[32713, 1113, 273, 7, 70, "Input", CellTags->"mmtag:03:Timing[]"]}, "mmtag:03:sign_example"->{ Cell[36820, 1244, 445, 8, 70, "Text", CellTags->{ "mmtag:03:sign_example", "mmtag:03:programming__example_step_function"}]}, "mmtag:03:programming__example_step_function"->{ Cell[36820, 1244, 445, 8, 70, "Text", CellTags->{ "mmtag:03:sign_example", "mmtag:03:programming__example_step_function"}]} } *) (*CellTagsIndex CellTagsIndex->{ {"mmtag:03:mutliple_instructions_in_same_cell", 42498, 1403}, {"mmtag:03:hiding_output", 42662, 1407}, {"mmtag:03:loops__Do[]", 42824, 1411}, {"mmtag:03:Do[]", 42941, 1414}, {"mmtag:03:Print[]", 43061, 1417}, {"mmtag:03:printing_intermediate_output", 43223, 1420}, {"mmtag:03:Table[]", 43364, 1423}, {"mmtag:03:ListPlot[]", 43465, 1426}, {"mmtag:03:FindMinimum[]", 43571, 1429}, {"mmtag:03:Nest[]", 43674, 1432}, {"mmtag:03:pure_functions", 43807, 1435}, {"mmtag:03:FindRoot[]", 44098, 1442}, {"mmtag:03:Module[]", 44200, 1445}, {"mmtag:03:local_variables__use_in_Module[]", 44411, 1450}, {"mmtag:03:switches__If[]_and_Which[]", 44616, 1455}, {"mmtag:03:If[]", 44782, 1460}, {"mmtag:03:Which[]", 44951, 1465}, {"mmtag:03:PrimeQ[]_query_for_prime_number", 45144, 1470}, {"mmtag:03:patterns", 45267, 1473}, {"mmtag:03:pattern_restrictions", 45379, 1476}, {"mmtag:03:switches__Cases[]", 45500, 1479}, {"mmtag:03:Cases[]", 45630, 1482}, {"mmtag:03:functions__defining_with_patterns", 45786, 1485}, {"mmtag:03:functions__errors_with_immediate_assignment_(=)", 45952, 1488}, {"mmtag:03:functions__using_delayed_assignment_(:=)", 46123, 1491}, {"mmtag:03:delayed_assignment_(:=)", 46360, 1496}, {"mmtag:03:(:=)_delayed_assignment", 46597, 1501}, {"mmtag:03:programming__using_rules", 46835, 1506}, {"mmtag:03:functional_programming", 47083, 1511}, {"mmtag:03:Factorial[]", 47320, 1516}, {"mmtag:03:programming__example_factorial", 47576, 1521}, {"mmtag:03:recursion_limit", 47817, 1526}, {"mmtag:03:Timing[]", 47924, 1529}, {"mmtag:03:sign_example", 48029, 1532}, {"mmtag:03:programming__example_step_function", 48213, 1536} } *) (*NotebookFileOutline Notebook[{ Cell[628, 22, 53, 0, 96, "Title"], Cell[CellGroupData[{ Cell[706, 26, 110, 5, 70, "Subtitle"], Cell[819, 33, 361, 6, 70, "Text"], Cell[1183, 41, 150, 2, 70, "Section", CellTags->{ "mmtag:03:mutliple_instructions_in_same_cell", "mmtag:03:hiding_output"}], Cell[1336, 45, 437, 14, 70, "Input"], Cell[1776, 61, 309, 5, 70, "Text"], Cell[2088, 68, 58, 1, 70, "Input"], Cell[2149, 71, 78, 1, 70, "Section", CellTags->{"mmtag:03:loops__Do[]", "mmtag:03:Do[]"}], Cell[2230, 74, 368, 10, 70, "Subsubsection"], Cell[2601, 86, 45, 1, 70, "Input"], Cell[2649, 89, 317, 11, 70, "Input"], Cell[2969, 102, 27, 0, 70, "Input"], Cell[2999, 104, 214, 6, 70, "Text"], Cell[3216, 112, 557, 16, 70, "Input", CellTags->{"mmtag:03:Print[]", "mmtag:03:printing_intermediate_output"}], Cell[3776, 130, 58, 1, 70, "Input"], Cell[3837, 133, 46, 1, 70, "Input"], Cell[3886, 136, 1093, 35, 70, "Input"], Cell[4982, 173, 48, 1, 70, "Input"], Cell[5033, 176, 48, 1, 70, "Input"], Cell[5084, 179, 58, 1, 70, "Input"], Cell[5145, 182, 424, 14, 70, "Input", CellTags->"mmtag:03:Table[]"], Cell[5572, 198, 156, 5, 70, "Text"], Cell[5731, 205, 393, 13, 70, "Input"], Cell[6127, 220, 741, 22, 70, "Input"], Cell[6871, 244, 271, 7, 70, "Text"] }, Closed]], Cell[CellGroupData[{ Cell[7179, 256, 202, 6, 108, "Subtitle"], Cell[7384, 264, 142, 4, 70, "Input", CellTags->"mmtag:03:ListPlot[]"], Cell[7529, 270, 67, 1, 70, "Input"], Cell[7599, 273, 116, 5, 70, "Text"], Cell[7718, 280, 366, 9, 70, "Input"], Cell[8087, 291, 52, 1, 70, "Input"], Cell[8142, 294, 709, 20, 70, "Input", CellTags->"mmtag:03:FindMinimum[]"], Cell[8854, 316, 282, 7, 70, "Text"], Cell[9139, 325, 536, 15, 70, "Text"], Cell[9678, 342, 58, 1, 70, "Input"], Cell[9739, 345, 334, 11, 70, "Input", CellTags->{"mmtag:03:Nest[]", "mmtag:03:pure_functions"}], Cell[10076, 358, 59, 0, 70, "Text"], Cell[10138, 360, 142, 4, 70, "Input"], Cell[10283, 366, 154, 5, 70, "Text"], Cell[10440, 373, 181, 5, 70, "Input", CellTags->"mmtag:03:FindRoot[]"] }, Closed]], Cell[CellGroupData[{ Cell[10658, 383, 52, 0, 56, "Subtitle"], Cell[10713, 385, 34, 0, 70, "Section"], Cell[10750, 387, 546, 17, 70, "Text"], Cell[11299, 406, 130, 1, 70, "Input"], Cell[11432, 409, 91, 2, 70, "Input"], Cell[11526, 413, 237, 8, 70, "Text"], Cell[11766, 423, 49, 1, 70, "Input"], Cell[11818, 426, 1542, 38, 70, "Input", CellTags->{ "mmtag:03:Module[]", "mmtag:03:local_variables__use_in_Module[]", "mmtag:03:pure_functions"}], Cell[13363, 466, 188, 2, 70, "Input"], Cell[13554, 470, 130, 2, 70, "Section", CellTags->{ "mmtag:03:switches__If[]_and_Which[]", "mmtag:03:If[]", "mmtag:03:Which[]"}], Cell[13687, 474, 45, 1, 70, "Input"], Cell[13735, 477, 215, 5, 70, "Input"], Cell[13953, 484, 104, 2, 70, "Input", CellTags->"mmtag:03:PrimeQ[]_query_for_prime_number"], Cell[14060, 488, 574, 13, 70, "Input"], Cell[14637, 503, 409, 10, 70, "Text"] }, Closed]], Cell[CellGroupData[{ Cell[15083, 518, 58, 0, 56, "Subtitle"], Cell[15144, 520, 31, 0, 70, "Section"], Cell[15178, 522, 474, 16, 70, "Text", CellTags->"mmtag:03:patterns"], Cell[15655, 540, 294, 7, 70, "Input"], Cell[15952, 549, 143, 4, 70, "Input"], Cell[16098, 555, 404, 12, 70, "Subsubsection"], Cell[16505, 569, 58, 1, 70, "Input"], Cell[16566, 572, 143, 4, 70, "Input"], Cell[16712, 578, 403, 11, 70, "Input"], Cell[17118, 591, 116, 3, 70, "Text"], Cell[17237, 596, 299, 8, 70, "Input", CellTags->"mmtag:03:pattern_restrictions"], Cell[17539, 606, 632, 18, 70, "Subsubsection"], Cell[18174, 626, 181, 5, 70, "Text"], Cell[18358, 633, 106, 2, 70, "Input"], Cell[18467, 637, 674, 20, 70, "Text"], Cell[19144, 659, 268, 8, 70, "Input"], Cell[19415, 669, 228, 7, 70, "Input"], Cell[19646, 678, 148, 3, 70, "Text"], Cell[19797, 683, 258, 8, 70, "Input"], Cell[20058, 693, 268, 8, 70, "Input"], Cell[20329, 703, 143, 2, 70, "Input"], Cell[20475, 707, 109, 3, 70, "Text"], Cell[20587, 712, 274, 8, 70, "Input"], Cell[20864, 722, 68, 1, 70, "Input"], Cell[20935, 725, 119, 3, 70, "Text"], Cell[21057, 730, 214, 5, 70, "Text"], Cell[21274, 737, 111, 2, 70, "Input", CellTags->{"mmtag:03:switches__Cases[]", "mmtag:03:Cases[]"}], Cell[21388, 741, 524, 16, 70, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[21949, 762, 61, 0, 56, "Subtitle"], Cell[22013, 764, 151, 3, 70, "Subsubsection"], Cell[22167, 769, 102, 2, 70, "Input"], Cell[22272, 773, 145, 3, 70, "Subsubsection"], Cell[22420, 778, 191, 5, 70, "Input"], Cell[22614, 785, 320, 9, 70, "Subsubsection"], Cell[22937, 796, 106, 2, 70, "Input"], Cell[23046, 800, 41, 0, 70, "Input"], Cell[23090, 802, 137, 3, 70, "Text"], Cell[23230, 807, 253, 7, 70, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[23520, 819, 138, 1, 56, "Subtitle"], Cell[23661, 822, 168, 4, 70, "Section", CellTags->"mmtag:03:functions__defining_with_patterns"], Cell[23832, 828, 428, 10, 70, "Text", CellTags->"mmtag:03:functions__errors_with_immediate_assignment_(=)"], Cell[24263, 840, 488, 14, 70, "Input"], Cell[24754, 856, 1195, 33, 70, "Text"], Cell[25952, 891, 157, 4, 70, "Input"], Cell[26112, 897, 134, 5, 70, "Text"], Cell[CellGroupData[{ Cell[26271, 906, 59, 1, 70, "Input"], Cell[26333, 909, 595, 15, 70, "Input"] }, Open ]], Cell[26943, 927, 105, 3, 70, "Text"], Cell[27051, 932, 417, 12, 70, "Input"], Cell[27471, 946, 77, 2, 70, "Input"], Cell[27551, 950, 189, 3, 70, "Subsection", CellTags->{ "mmtag:03:functions__using_delayed_assignment_(:=)", "mmtag:03:delayed_assignment_(:=)", "mmtag:03:(:=)_delayed_assignment"}], Cell[27743, 955, 417, 8, 70, "Text"], Cell[28163, 965, 119, 2, 70, "Input"], Cell[28285, 969, 147, 4, 70, "Input"], Cell[28435, 975, 77, 2, 70, "Input"], Cell[28515, 979, 77, 2, 70, "Input"], Cell[28595, 983, 77, 2, 70, "Input"], Cell[28675, 987, 77, 2, 70, "Input"], Cell[28755, 991, 58, 1, 70, "Input"], Cell[28816, 994, 217, 5, 70, "Subsubsection"] }, Closed]], Cell[CellGroupData[{ Cell[29070, 1004, 141, 2, 56, "Subtitle"], Cell[29214, 1008, 300, 6, 70, "Section", CellTags->{ "mmtag:03:programming__using_rules", "mmtag:03:functional_programming", "mmtag:03:Factorial[]", "mmtag:03:programming__example_factorial"}], Cell[29517, 1016, 260, 5, 70, "Text"], Cell[29780, 1023, 182, 5, 70, "Input"], Cell[29965, 1030, 72, 1, 70, "Text"], Cell[30040, 1033, 62, 1, 70, "Input"], Cell[30105, 1036, 464, 8, 70, "Text"], Cell[30572, 1046, 114, 3, 70, "Input"], Cell[30689, 1051, 64, 1, 70, "Input"], Cell[30756, 1054, 64, 1, 70, "Input"], Cell[30823, 1057, 385, 8, 70, "Text"], Cell[31211, 1067, 80, 1, 70, "Input", CellTags->"mmtag:03:recursion_limit"], Cell[31294, 1070, 210, 4, 70, "Input"], Cell[31507, 1076, 116, 1, 70, "Section"], Cell[31626, 1079, 115, 2, 70, "Input"], Cell[31744, 1083, 241, 6, 70, "Input"], Cell[31988, 1091, 280, 5, 70, "Text"], Cell[32271, 1098, 255, 7, 70, "Input"], Cell[32529, 1107, 181, 4, 70, "Text"], Cell[32713, 1113, 273, 7, 70, "Input", CellTags->"mmtag:03:Timing[]"], Cell[32989, 1122, 145, 1, 70, "Text"], Cell[33137, 1125, 245, 6, 70, "Input"], Cell[33385, 1133, 66, 1, 70, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[33488, 1139, 261, 5, 108, "Subtitle"], Cell[33752, 1146, 235, 3, 70, "Section"], Cell[33990, 1151, 183, 4, 70, "Text"], Cell[34176, 1157, 66, 1, 70, "Input"], Cell[34245, 1160, 284, 8, 70, "Input"], Cell[34532, 1170, 158, 3, 70, "Text"], Cell[34693, 1175, 63, 1, 70, "Input"], Cell[34759, 1178, 54, 0, 70, "Text"], Cell[34816, 1180, 66, 1, 70, "Input"], Cell[34885, 1183, 291, 8, 70, "Input"], Cell[35179, 1193, 248, 4, 70, "Text"], Cell[35430, 1199, 63, 1, 70, "Input"], Cell[35496, 1202, 194, 2, 70, "Section"], Cell[35693, 1206, 192, 4, 70, "Text"], Cell[35888, 1212, 80, 2, 70, "Input"], Cell[35971, 1216, 66, 1, 70, "Input"], Cell[36040, 1219, 323, 9, 70, "Input"], Cell[36366, 1230, 63, 1, 70, "Input"], Cell[36432, 1233, 63, 1, 70, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[36532, 1239, 285, 3, 56, "Subtitle"], Cell[36820, 1244, 445, 8, 70, "Text", CellTags->{ "mmtag:03:sign_example", "mmtag:03:programming__example_step_function"}], Cell[37268, 1254, 47, 1, 70, "Input"], Cell[37318, 1257, 332, 6, 70, "Text"], Cell[37653, 1265, 578, 16, 70, "Input"], Cell[38234, 1283, 354, 8, 70, "Input"], Cell[38591, 1293, 1025, 29, 70, "Input"], Cell[39619, 1324, 225, 3, 70, "Section"], Cell[39847, 1329, 237, 4, 70, "Text"], Cell[40087, 1335, 1132, 26, 70, "Input"], Cell[41222, 1363, 128, 2, 70, "Input"], Cell[41353, 1367, 401, 11, 70, "Input"] }, Closed]] } ] *) (* End of internal cache information *)