(* 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[ 24838, 833] NotebookOptionsPosition[ 22333, 752] NotebookOutlinePosition[ 22763, 771] CellTagsIndexPosition[ 22720, 768] WindowFrame->Normal ContainsDynamic->False*) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell["Weekly Exercises (2)", "Title"], Cell["\<\ Assigned: January 29, 2009 Due: before class on February 5, 2009\ \>", "Subsubtitle", CellChangeTimes->{{3.4422553649545813`*^9, 3.442255378095483*^9}, 3.4422555705969667`*^9}], Cell[CellGroupData[{ Cell["Verlet's Method (in-class)", "Subsection"], Cell[TextData[{ "Verlet's method uses a central-difference for the second-derivative of \ \[Theta]:\n\t", Cell[BoxData[ FormBox[ RowBox[{ SubscriptBox["\[PartialD]", "t"], " ", RowBox[{ SubscriptBox["\[PartialD]", "t"], " ", "\[Theta]"}]}], TraditionalForm]]], " = - (", StyleBox["g/L", FontSlant->"Italic"], ") Sin[\[Theta]] , or approximately as:\n\t", Cell[BoxData[ FormBox[ StyleBox[ FractionBox[ RowBox[{ RowBox[{"\[Theta]", "[", RowBox[{"t", "-", "\[Delta]t"}], "]"}], " ", "-", " ", RowBox[{"2", RowBox[{"\[Theta]", "[", "t", "]"}]}], " ", "+", " ", RowBox[{"\[Theta]", "[", RowBox[{"t", "+", "\[Delta]t"}], "]"}]}], SuperscriptBox[ RowBox[{"(", "\[Delta]t", ")"}], "2"]], FontSize->16], TraditionalForm]]], "~ -Sin[\[Theta][", StyleBox["t", FontSlant->"Italic"], "]] + O(", Cell[BoxData[ FormBox[ SuperscriptBox[ StyleBox[ RowBox[{"\[Delta]", StyleBox["t", FontSlant->"Italic"]}]], "2"], TraditionalForm]]], ")\nThis method computes only the position and not the velocity. \ Consequently, it is suitable for problems when the force depends only on the \ position (and not the velocity). Notice that the trunction error scales like \ ", Cell[BoxData[ FormBox[ SuperscriptBox["\[Delta]t", "4"], TraditionalForm]]], ". Verlet's method is relatively accurate and easy-to-program. Like the ", StyleBox["leap-frog", FontSlant->"Italic"], " method, this", " method is not ", StyleBox["self-starting", FontSlant->"Italic"], ". Use one step of Euler to start your integration, and then compute an \ approximation to the angular motion of the pendulum, \[Theta](", StyleBox["t", FontSlant->"Italic"], "), for several periods. You may start with any initial condition. You may \ also normalize length and time so that (", StyleBox["g", FontSlant->"Italic"], "/", StyleBox["L", FontSlant->"Italic"], ") = 1.0." }], "Text"], Cell[CellGroupData[{ Cell["A Solution (Method 1)", "Subsubsection", CellChangeTimes->{{3.442874947991399*^9, 3.442874951939734*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"stepV", "[", "\[Theta]_", "]"}], ":=", " ", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", "tlast", "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"tlast", " ", "=", " ", "thetaLast"}], ";", "\[IndentingNewLine]", RowBox[{"thetaLast", " ", "=", " ", "\[Theta]"}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"-", RowBox[{"dt", "^", "2"}]}], " ", RowBox[{"Sin", "[", "\[Theta]", "]"}]}], " ", "+", " ", RowBox[{"2", " ", "\[Theta]"}], " ", "-", " ", "tlast"}]}]}], "]"}]}]], "Input"], Cell[BoxData[{ RowBox[{ RowBox[{"dt", " ", "=", " ", "0.01"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"w0", " ", "=", " ", "0.0"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"\[Theta]0", " ", "=", " ", RowBox[{"N", "[", RowBox[{"75", " ", "Degree"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"thetaLast", " ", "=", " ", RowBox[{"\[Theta]0", " ", "-", " ", RowBox[{"w0", " ", "dt"}]}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"steps", " ", "=", " ", RowBox[{"NestList", "[", RowBox[{"stepV", ",", " ", "\[Theta]0", ",", " ", "5000"}], "]"}]}], ";"}]}], "Input", CellChangeTimes->{{3.442875030928267*^9, 3.442875039886549*^9}}], Cell[BoxData[ RowBox[{"steps", " ", "//", " ", "Shallow"}]], "Input"], Cell[BoxData[ RowBox[{"ListPlot", "[", "steps", "]"}]], "Input"] }, Closed]], Cell[CellGroupData[{ Cell["A Solution (Method 2)", "Subsubsection", CellChangeTimes->{{3.442874947991399*^9, 3.442874962734445*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"stepV", "[", RowBox[{"{", RowBox[{"\[Theta]Now_", ",", "\[Theta]Then_"}], "}"}], "]"}], ":=", " ", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{ RowBox[{"-", RowBox[{"dt", "^", "2"}]}], " ", RowBox[{"Sin", "[", "\[Theta]Now", "]"}]}], " ", "+", " ", RowBox[{"2", " ", "\[Theta]Now"}], " ", "-", " ", "\[Theta]Then"}], ",", " ", "\[Theta]Now"}], "}"}]}]], "Input", CellChangeTimes->{{3.442874965704411*^9, 3.442875020746649*^9}}], Cell[BoxData[{ RowBox[{ RowBox[{"dt", " ", "=", " ", "0.01"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"w0", " ", "=", " ", "0.0"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"\[Theta]0", " ", "=", " ", RowBox[{"N", "[", RowBox[{"75", " ", "Degree"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"thetaLast", " ", "=", " ", RowBox[{"\[Theta]0", " ", "-", " ", RowBox[{"w0", " ", "dt"}]}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"steps", " ", "=", " ", RowBox[{"NestList", "[", RowBox[{"stepV", ",", " ", RowBox[{"{", RowBox[{"\[Theta]0", " ", ",", "thetaLast"}], "}"}], ",", " ", "5000"}], "]"}]}], ";"}]}], "Input", CellChangeTimes->{{3.4428750506101313`*^9, 3.4428750705683947`*^9}}], Cell[BoxData[ RowBox[{"steps", " ", "//", " ", "Shallow"}]], "Input"], Cell[BoxData[ RowBox[{"ListPlot", "[", RowBox[{"First", "[", RowBox[{"Transpose", "[", "steps", "]"}], "]"}], "]"}]], "Input", CellChangeTimes->{{3.442875076086879*^9, 3.442875081857325*^9}}] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell["Period of a Nonlinear Pendulum (in-class)", "Subsection"], Cell[TextData[{ "A linear pendulum has a period that is ", StyleBox["independent ", FontSlant->"Italic"], " of the amplitude of oscillation. This is why pendulums can be used for \ clocks. A real pendulum is nonlinear, and the period changes as the amplitude \ of its swinging increases." }], "Text"], Cell[TextData[{ "Use ", StyleBox["NDSolve[\[Ellipsis]]", FontWeight->"Bold"], " and compute the period of our pendulum as a function of angle.\nYou should \ begin with the solution discussed in class:" }], "Text"], Cell[BoxData[ RowBox[{"eqs", " ", "=", " ", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{ RowBox[{"\[Theta]", "'"}], "[", "t", "]"}], " ", "==", " ", RowBox[{"w", "[", "t", "]"}]}], ",", " ", RowBox[{ RowBox[{ RowBox[{"w", "'"}], "[", "t", "]"}], " ", "==", " ", RowBox[{"-", " ", RowBox[{"Sin", "[", RowBox[{"\[Theta]", "[", "t", "]"}], "]"}]}]}]}], "}"}]}]], "Input"], Cell[BoxData[{ RowBox[{ RowBox[{"initial", "=", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"\[Theta]", "[", "0", "]"}], "\[Equal]", RowBox[{"N", "[", RowBox[{"75", " ", "\[Degree]"}], "]"}]}], ",", RowBox[{ RowBox[{"w", "[", "0", "]"}], "\[Equal]", "0"}]}], "}"}]}], ";"}], "\n", RowBox[{ RowBox[{"sol", "=", RowBox[{"NDSolve", "[", RowBox[{ RowBox[{"Join", "[", RowBox[{"eqs", ",", "initial"}], "]"}], ",", RowBox[{"{", RowBox[{ RowBox[{"\[Theta]", "[", "t", "]"}], ",", RowBox[{"w", "[", "t", "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"t", ",", "0", ",", "20"}], "}"}]}], "]"}]}], ";"}], "\n", RowBox[{"Plot", "[", RowBox[{ RowBox[{"Evaluate", "[", RowBox[{ RowBox[{"\[Theta]", "[", "t", "]"}], "/.", "\[InvisibleSpace]", "sol"}], "]"}], ",", RowBox[{"{", RowBox[{"t", ",", "0", ",", "20"}], "}"}]}], "]"}]}], "Input"], Cell[TextData[{ "Next, you will need to use ", StyleBox["FindRoot[\[Ellipsis]]", FontWeight->"Bold"], ", to estimate the time when the pendulum crosses the horizontal. This will \ be 1/4 of the period. ", StyleBox["FindRoot[...]", FontWeight->"Bold"], " returns a \"", StyleBox["Replacement Rule", FontColor->RGBColor[1, 0, 0]], "\" (not a number). We must use \"/.\" (called \"slash-dot\", and meaning \ \"ReplaceAll\") to apply the rule." }], "Text"], Cell[BoxData[ RowBox[{"?", "FindRoot"}]], "Input"], Cell[BoxData[ RowBox[{"FindRoot", "[", RowBox[{ RowBox[{"Evaluate", "[", RowBox[{ RowBox[{"\[Theta]", "[", "t", "]"}], " ", "/.", " ", "sol"}], "]"}], ",", " ", RowBox[{"{", RowBox[{"t", ",", " ", "2.0"}], "}"}]}], "]"}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"\[Theta]", "[", "t", "]"}], " ", "/.", " ", "sol"}], ")"}], "/.", " ", "%", " ", RowBox[{"(*", " ", RowBox[{"should", " ", "be", " ", "near", " ", "zero"}], " ", "*)"}]}]], "Input"], Cell[TextData[{ StyleBox["Note: ", FontColor->RGBColor[1, 0, 0]], StyleBox["FindRoot[...]", FontWeight->"Bold"], " needs a \"guess\" where to look for a zero-crossing. The period of the \ pendulum is four times the time to the first \"zero crossing\"." }], "Text", CellChangeTimes->{{3.4428751618166723`*^9, 3.442875181095996*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"4", " ", "t"}], " ", "/.", " ", RowBox[{"FindRoot", "[", RowBox[{ RowBox[{"Evaluate", "[", RowBox[{ RowBox[{"\[Theta]", "[", "t", "]"}], " ", "/.", " ", "sol"}], "]"}], ",", " ", RowBox[{"{", RowBox[{"t", ",", " ", "2.0"}], "}"}]}], "]"}]}]], "Input", CellChangeTimes->{{3.4428751388312197`*^9, 3.442875148361381*^9}, 3.442875220677746*^9}], Cell[TextData[{ "Combine these statements into a single ", StyleBox["Module[\[Ellipsis]]", FontWeight->"Bold"], " and define a function of the initial angle that returns the period." }], "Text"], Cell[CellGroupData[{ Cell["A Solution", "Subsubsection"], Cell[BoxData[ RowBox[{ RowBox[{"period", "[", "\[Theta]0_", "]"}], " ", ":=", " ", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", RowBox[{"initial", ",", "sol"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"initial", " ", "=", " ", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"\[Theta]", "[", "0", "]"}], " ", "\[Equal]", "\[Theta]0"}], ",", " ", RowBox[{ RowBox[{"w", "[", "0", "]"}], " ", "==", " ", "0"}]}], "}"}]}], ";", "\[IndentingNewLine]", RowBox[{"sol", " ", "=", " ", RowBox[{"NDSolve", "[", " ", RowBox[{ RowBox[{"eqs", " ", "~", " ", "Join", " ", "~", " ", "initial"}], ",", " ", RowBox[{"{", RowBox[{ RowBox[{"\[Theta]", "[", "t", "]"}], ",", " ", RowBox[{"w", "[", "t", "]"}]}], "}"}], ",", " ", RowBox[{"{", RowBox[{"t", ",", " ", "0", ",", " ", "20"}], "}"}]}], "]"}]}], " ", ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"4", " ", "t"}], " ", "/.", " ", RowBox[{"FindRoot", "[", RowBox[{ RowBox[{"Evaluate", "[", RowBox[{ RowBox[{"\[Theta]", "[", "t", "]"}], " ", "/.", " ", "sol"}], "]"}], ",", " ", RowBox[{"{", RowBox[{"t", ",", "2.0"}], "}"}]}], "]"}]}]}]}], "]"}]}]], "Input", CellChangeTimes->{{3.442875195526039*^9, 3.442875204244802*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"pList", " ", "=", " ", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"t0", "/", "Degree"}], ",", " ", RowBox[{ RowBox[{"period", "[", "t0", "]"}], "/", RowBox[{"(", RowBox[{"2", " ", "\[Pi]"}], ")"}]}]}], "}"}], ",", " ", RowBox[{"{", RowBox[{"t0", ",", " ", RowBox[{"1", " ", "Degree"}], ",", " ", RowBox[{"170", " ", "Degree"}], ",", " ", RowBox[{"5", " ", "Degree"}]}], "}"}]}], "]"}]}], ";"}]], "Input", CellChangeTimes->{3.442875209370913*^9}], Cell[BoxData[ RowBox[{"ListPlot", "[", "pList", "]"}]], "Input"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell["A \"Constant\" Restoring Force", "Subsection"], Cell[TextData[{ "Compute the motion of an object confined by a \"constant\" restoring force. \ The force is directed towards the origin, ", StyleBox["x", FontSlant->"Italic"], " = 0. When ", StyleBox["x", FontSlant->"Italic"], " < 0, then the force is ", Cell[BoxData[ FormBox[ SubscriptBox["F", "0"], TraditionalForm]]], "; and when ", StyleBox["x", FontSlant->"Italic"], " > 0, then the force is \[Dash] ", Cell[BoxData[ FormBox[ SubscriptBox["F", "0"], TraditionalForm]]], ". (For simplicity, let ", Cell[BoxData[ FormBox[ SubscriptBox["F", "0"], TraditionalForm]]], " = 1.0.)\nUse ", StyleBox["both", FontSlant->"Italic"], " the Euler-Cromer method and", " the built-in method in ", StyleBox["Mathematica", FontSlant->"Italic"], ", ", StyleBox["NDSolve[\[Ellipsis]]", FontWeight->"Bold"], ". Start with the object at rest (", StyleBox["v", FontSlant->"Italic"], " = 0.0) but with a non-zero initial position, ", StyleBox["x", FontSlant->"Italic"], "(0) \[NotEqual] 0. Note how the period of oscillation depends upon the \ amplitude. Finally, use ", StyleBox["NDSolve[\[Ellipsis]]", FontWeight->"Bold"], " and the technique used in the previous exercise to graph the period of \ oscillation as a function of the initial position. (Did you notice the \ geometric shape of the trajectory, ", StyleBox["x", FontSlant->"Italic"], "(", StyleBox["t", FontSlant->"Italic"], ")? The period should scale as ", Cell[BoxData[ FormBox[ SqrtBox[ RowBox[{"x", "(", "0", ")"}]], TraditionalForm]]], ".)" }], "Text"], Cell[CellGroupData[{ Cell["Solution", "Subsubsection"], Cell["First, the Euler-Cromer method:", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"stepEC", "[", RowBox[{"{", RowBox[{"x_", ",", " ", "v_"}], "}"}], "]"}], " ", ":=", " ", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", "vnext", "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"vnext", " ", "=", " ", RowBox[{"If", "[", RowBox[{ RowBox[{"x", " ", "<", " ", "0.0"}], ",", RowBox[{"v", " ", "+", " ", RowBox[{"1.0", " ", "dt"}]}], ",", " ", RowBox[{"v", " ", "-", RowBox[{"1.0", " ", "dt"}]}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{"N", "[", RowBox[{"x", " ", "+", " ", RowBox[{"dt", " ", "vnext"}]}], "]"}], ",", " ", "vnext"}], "}"}]}]}], "]"}]}]], "Input"], Cell[BoxData[{ RowBox[{ RowBox[{"dt", "=", "0.01"}], ";"}], "\n", RowBox[{ RowBox[{"steps", "=", RowBox[{"NestList", "[", RowBox[{"stepEC", ",", RowBox[{"{", RowBox[{"1.", ",", "0."}], "}"}], ",", "5000"}], "]"}]}], ";"}], "\n", RowBox[{"ListPlot", "[", RowBox[{ RowBox[{"First", "[", RowBox[{"Transpose", "[", "steps", "]"}], "]"}], ",", RowBox[{"PlotLabel", "\[Rule]", "\"\\""}]}], "]"}]}], "Input", CellChangeTimes->{{3.4434324979473352`*^9, 3.4434325014450827`*^9}}], Cell[TextData[{ "Then, we use ", StyleBox["NDSolve[\[Ellipsis]]:", FontWeight->"Bold"] }], "Text"], Cell[BoxData[ RowBox[{"eqs", " ", "=", " ", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{ RowBox[{"x", "'"}], "[", "t", "]"}], " ", "==", " ", RowBox[{"v", "[", "t", "]"}]}], ",", " ", RowBox[{ RowBox[{ RowBox[{"v", "'"}], "[", "t", "]"}], " ", "==", " ", RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"x", "[", "t", "]"}], " ", "<", " ", "0"}], ",", " ", "1.0", ",", " ", RowBox[{"-", "1.0"}]}], "]"}]}]}], "}"}]}]], "Input"], Cell[BoxData[{ RowBox[{ RowBox[{"initial", "=", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"x", "[", "0", "]"}], "\[Equal]", "1."}], ",", RowBox[{ RowBox[{"v", "[", "0", "]"}], "\[Equal]", "0."}]}], "}"}]}], ";"}], "\n", RowBox[{ RowBox[{"sol", "=", RowBox[{"NDSolve", "[", RowBox[{ RowBox[{"Join", "[", RowBox[{"eqs", ",", "initial"}], "]"}], ",", RowBox[{"{", RowBox[{ RowBox[{"x", "[", "t", "]"}], ",", RowBox[{"v", "[", "t", "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"t", ",", "0", ",", "30"}], "}"}]}], "]"}]}], ";"}], "\n", RowBox[{"Plot", "[", RowBox[{ RowBox[{"Evaluate", "[", RowBox[{ RowBox[{"x", "[", "t", "]"}], "/.", "\[InvisibleSpace]", "sol"}], "]"}], ",", RowBox[{"{", RowBox[{"t", ",", "0", ",", "30"}], "}"}], ",", " ", RowBox[{"AxesLabel", " ", "\[Rule]", " ", RowBox[{"{", RowBox[{"\"\\"", ",", "\"\\""}], "}"}]}]}], "]"}]}], "Input", CellChangeTimes->{{3.443432504333889*^9, 3.4434325056633463`*^9}, { 3.443432706356689*^9, 3.44343272083475*^9}}], Cell[BoxData[{ RowBox[{ RowBox[{"initial", "=", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"x", "[", "0", "]"}], "\[Equal]", "5."}], ",", RowBox[{ RowBox[{"v", "[", "0", "]"}], "\[Equal]", "0."}]}], "}"}]}], ";"}], "\n", RowBox[{ RowBox[{"sol", "=", RowBox[{"NDSolve", "[", RowBox[{ RowBox[{"Join", "[", RowBox[{"eqs", ",", "initial"}], "]"}], ",", RowBox[{"{", RowBox[{ RowBox[{"x", "[", "t", "]"}], ",", RowBox[{"v", "[", "t", "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"t", ",", "0", ",", "30"}], "}"}]}], "]"}]}], ";"}], "\n", RowBox[{"Plot", "[", RowBox[{ RowBox[{"Evaluate", "[", RowBox[{ RowBox[{"x", "[", "t", "]"}], "/.", "\[InvisibleSpace]", "sol"}], "]"}], ",", RowBox[{"{", RowBox[{"t", ",", "0", ",", "30"}], "}"}], ",", " ", RowBox[{"AxesLabel", " ", "\[Rule]", " ", RowBox[{"{", RowBox[{"\"\\"", ",", "\"\\""}], "}"}]}]}], "]"}]}], "Input", CellChangeTimes->{{3.443432507016109*^9, 3.443432508375763*^9}, 3.4434327315687943`*^9}], Cell[TextData[{ "The period gets ", StyleBox["longer", FontSlant->"Italic"], " as the amplitude gets larger. We also notice that the trajectories are \ parabolas!" }], "Text"], Cell["\<\ Finally, we compute the period as a function of initial position:\ \>", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"period", "[", "x0_", "]"}], " ", ":=", " ", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", RowBox[{"initial", ",", "sol"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"initial", " ", "=", " ", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"x", "[", "0", "]"}], " ", "\[Equal]", " ", "x0"}], ",", " ", RowBox[{ RowBox[{"v", "[", "0", "]"}], " ", "\[Equal]", " ", "0.0"}]}], "}"}]}], ";", "\[IndentingNewLine]", RowBox[{"sol", " ", "=", " ", RowBox[{"NDSolve", "[", " ", RowBox[{ RowBox[{"eqs", " ", "~", " ", "Join", " ", "~", " ", "initial"}], ",", " ", RowBox[{"{", RowBox[{ RowBox[{"x", "[", "t", "]"}], ",", " ", RowBox[{"v", "[", "t", "]"}]}], "}"}], ",", " ", RowBox[{"{", RowBox[{"t", ",", " ", "0", ",", " ", "40"}], "}"}]}], "]"}]}], " ", ";", "\[IndentingNewLine]", RowBox[{"4", "*", RowBox[{"(", RowBox[{"t", " ", "/.", " ", RowBox[{"FindRoot", "[", RowBox[{ RowBox[{"Evaluate", "[", RowBox[{ RowBox[{"x", "[", "t", "]"}], " ", "/.", " ", "sol"}], "]"}], ",", " ", RowBox[{"{", RowBox[{"t", ",", " ", "2.0"}], "}"}]}], "]"}]}], ")"}]}]}]}], "]"}]}]], "Input", CellChangeTimes->{{3.443432553715762*^9, 3.443432560767091*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"pList", " ", "=", " ", RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{"x0", ",", " ", RowBox[{"period", "[", "x0", "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{"x0", ",", " ", "1.0", ",", "5.0", ",", " ", "0.1"}], "}"}]}], "]"}]}], ";"}]], "Input", CellChangeTimes->{3.44343256986473*^9}], Cell[BoxData[ RowBox[{"p1", "=", RowBox[{"ListPlot", "[", RowBox[{"pList", ",", RowBox[{"PlotLabel", "\[Rule]", "\"\\""}], ",", RowBox[{"PlotStyle", "\[Rule]", RowBox[{"PointSize", "[", "0.02", "]"}]}], ",", " ", RowBox[{"AxesLabel", " ", "\[Rule]", " ", RowBox[{"{", RowBox[{ "\"\<\!\(\*SubscriptBox[\(x\), \(0\)]\)\>\"", ",", "\"\\""}], "}"}]}]}], "]"}]}]], "Input", CellChangeTimes->{{3.443432578129841*^9, 3.443432654904179*^9}}], Cell[TextData[{ "And we show that the period scales like ", Cell[BoxData[ FormBox[ SqrtBox[ RowBox[{"x", "(", "0", ")"}]], TraditionalForm]]], ", " }], "Text"], Cell[BoxData[ RowBox[{"Fit", "[", RowBox[{"pList", ",", " ", RowBox[{"Sqrt", "[", "x", "]"}], ",", " ", "x"}], "]"}]], "Input"], Cell[BoxData[{ RowBox[{ RowBox[{"p2", "=", RowBox[{"Plot", "[", RowBox[{ RowBox[{"5.65685", " ", SqrtBox["x"]}], ",", RowBox[{"{", RowBox[{"x", ",", "1.", ",", "5."}], "}"}], ",", RowBox[{"PlotStyle", "\[Rule]", RowBox[{"{", RowBox[{"RGBColor", "[", RowBox[{"0", ",", "0", ",", "1"}], "]"}], "}"}]}]}], "]"}]}], ";"}], "\n", RowBox[{"Show", "[", RowBox[{"p1", ",", "p2"}], "]"}]}], "Input", CellChangeTimes->{{3.443432585633441*^9, 3.443432592759173*^9}, { 3.4434326731482162`*^9, 3.443432673969153*^9}}], Cell[TextData[{ "Do you know the exact relationship between oscillation period and ", Cell[BoxData[ FormBox[ SqrtBox[ SubscriptBox["x", "0"]], TraditionalForm]], FormatType->"TraditionalForm"], "?" }], "Text", CellChangeTimes->{{3.443432757122245*^9, 3.4434328092727423`*^9}}] }, Closed]] }, Closed]] }, Open ]] }, WindowSize->{1005, 875}, WindowMargins->{{38, Automatic}, {Automatic, 0}}, PrintingCopies->1, PrintingPageRange->{1, Automatic}, ShowSelection->True, Magnification->1.5, FrontEndVersion->"6.0 for Mac OS X x86 (32-bit) (May 21, 2008)", StyleDefinitions->"Default.nb" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[590, 23, 37, 0, 110, "Title"], Cell[630, 25, 191, 5, 67, "Subsubtitle"], Cell[CellGroupData[{ Cell[846, 34, 48, 0, 49, "Subsection"], Cell[897, 36, 1986, 65, 223, "Text"], Cell[CellGroupData[{ Cell[2908, 105, 112, 1, 36, "Subsubsection"], Cell[3023, 108, 616, 17, 99, "Input"], Cell[3642, 127, 712, 18, 117, "Input"], Cell[4357, 147, 70, 1, 38, "Input"], Cell[4430, 150, 65, 1, 40, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[4532, 156, 112, 1, 36, "Subsubsection"], Cell[4647, 159, 515, 14, 41, "Input"], Cell[5165, 175, 784, 20, 117, "Input"], Cell[5952, 197, 70, 1, 38, "Input"], Cell[6025, 200, 200, 4, 40, "Input"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[6274, 210, 63, 0, 35, "Subsection"], Cell[6340, 212, 305, 7, 62, "Text"], Cell[6648, 221, 218, 6, 62, "Text"], Cell[6869, 229, 429, 13, 40, "Input"], Cell[7301, 244, 967, 31, 81, "Input"], Cell[8271, 277, 465, 13, 84, "Text"], Cell[8739, 292, 51, 1, 38, "Input"], Cell[8793, 295, 261, 8, 40, "Input"], Cell[9057, 305, 260, 8, 40, "Input"], Cell[9320, 315, 339, 8, 62, "Text"], Cell[9662, 325, 419, 12, 40, "Input"], Cell[10084, 339, 199, 5, 39, "Text"], Cell[CellGroupData[{ Cell[10308, 348, 35, 0, 36, "Subsubsection"], Cell[10346, 350, 1446, 39, 101, "Input"], Cell[11795, 391, 599, 17, 60, "Input"], Cell[12397, 410, 65, 1, 40, "Input"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[12511, 417, 52, 0, 35, "Subsection"], Cell[12566, 419, 1581, 57, 182, "Text"], Cell[CellGroupData[{ Cell[14172, 480, 33, 0, 36, "Subsubsection"], Cell[14208, 482, 47, 0, 39, "Text"], Cell[14258, 484, 785, 23, 81, "Input"], Cell[15046, 509, 538, 15, 79, "Input"], Cell[15587, 526, 102, 4, 39, "Text"], Cell[15692, 532, 508, 16, 40, "Input"], Cell[16203, 550, 1127, 34, 80, "Input"], Cell[17333, 586, 1105, 34, 80, "Input"], Cell[18441, 622, 180, 6, 39, "Text"], Cell[18624, 630, 89, 2, 39, "Text"], Cell[18716, 634, 1479, 41, 101, "Input"], Cell[20198, 677, 373, 11, 40, "Input"], Cell[20574, 690, 528, 13, 60, "Input"], Cell[21105, 705, 171, 7, 45, "Text"], Cell[21279, 714, 135, 3, 40, "Input"], Cell[21417, 719, 582, 17, 77, "Input"], Cell[22002, 738, 291, 9, 45, "Text"] }, Closed]] }, Closed]] }, Open ]] } ] *) (* End of internal cache information *)