(* 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[ 14176, 477] NotebookOptionsPosition[ 11773, 395] NotebookOutlinePosition[ 12145, 411] CellTagsIndexPosition[ 12102, 408] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell[TextData[{ StyleBox["261 ", FontColor->RGBColor[0, 0, 1]], StyleBox["Mathematica", FontSlant->"Italic", FontColor->RGBColor[0, 0, 1]], StyleBox[" Session 2", FontColor->RGBColor[0, 0, 1]] }], "Subtitle", TextAlignment->Center, TextJustification->0], Cell["\<\ As in the last session, this notebook has a collection of cells which you \ should read and evaluate. There are also problems to solve, for which you will create and evaluate your \ own cells.\ \>", "Text", CellChangeTimes->{{3.4640078245608077`*^9, 3.464007825513932*^9}}], Cell[TextData[StyleBox["Be sure to switch control of the keyboard and mouse \ regularly, so that all group members can be equally frustrated.", FontWeight->"Bold", FontColor->RGBColor[1, 0, 0]]], "Text"], Cell[CellGroupData[{ Cell["Clear symbols", "Section", Evaluatable->False, AspectRatioFixed->True], Cell["\<\ In order to avoid interference from symbols defined in other notebooks, we \ first Clear all symbols. We assume that the relevant symbols are in the \ Global` context.\ \>", "Text", Evaluatable->False, AspectRatioFixed->True], Cell["Clear[\"Global`*\"]", "Input", AspectRatioFixed->True], Cell["\<\ We put this here so you can re-evaluate this cell when things are going all \ wrong.\ \>", "Text"] }, Open ]], Cell[CellGroupData[{ Cell["Review", "Section"], Cell["\<\ Here are some things to recall from last time. \t Do you remember the significance and use of the various parentheses: \ [square] (round) {squiggly}? \t What is the difference between these: x = 2 and x == 2? \t How about making a Plot of a function? Let's take Tanh[x] to be \ specific. \t And finally, try using Solve to find an angle such that Cos[\[Theta]] = \ Tan[\[Theta]]\ \>", "Text", CellChangeTimes->{{3.4640007848046*^9, 3.4640007899058*^9}}] }, Open ]], Cell[CellGroupData[{ Cell["Math worksheet stuff", "Section", CellChangeTimes->{{3.4640008353174*^9, 3.4640008415573997`*^9}}], Cell[TextData[{ "The math worksheet portion of the homework asks you to sketch a few \ functions and take some derivatives. Of course the goal is for you to be \ able to do it \"by hand\", but you are always free to ask ", StyleBox["Mathematica", FontSlant->"Italic"], " for the answer and then figure out why you always knew that.\nAs a warmup, \ here is some random function:" }], "Text", CellChangeTimes->{{3.4640008445058002`*^9, 3.464000901711*^9}, { 3.4640009470446*^9, 3.4640009760917997`*^9}, {3.4640010098814*^9, 3.464001034467*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"f", "[", "x_", "]"}], " ", "=", " ", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"x", "^", "2"}], " ", "-", "1"}], ")"}], "/", RowBox[{"(", RowBox[{"x", "-", "3"}], ")"}]}]}]], "Input", CellChangeTimes->{{3.4640010366198*^9, 3.4640011849133997`*^9}}], Cell["\<\ First ask yourself: where are the zeroes and singularities? How does the \ function behave for large |x|?\ \>", "Text", CellChangeTimes->{{3.4640012151306*^9, 3.4640012433822002`*^9}, { 3.4640013930786*^9, 3.464001403047*^9}}], Cell[TextData[{ "Then here is how to ask ", StyleBox["Mathematica", FontSlant->"Italic"], " for that information:" }], "Text", CellChangeTimes->{{3.4640012581242*^9, 3.4640012666574*^9}}], Cell[BoxData[ RowBox[{"Solve", "[", RowBox[{ RowBox[{ RowBox[{"f", "[", "x", "]"}], "\[Equal]", "0"}], ",", "x"}], "]"}]], "Input", CellChangeTimes->{{3.4640012686074*^9, 3.4640012717274*^9}}], Cell[BoxData[ RowBox[{"Solve", "[", RowBox[{ RowBox[{ RowBox[{"1", "/", RowBox[{"f", "[", "x", "]"}]}], "\[Equal]", "0"}], ",", "x"}], "]"}]], "Input", CellChangeTimes->{{3.4640012757834*^9, 3.4640012935362*^9}}], Cell[BoxData[ RowBox[{"Limit", "[", RowBox[{ RowBox[{ RowBox[{"f", "[", "x", "]"}], "/", "x"}], ",", RowBox[{"x", "\[Rule]", "Infinity"}]}], "]"}]], "Input", CellChangeTimes->{{3.4640013782342*^9, 3.4640014233114*^9}}], Cell["\<\ With that information, try making a sketch by hand, then check using Plot[]. Likewise with any of the homework you care to take on here and now.\ \>", "Text", CellChangeTimes->{{3.4640013388386*^9, 3.4640013648438*^9}, { 3.4640014482558002`*^9, 3.4640014682237997`*^9}}] }, Open ]], Cell[CellGroupData[{ Cell["Substitution Rules", "Section"], Cell[TextData[{ "Here is a new ", StyleBox["Mathematica", FontSlant->"Italic"], "-ism for the day: the slashdot. Often we have an expression involving a \ variable or two and we'd like\nto know the value of the expression when we \ plug in specific values. Here is how to do that quickly and without lasting \ side-effects:" }], "Text"], Cell[BoxData[ RowBox[{ RowBox[{"q", "^", "2"}], " ", "/.", " ", RowBox[{"q", "\[Rule]", " ", "3"}]}]], "Input"], Cell["Or maybe there are several parameters we want to substitute:", "Text"], Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"m1", " ", "+", " ", "m2"}], ")"}], " ", "g"}], " ", "/.", " ", RowBox[{"{", RowBox[{ RowBox[{"m1", "\[Rule]", "m"}], ",", " ", RowBox[{"m2", "\[Rule]", RowBox[{"2", "m"}]}], ",", " ", RowBox[{"g", "\[Rule]", "9.8"}]}], "}"}]}]], "Input"] }, Open ]], Cell[CellGroupData[{ Cell["Simultaneous Equations", "Section"], Cell[TextData[{ "As we attack more complicated physics problems we typically end up with a \ whole set of unknowns (e.g. accelerations, tensions, ...)\nand a whole set of \ relationships (F=ma, constraints, ...) which we need to solve simultaneously. \ ", StyleBox["Mathematica", FontSlant->"Italic"], "'s Solve[] can handle it.\nHere is a set of simultaneous linear equations. \ Note that the single = sign\nis used to assign a name to the equation, but \ the equation itself has the double == sign." }], "Text"], Cell[BoxData[ RowBox[{"eqn1", " ", "=", " ", RowBox[{ RowBox[{ RowBox[{"4", " ", "x"}], " ", "+", " ", RowBox[{"3", " ", "y"}], " ", "-", " ", "z"}], " ", "==", " ", "3"}]}]], "Input"], Cell[BoxData[ RowBox[{"eqn2", " ", "=", " ", RowBox[{ RowBox[{ RowBox[{"2", " ", "x"}], " ", "-", " ", "y", " ", "+", " ", "z"}], " ", "==", " ", "3"}]}]], "Input"], Cell[BoxData[ RowBox[{"eqn3", " ", "=", " ", RowBox[{ RowBox[{"x", " ", "-", " ", "y", " ", "-", "z"}], " ", "\[Equal]", " ", "0"}]}]], "Input"], Cell[BoxData[ RowBox[{"solutionrule", " ", "=", " ", RowBox[{"Solve", "[", RowBox[{ RowBox[{"{", RowBox[{"eqn1", ",", "eqn2", ",", "eqn3"}], "}"}], ",", RowBox[{"{", RowBox[{"x", ",", "y", ",", "z"}], "}"}]}], "]"}]}]], "Input"], Cell["\<\ Note the syntax: we give a list of equations to be satisfied, and then a list \ of the variables we are solving for. Now check the solution by plugging back in:\ \>", "Text", CellChangeTimes->{{3.4640008184849997`*^9, 3.464000818641*^9}}], Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{"4", " ", "x"}], " ", "+", " ", RowBox[{"3", " ", "y"}], " ", "-", " ", "z"}], " ", "/.", " ", "solutionrule"}]], "Input"], Cell["Or check all three at once this way:", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"{", RowBox[{"eqn1", ",", "eqn2", ",", "eqn3"}], "}"}], " ", "/.", " ", "solutionrule"}]], "Input"], Cell["\<\ Now you try. Solve 2x + 2y + z = -1; x + 2y -z = 2 ; y+z =0.\ \>", "Text"] }, Open ]], Cell[CellGroupData[{ Cell["Differential Equations", "Section"], Cell[TextData[{ StyleBox["Mathematica", FontSlant->"Italic"], " can solve not only ordinary algebraic equations, but also differential \ equations.\nWhat is a differential equation? It is an equation which gives a \ relationship involving the\nderivatives of a function. The solution to a \ differential equation is not just a number, it is a\nwhole function. For \ example, what function y[x] is it which satisfies: dy/dx = x^2?\nMust be \ y[x] = (1/3) x^3 plus a constant, right?\nHere is the incantation to get ", StyleBox["Mathematica", FontSlant->"Italic"], " to give the answer:" }], "Text"], Cell[BoxData[ RowBox[{"DSolve", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{"y", "'"}], "[", "x", "]"}], "\[Equal]", " ", RowBox[{"x", "^", "2"}]}], ",", RowBox[{"y", "[", "x", "]"}], ",", "x"}], "]"}]], "Input"], Cell[TextData[{ "Again note the syntax: first we give the equation, where the prime on y'[x] \ indicates a deriviative,\nthen we give the thing we are looking for (y[x]), \ and then we specify the independent variable (x).\nIn giving the answer ", StyleBox["Mathematica", FontSlant->"Italic"], " has created a new constant for us (C[1]). In a given problem,\nthe value \ of this constant will be determined from other information. E.g. if we are \ told that the\nparticular y[x] we seek satisfies y[1] == 1, then what must \ the constant be?\nHere is how we can get ", StyleBox["Mathematica", FontSlant->"Italic"], " to find the particular solution:\n" }], "Text"], Cell[BoxData[ RowBox[{"DSolve", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{ RowBox[{ RowBox[{"y", "'"}], "[", "x", "]"}], "\[Equal]", RowBox[{"x", "^", "2"}]}], ",", " ", RowBox[{ RowBox[{"y", "[", "1", "]"}], "\[Equal]", "1"}]}], "}"}], ",", RowBox[{"y", "[", "x", "]"}], ",", "x"}], "]"}]], "Input"], Cell[CellGroupData[{ Cell["Another Differential Equation", "Subsection"], Cell["\<\ Some differential equations give a relationship between the derivatives of a \ function and the function itself. For example, what function y[x] is its own derivative, i.e. \ solves y'[x] == y[x]. To get a specific solution lets also demand that y[1] = 1.\ \>", "Text"], Cell[BoxData[ RowBox[{"DSolve", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{ RowBox[{ RowBox[{"y", "'"}], "[", "x", "]"}], "\[Equal]", RowBox[{"y", "[", "x", "]"}]}], ",", RowBox[{ RowBox[{"y", "[", "1", "]"}], "\[Equal]", "1"}]}], "}"}], ",", RowBox[{"y", "[", "x", "]"}], ",", "x"}], "]"}]], "Input"] }, Open ]], Cell[CellGroupData[{ Cell["Ballistic Motion", "Subsection"], Cell[TextData[{ "Suppose that at time t=0 a ball is thrown straight up in the air. Its \ initial height is z[0] == z0,\nand its initial velocity is z'[0] == v0. Its \ acceleration is of course z''[t] = -g.\nHave ", StyleBox["Mathematica", FontSlant->"Italic"], " give you the full form of z[t]." }], "Text"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell["Parametric Plots", "Section"], Cell["\<\ The function Plot[] gives us a sketch of y=f(x). Sometimes we want to trace \ out the trajectory as a vector {x(t),y(t)} varies with time. For this the recipe is ParametricPlot. For example, here is a projectile:\ \>", "Text"], Cell[BoxData[{ RowBox[{"x", " ", "=", " ", RowBox[{"5", " ", "t"}]}], "\[IndentingNewLine]", RowBox[{"y", " ", "=", " ", RowBox[{"4", " ", "+", " ", RowBox[{"3", " ", "t"}], " ", "-", " ", RowBox[{"2", " ", RowBox[{"t", "^", "2"}]}]}]}], "\[IndentingNewLine]", RowBox[{"ParametricPlot", "[", RowBox[{ RowBox[{"{", RowBox[{"x", ",", "y"}], "}"}], ",", RowBox[{"{", RowBox[{"t", ",", "0", ",", "3"}], "}"}]}], "]"}]}], "Input"] }, Open ]] }, Open ]] }, WindowToolbars->"EditBar", WindowSize->{824, 666}, WindowMargins->{{Automatic, 45}, {-1, Automatic}}, FrontEndVersion->"7.0 for Microsoft Windows (32-bit) (February 18, 2009)", StyleDefinitions->"Default.nb" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[567, 22, 266, 10, 50, "Subtitle"], Cell[836, 34, 284, 6, 47, "Text"], Cell[1123, 42, 205, 3, 29, "Text"], Cell[CellGroupData[{ Cell[1353, 49, 78, 2, 71, "Section", Evaluatable->False], Cell[1434, 53, 238, 6, 47, "Text", Evaluatable->False], Cell[1675, 61, 61, 1, 31, "Input"], Cell[1739, 64, 108, 3, 29, "Text"] }, Open ]], Cell[CellGroupData[{ Cell[1884, 72, 25, 0, 71, "Section"], Cell[1912, 74, 471, 10, 101, "Text"] }, Open ]], Cell[CellGroupData[{ Cell[2420, 89, 105, 1, 71, "Section"], Cell[2528, 92, 554, 11, 65, "Text"], Cell[3085, 105, 306, 9, 31, "Input"], Cell[3394, 116, 239, 5, 29, "Text"], Cell[3636, 123, 193, 6, 29, "Text"], Cell[3832, 131, 207, 6, 31, "Input"], Cell[4042, 139, 233, 7, 31, "Input"], Cell[4278, 148, 234, 6, 31, "Input"], Cell[4515, 156, 283, 5, 47, "Text"] }, Open ]], Cell[CellGroupData[{ Cell[4835, 166, 37, 0, 71, "Section"], Cell[4875, 168, 344, 8, 47, "Text"], Cell[5222, 178, 117, 3, 31, "Input"], Cell[5342, 183, 76, 0, 29, "Text"], Cell[5421, 185, 329, 10, 31, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[5787, 200, 41, 0, 71, "Section"], Cell[5831, 202, 520, 10, 83, "Text"], Cell[6354, 214, 204, 6, 31, "Input"], Cell[6561, 222, 179, 5, 31, "Input"], Cell[6743, 229, 155, 4, 31, "Input"], Cell[6901, 235, 257, 7, 31, "Input"], Cell[7161, 244, 249, 6, 65, "Text"], Cell[7413, 252, 176, 5, 31, "Input"], Cell[7592, 259, 52, 0, 29, "Text"], Cell[7647, 261, 140, 4, 31, "Input"], Cell[7790, 267, 88, 2, 29, "Text"] }, Open ]], Cell[CellGroupData[{ Cell[7915, 274, 41, 0, 71, "Section"], Cell[7959, 276, 609, 12, 119, "Text"], Cell[8571, 290, 233, 7, 31, "Input"], Cell[8807, 299, 675, 13, 137, "Text"], Cell[9485, 314, 355, 11, 31, "Input"], Cell[CellGroupData[{ Cell[9865, 329, 51, 0, 36, "Subsection"], Cell[9919, 331, 280, 6, 65, "Text"], Cell[10202, 339, 355, 11, 31, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[10594, 355, 38, 0, 36, "Subsection"], Cell[10635, 357, 314, 7, 65, "Text"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[10998, 370, 35, 0, 71, "Section"], Cell[11036, 372, 237, 4, 47, "Text"], Cell[11276, 378, 469, 13, 72, "Input"] }, Open ]] }, Open ]] } ] *) (* End of internal cache information *)