(************** Content-type: application/mathematica ************** CreatedBy='Mathematica 5.2' Mathematica-Compatible Notebook This notebook can be used with any Mathematica-compatible application, such as Mathematica, MathReader or Publicon. The data for the notebook starts with the line containing stars above. To get the notebook into a Mathematica-compatible application, do one of the following: * Save the data starting with the line of stars above into a file with a name ending in .nb, then open the file inside the application; * Copy the data starting with the line of stars above to the clipboard, then use the Paste menu command inside the application. Data for notebooks contains only printable 7-bit ASCII and can be sent directly in email or through ftp in text mode. Newlines can be CR, LF or CRLF (Unix, Macintosh or MS-DOS style). NOTE: If you modify the data for this notebook not in a Mathematica- compatible application, you must delete the line below containing the word CacheID, otherwise Mathematica-compatible applications may try to use invalid cache data. For more information on notebooks and Mathematica-compatible applications, contact Wolfram Research: web: http://www.wolfram.com email: info@wolfram.com phone: +1-217-398-0700 (U.S.) Notebook reader applications are available free of charge from Wolfram Research. *******************************************************************) (*CacheID: 232*) (*NotebookFileLineBreakTest NotebookFileLineBreakTest*) (*NotebookOptionsPosition[ 12973, 431]*) (*NotebookOutlinePosition[ 17585, 543]*) (* CellTagsIndexPosition[ 16600, 520]*) (*WindowFrame->Normal*) Notebook[{ Cell["Differential Operators and Harmonic Oscillators", "Title"], Cell[CellGroupData[{ Cell["\<\ Operator Calculus to Solve Heterogeneous Second-Order Linear ODEs\ \ \>", "Subtitle"], Cell[TextData[{ "Does ", StyleBox["Mathematica", FontSlant->"Italic"], " apply the Fourier Transform/Derivative Rule Automagically?" }], "Text", CellTags->"mmtag:22:implementing_rules_for_linear_operators"], Cell[BoxData[ \(FourierTransform[D[f[x], {x, 1}], x, k]\)], "Input", CellTags->"mmtag:22:FourierTransform[]__of_derivatives"], Cell["It does as of version 5.0! .", "Text"], Cell[BoxData[ \(Table[FourierTransform[D[f[x], {x, i}], x, k], {i, 24}] // MatrixForm\)], "Input"], Cell[TextData[{ "Does ", StyleBox["Mathematica", FontSlant->"Italic"], " apply the rules according to the Fourier Transform being a linear \ operator?" }], "Text", CellTags->{ "mmtag:22:FourierTransform[]__implementing_rules_as_linear_operator", "mmtag:22:implementing_rules_for_linear_operators__FourierTransform[]"}], Cell[BoxData[ \(FourierTransform[a\ f[x]\ + \ b\ g[x], x, k]\)], "Input"], Cell["\<\ Apparently not--so we make some rules that can be applied. It may \ be instructive to see how to do this.\ \>", "Text"], Cell[BoxData[{ \(ConstantRule\ = \ FourierTransform[\((NoX_. \ \ )\)\ *\((\ \ fun_\ )\), \ x_\ , \ k_]\ :> \ NoX\ FourierTransform[fun, x, k] /; \((FreeQ[NoX, x]\ && \ MemberQ[fun, x, Infinity])\)\[IndentingNewLine]\), "\[IndentingNewLine]", \(DistributeRule = \ \ \[IndentingNewLine]FourierTransform[Plus[expr_], x_, \ k_]\ :> Distribute[FourierTransform[expr, x, k], Plus]\)}], "Input"], Cell["Try them out:", "Text"], Cell[BoxData[ \(FourierTransform[a\ g[x]\ \ f[x]\ , x, \ k] //. ConstantRule\)], "Input"], Cell[BoxData[ \(\(FourierTransform[a\ x\ f[x]\ + \ b\ v[x]\ \ g[x]\ + \ d\ p[x], x, k] //. DistributeRule\) //. ConstantRule\)], "Input"], Cell["\<\ Let's Fourier Transform the left-hand -side of a second-order ODE:\ \ \>", "Text", CellTags->{ "mmtag:22:FourierTransform[]__to_solve_damped_forced_harmonic_oscillator", "mmtag:22:damped_forced_harmonic_operator__solution_using_\ FourierTransform[]"}], Cell[BoxData[ \(ODE2nd\ = \ Mass\ D[y[t], {t, 2}]\ + \ Viscosity\ D[y[t], t]\ + \ SpringK\ y\ [t]\)], "Input"], Cell[BoxData[ \(FrrODE2nd\ = Factor[\[IndentingNewLine]\(FourierTransform[ODE2nd, t, \[Omega]] //. DistributeRule\) //. ConstantRule\[IndentingNewLine]]\)], "Input"], Cell[BoxData[ \(rhs\ = \ FourierTransform[Cos[\ \[Omega]0\ \ t]\ , t, \[Omega]]\)], "Input", CellTags->"mmtag:22:DiracDelta[]__as_FourierTransform[]_of_Cos[]"], Cell[BoxData[ \(ftsol\ = \ Solve[FrrODE2nd\ \[Equal] rhs, FourierTransform[y[t], t, \[Omega]]]\)], "Input"], Cell[BoxData[ \(InverseFourierTransform[ FourierTransform[y[t], t, \[Omega]] /. Flatten[ftsol], \[Omega], t, Assumptions\ \[Rule] \ \[Omega]0 > \ 0]\)], "Input", CellTags-> "mmtag:22:InverseFourierTransform[]__in_solution_to_harmonic_oscillator"], Cell["\<\ Otherwise, the complete solution (i.e., the inhomogeneous plus the \ homogeneous parts) can be calculated by the DSolve function\ \>", "Text"], Cell[BoxData[ \(GenSol\ = \ DSolve[Mass\ D[y[t], {t, 2}]\ + \ Damper\ D[y[t], t]\ + \ SpringK\ y[t]\ \[Equal] \ Cos[\[Omega]\_o\ t], y[t], t]\)], "Input"], Cell[BoxData[ \(FullSimplify[y[t] /. Flatten[GenSol], Assumptions -> \ \[Omega]0\ > \ 0\ && \ \ Mass\ > \ 0\ && \ Damper\ > \ 0\ && \ SpringK\ > \ 0]\)], "Input", CellTags->"mmtag:22:damped_forced_harmonic_operator__general_solution"] }, Open ]], Cell[CellGroupData[{ Cell["\<\ Functionals: An Introduction to Variational Calculus by way of \ Variation of Parameters\ \>", "Subtitle"], Cell[TextData[{ "An early application of introductory calculus involves finding extreme \ values of a function ", StyleBox["y", FontSlant->"Italic"], " = ", StyleBox["y", FontSlant->"Italic"], "(", StyleBox["x", FontSlant->"Italic"], "): values of the independent variable ", StyleBox["x", FontSlant->"Italic"], " are sought that maximize or minimize ", StyleBox["y", FontSlant->"Italic"], "(", StyleBox["x", FontSlant->"Italic"], "). In the calculus of variations, a common problem involves finding an \ unknown ", StyleBox["function y", FontSlant->"Italic"], "(", StyleBox["x", FontSlant->"Italic"], ") that minimizes a different function in which ", StyleBox["y", FontSlant->"Italic"], "(", StyleBox["x", FontSlant->"Italic"], ") appears inside an integral. Here we pursue an answer to a problem of \ this type." }], "Section", CellTags->{ "mmtag:22:functionals", "mmtag:22:calculus_of_variations__introduction"}], Cell[TextData[{ "The \"quickest\" path of running up-hill can be estimated with a model of \ how fast one runs up hill. Given a starting point ", StyleBox["y", FontSlant->"Italic"], "(", StyleBox["x", FontSlant->"Italic"], "=0) = 0 and an ending point ", StyleBox["y", FontSlant->"Italic"], "(", StyleBox["x", FontSlant->"Italic"], "=1) = 1, the question is to find, among all possible choices of path ", StyleBox["y", FontSlant->"Italic"], "(", StyleBox["x", FontSlant->"Italic"], ") that connects the end and starting point, which is the one that takes \ the least time if there is a hill ", StyleBox["h", FontSlant->"Italic"], "(", StyleBox["x", FontSlant->"Italic"], ") that has to be \"run-up.\"\nA reasonable model is that running speed is \ proportional to Cos(climbing-angle)--that is the velocity is 1 for running on \ a flat surface and goes to zero as the climbing-angle goes to ", Cell[BoxData[ \(TraditionalForm\`\(\(\[Pi]\/2\)\(\ \)\(.\)\)\)]], "\n\nIn this case, the time can be represented as an integral of the \ unknown ", StyleBox["y", FontSlant->"Italic"], "(", StyleBox["x", FontSlant->"Italic"], ") (this is worked out in the accompanying lecture notes)\n", StyleBox["T", FontSlant->"Italic"], "[", StyleBox["y", FontSlant->"Italic"], "(", StyleBox["x", FontSlant->"Italic"], ")] = ", Cell[BoxData[ FormBox[ RowBox[{\(\[Integral]\_\(x = 0\)\%\(x = 1\)\), RowBox[{ SqrtBox[ RowBox[{"1", " ", "+", " ", SuperscriptBox[ RowBox[{"(", FractionBox[ StyleBox["dy", FontSlant->"Italic"], StyleBox["dx", FontSlant->"Italic"]], ")"}], "2"], " ", "+", SuperscriptBox[ RowBox[{ RowBox[{"(", FractionBox[ StyleBox["dh", FontSlant->"Italic"], StyleBox["dx", FontSlant->"Italic"]], ")"}], " "}], "2"]}]], " ", \(\[DifferentialD]x\)}]}], TraditionalForm]]], "\nSuppose that the \"hill\" has the shape ", StyleBox["h", FontSlant->"Italic"], "(", StyleBox["x", FontSlant->"Italic"], ") = ", Cell[BoxData[ \(TraditionalForm\`x\^2\)]], ".\n\nHere, the \"real\" problem of finding the optimal path from the \ infinite set of all paths connecting ", StyleBox["y", FontSlant->"Italic"], "(", StyleBox["x", FontSlant->"Italic"], "=0) = 0 to", StyleBox["y", FontSlant->"Italic"], "(", StyleBox["x", FontSlant->"Italic"], "=1) = 1 will be replaced by looking at all second-order polynomials: ", StyleBox["y", FontSlant->"Italic"], "(", StyleBox["x", FontSlant->"Italic"], ") = ", StyleBox["a", FontSlant->"Italic"], " + ", StyleBox["bx", FontSlant->"Italic"], " + ", StyleBox["c", FontSlant->"Italic"], Cell[BoxData[ \(TraditionalForm\`x\^2\)]] }], "Text", CellTags->"mmtag:22:optimal_path__example"], Cell[BoxData[{ \(\(h\ = \ x^2;\)\), "\[IndentingNewLine]", \(\(YGeneral\ = \ a\ + \ b\ x\ + \ c\ x\^2;\)\)}], "Input"], Cell["The general path must satisfy the boundary conditions:", "Text"], Cell[BoxData[ \(YSatisifyingBCs\ = \ YGeneral /. \((Solve[{\((YGeneral /. x \[Rule] 0)\) \[Equal] 0, \((YGeneral /. x \[Rule] 1)\) \[Equal] 1}, {a, c}] // Flatten)\)\)], "Input"], Cell["\<\ There is one remaining free variable, it can be determined by \ minimizing the integral\ \>", "Text"], Cell[BoxData[ \(TimeIntegral\ = \ Integrate[ Sqrt[1\ + \ \((D[YSatisifyingBCs, x])\)^2\ + \ \((D[h, x])\)^2], x]\)], "Input"], Cell[BoxData[ \(Time\ = \ Simplify[\((TimeIntegral /. x \[Rule] 1)\)\ - \ \((TimeIntegral /. x \[Rule] 0)\)]\)], "Input"], Cell[BoxData[ \(Plot[Time, {b, \(-2\), 2}]\)], "Input"], Cell[TextData[{ "OK, the time is a minimum somewhere on the interval 0 < ", StyleBox["b ", FontSlant->"Italic"], "< 1. Solving for the value of ", StyleBox["b", FontSlant->"Italic"], " at the minimum:" }], "Text"], Cell[BoxData[ \(Bminsol\ = \ FindMinimum[Time, {b, 0, 1}]\)], "Input", CellTags->"mmtag:22:FindMinimum[]"], Cell["\<\ Now we can write the desired fuction that minimizes the time and \ plot it:\ \>", "Subsubsection"], Cell[BoxData[ \(YCubicSolution\ = \ YSatisifyingBCs /. Bminsol[\([2]\)]\)], "Input"], Cell[BoxData[ \(ApproxSolution\ = \ Plot[YCubicSolution, {x, 0, 1}]\)], "Input"], Cell["\<\ The exact minimizing path can be found by using Calculus of \ Variations. The solution is obtained from a boundary-value problem which we \ do not take up at this point, but it is interesting to see the exact solution \ and compare it with the approximate one we obtained above. The closed-form \ expression for the function that minimizes the climbing time is:\ \>", "Text"], Cell[BoxData[ \(\(\(\[IndentingNewLine]\)\(YExactSolution\ = \ \((2 x\ \@\(1 + 4\ \ x\^2\) + \ ArcSinh[2\ x])\)\/\((2\ \@5 + ArcSinh[2])\);\)\)\)], "Input"], Cell["and a series approimation to this function is:", "Text"], Cell[BoxData[ \(\(Series[YExactSolution, {x, 0, 6}] // Normal\) // N\)], "Input"], Cell["\<\ Now plot the exact solution and compare it to our calculated \ approximation...\ \>", "Subsubsection"], Cell[BoxData[ \(ExactSolution = \ Plot[YExactSolution, {x, 0, 1}, PlotStyle \[Rule] {Thickness[0.005], Hue[1]}]\)], "Input"], Cell[BoxData[ \(Show[ApproxSolution, ExactSolution]\)], "Input"], Cell["These two curves are very close!", "Subsubsection"], Cell[BoxData[ \(TimeIntegral\ = \ Integrate[ Sqrt[1\ + \ \((D[YCubicSolution, x])\)^2\ + \ \((D[h, x])\)^2], {x, 0, 1}]\)], "Input"], Cell[BoxData[ \(TimeIntegral\ = \ Integrate[ Sqrt[1\ + \ \((D[YExactSolution, x])\)^2\ + \ \((D[h, x])\)^2], {x, 0, 1.0}]\)], "Input"] }, Open ]] }, FrontEndVersion->"5.2 for Macintosh", ScreenRectangle->{{4, 1280}, {0, 832}}, CellGrouping->Manual, WindowSize->{844, 683}, WindowMargins->{{Automatic, 385}, {Automatic, 182}}, WindowTitle->"Lecture 22 MIT 3.016 (Fall 2006) \[Copyright] W. Craig Carter \ 2003-2006", PrintingCopies->1, PrintingPageRange->{1, Automatic}, ShowCellLabel->False, CellLabelAutoDelete->True, StyleDefinitions -> "3016_Carter.nb" ] (******************************************************************* Cached data follows. If you edit this Notebook file directly, not using Mathematica, you must remove the line containing CacheID at the top of the file. The cache data will then be recreated when you save this file from within Mathematica. *******************************************************************) (*CellTagsOutline CellTagsIndex->{ "mmtag:22:implementing_rules_for_linear_operators"->{ Cell[1941, 60, 219, 6, 46, "Text", CellTags->"mmtag:22:implementing_rules_for_linear_operators"]}, "mmtag:22:FourierTransform[]__of_derivatives"->{ Cell[2163, 68, 131, 2, 42, "Input", CellTags->"mmtag:22:FourierTransform[]__of_derivatives"]}, "mmtag:22:FourierTransform[]__implementing_rules_as_linear_operator"->{ Cell[2456, 78, 338, 9, 46, "Text", CellTags->{ "mmtag:22:FourierTransform[]__implementing_rules_as_linear_operator", "mmtag:22:implementing_rules_for_linear_operators__FourierTransform[]\ "}]}, "mmtag:22:implementing_rules_for_linear_operators__FourierTransform[]"->{ Cell[2456, 78, 338, 9, 46, "Text", CellTags->{ "mmtag:22:FourierTransform[]__implementing_rules_as_linear_operator", "mmtag:22:implementing_rules_for_linear_operators__FourierTransform[]\ "}]}, "mmtag:22:FourierTransform[]__to_solve_damped_forced_harmonic_oscillator"->{\ Cell[3784, 117, 271, 7, 46, "Text", CellTags->{ "mmtag:22:FourierTransform[]__to_solve_damped_forced_harmonic_\ oscillator", "mmtag:22:damped_forced_harmonic_operator__solution_using_\ FourierTransform[]"}]}, "mmtag:22:damped_forced_harmonic_operator__solution_using_FourierTransform[]\ "->{ Cell[3784, 117, 271, 7, 46, "Text", CellTags->{ "mmtag:22:FourierTransform[]__to_solve_damped_forced_harmonic_\ oscillator", "mmtag:22:damped_forced_harmonic_operator__solution_using_\ FourierTransform[]"}]}, "mmtag:22:DiracDelta[]__as_FourierTransform[]_of_Cos[]"->{ Cell[4387, 136, 173, 3, 42, "Input", CellTags->"mmtag:22:DiracDelta[]__as_FourierTransform[]_of_Cos[]"]}, "mmtag:22:InverseFourierTransform[]__in_solution_to_harmonic_oscillator"->{ Cell[4695, 146, 268, 5, 42, "Input", CellTags-> "mmtag:22:InverseFourierTransform[]__in_solution_to_harmonic_\ oscillator"]}, "mmtag:22:damped_forced_harmonic_operator__general_solution"->{ Cell[5315, 164, 265, 4, 59, "Input", CellTags-> "mmtag:22:damped_forced_harmonic_operator__general_solution"]}, "mmtag:22:functionals"->{ Cell[5736, 178, 1002, 37, 194, "Section", CellTags->{ "mmtag:22:functionals", "mmtag:22:calculus_of_variations__introduction"}]}, "mmtag:22:calculus_of_variations__introduction"->{ Cell[5736, 178, 1002, 37, 194, "Section", CellTags->{ "mmtag:22:functionals", "mmtag:22:calculus_of_variations__introduction"}]}, "mmtag:22:optimal_path__example"->{ Cell[6741, 217, 3217, 111, 431, "Text", CellTags->"mmtag:22:optimal_path__example"]}, "mmtag:22:FindMinimum[]"->{ Cell[11115, 371, 113, 2, 42, "Input", CellTags->"mmtag:22:FindMinimum[]"]} } *) (*CellTagsIndex CellTagsIndex->{ {"mmtag:22:implementing_rules_for_linear_operators", 13856, 454}, {"mmtag:22:FourierTransform[]__of_derivatives", 14016, 457}, {"mmtag:22:FourierTransform[]__implementing_rules_as_linear_operator", \ 14195, 460}, {"mmtag:22:implementing_rules_for_linear_operators__FourierTransform[]", \ 14490, 466}, {"mmtag:22:FourierTransform[]__to_solve_damped_forced_harmonic_oscillator", \ 14788, 472}, {"mmtag:22:damped_forced_harmonic_operator__solution_using_FourierTransform[\ ]", 15109, 481}, {"mmtag:22:DiracDelta[]__as_FourierTransform[]_of_Cos[]", 15404, 488}, {"mmtag:22:InverseFourierTransform[]__in_solution_to_harmonic_oscillator", \ 15598, 491}, {"mmtag:22:damped_forced_harmonic_operator__general_solution", 15806, 496}, {"mmtag:22:functionals", 15962, 500}, {"mmtag:22:calculus_of_variations__introduction", 16170, 505}, {"mmtag:22:optimal_path__example", 16363, 510}, {"mmtag:22:FindMinimum[]", 16489, 513} } *) (*NotebookFileOutline Notebook[{ Cell[1754, 51, 64, 0, 124, "Title"], Cell[CellGroupData[{ Cell[1843, 55, 95, 3, 94, "Subtitle"], Cell[1941, 60, 219, 6, 46, "Text", CellTags->"mmtag:22:implementing_rules_for_linear_operators"], Cell[2163, 68, 131, 2, 42, "Input", CellTags->"mmtag:22:FourierTransform[]__of_derivatives"], Cell[2297, 72, 44, 0, 46, "Text"], Cell[2344, 74, 109, 2, 42, "Input"], Cell[2456, 78, 338, 9, 46, "Text", CellTags->{ "mmtag:22:FourierTransform[]__implementing_rules_as_linear_operator", "mmtag:22:implementing_rules_for_linear_operators__FourierTransform[]"}], Cell[2797, 89, 78, 1, 42, "Input"], Cell[2878, 92, 129, 3, 46, "Text"], Cell[3010, 97, 486, 9, 110, "Input"], Cell[3499, 108, 29, 0, 46, "Text"], Cell[3531, 110, 93, 1, 42, "Input"], Cell[3627, 113, 154, 2, 42, "Input"], Cell[3784, 117, 271, 7, 46, "Text", CellTags->{ "mmtag:22:FourierTransform[]__to_solve_damped_forced_harmonic_oscillator", "mmtag:22:damped_forced_harmonic_operator__solution_using_\ FourierTransform[]"}], Cell[4058, 126, 133, 3, 42, "Input"], Cell[4194, 131, 190, 3, 76, "Input"], Cell[4387, 136, 173, 3, 42, "Input", CellTags->"mmtag:22:DiracDelta[]__as_FourierTransform[]_of_Cos[]"], Cell[4563, 141, 129, 3, 42, "Input"], Cell[4695, 146, 268, 5, 42, "Input", CellTags-> "mmtag:22:InverseFourierTransform[]__in_solution_to_harmonic_oscillator"], Cell[4966, 153, 152, 3, 66, "Text"], Cell[5121, 158, 191, 4, 42, "Input"], Cell[5315, 164, 265, 4, 59, "Input", CellTags->"mmtag:22:damped_forced_harmonic_operator__general_solution"] }, Open ]], Cell[CellGroupData[{ Cell[5617, 173, 116, 3, 94, "Subtitle"], Cell[5736, 178, 1002, 37, 194, "Section", CellTags->{ "mmtag:22:functionals", "mmtag:22:calculus_of_variations__introduction"}], Cell[6741, 217, 3217, 111, 431, "Text", CellTags->"mmtag:22:optimal_path__example"], Cell[9961, 330, 131, 2, 63, "Input"], Cell[10095, 334, 70, 0, 46, "Text"], Cell[10168, 336, 222, 4, 59, "Input"], Cell[10393, 342, 111, 3, 46, "Text"], Cell[10507, 347, 156, 4, 42, "Input"], Cell[10666, 353, 149, 3, 42, "Input"], Cell[10818, 358, 59, 1, 42, "Input"], Cell[10880, 361, 232, 8, 46, "Text"], Cell[11115, 371, 113, 2, 42, "Input", CellTags->"mmtag:22:FindMinimum[]"], Cell[11231, 375, 108, 3, 43, "Subsubsection"], Cell[11342, 380, 89, 1, 42, "Input"], Cell[11434, 383, 85, 1, 42, "Input"], Cell[11522, 386, 386, 6, 106, "Text"], Cell[11911, 394, 162, 2, 125, "Input"], Cell[12076, 398, 62, 0, 46, "Text"], Cell[12141, 400, 85, 1, 42, "Input"], Cell[12229, 403, 112, 3, 43, "Subsubsection"], Cell[12344, 408, 144, 3, 42, "Input"], Cell[12491, 413, 68, 1, 42, "Input"], Cell[12562, 416, 57, 0, 43, "Subsubsection"], Cell[12622, 418, 165, 4, 42, "Input"], Cell[12790, 424, 167, 4, 42, "Input"] }, Open ]] } ] *) (******************************************************************* End of Mathematica Notebook file. *******************************************************************)