(*********************************************************************** Mathematica-Compatible Notebook This notebook can be used on any computer system with Mathematica 3.0, MathReader 3.0, or any compatible application. The data for the notebook starts with the line of 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[ 16558, 475]*) (*NotebookOutlinePosition[ 17583, 508]*) (* CellTagsIndexPosition[ 17539, 504]*) (*WindowFrame->Normal*) Notebook[{ Cell[CellGroupData[{ Cell[TextData[{ StyleBox[ "Work out the Lagrangian equations of motion for an inverted pendulum on a \ \nmoving base.\n", "Section"], "\nm1 mass of block\n\nm2 mass of pendulum\n\nl length of pendulum\n\nx[t] \ position of m1\n\n\[Phi][t] angle of pendulum 0 is down\n\ng force of gravity\ \n\nFx[t] the force we apply to the m1.\n\nF\[Phi][t] the tangential force we \ apply to m2.\n\n", StyleBox["By inspection we find the Lagrangian", "Subsection"] }], "Section", CellDingbat->None, CellMargins->{{35, Inherited}, {Inherited, Inherited}}], Cell[CellGroupData[{ Cell[BoxData[ \(L\ = \ T\ - \ U\)], "Input", CellMargins->{{35, Inherited}, {Inherited, Inherited}}], Cell[BoxData[ \(T - U\)], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(T\ = \ 1/2\ m1\ *\ \(x'\)[t]^2\ + \ 1/2 m2 \((x2'^2\ + \ y2'^2)\)\)], "Input", CellMargins->{{35, Inherited}, {Inherited, Inherited}}], Cell[BoxData[ RowBox[{ RowBox[{\(1\/2\), " ", "m2", " ", RowBox[{"(", RowBox[{ SuperscriptBox[ RowBox[{"(", SuperscriptBox["x2", "\[Prime]", MultilineFunction->None], ")"}], "2"], "+", SuperscriptBox[ RowBox[{"(", SuperscriptBox["y2", "\[Prime]", MultilineFunction->None], ")"}], "2"]}], ")"}]}], "+", RowBox[{\(1\/2\), " ", "m1", " ", SuperscriptBox[ RowBox[{ SuperscriptBox["x", "\[Prime]", MultilineFunction->None], "[", "t", "]"}], "2"]}]}]], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[TextData[ "We use x2 and y2 as the x and y position of m2 - now we need x2 and y2 in \n\ terms of x, l and \[Phi]."], "Subsection", CellDingbat->None, CellMargins->{{35, Inherited}, {Inherited, Inherited}}], Cell[CellGroupData[{ Cell[BoxData[ \(x2'\ = \ \(x'\)[t]\ + \ \(l\ \(\[Phi]'\)[t]\ Cos[\[Phi][t]]\ \)\)], "Input", CellMargins->{{35, Inherited}, {Inherited, Inherited}}], Cell[BoxData[ RowBox[{ RowBox[{ SuperscriptBox["x", "\[Prime]", MultilineFunction->None], "[", "t", "]"}], "+", RowBox[{"l", " ", \(Cos[\[Phi][t]]\), " ", RowBox[{ SuperscriptBox["\[Phi]", "\[Prime]", MultilineFunction->None], "[", "t", "]"}]}]}]], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(y2'\ = \ l\ \(\[Phi]'\)[t]\ Sin[\[Phi][t]]\)], "Input", CellMargins->{{35, Inherited}, {Inherited, Inherited}}], Cell[BoxData[ RowBox[{"l", " ", \(Sin[\[Phi][t]]\), " ", RowBox[{ SuperscriptBox["\[Phi]", "\[Prime]", MultilineFunction->None], "[", "t", "]"}]}]], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(U\ = \ \(-\ m1\)\ g\ l\ Cos[\[Phi][t]]\)], "Input", CellMargins->{{35, Inherited}, {Inherited, Inherited}}], Cell[BoxData[ \(\(-g\)\ l\ m1\ Cos[\[Phi][t]]\)], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(FullSimplify[L]\)], "Input", CellMargins->{{35, Inherited}, {Inherited, Inherited}}], Cell[BoxData[ RowBox[{\(1\/2\), " ", RowBox[{"(", RowBox[{ RowBox[{\((m1 + m2)\), " ", SuperscriptBox[ RowBox[{ SuperscriptBox["x", "\[Prime]", MultilineFunction->None], "[", "t", "]"}], "2"]}], "+", RowBox[{"2", " ", "l", " ", "m2", " ", \(Cos[\[Phi][t]]\), " ", RowBox[{ SuperscriptBox["x", "\[Prime]", MultilineFunction->None], "[", "t", "]"}], " ", RowBox[{ SuperscriptBox["\[Phi]", "\[Prime]", MultilineFunction->None], "[", "t", "]"}]}], "+", RowBox[{"l", " ", RowBox[{"(", RowBox[{\(2\ g\ m1\ Cos[\[Phi][t]]\), "+", RowBox[{"l", " ", "m2", " ", SuperscriptBox[ RowBox[{ SuperscriptBox["\[Phi]", "\[Prime]", MultilineFunction->None], "[", "t", "]"}], "2"]}]}], ")"}]}]}], ")"}]}]], "Output"] }, Open ]], Cell[TextData[StyleBox[ "Now to get the Lagrangian equations of motion. ", "Subsection"]], "Text", CellMargins->{{35, Inherited}, {Inherited, Inherited}}], Cell[CellGroupData[{ Cell[BoxData[ \(eq1\ = \ D[D[L, \(x'\)[t]], t]\ - \ D[L, x[t]]\ \[Equal] \ Fx[t]\)], "Input", CellMargins->{{35, Inherited}, {Inherited, Inherited}}], Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{"m1", " ", RowBox[{ SuperscriptBox["x", "\[DoublePrime]", MultilineFunction->None], "[", "t", "]"}]}], "+", RowBox[{"m2", " ", RowBox[{"(", RowBox[{ RowBox[{\(-l\), " ", \(Sin[\[Phi][t]]\), " ", SuperscriptBox[ RowBox[{ SuperscriptBox["\[Phi]", "\[Prime]", MultilineFunction->None], "[", "t", "]"}], "2"]}], "+", RowBox[{ SuperscriptBox["x", "\[DoublePrime]", MultilineFunction->None], "[", "t", "]"}], "+", RowBox[{"l", " ", \(Cos[\[Phi][t]]\), " ", RowBox[{ SuperscriptBox["\[Phi]", "\[DoublePrime]", MultilineFunction->None], "[", "t", "]"}]}]}], ")"}]}]}], "==", \(Fx[t]\)}]], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(eq2\ = \ D[D[L, \(\[Phi]'\)[t]], t]\ - \ D[L, \[Phi][t]]\ \[Equal] F\[Phi][t]\)], "Input", CellMargins->{{35, Inherited}, {Inherited, Inherited}}], Cell[BoxData[ RowBox[{ RowBox[{\(g\ l\ m1\ Sin[\[Phi][t]]\), "-", RowBox[{\(1\/2\), " ", "m2", " ", RowBox[{"(", RowBox[{ RowBox[{ "2", " ", \(l\^2\), " ", \(Cos[\[Phi][t]]\), " ", \(Sin[\[Phi][t]]\), " ", SuperscriptBox[ RowBox[{ SuperscriptBox["\[Phi]", "\[Prime]", MultilineFunction->None], "[", "t", "]"}], "2"]}], "-", RowBox[{"2", " ", "l", " ", \(Sin[\[Phi][t]]\), " ", RowBox[{ SuperscriptBox["\[Phi]", "\[Prime]", MultilineFunction->None], "[", "t", "]"}], " ", RowBox[{"(", RowBox[{ RowBox[{ SuperscriptBox["x", "\[Prime]", MultilineFunction->None], "[", "t", "]"}], "+", RowBox[{"l", " ", \(Cos[\[Phi][t]]\), " ", RowBox[{ SuperscriptBox["\[Phi]", "\[Prime]", MultilineFunction->None], "[", "t", "]"}]}]}], ")"}]}]}], ")"}]}], "+", RowBox[{\(1\/2\), " ", "m2", " ", RowBox[{"(", RowBox[{ RowBox[{ "4", " ", \(l\^2\), " ", \(Cos[\[Phi][t]]\), " ", \(Sin[\[Phi][t]]\), " ", SuperscriptBox[ RowBox[{ SuperscriptBox["\[Phi]", "\[Prime]", MultilineFunction->None], "[", "t", "]"}], "2"]}], "-", RowBox[{"2", " ", "l", " ", \(Sin[\[Phi][t]]\), " ", RowBox[{ SuperscriptBox["\[Phi]", "\[Prime]", MultilineFunction->None], "[", "t", "]"}], " ", RowBox[{"(", RowBox[{ RowBox[{ SuperscriptBox["x", "\[Prime]", MultilineFunction->None], "[", "t", "]"}], "+", RowBox[{"l", " ", \(Cos[\[Phi][t]]\), " ", RowBox[{ SuperscriptBox["\[Phi]", "\[Prime]", MultilineFunction->None], "[", "t", "]"}]}]}], ")"}]}], "+", RowBox[{"2", " ", \(l\^2\), " ", \(Sin[\[Phi][t]]\^2\), " ", RowBox[{ SuperscriptBox["\[Phi]", "\[DoublePrime]", MultilineFunction->None], "[", "t", "]"}]}], "+", RowBox[{"2", " ", "l", " ", \(Cos[\[Phi][t]]\), " ", RowBox[{"(", RowBox[{ RowBox[{\(-l\), " ", \(Sin[\[Phi][t]]\), " ", SuperscriptBox[ RowBox[{ SuperscriptBox["\[Phi]", "\[Prime]", MultilineFunction->None], "[", "t", "]"}], "2"]}], "+", RowBox[{ SuperscriptBox["x", "\[DoublePrime]", MultilineFunction->None], "[", "t", "]"}], "+", RowBox[{"l", " ", \(Cos[\[Phi][t]]\), " ", RowBox[{ SuperscriptBox["\[Phi]", "\[DoublePrime]", MultilineFunction->None], "[", "t", "]"}]}]}], ")"}]}]}], ")"}]}]}], "==", \(F\[Phi][t]\)}]], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(Simplify[eq1]\)], "Input", CellMargins->{{35, Inherited}, {Inherited, Inherited}}], Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{\(-l\), " ", "m2", " ", \(Sin[\[Phi][t]]\), " ", SuperscriptBox[ RowBox[{ SuperscriptBox["\[Phi]", "\[Prime]", MultilineFunction->None], "[", "t", "]"}], "2"]}], "+", RowBox[{\((m1 + m2)\), " ", RowBox[{ SuperscriptBox["x", "\[DoublePrime]", MultilineFunction->None], "[", "t", "]"}]}], "+", RowBox[{"l", " ", "m2", " ", \(Cos[\[Phi][t]]\), " ", RowBox[{ SuperscriptBox["\[Phi]", "\[DoublePrime]", MultilineFunction->None], "[", "t", "]"}]}]}], "==", \(Fx[t]\)}]], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(Simplify[eq2]\)], "Input", CellMargins->{{35, Inherited}, {Inherited, Inherited}}], Cell[BoxData[ RowBox[{ RowBox[{"l", " ", RowBox[{"(", RowBox[{\(g\ m1\ Sin[\[Phi][t]]\), "+", RowBox[{"m2", " ", \(Cos[\[Phi][t]]\), " ", RowBox[{ SuperscriptBox["x", "\[DoublePrime]", MultilineFunction->None], "[", "t", "]"}]}], "+", RowBox[{"l", " ", "m2", " ", RowBox[{ SuperscriptBox["\[Phi]", "\[DoublePrime]", MultilineFunction->None], "[", "t", "]"}]}]}], ")"}]}], "==", \(F\[Phi][t]\)}]], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(\(\(sol1\ \) = \ FullSimplify[Solve[eq1, \(\(x'\)'\)[t]]]\[IndentingNewLine]\)\)], "Input", CellMargins->{{35, Inherited}, {Inherited, Inherited}}], Cell[BoxData[ RowBox[{"{", RowBox[{"{", RowBox[{ RowBox[{ SuperscriptBox["x", "\[DoublePrime]", MultilineFunction->None], "[", "t", "]"}], "\[Rule]", FractionBox[ RowBox[{\(Fx[t]\), "+", RowBox[{"l", " ", "m2", " ", RowBox[{"(", RowBox[{ RowBox[{\(Sin[\[Phi][t]]\), " ", SuperscriptBox[ RowBox[{ SuperscriptBox["\[Phi]", "\[Prime]", MultilineFunction->None], "[", "t", "]"}], "2"]}], "-", RowBox[{\(Cos[\[Phi][t]]\), " ", RowBox[{ SuperscriptBox["\[Phi]", "\[DoublePrime]", MultilineFunction->None], "[", "t", "]"}]}]}], ")"}]}]}], \(m1 + m2\)]}], "}"}], "}"}]], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(sol2\ = \ FullSimplify[Solve[eq2, \(\(\[Phi]'\)'\)[t]]]\)], "Input", CellMargins->{{35, Inherited}, {Inherited, Inherited}}], Cell[BoxData[ RowBox[{"{", RowBox[{"{", RowBox[{ RowBox[{ SuperscriptBox["\[Phi]", "\[DoublePrime]", MultilineFunction->None], "[", "t", "]"}], "\[Rule]", FractionBox[ RowBox[{\(F\[Phi][t]\), "-", RowBox[{"l", " ", RowBox[{"(", RowBox[{\(g\ m1\ Sin[\[Phi][t]]\), "+", RowBox[{"m2", " ", \(Cos[\[Phi][t]]\), " ", RowBox[{ SuperscriptBox["x", "\[DoublePrime]", MultilineFunction->None], "[", "t", "]"}]}]}], ")"}]}]}], \(l\^2\ m2\)]}], "}"}], "}"}]], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(\(x'\)[t]\ \[Equal] \ v[t]\)], "Input", CellMargins->{{35, Inherited}, {Inherited, Inherited}}], Cell[BoxData[ RowBox[{ RowBox[{ SuperscriptBox["x", "\[Prime]", MultilineFunction->None], "[", "t", "]"}], "==", \(v[t]\)}]], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(\(\[Phi]'\)[t] \[Equal] \ \[Omega][t]\)], "Input", CellMargins->{{35, Inherited}, {Inherited, Inherited}}], Cell[BoxData[ RowBox[{ RowBox[{ SuperscriptBox["\[Phi]", "\[Prime]", MultilineFunction->None], "[", "t", "]"}], "==", \(\[Omega][t]\)}]], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(FullSimplify[ Solve[{eq1, eq2}, {\(\(x'\)'\)[t], \(\(\[Phi]'\)'\)[t]}]] /. \ {\(x'\)' \[Rule] v', \[Phi]' \[Rule] \[Omega], \(\[Phi]'\)' \[Rule] \[Omega]'}\)], "Input", CellMargins->{{35, Inherited}, {Inherited, Inherited}}], Cell[BoxData[ RowBox[{"{", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{ SuperscriptBox["v", "\[Prime]", MultilineFunction->None], "[", "t", "]"}], "\[Rule]", \(\(2\ \(( l\ Fx[t] - Cos[\[Phi][t]]\ F\[Phi][t] + l\ Sin[\[Phi][t]]\ \((g\ m1\ Cos[\[Phi][t]] + l\ m2\ \[Omega][t]\^2)\)) \)\)\/\(l\ \((2\ m1 + m2 - m2\ Cos[2\ \[Phi][t]])\)\)\)}], ",", RowBox[{ RowBox[{ SuperscriptBox["\[Omega]", "\[Prime]", MultilineFunction->None], "[", "t", "]"}], "\[Rule]", \(\(2\ l\ m2\ Cos[\[Phi][t]]\ Fx[t] + 2\ \((m1 + m2)\)\ \((\(-F\[Phi][t]\) + g\ l\ m1\ Sin[\[Phi][t]])\) + l\^2\ m2\^2\ Sin[2\ \[Phi][t]]\ \[Omega][t]\^2\)\/\(l\^2\ m2 \ \((\(-2\)\ m1 - m2 + m2\ Cos[2\ \[Phi][t]])\)\)\)}]}], "}"}], "}"}]], "Output"] }, Open ]] }, Open ]] }, Open ]] }, FrontEndVersion->"Macintosh 3.0", ScreenRectangle->{{0, 1920}, {0, 1178}}, ScreenStyleEnvironment->"Presentation", WindowToolbars->"RulerBar", WindowSize->{1339, 827}, WindowMargins->{{Automatic, 64}, {Automatic, 73}}, PrintingCopies->1, PrintingPageRange->{Automatic, Automatic}, Magnification->1, StyleDefinitions -> "Default.nb", MacintoshSystemPageSetup->"\<\ 02P0001804P000000^L2D_ogooL33`9K8085:0?l0000005X0FP000003X<;VP5d 038;VTRX04/00@4100000BL?00400@000000000000000000000000000040I0<0 000000000P
" ] (*********************************************************************** 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->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[1731, 51, 554, 11, 584, "Section"], Cell[CellGroupData[{ Cell[2310, 66, 108, 2, 36, "Input"], Cell[2421, 70, 39, 1, 36, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[2497, 76, 170, 4, 36, "Input"], Cell[2670, 82, 661, 17, 52, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[3368, 104, 215, 4, 87, "Subsection"], Cell[CellGroupData[{ Cell[3608, 112, 159, 3, 36, "Input"], Cell[3770, 117, 324, 8, 36, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[4131, 130, 134, 2, 36, "Input"], Cell[4268, 134, 187, 4, 36, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[4492, 143, 130, 2, 36, "Input"], Cell[4625, 147, 63, 1, 36, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[4725, 153, 106, 2, 36, "Input"], Cell[4834, 157, 1041, 24, 52, "Output"] }, Open ]], Cell[5890, 184, 156, 2, 36, "Text"], Cell[CellGroupData[{ Cell[6071, 190, 161, 3, 36, "Input"], Cell[6235, 195, 950, 23, 38, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[7222, 223, 187, 4, 36, "Input"], Cell[7412, 229, 3471, 73, 135, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[10920, 307, 104, 2, 36, "Input"], Cell[11027, 311, 684, 16, 38, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[11748, 332, 104, 2, 36, "Input"], Cell[11855, 336, 567, 13, 36, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[12459, 354, 179, 4, 56, "Input"], Cell[12641, 360, 961, 22, 55, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[13639, 387, 147, 2, 36, "Input"], Cell[13789, 391, 701, 16, 52, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[14527, 412, 118, 2, 36, "Input"], Cell[14648, 416, 166, 5, 36, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[14851, 426, 128, 2, 36, "Input"], Cell[14982, 430, 182, 5, 36, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[15201, 440, 270, 5, 36, "Input"], Cell[15474, 447, 1044, 23, 104, "Output"] }, Open ]] }, Open ]] }, Open ]] } ] *) (*********************************************************************** End of Mathematica Notebook file. ***********************************************************************)