home *** CD-ROM | disk | FTP | other *** search
Wrap
(*^ ::[paletteColors = 128; currentKernel; fontset = title, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, bold, L1, e8, 24, "Times"; ; fontset = subtitle, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, bold, L1, e6, 18, "Times"; ; fontset = subsubtitle, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, italic, L1, e6, 14, "Times"; ; fontset = section, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, grayBox, M22, bold, L1, a20, 18, "Times"; ; fontset = subsection, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, blackBox, M19, bold, L1, a15, 14, "Times"; ; fontset = subsubsection, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, whiteBox, M18, bold, L1, a12, 12, "Times"; ; fontset = text, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12; fontset = smalltext, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 10, "Times"; ; fontset = input, noPageBreakBelow, nowordwrap, preserveAspect, groupLikeInput, M42, N23, bold, L1, 12, "Courier"; ; fontset = output, output, inactive, noPageBreakBelow, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L-5, 12, "Courier"; ; fontset = message, inactive, noPageBreakBelow, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L1, 12, "Courier"; ; fontset = print, inactive, noPageBreakBelow, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L1, 12, "Courier"; ; fontset = info, inactive, noPageBreakBelow, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L1, 12, "Courier"; ; fontset = postscript, PostScript, formatAsPostScript, output, inactive, noPageBreakBelow, nowordwrap, preserveAspect, groupLikeGraphics, M7, l34, w282, h287, L1, 12, "Courier"; ; fontset = name, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, italic, L1, 10, "Times"; ; fontset = header, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12; fontset = Left Header, nohscroll, cellOutline, 12; fontset = footer, inactive, nohscroll, noKeepOnOnePage, preserveAspect, center, M7, L1, 12; fontset = Left Footer, cellOutline, blackBox, 12; fontset = help, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 10, "Times"; ; fontset = clipboard, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12; fontset = completions, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12, "Courier"; ; fontset = special1, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12; fontset = special2, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12; fontset = special3, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12; fontset = special4, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12; fontset = special5, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12;] :[font = title; inactive; preserveAspect; ] Lagrange's Equations for a Pendulum on a Spring. :[font = subtitle; inactive; preserveAspect; ] by Charles G. Fleming Educational Computing Services Allegheny College Partially supported by a grant from the Vira Heinz Foundation. :[font = subtitle; inactive; preserveAspect; ] This notebook contains a step-by-step derivation of Lagrange's differential equations for the motion of a pendulum whose rotating arm is a spring instead of a rigid arm. Although this notebook deals with a specific mechanical system, it should be relatively easy for the user to modify it to handle a wide variety of other mechanical systems. :[font = section; inactive; Cclosed; preserveAspect; startGroup; ] Set Up :[font = input; initialization; preserveAspect; endGroup; ] *) Off[General::spell] Off[General::spell1] (* :[font = section; inactive; Cclosed; preserveAspect; startGroup; ] The derivation of Lagrange's Equations :[font = subsection; inactive; Cclosed; preserveAspect; startGroup; ] The Coordinates :[font = text; inactive; preserveAspect; endGroup; ] Polar coordinates, r and theta, naturally describe the position of the mass on a pendulum whose arm is a spring rather than a rigid rod. We will refer to this mechanical system as a springy pendulum. The attachement point for the pendulum arm is assumed to be at r = 0. We denote the natural length of the spring by r0. Theta is measured from the negative x axis, in the counterclockwise direction . ;[s] 3:0,0;320,1;321,2;408,-1; 3:1,14,11,Times,0,16,0,0,0;1,14,11,Times,64,16,0,0,0;1,14,11,Times,0,16,0,0,0; :[font = subsection; inactive; Cclosed; preserveAspect; startGroup; ] The Kinetic Energy :[font = text; inactive; Cclosed; preserveAspect; startGroup; ] The formula for the kinetic energy of the system is 1/2 m v2, where v denotes the length of the velocity vector. Recall that the velocity vector is given by (ds/dt, dr/dt) where s is the arc length parameter for the path along which the mass travels. Since s = r theta, we have that the velocity is given by (r dtheta/dt, dr/dt). Therefore v2 is (r dtheta/dt)2 + (dr/dt)2. We denote the kinetic energy by T. ;[s] 9:0,0;59,1;60,2;344,3;345,4;363,5;364,6;374,7;375,8;412,-1; 9:1,14,11,Times,0,16,0,0,0;1,14,11,Times,32,16,0,0,0;1,14,11,Times,0,16,0,0,0;1,14,11,Times,32,16,0,0,0;1,14,11,Times,0,16,0,0,0;1,14,11,Times,32,16,0,0,0;1,14,11,Times,0,16,0,0,0;1,14,11,Times,32,16,0,0,0;1,14,11,Times,0,16,0,0,0; :[font = input; initialization; preserveAspect; endGroup; endGroup; ] *) T = (m/2) ( (r[t] D[theta[t], t])^2 + (D[r[t], t])^2 ) (* :[font = subsection; inactive; Cclosed; preserveAspect; startGroup; ] The Potential Energy :[font = text; inactive; Cclosed; preserveAspect; startGroup; ] The calculation of the potential energy of the system is a little more challenging. The potential energy at a point (r, theta) is by definition the negative of the path integral of f . dR, from some reference point (rRef, thetaRef) to the point (r, theta). f is the force acting on the mass and R is the position vector of the mass. ;[s] 1:0,0;338,-1; 1:1,14,11,Times,0,16,0,0,0; :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup; ] The position vector :[font = text; inactive; Cclosed; preserveAspect; startGroup; ] The position vector R with respect to the standard basis is given by the following formula. ;[s] 1:0,0;92,-1; 1:1,14,11,Times,0,16,0,0,0; :[font = input; initialization; preserveAspect; endGroup; endGroup; ] *) R = {r Cos[theta], r Sin[theta]} (* :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup; ] Tangent vectors :[font = text; inactive; Cclosed; preserveAspect; startGroup; ] A more natural basis for this problem is obtained by thinking of r and theta as curvilinear coordinates. The tangent vectors along curves obtained by holding r and then theta fixed, form a basis. These vectors are easy to compute. ;[s] 1:0,0;232,-1; 1:1,14,11,Times,0,16,0,0,0; :[font = input; initialization; preserveAspect; ] *) vr = D[R, r] (* :[font = input; initialization; preserveAspect; endGroup; ] *) vtheta = D[R, theta] (* :[font = text; inactive; Cclosed; preserveAspect; startGroup; ] The following calculuations show that vr has length one, but vtheta has length r. This will be important when we compute f . dR. ;[s] 5:0,0;39,1;40,2;62,3;67,4;129,-1; 5:1,14,11,Times,0,16,0,0,0;1,14,11,Times,64,16,0,0,0;1,14,11,Times,0,16,0,0,0;1,14,11,Times,64,16,0,0,0;1,14,11,Times,0,16,0,0,0; :[font = input; initialization; preserveAspect; ] *) lenr = Sqrt[vr . vr] /. Sin[theta]^2 -> 1 - Cos[theta]^2 (* :[font = input; initialization; preserveAspect; ] *) lentheta = Sqrt[vtheta . vtheta] /. Sin[theta]^2 -> 1 - Cos[theta]^2 (* :[font = input; initialization; preserveAspect; endGroup; endGroup; ] *) lentheta = Simplify[lentheta] (* :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup; ] The differential of position :[font = text; inactive; preserveAspect; ] The differential of the position vector dR is simply ;[s] 1:0,0;52,-1; 1:1,14,11,Times,0,16,0,0,0; :[font = input; initialization; preserveAspect; endGroup; ] *) dR = vr dr + vtheta dtheta (* :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup; ] The forces :[font = text; inactive; Cclosed; preserveAspect; startGroup; ] The component of the force on the mass in the vr direction is obtained from Hooke's Law. ;[s] 3:0,0;47,1;48,2;88,-1; 3:1,14,11,Times,0,16,0,0,0;1,14,11,Times,64,16,0,0,0;1,14,11,Times,0,16,0,0,0; :[font = input; initialization; preserveAspect; endGroup; ] *) fr = - k (r - r0) vr (* :[font = text; inactive; Cclosed; preserveAspect; startGroup; ] The component of the force in the vtheta direction is due to gravity. ;[s] 1:0,0;69,-1; 1:1,14,11,Times,0,16,0,0,0; :[font = input; initialization; preserveAspect; ] *) ftheta = - m g Sin[theta] vtheta (* :[font = text; inactive; Cclosed; preserveAspect; startGroup; ] Now since ftheta is in terms of a unit vector in the theta direction, and since as we saw above, vtheta has length r, we must modify ftheta before we use it in our calculations. ;[s] 7:0,0;11,1;16,2;98,3;103,4;134,5;139,6;177,-1; 7:1,14,11,Times,0,16,0,0,0;1,14,11,Times,64,16,0,0,0;1,14,11,Times,0,16,0,0,0;1,14,11,Times,64,16,0,0,0;1,14,11,Times,0,16,0,0,0;1,14,11,Times,64,16,0,0,0;1,14,11,Times,0,16,0,0,0; :[font = input; initialization; preserveAspect; endGroup; endGroup; endGroup; ] *) ftheta = ftheta / r (* :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup; ] Compute f . dR :[font = input; initialization; preserveAspect; ] *) fdR = Simplify[(fr + ftheta) . dR] (* :[font = input; initialization; preserveAspect; ] *) fdR = fdR /. Sin[x_]^2 -> 1 - Cos[x]^2 (* :[font = text; inactive; preserveAspect; endGroup; ] This result can also be rewritten as f . dR = - k (r - r0) dr - m g Sin[theta] r dtheta. ;[s] 1:0,0;89,-1; 1:1,14,11,Times,0,16,0,0,0; :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup; ] Compute the potential energy :[font = text; inactive; Cclosed; preserveAspect; startGroup; ] To compute the potential energy at an arbitrary point (r, theta), we must now integrate - f . dR along a path from some reference point to the point (r, theta). We wil choose the point (r0, Pi/2) as our reference point and assume that the potential there is zero. Recall that we are free to choose any point as the reference point and can assign to that point as potential we wish. Since the forces considered here are conservitave, we can integrate along any path from (r0, Pi/2) to (r, theta). The path we choose is the path from (r0, Pi/2) to (r, Pi/2) where the angle constant, and then from (r, Pi/2) to (r, theta) where r is constant. Along the first path dtheta is zero, and along the second path dr is zero. Since r and theta are functions of t, we insert this dependence in the following formulas. ;[s] 7:0,0;188,1;189,2;475,3;476,4;538,5;539,6;812,-1; 7:1,14,11,Times,0,16,0,0,0;1,14,11,Times,64,16,0,0,0;1,14,11,Times,0,16,0,0,0;1,14,11,Times,64,16,0,0,0;1,14,11,Times,0,16,0,0,0;1,14,11,Times,64,16,0,0,0;1,14,11,Times,0,16,0,0,0; :[font = input; initialization; preserveAspect; ] *) integral1 = - Integrate[ - k (u - r0) , {u, r0, r[t]}] (* :[font = input; initialization; preserveAspect; ] *) integral2 = - Integrate[ - m g Sin[u] r[t] , {u, Pi/2, theta[t]}] (* :[font = text; inactive; Cclosed; preserveAspect; startGroup; ] The potential energy of this system then is ;[s] 1:0,0;43,-1; 1:1,14,11,Times,0,16,0,0,0; :[font = input; initialization; preserveAspect; endGroup; endGroup; endGroup; endGroup; endGroup; ] *) V = integral1 + integral2 (* :[font = subsection; inactive; Cclosed; preserveAspect; startGroup; ] The Lagrangian :[font = text; inactive; Cclosed; preserveAspect; startGroup; ] Recall that the Lagrangian is T - V. ;[s] 1:0,0;36,-1; 1:1,14,11,Times,0,16,0,0,0; :[font = input; initialization; preserveAspect; endGroup; endGroup; ] *) L = Simplify[T - V] (* :[font = subsection; inactive; Cclosed; preserveAspect; startGroup; ] Lagrange's Equations :[font = text; inactive; Cclosed; preserveAspect; startGroup; ] Our last step is to compute Langrange's equations. These second order equations will describe the motion of the springy pendulum. ;[s] 1:0,0;130,-1; 1:1,14,11,Times,0,16,0,0,0; :[font = input; initialization; preserveAspect; ] *) equ1 = D[ D[L, D[r[t], t]], t] - D[L, r[t]] (* :[font = input; initialization; preserveAspect; endGroup; endGroup; endGroup; ] *) equ2 = D[ D[L, D[theta[t], t]], t] - D[L, theta[t]] (* ^*)