%23%20%2F%2F%2F%20script%0A%23%20requires-python%20%3D%20%22%3E%3D3.11%22%0A%23%20dependencies%20%3D%20%5B%22marimo%3E%3D0.23.9%22%5D%0A%23%20%2F%2F%2F%0A%0Aimport%20marimo%0A%0A__generated_with%20%3D%20%220.25.2%22%0Aapp%20%3D%20marimo.App()%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%20Lagrangian%20mechanics%20in%20generalized%20coordinates%0A%0A%20%20%20%20%3E%20Marcos%20Duarte%2C%20Renato%20Naville%20Watanabe%3Cbr%3E%0A%20%20%20%20%3E%20%5BLaboratory%20of%20Biomechanics%20and%20Motor%20Control%5D(https%3A%2F%2Fbmclab.pesquisa.ufabc.edu.br%2F)%3Cbr%3E%0A%20%20%20%20%3E%20Federal%20University%20of%20ABC%2C%20Brazil%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20How%20to%20use%20this%20guide%0A%0A%20%20%20%20We%20will%20connect%20Newton%E2%80%99s%20equations%20to%20virtual%20work%20and%20then%20choose%20generalized%20coordinates.%20Keep%20a%20distinction%20between%20an%20actual%20displacement%20over%20time%20and%20a%20virtual%20displacement%20at%20a%20fixed%20time.%20The%20assumptions%20about%20constraints%20determine%20which%20forces%20disappear.%0A%0A%20%20%20%20Try%20the%20distributed%20**Exercises**%20before%20opening%20their%20collapsed%20worked%20solutions.%20Then%20use%20the%20**Checkpoint%20questions**%20and%20attempt%20the%20**Problems**%20independently%3B%20their%20panels%20contain%20final%20answers%20only.%20Predict%20the%20effect%20of%20a%20parameter%20change%20before%20running%20it%2C%20and%20check%20units%20and%20limiting%20cases.%0A%0A%20%20%20%20**Opening%20challenge.**%20A%20bead%20is%20constrained%20to%20a%20circular%20wire.%20Do%20you%20need%20two%20Cartesian%20equations%20and%20an%20unknown%20normal%20force%2C%20or%20can%20one%20coordinate%20describe%20the%20motion%3F%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20Python%20setup%0A%0A%20%20%20%20The%20dependency%20declaration%20at%20the%20top%20of%20this%20file%20lists%20the%20packages%20used%20by%20this%20guide.%20Marimo%20runs%20cells%20in%20dependency%20order.%20Run%20the%20notebook%20in%20an%20editor%20to%20use%20its%20displays%20and%20controls%3B%20the%20computational%20examples%20below%20explain%20their%20inputs%20before%20using%20them.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20The%20Lagrangian%20mechanics%20can%20be%20formulated%20completely%20independent%20of%20the%20Newtonian%20mechanics%20and%20Cartesian%20coordinates%3B%20Lagrange%20developed%20this%20new%20formalism%20based%20on%20the%20%5Bprinciple%20of%20least%20action%5D(https%3A%2F%2Fmolab.marimo.io%2Fgithub%2FBMClab%2FBMC%2Fblob%2Fmaster%2Fnotebooks%2Fprinciple_of_least_action.py).%3Cbr%3E%0A%20%20%20%20In%20this%20notebook%2C%20we%20will%20take%20a%20less%20noble%20path%2C%20we%20will%20deduce%20the%20Lagrange's%20equation%20from%20Newtonian%20mechanics.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20Review%20on%20Newton's%20laws%20of%20motion%0A%0A%20%20%20%20The%20%5BNewton's%20laws%20of%20motion%5D(https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FNewton's_laws_of_motion)%20laid%20the%20foundation%20for%20classical%20mechanics.%20They%20describe%20the%20relationship%20between%20the%20motion%20of%20a%20body%20and%20the%20possible%20forces%20acting%20upon%20it.%0A%0A%20%20%20%20Consider%20the%20motion%20of%20a%20particle%20in%20three-dimensional%20space%2C%20its%20position%20in%20time%20can%20be%20represented%20by%20the%20following%20vector%3A%0A%0A%20%20%20%20%24%24%0A%20%20%20%20%5Cvec%7Br%7D(t)%20%3D%20x(t)%5Chat%7Bi%7D%20%2B%20y(t)%5Chat%7Bj%7D%20%2B%20z(t)%5Chat%7Bk%7D%0A%20%20%20%20%24%24%0A%0A%20%20%20%20And%20given%20its%20position%2C%20the%20particle's%20velocity%20and%20acceleration%20are%3A%0A%0A%20%20%20%20%24%24%0A%20%20%20%20%5Cbegin%7Barray%7D%7Bl%7D%0A%20%20%20%20%5Cvec%7Bv%7D(t)%20%3D%20%5Cdfrac%7B%5Cmathrm%20d%20%5Cvec%7Br%7D(t)%7D%7B%5Cmathrm%20d%20t%7D%20%3D%20%5Cdfrac%7Bd%20x(t)%7D%7B%5Cmathrm%20d%20t%7D%5Chat%7Bi%7D%20%2B%20%5Cdfrac%7Bd%20y(t)%7D%7B%5Cmathrm%20d%20t%7D%5Chat%7Bj%7D%20%2B%20%5Cdfrac%7Bd%20z(t)%7D%7B%5Cmathrm%20d%20t%7D%5Chat%7Bk%7D%20%5C%5C%0A%20%20%20%20%5Cvec%7Ba%7D(t)%20%3D%20%5Cdfrac%7B%5Cmathrm%20d%20%5Cvec%7Bv%7D(t)%7D%7B%5Cmathrm%20d%20t%7D%20%3D%20%5Cdfrac%7B%5Cmathrm%20d%5E2%20%5Cvec%7Br%7D(t)%7D%7B%5Cmathrm%20d%20t%5E2%7D%20%3D%20%5Cdfrac%7Bd%5E2%20x(t)%7D%7B%5Cmathrm%20d%20t%5E2%7D%5Chat%7Bi%7D%20%2B%20%5Cdfrac%7Bd%5E2%20y(t)%7D%7B%5Cmathrm%20d%20t%5E2%7D%5Chat%7Bj%7D%20%2B%20%5Cdfrac%7Bd%5E2%20z(t)%7D%7B%5Cmathrm%20d%20t%5E2%7D%5Chat%7Bk%7D%0A%20%20%20%20%5Cend%7Barray%7D%0A%20%20%20%20%24%24%0A%0A%20%20%20%20The%20particle's%20linear%20momentum%20is%20defined%20as%3A%0A%0A%20%20%20%20%24%24%0A%20%20%20%20%5Cvec%7Bp%7D(t)%20%3D%20m%5Cvec%7Bv%7D(t)%0A%20%20%20%20%24%24%0A%0A%20%20%20%20where%20%24m%24%20and%20%24%5Cvec%7Bv%7D%24%20are%20the%20mass%20and%20velocity%20of%20the%20body.%0A%0A%20%20%20%20Newton's%20second%20law%20relates%20the%20resultant%20force%20applied%20on%20the%20particle%20to%20the%20rate%20of%20variation%20of%20its%20linear%20momentum%2C%20and%20if%20the%20mass%20is%20constant%3A%0A%0A%20%20%20%20%24%24%0A%20%20%20%20%5Cbegin%7Barray%7D%7Bl%7D%0A%20%20%20%20%5Cvec%7BF%7D(t)%20%3D%20%5Cdfrac%7B%5Cmathrm%20d%20%5Cvec%7Bp%7D(t)%7D%7B%5Cmathrm%20d%20t%7D%20%3D%20%5Cdfrac%7B%5Cmathrm%20d%20(m%5Cvec%7Bv%7D(t))%7D%7B%5Cmathrm%20d%20t%7D%20%5C%5C%0A%20%20%20%20%5Cvec%7BF%7D(t)%20%3D%20m%5Cvec%7Ba%7D(t)%0A%20%20%20%20%5Cend%7Barray%7D%0A%20%20%20%20%24%24%0A%0A%20%20%20%20From%20Newton's%20second%20law%2C%20if%20the%20position%20of%20the%20particle%20at%20any%20time%20is%20known%2C%20one%20can%20determine%20the%20resultant%20force%20acting%20on%20it.%20If%20the%20position%20is%20not%20known%2C%20but%20the%20resultant%20force%20is%2C%20the%20position%20of%20the%20particle%20can%20determined%20solving%20the%20following%20second%20order%20ordinary%20differential%20equation%3A%0A%0A%20%20%20%20%24%24%0A%20%20%20%20%5Cfrac%7B%5Cmathrm%20d%5E2%20%5Cvec%7Br%7D(t)%7D%7B%5Cmathrm%20d%20t%5E2%7D%20%3D%20%5Cfrac%7B%5Cvec%7BF%7D(t)%7D%7Bm%7D%0A%20%20%20%20%24%24%0A%0A%20%20%20%20The%20differential%20equation%20above%20is%20referred%20as%20the%20equation%20of%20motion%20(EOM)%20of%20the%20particle.%20For%20example%2C%20a%20system%20of%20%24N%24%20particles%20will%20require%20%243N%24%20EOMs%20to%20describe%20their%20motion.%3Cbr%3E%0A%20%20%20%20The%20EOM%20has%20the%20general%20solution%3A%0A%0A%20%20%20%20%24%24%0A%20%20%20%20%5Cvec%7Br%7D(t)%20%3D%20%5Cint%5C!%5Cbigg(%5Cint%5Cfrac%7B%5Cvec%7BF%7D(t)%7D%7Bm%7D%20%5C%2C%20%5Cmathrm%7Bd%7Dt%5Cbigg)%20%5C%2C%20%5Cmathrm%7Bd%7Dt%0A%20%20%20%20%24%24%0A%0A%20%20%20%20which%20requires%20the%20determination%20of%20two%20constants%2C%20the%20initial%20position%20and%20velocity.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%23%20Mechanical%20energy%0A%0A%20%20%20%20A%20related%20physical%20quantity%20is%20the%20mechanical%20energy%2C%20which%20is%20the%20sum%20of%20kinetic%20and%20potential%20energies.%3Cbr%3E%0A%20%20%20%20The%20kinetic%20energy%2C%20%24T%24%20of%20a%20particle%20is%20given%20by%3A%0A%0A%20%20%20%20%24%24%0A%20%20%20%20T%20%3D%20%5Cfrac%7B1%7D%7B2%7Dm%20v%5E2%0A%20%20%20%20%24%24%0A%0A%20%20%20%20Which%20can%20be%20expressed%20in%20terms%20of%20its%20linear%20momentum%20as%3A%0A%0A%20%20%20%20%24%24%0A%20%20%20%20T%20%3D%20%5Cfrac%7B1%7D%7B2m%7D%20%20p%5E2%0A%20%20%20%20%24%24%0A%0A%20%20%20%20And%20for%20a%20given%20coordinate%20of%20the%20particle's%20motion%2C%20its%20linear%20momentum%20can%20be%20obtained%20from%20its%20kinetic%20energy%20by%3A%0A%0A%20%20%20%20%24%24%0A%20%20%20%20%5Cvec%7Bp%7D%20%3D%20%5Cfrac%7B%5Cpartial%20T%7D%7B%5Cpartial%20%5Cvec%7Bv%7D%7D%0A%20%20%20%20%24%24%0A%0A%20%20%20%20The%20potential%20energy%20%24V%24%20is%20the%20stored%20energy%20of%20a%20particle%20and%20its%20formulation%20is%20dependent%20on%20the%20force%20acting%20on%20the%20particle.%20For%20a%20conservative%20force%20dependent%20solely%20on%20the%20particle%20position%2C%20such%20as%20due%20to%20the%20gravitational%20field%20near%20the%20Earth%20surface%20or%20due%20to%20a%20linear%20spring%2C%20the%20force%20can%20be%20expressed%20in%20terms%20of%20the%20gradient%20of%20the%20potential%20energy%3A%0A%0A%20%20%20%20%24%24%0A%20%20%20%20%5Cvec%7BF%7D%20%3D%20-%5Cnabla%20V(%5Cvec%7Br%7D)%20%3D%20-%5Cfrac%7B%5Cpartial%20V%7D%7B%5Cpartial%20x%7D%5Chat%7Bi%7D%20-%20%5Cfrac%7B%5Cpartial%20V%7D%7B%5Cpartial%20y%7D%5Chat%7Bj%7D%20-%20%5Cfrac%7B%5Cpartial%20V%7D%7B%5Cpartial%20z%7D%5Chat%7Bk%7D%0A%20%20%20%20%24%24%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20Lagrange's%20equation%20in%20Cartesian%20Coordinates%0A%0A%20%20%20%20For%20simplicity%2C%20let's%20first%20deduce%20the%20Lagrange's%20equation%20for%20a%20particle%20in%20Cartesian%20Coordinates%20and%20from%20Newton's%20second%20law.%0A%0A%20%20%20%20Because%20we%20want%20to%20deduce%20the%20laws%20of%20motion%20based%20on%20the%20mechanical%20energy%20of%20the%20particle%2C%20one%20can%20see%20that%20the%20time%20derivative%20of%20the%20expression%20for%20the%20linear%20momentum%20as%20a%20function%20of%20the%20kinetic%20energy%2C%20cf.%20Eq.%20(%5Cref%7Beq11%7D)%2C%20is%20equal%20to%20the%20force%20acting%20on%20the%20particle%20and%20we%20can%20substitute%20the%20force%20in%20Newton's%20second%20law%20by%20this%20term%3A%0A%0A%20%20%20%20%24%24%0A%20%20%20%20%5Cfrac%7B%5Cmathrm%20d%20%7D%7B%5Cmathrm%20d%20t%7D%5Cbigg(%5Cfrac%7B%5Cpartial%20T%7D%7B%5Cpartial%20%5Cdot%20x%7D%5Cbigg)%20%3D%20m%5Cddot%20x%0A%20%20%20%20%24%24%0A%0A%20%20%20%20We%20saw%20that%20a%20conservative%20force%20can%20also%20be%20expressed%20in%20terms%20of%20the%20potential%20energy%20of%20the%20particle%2C%20cf.%20Eq.%20(%5Cref%7Beq12%7D)%3B%20substituting%20the%20right%20side%20of%20the%20equation%20above%20by%20this%20expression%2C%20we%20have%3A%0A%0A%20%20%20%20%24%24%0A%20%20%20%20%5Cfrac%7B%5Cmathrm%20d%20%7D%7B%5Cmathrm%20d%20t%7D%5Cbigg(%5Cfrac%7B%5Cpartial%20T%7D%7B%5Cpartial%20%5Cdot%20x%7D%5Cbigg)%20%3D%20-%5Cfrac%7B%5Cpartial%20V%7D%7B%5Cpartial%20x%7D%0A%20%20%20%20%24%24%0A%0A%20%20%20%20Using%20the%20fact%20that%3A%0A%0A%20%20%20%20%24%24%0A%20%20%20%20%5Cfrac%7B%5Cpartial%20T%7D%7B%5Cpartial%20x%7D%20%3D%200%20%5Cquad%20and%20%5Cquad%20%5Cfrac%7B%5Cpartial%20V%7D%7B%5Cpartial%20%5Cdot%20x%7D%20%3D%200%0A%20%20%20%20%24%24%0A%0A%20%20%20%20We%20can%20write%3A%0A%0A%20%20%20%20%24%24%0A%20%20%20%20%5Cfrac%7B%5Cmathrm%20d%20%7D%7B%5Cmathrm%20d%20t%7D%5Cbigg(%5Cfrac%7B%5Cpartial%20(T-V)%7D%7B%5Cpartial%20%5Cdot%20x%7D%5Cbigg)%20-%20%5Cfrac%7B%5Cpartial%20(T-V)%7D%7B%5Cpartial%20x%7D%20%3D%200%0A%20%20%20%20%24%24%0A%0A%20%20%20%20Defining%20the%20Lagrange%20or%20Lagrangian%20function%2C%20%24%5Cmathcal%7BL%7D%24%2C%20as%20the%20difference%20between%20the%20kinetic%20and%20potential%20energy%20in%20the%20system%3A%0A%0A%20%20%20%20%24%24%0A%20%20%20%20%5Cmathcal%7BL%7D%20%3D%20T%20-%20V%0A%20%20%20%20%24%24%0A%0A%20%20%20%20We%20have%20the%20Lagrange's%20equation%20in%20Cartesian%20Coordinates%20for%20a%20conservative%20force%20acting%20on%20a%20particle%3A%0A%0A%20%20%20%20%24%24%0A%20%20%20%20%5Cfrac%7B%5Cmathrm%20d%20%7D%7B%5Cmathrm%20d%20t%7D%5Cbigg(%5Cfrac%7B%5Cpartial%20%5Cmathcal%7BL%7D%7D%7B%5Cpartial%20%5Cdot%20x%7D%5Cbigg)%20-%20%5Cfrac%7B%5Cpartial%20%5Cmathcal%7BL%7D%7D%7B%5Cpartial%20x%7D%20%3D%200%0A%20%20%20%20%24%24%0A%0A%20%20%20%20Once%20all%20derivatives%20of%20the%20Lagrangian%20function%20are%20calculated%2C%20this%20equation%20will%20be%20the%20equation%20of%20motion%20for%20the%20particle.%20If%20there%20are%20%24N%24%20independent%20particles%20in%20a%20three-dimensional%20space%2C%20there%20will%20be%20%243N%24%20equations%20of%20motion%20for%20the%20system.%3Cbr%3E%0A%20%20%20%20The%20set%20of%20equations%20above%20for%20a%20system%20are%20known%20as%20Euler%E2%80%93Lagrange's%20equations%2C%20or%20Lagrange's%20equations%20of%20the%20second%20kind.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20**Exercise%201%20%E2%80%94%20Count%20independent%20coordinates.**%20A%20particle%20moves%20in%20the%20plane%20on%20a%20circle%20%24x%5E2%2By%5E2%3DR%5E2%24.%20How%20many%20independent%20coordinates%20remain%3F%20Give%20a%20convenient%20parameterization.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%2F%2F%2F%20details%20%7C%20Solution%20to%20Exercise%201%0A%0A%20%20%20%20One%20holonomic%20constraint%20removes%20one%20of%20the%20two%20configuration%20coordinates.%20Choose%20%24q%3D%5Ctheta%24%2C%20%24x%3DR%5Ccos%5Ctheta%24%2C%20%24y%3DR%5Csin%5Ctheta%24.%20Angle%20determines%20position%3B%20its%20velocity%20remains%20separate%20initial%20data.%0A%20%20%20%20%2F%2F%2F%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20Generalized%20coordinates%0A%0A%20%20%20%20The%20direct%20application%20of%20Newton's%20laws%20to%20mechanical%20systems%20results%20in%20a%20set%20of%20equations%20of%20motion%20in%20terms%20of%20Cartesian%20coordinates%20of%20each%20of%20the%20particles%20that%20make%20up%20the%20system.%20In%20many%20cases%2C%20this%20is%20not%20the%20most%20convenient%20coordinate%20system%20to%20solve%20the%20problem%20or%20describe%20the%20movement%20of%20the%20system.%20For%20example%2C%20for%20a%20serial%20chain%20of%20rigid%20links%2C%20such%20as%20a%20member%20of%20the%20human%20body%20or%20from%20a%20robot%20manipulator%2C%20it%20may%20be%20simpler%20to%20describe%20the%20positions%20of%20each%20link%20by%20the%20angles%20between%20links.%0A%0A%20%20%20%20Coordinate%20systems%20such%20as%20angles%20of%20a%20chain%20of%20links%20are%20referred%20as%20%5Bgeneralized%20coordinates%5D(https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FGeneralized_coordinates).%20Generalized%20coordinates%20uniquely%20specify%20the%20positions%20of%20the%20particles%20in%20a%20system.%20Although%20there%20may%20be%20several%20generalized%20coordinates%20to%20describe%20a%20system%2C%20usually%20a%20judicious%20choice%20of%20generalized%20coordinates%20provides%20the%20minimum%20number%20of%20independent%20coordinates%20that%20define%20the%20configuration%20of%20a%20system%20(which%20is%20the%20number%20of%20%3Ca%20href%3D%22https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FDegrees_of_freedom_(mechanics)%22%3Edegrees%20of%20freedom%3C%2Fa%3E%20of%20the%20system)%2C%20turning%20the%20problem%20simpler%20to%20solve.%20In%20this%20case%2C%20when%20the%20number%20of%20generalized%20coordinates%20equals%20the%20number%20of%20degrees%20of%20freedom%2C%20the%20system%20is%20referred%20as%20a%20holonomic%20system.%20In%20a%20non-holonomic%20system%2C%20the%20number%20of%20generalized%20coordinates%20necessary%20do%20describe%20the%20system%20depends%20on%20the%20path%20taken%20by%20the%20system.%0A%0A%20%20%20%20Being%20a%20little%20more%20technical%2C%20according%20to%20%5BWikipedia%5D(https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FConfiguration_space_(physics))%3A%3Cbr%3E%0A%20%20%20%20%22In%20classical%20mechanics%2C%20the%20parameters%20that%20define%20the%20configuration%20of%20a%20system%20are%20called%20generalized%20coordinates%2C%20and%20the%20vector%20space%20defined%20by%20these%20coordinates%20is%20called%20the%20configuration%20space%20of%20the%20physical%20system.%20It%20is%20often%20the%20case%20that%20these%20parameters%20satisfy%20mathematical%20constraints%2C%20such%20that%20the%20set%20of%20actual%20configurations%20of%20the%20system%20is%20a%20manifold%20in%20the%20space%20of%20generalized%20coordinates.%20This%20manifold%20is%20called%20the%20configuration%20manifold%20of%20the%20system.%22%0A%0A%20%20%20%20In%20problems%20where%20it%20is%20desired%20to%20use%20generalized%20coordinates%2C%20one%20can%20write%20Newton's%20equations%20of%20motion%20in%20terms%20of%20Cartesian%20coordinates%20and%20then%20transform%20them%20into%20generalized%20coordinates.%20However%2C%20it%20would%20be%20desirable%20and%20convenient%20to%20have%20a%20general%20method%20that%20would%20directly%20establish%20the%20equations%20of%20motion%20in%20terms%20of%20a%20set%20of%20convenient%20generalized%20coordinates.%20In%20addition%2C%20general%20methods%20for%20writing%2C%20and%20perhaps%20solving%2C%20the%20equations%20of%20motion%20in%20terms%20of%20any%20coordinate%20system%20would%20also%20be%20desirable.%20The%20%5BLagrangian%20mechanics%5D(https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FLagrangian_mechanics)%20is%20such%20a%20method.%0A%0A%20%20%20%20When%20describing%20a%20system%20of%20particles%20using%20any%20set%20of%20generalized%20coordinates%2C%20%24q_1%2C%5Cdotsc%2Cq_%7B3N%7D%24%2C%20these%20are%20related%20to%2C%20for%20example%2C%20the%20Cartesian%20coordinates%20by%3A%0A%0A%20%20%20%20%24%24%0A%20%20%20%20%5Cbegin%7Barray%7D%7Brcl%7D%0A%20%20%20%20q_i%20%3Dq_i%20(x_1%2C%5Cdotsc%2Cx_%7B3N%7D%20)%20%5Cquad%20i%3D1%2C%5Cdotsc%2C3N%20%5C%5C%0A%20%20%20%20x_i%20%3Dx_i%20(q_1%2C%5Cdotsc%2Cq_%7B3N%7D%20)%20%5Cquad%20i%3D1%2C%5Cdotsc%2C3N%0A%20%20%20%20%5Cend%7Barray%7D%0A%20%20%20%20%24%24%0A%0A%20%20%20%20The%20Cartesian%20components%20of%20velocity%20as%20a%20function%20of%20generalized%20coordinates%20are%3A%0A%0A%20%20%20%20%24%24%0A%20%20%20%20%5Cdot%7Bx%7D_i%20%3D%5Cfrac%7B%5Cmathrm%20d%20x_i%20(q_1%2C%20q_2%2C%5Cdotsc%2Cq_%7B3N%7D%0A%20%20%20%20)%7D%7B%5Cmathrm%20d%20t%7D%3D%5Csum%5Climits_%7Bj%3D1%7D%5E%7B3N%7D%20%7B%5Cfrac%7B%5Cpartial%20x_i%20%7D%7B%5Cpartial%20q_j%20%7D%7D%0A%20%20%20%20%5Cfrac%7B%5Cmathrm%20d%20q_j%20%7D%7B%5Cmathrm%20d%20t%7D%0A%20%20%20%20%24%24%0A%0A%20%20%20%20where%20for%20simplicity%20we%20omitted%20the%20explicit%20mention%20of%20the%20temporal%20dependence%20of%20each%20coordinate.%0A%0A%20%20%20%20That%20is%2C%20any%20Cartesian%20component%20of%20the%20particle%20velocity%20as%20a%20function%20of%20generalized%20coordinates%20is%20a%20function%20of%20all%20the%20components%20of%20position%20and%20velocity%20in%20the%20generalized%20coordinates%3A%0A%0A%20%20%20%20%24%24%0A%20%20%20%20%5Cdot%7Bx%7D_i%20%3D%20%5Cdot%7Bx%7D_i%20(q_1%2C%5Cdotsc%2Cq_%7B3N%7D%20%2C%5Cdot%7Bq%7D_1%2C%5Cdotsc%2C%5Cdot%7Bq%7D_%7B3N%7D%20)%20%5Cquad%20i%3D1%2C%5Cdotsc%2C3N%0A%20%20%20%20%24%24%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20**Exercise%202%20%E2%80%94%20Find%20a%20generalized%20force.**%20A%20force%20%24(F_x%2CF_y)%24%20acts%20on%20the%20circular%20bead.%20Find%20%24Q_%5Ctheta%24%20from%20the%20coordinate%20map.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%2F%2F%2F%20details%20%7C%20Solution%20to%20Exercise%202%0A%0A%20%20%20%20%24Q_%5Ctheta%3D%5Cmathbf%20F%5Ccdot%5Cpartial%5Cmathbf%20r%2F%5Cpartial%5Ctheta%3DR(-F_x%5Csin%5Ctheta%2BF_y%5Ccos%5Ctheta)%24.%20It%20has%20units%20N%20m%20because%20its%20coordinate%20is%20an%20angle.%20A%20radial%20ideal%20normal%20force%20gives%20zero%20generalized%20force.%0A%20%20%20%20%2F%2F%2F%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20Lagrange's%20equation%0A%0A%20%20%20%20In%20analogy%20to%20Newtonian%20mechanics%2C%20one%20can%20think%20that%20the%20equations%20of%20motion%20can%20be%20obtained%20by%20equating%20the%20generalized%20force%2C%20%24F_i%24%2C%20to%20the%20temporal%20rate%20of%20change%20of%20each%20generalized%20momentum%2C%20%24p_i%24%3A%0A%0A%20%20%20%20%24%24%0A%20%20%20%20F_i%20%3D%5Cfrac%7B%5Cpartial%20p_i%20%7D%7B%5Cpartial%20t%7D%0A%20%20%20%20%24%24%0A%0A%20%20%20%20In%20the%20formula%20above%2C%20let's%20substitute%20the%20quantity%20%24p_i%24%20by%20its%20definition%20in%20terms%20of%20the%20kinetic%20energy%3A%0A%0A%20%20%20%20%24%24%0A%20%20%20%20%5Cfrac%7B%5Cpartial%20p_i%20%7D%7B%5Cpartial%20t%7D%20%3D%5Cfrac%7B%5Cpartial%20%7D%7B%5Cpartial%20t%7D%5Cleft(%20%7B%5Cfrac%7B%5Cpartial%20T%7D%7B%5Cpartial%0A%20%20%20%20%5Cdot%7Bq%7D_i%20%7D%7D%20%5Cright)%3D%5Cfrac%7B%5Cpartial%20%7D%7B%5Cpartial%20t%7D%5Cleft(%0A%20%20%20%20%7B%5Csum%5Climits_%7Bj%3D1%7D%5E%7B3N%7D%20%7Bm_j%20%5Cdot%7Bx%7D_j%20%5Cfrac%7B%5Cpartial%20%5Cdot%7Bx%7D_j%0A%20%20%20%20%7D%7B%5Cpartial%20%5Cdot%7Bq%7D_i%20%7D%7D%20%7D%20%5Cright)%0A%20%20%20%20%24%24%0A%0A%20%20%20%20where%20we%20used%3A%0A%0A%20%20%20%20%24%24%0A%20%20%20%20%5Cfrac%7B%5Cpartial%20T%7D%7B%5Cpartial%20%5Cdot%7Bq%7D_i%20%7D%3D%5Csum%5Climits_%7Bj%3D1%7D%5E%7B3N%7D%0A%20%20%20%20%7B%5Cfrac%7B%5Cpartial%20T%7D%7B%5Cpartial%20%5Cdot%7Bx%7D_j%20%7D%5Cfrac%7B%5Cpartial%20%5Cdot%7Bx%7D_j%0A%20%20%20%20%7D%7B%5Cpartial%20%5Cdot%7Bq%7D_i%20%7D%7D%0A%20%20%20%20%24%24%0A%0A%20%20%20%20Using%20the%20%5Bproduct%20rule%5D(https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FProduct_rule)%2C%20the%20derivative%20of%20the%20product%20in%20Eq.%20(%5Cref%7Beq29%7D)%20is%3A%0A%0A%20%20%20%20%24%24%0A%20%20%20%20%5Cfrac%7B%5Cpartial%20p_i%20%7D%7B%5Cpartial%20t%7D%3D%5Csum%5Climits_%7Bj%3D1%7D%5E%7B3N%7D%20%7Bm_j%0A%20%20%20%20%5Cddot%7Bx%7D_j%20%5Cfrac%7B%5Cpartial%20%5Cdot%7Bx%7D_j%20%7D%7B%5Cpartial%20%5Cdot%7Bq%7D_i%20%7D%7D%0A%20%20%20%20%2B%5Csum%5Climits_%7Bj%3D1%7D%5E%7B3N%7D%20%7Bm_j%20%5Cdot%7Bx%7D_j%20%5Cfrac%7B%5Cmathrm%20d%20%7D%7B%5Cmathrm%20d%20t%7D%5Cleft(%0A%20%20%20%20%7B%5Cfrac%7B%5Cpartial%20%5Cdot%7Bx%7D_j%20%7D%7B%5Cpartial%20%5Cdot%7Bq%7D_i%20%7D%7D%20%5Cright)%7D%0A%20%20%20%20%24%24%0A%0A%20%20%20%20But%3A%0A%0A%20%20%20%20%24%24%0A%20%20%20%20%5Cfrac%7B%5Cpartial%20%5Cdot%7Bx%7D_i%20%7D%7B%5Cpartial%20%5Cdot%7Bq%7D_j%20%7D%3D%5Cfrac%7B%5Cpartial%20x_i%0A%20%20%20%20%7D%7B%5Cpartial%20q_j%20%7D%20%5Cquad%20because%20%5Cquad%20%5Cfrac%7B%5Cpartial%0A%20%20%20%20%5Cdot%7Bx%7D_i%20%7D%7B%5Cpartial%20%5Cdot%7Bq%7D_j%20%7D%3D%5Cfrac%7B%5Cpartial%20x_i%20%7D%7B%5Cpartial%0A%20%20%20%20t%7D%5Cfrac%7B%5Cpartial%20t%7D%7B%5Cpartial%20q_j%20%7D%3D%5Cfrac%7B%5Cpartial%20x_i%20%7D%7B%5Cpartial%20q_j%7D%0A%20%20%20%20%24%24%0A%0A%20%20%20%20Then%3A%0A%0A%20%20%20%20%24%24%0A%20%20%20%20%5Cfrac%7B%5Cpartial%20p_i%20%7D%7B%5Cpartial%20t%7D%3D%5Csum%5Climits_%7Bj%3D1%7D%5E%7B3N%7D%20%7Bm_j%0A%20%20%20%20%5Cddot%7Bx%7D_j%20%5Cfrac%7B%5Cpartial%20x_j%20%7D%7B%5Cpartial%20q_i%20%7D%7D%0A%20%20%20%20%2B%5Csum%5Climits_%7Bj%3D1%7D%5E%7B3N%7D%20%7Bm_j%20%5Cdot%7Bx%7D_j%20%5Cfrac%7B%5Cmathrm%20d%20%7D%7B%5Cmathrm%20d%20t%7D%5Cleft(%0A%20%20%20%20%7B%5Cfrac%7B%5Cpartial%20x_j%20%7D%7B%5Cpartial%20q_i%20%7D%7D%20%5Cright)%7D%0A%20%20%20%20%24%24%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20The%20first%20term%20on%20the%20right%20side%20of%20the%20equation%20above%20is%20proportional%20to%20%24m_j%5Cddot%7Bx%7D_j%24%20and%20we%20will%20define%20as%20the%20generalized%20force%2C%20%24Q_i%24.%20But%2C%20different%20from%20Newtonian%20mechanics%2C%20the%20temporal%20variation%20of%20the%20generalized%20momentum%20is%20equal%20to%20the%20generalized%20force%20plus%20another%20term%2C%20which%20will%20investigate%20now.%20The%20last%20part%20of%20this%20second%20term%20can%20be%20derived%20as%3A%0A%0A%20%20%20%20%24%24%0A%20%20%20%20%5Cfrac%7B%5Cmathrm%20d%20%7D%7B%5Cmathrm%20d%20t%7D%5Cleft(%20%7B%5Cfrac%7B%5Cpartial%20x_j%20%7D%7B%5Cpartial%20q_i%20%7D%7D%20%5Cright)%20%3D%0A%20%20%20%20%5Csum%5Climits_%7Bk%3D1%7D%5E%7B3N%7D%20%7B%5Cfrac%7B%5Cmathrm%20d%20%7D%7B%5Cmathrm%20d%20q_k%20%7D%5Cleft(%20%7B%5Cfrac%7B%5Cpartial%0A%20%20%20%20x_j%20%7D%7B%5Cpartial%20q_i%20%7D%7D%20%5Cright)%5Cfrac%7B%5Cmathrm%20d%20q_k%20%7D%7B%5Cmathrm%20d%20t%7D%7D%20%3D%5Csum%5Climits_%7Bk%3D1%7D%5E%7B3N%7D%0A%20%20%20%20%7B%5Cfrac%7B%5Cpartial%5E2%20x_j%20%7D%7B%5Cpartial%20q_k%20%5Cpartial%20q_i%20%7D%5Cdot%7Bq%7D_k%20%7D%0A%20%20%20%20%24%24%0A%0A%20%20%20%20where%20we%20used%20the%20%5Bchain%20rule%5D(https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FChain_rule)%20for%20the%20differentiation%3A%0A%0A%20%20%20%20%24%24%0A%20%20%20%20%5Cfrac%7B%5Cmathrm%20d%20%7D%7B%5Cmathrm%20d%20t%7D%5CBig(%20%7Bf%5Cbig(%7Bg(t)%7D%5Cbig)%7D%5CBig)%20%3D%20%5Cfrac%7B%5Cpartial%20f%7D%7B%5Cpartial%20g%7D%5Cfrac%7B%5Cpartial%20g%7D%7B%5Cpartial%20t%7D%0A%20%20%20%20%24%24%0A%0A%20%20%20%20But%20if%20we%20look%20at%20Eq.%20(%5Cref%7Beq_xdotqdot%7D)%20we%20see%20that%20the%20term%20at%20the%20right%20side%20of%20the%20Eq.%20(%5Cref%7Beq34%7D)%20can%20be%20obtained%20by%3A%0A%0A%20%20%20%20%24%24%0A%20%20%20%20%5Cfrac%7B%5Cpartial%20%5Cdot%7Bx%7D_j%20%7D%7B%5Cpartial%20q_i%20%7D%20%3D%20%5Cfrac%7B%5Cpartial%20%7D%7B%5Cpartial%20q_i%20%7D%5Cleft(%5Csum%5Climits_%7Bk%3D1%7D%5E%7B3N%7D%20%5Cfrac%7B%5Cpartial%0A%20%20%20%20x_j%20%7D%7B%5Cpartial%20q_i%20%7D%5Cdot%7Bq%7D_k%20%5Cright)%20%3D%20%5Csum%5Climits_%7Bk%3D1%7D%5E%7B3N%7D%0A%20%20%20%20%7B%5Cfrac%7B%5Cpartial%5E2%20x_j%20%7D%7B%5Cpartial%20q_k%20%5Cpartial%20q_i%20%7D%5Cdot%7Bq%7D_k%20%7D%0A%20%20%20%20%24%24%0A%0A%20%20%20%20Comparing%20the%20Eq.%20(%5Cref%7Beq34%7D)%20and%20Eq.%20(%5Cref%7Beq36%7D)%20we%20have%3A%0A%0A%20%20%20%20%24%24%0A%20%20%20%20%5Cfrac%7B%5Cmathrm%20d%20%7D%7B%5Cmathrm%20d%20t%7D%5Cleft(%20%7B%5Cfrac%7B%5Cpartial%20x_j%20%7D%7B%5Cpartial%20q_i%20%7D%7D%20%5Cright)%20%3D%0A%20%20%20%20%5Cfrac%7B%5Cmathrm%20d%20%7D%7B%5Cmathrm%20d%20q_i%7D%5Cleft(%20%7B%5Cfrac%7B%5Cpartial%20x_j%20%7D%7B%5Cpartial%20t%20%7D%7D%20%5Cright)%0A%20%20%20%20%24%24%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20On%20the%20other%20hand%2C%20it%20is%20possible%20to%20relate%20the%20term%20%24%5Cpartial%20%5Cdot%7Bx%7D_j%20%2F%20%5Cpartial%20q_i%24%20to%20the%20derivative%20of%20kinetic%20energy%20with%20respect%20to%20the%20coordinate%20%24q_i%24%3A%0A%0A%20%20%20%20%24%24%0A%20%20%20%20%5Cfrac%7B%5Cpartial%20T%7D%7B%5Cpartial%20q_i%20%7D%3D%5Cfrac%7B%5Cpartial%20%7D%7B%5Cpartial%20q_i%20%7D%5Cleft(%0A%20%20%20%20%7B%5Csum%5Climits_%7Bj%3D1%7D%5E%7B3N%7D%20%7B%5Cfrac%7B1%7D%7B2%7Dm_j%20%5Cdot%7Bx%7D_j%5E2%7D%20%7D%0A%20%20%20%20%5Cright)%3D%5Csum%5Climits_%7Bj%3D1%7D%5E%7B3N%7D%20%7Bm_j%20%5Cdot%7Bx%7D_j%20%7D%20%5Cfrac%7B%5Cpartial%0A%20%20%20%20%5Cdot%7Bx%7D_j%20%7D%7B%5Cpartial%20q_i%20%7D%0A%20%20%20%20%24%24%0A%0A%20%20%20%20where%20once%20again%20we%20used%20the%20chain%20rule%20for%20the%20differentiation.%0A%0A%20%20%20%20Using%20Eq.%20(%5Cref%7Beq_dotdxdq%7D)%2C%20Eq.%20(%5Cref%7Beq38%7D)%20becomes%0A%0A%20%20%20%20%24%24%0A%20%20%20%20%5Cfrac%7B%5Cpartial%20T%7D%7B%5Cpartial%20q_i%20%7D%3D%5Csum%5Climits_%7Bj%3D1%7D%5E%7B3N%7D%20%7Bm_j%0A%20%20%20%20%5Cdot%7Bx%7D_j%20%7D%20%5Cfrac%7B%5Cmathrm%20d%20%7D%7B%5Cmathrm%20d%20t%7D%5Cleft(%20%7B%5Cfrac%7B%5Cpartial%20x_j%20%7D%7B%5Cpartial%20q_i%20%7D%7D%0A%20%20%20%20%5Cright)%0A%20%20%20%20%24%24%0A%0A%20%20%20%20Returning%20to%20Eq.%20(%5Cref%7Beq33%7D)%2C%20it%20can%20be%20rewritten%20as%3A%0A%0A%20%20%20%20%24%24%0A%20%20%20%20%5Cfrac%7B%5Cmathrm%20d%20%7D%7B%5Cmathrm%20d%20t%7D%5Cleft(%20%7B%5Cfrac%7B%5Cpartial%20T%7D%7B%5Cpartial%20%5Cdot%7Bq%7D_i%20%7D%7D%20%5Cright)%20%3D%20Q_i%20%2B%20%5Cfrac%7B%5Cpartial%20T%7D%7B%5Cpartial%20q_i%20%7D%0A%20%20%20%20%24%24%0A%0A%20%20%20%20and%0A%0A%20%20%20%20%24%24%0A%20%20%20%20%5Cfrac%7B%5Cmathrm%20d%20%7D%7B%5Cmathrm%20d%20t%7D%5Cleft(%20%7B%5Cfrac%7B%5Cpartial%20T%7D%7B%5Cpartial%20%5Cdot%7Bq%7D_i%20%7D%7D%20%5Cright)%20-%20%5Cfrac%7B%5Cpartial%20T%7D%7B%5Cpartial%20q_i%20%7D%20%3D%20Q_i%0A%20%20%20%20%24%24%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20Now%20let's%20look%20at%20%24Q_i%24%2C%20the%20generalized%20force.%20It%20can%20be%20decomposed%20into%20two%20terms%3A%0A%0A%20%20%20%20The%20first%20term%2C%20composed%20of%20the%20conservative%20forces%2C%20i.e.%20forces%20that%20can%20be%20written%20as%20potential%20gradients%3A%0A%0A%20%20%20%20%24%24%0A%20%20%20%20Q_C%20%3D-%5Cfrac%7B%5Cpartial%20V%7D%7B%5Cpartial%20q_i%20%7D%20%5Cquad%20%2C%20%5Cquad%20V%3DV%5Cleft(%20%7Bq_1%2C%5Cdotsc%2Cq_%7B3N%7D%20%7D%20%5Cright)%0A%20%20%20%20%24%24%0A%0A%20%20%20%20An%20example%20of%20conservative%20force%20is%20the%20gravitational%20force.%0A%0A%20%20%20%20And%20the%20second%20term%2C%20encompassing%20all%20non-conservative%20forces%2C%20%24Q_%7BNC%7D%24.%0A%0A%20%20%20%20Then%3A%0A%0A%20%20%20%20%24%24%0A%20%20%20%20Q_i%20%3D-%5Cfrac%7B%5Cpartial%20V%7D%7B%5Cpartial%20q_i%20%7D%2BQ_%7BNCi%7D%20%5Cquad%20%2C%20%5Cquad%20V%3DV%5Cleft(%20%7Bq_1%2C%5Cdotsc%2Cq_%7B3N%7D%20%7D%20%5Cright)%0A%20%20%20%20%24%24%0A%0A%20%20%20%20The%20Eq.%20(%5Cref%7Beq41%7D)%20becomes%0A%0A%20%20%20%20%24%24%0A%20%20%20%20%5Cfrac%7B%5Cmathrm%20d%20%7D%7B%5Cmathrm%20d%20t%7D%5Cleft(%20%7B%5Cfrac%7B%5Cpartial%20T%7D%7B%5Cpartial%20%5Cdot%7Bq%7D_i%20%7D%7D%0A%20%20%20%20%5Cright)-%5Cfrac%7B%5Cpartial%20T%7D%7B%5Cpartial%20q_i%20%7D%3D-%5Cfrac%7B%5Cpartial%20V%7D%7B%5Cpartial%20q_i%7D%20%2B%20Q_%7BNCi%7D%0A%20%20%20%20%24%24%0A%0A%20%20%20%20Rearranging%2C%20we%20have%3A%0A%0A%20%20%20%20%24%24%0A%20%20%20%20%5Cfrac%7B%5Cmathrm%20d%20%7D%7B%5Cmathrm%20d%20t%7D%5Cleft(%20%7B%5Cfrac%7B%5Cpartial%20%5Cleft(%20%7BT-V%7D%20%5Cright)%7D%7B%5Cpartial%0A%20%20%20%20%5Cdot%7Bq%7D_i%20%7D%7D%20%5Cright)-%5Cfrac%7B%5Cpartial%20%5Cleft(%20%7BT-V%7D%20%5Cright)%7D%7B%5Cpartial%20q_i%7D%20%3D%20Q_%7BNCi%7D%0A%20%20%20%20%24%24%0A%0A%20%20%20%20This%20is%20possible%20because%3A%0A%0A%20%20%20%20%24%24%0A%20%20%20%20%5Cfrac%7B%5Cpartial%20V%7D%7B%5Cpartial%20%5Cdot%7Bq%7D_i%7D%20%3D%200%0A%20%20%20%20%24%24%0A%0A%20%20%20%20Defining%3A%0A%0A%20%20%20%20%24%24%0A%20%20%20%20%5Cmathcal%7BL%7D%20%5Cequiv%20%5Cmathcal%7BL%7D(q_1%2C%5Cdotsc%2Cq_%7B3N%7D%20%2C%5Cdot%7Bq%7D_1%2C%5Cdotsc%2C%5Cdot%7Bq%7D_%7B3N%7D%20)%20%3D%20T%20-%20V%0A%20%20%20%20%24%24%0A%0A%20%20%20%20as%20the%20Lagrange%20or%20Lagrangian%20function%2C%20we%20have%20the%20Lagrange's%20equation%3A%0A%0A%20%20%20%20%24%24%0A%20%20%20%20%5Cfrac%7B%5Cmathrm%20d%20%7D%7B%5Cmathrm%20d%20t%7D%5Cleft(%20%7B%5Cfrac%7B%5Cpartial%20%5Cmathcal%7BL%7D%7D%7B%5Cpartial%20%5Cdot%7Bq%7D_i%20%7D%7D%0A%20%20%20%20%5Cright)-%5Cfrac%7B%5Cpartial%20%5Cmathcal%7BL%7D%7D%7B%5Cpartial%20q_i%20%7D%20%3D%20Q_%7BNCi%7D%20%5Cquad%20i%3D1%2C%5Cdotsc%2C3N%0A%20%20%20%20%24%24%0A%0A%20%20%20%20Once%20all%20derivatives%20of%20the%20Lagrangian%20function%20are%20calculated%2C%20this%20equation%20will%20be%20the%20equation%20of%20motion%20for%20each%20particle.%20If%20there%20are%20%20%24N%24%20independent%20particles%20in%20a%20three-dimensional%20space%2C%20there%20will%20be%20%243N%24%20equations%20for%20the%20system.%0A%0A%20%20%20%20The%20set%20of%20equations%20above%20for%20a%20system%20are%20known%20as%20Euler%E2%80%93Lagrange%20equations%2C%20or%20Lagrange's%20equations%20of%20the%20second%20kind.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20**Exercise%203%20%E2%80%94%20Add%20a%20conservative%20potential.**%20For%20a%20vertical%20circle%20with%20%24y%3D-R%5Ccos%5Ctheta%24%2C%20write%20the%20Lagrangian%20and%20angle%20equation%20under%20gravity.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%2F%2F%2F%20details%20%7C%20Solution%20to%20Exercise%203%0A%0A%20%20%20%20%24L%3D%5Ctfrac12mR%5E2%5Cdot%5Ctheta%5E2%2BmgR%5Ccos%5Ctheta%24.%20Its%20equation%20is%20%24mR%5E2%5Cddot%5Ctheta%2BmgR%5Csin%5Ctheta%3D0%24.%20This%20uses%20a%20fixed%20wire%20and%20a%20normal%20force%20that%20does%20no%20virtual%20work.%0A%20%20%20%20%2F%2F%2F%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%23%20Constraints%0A%0A%20%20%20%20An%20important%20class%20of%20problems%20in%20mechanics%2C%20in%20which%20the%20Lagrangian%20equations%20are%20particularly%20useful%2C%20are%20composed%20of%20constrained%20systems.%20A%20constraint%20is%20a%20restriction%20on%20the%20freedom%20of%20movement%20of%20a%20particle%20or%20a%20system%20of%20particles%20(a%20constraint%20decreases%20the%20number%20of%20degrees%20of%20freedom%20of%20a%20system).%20A%20rigid%20body%2C%20or%20the%20movement%20of%20a%20pendulum%2C%20are%20examples%20of%20constrained%20systems.%20It%20can%20be%20shown%2C%20in%20a%20similar%20way%2C%20that%20the%20Lagrange%20equation%2C%20deduced%20here%20for%20a%20system%20of%20free%20particles%2C%20is%20also%20valid%20for%20a%20system%20of%20particles%20under%20the%20action%20of%20constraints.%3Cbr%3E%0A%20%20%20%20The%20Euler-Lagrange%20equation%2C%20for%20a%20system%20of%20%243N%24%20particles%20and%20with%20%24k%24%20constraints%2C%20is%20then%20defined%20as%3A%0A%0A%20%20%20%20%24%24%0A%20%20%20%20%5Cfrac%7B%5Cmathrm%20d%20%7D%7B%5Cmathrm%20d%20t%7D%5Cleft(%20%7B%5Cfrac%7B%5Cpartial%20%5Cmathcal%7BL%7D%7D%7B%5Cpartial%20%5Cdot%7Bq%7D_i%7D%7D%20%5Cright)-%5Cfrac%7B%5Cpartial%20%5Cmathcal%7BL%7D%7D%7B%5Cpartial%20q_i%20%7D%20%3D%20Q_%7BNCi%7D%20%5Cquad%20i%3D1%2C%5Cdotsc%2C3N-k%0A%20%20%20%20%24%24%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20**Exercise%204%20%E2%80%94%20Distinguish%20virtual%20from%20actual%20motion.**%20An%20ideal%20constraint%20moves%20with%20time.%20Must%20its%20reaction%20do%20zero%20actual%20work%20simply%20because%20it%20does%20zero%20virtual%20work%3F%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%2F%2F%2F%20details%20%7C%20Solution%20to%20Exercise%204%0A%0A%20%20%20%20No.%20Virtual%20displacement%20holds%20time%20fixed%20and%20respects%20the%20instantaneous%20constraint.%20Actual%20velocity%20also%20includes%20motion%20of%20the%20constraint%20itself.%20A%20moving%20support%20can%20transfer%20energy%20even%20when%20its%20ideal%20reaction%20does%20no%20virtual%20work.%0A%20%20%20%20%2F%2F%2F%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_()%3A%0A%20%20%20%20import%20marimo%20as%20mo%0A%0A%20%20%20%20return%20(mo%2C)%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20Checkpoint%20questions%0A%0A%20%20%20%201.%20Are%20generalized%20coordinates%20always%20lengths%20or%20angles%3F%0A%20%20%20%202.%20What%20determines%20the%20units%20of%20a%20generalized%20force%3F%0A%20%20%20%203.%20Does%20every%20constraint%20reduce%20the%20configuration%20dimension%20by%20one%3F%0A%20%20%20%204.%20When%20may%20ideal%20constraint%20forces%20be%20omitted%3F%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%2F%2F%2F%20details%20%7C%20Checkpoint%20answers%0A%0A%20%20%20%201.%20No%3B%20any%20independent%20parameters%20that%20specify%20configuration%20can%20be%20used.%0A%20%20%20%202.%20The%20product%20%24Q_i%5C%2Cdq_i%24%20must%20have%20work%20units.%0A%20%20%20%203.%20Only%20independent%20holonomic%20constraints%20do%20so%20in%20this%20simple%20counting%20rule.%0A%20%20%20%204.%20When%20their%20total%20virtual%20work%20vanishes%20for%20the%20allowed%20virtual%20displacements.%0A%20%20%20%20%2F%2F%2F%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20Problems%0A%0A%20%20%20%201.%20For%20%24x%3D2q%24%2C%20%24y%3D3q%24%20(lengths%20in%20metres%20when%20q%20is%20dimensionless)%20and%20a%20force%20%24(4%2C5)%24%20N%2C%20find%20%24Q_q%24.%0A%0A%20%20%20%202.%20A%20point%20pendulum%20has%20mass%202%20kg%20and%20length%200.5%20m.%20Write%20its%20mass%20coefficient%20and%20gravity%20term%20for%20angle%20from%20downward%20vertical%2C%20with%20%24g%3D9.81%24%20m%2Fs%C2%B2.%0A%0A%20%20%20%203.%20A%20normal%20force%20on%20a%20fixed%20frictionless%20circle%20is%20radial.%20Give%20its%20generalized%20force%20for%20the%20angle%20coordinate.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%2F%2F%2F%20details%20%7C%20Final%20answers%20to%20Problems%0A%0A%20%20%20%201.%2023%20J%20per%20unit%20q.%0A%0A%20%20%20%202.%20%24M%3D0.5%24%20kg%20m%C2%B2%3B%20%24G_%7Bleft%7D%3D9.81%5Csin%5Ctheta%24%20N%20m%3B%20%240.5%5Cddot%5Ctheta%2B9.81%5Csin%5Ctheta%3D0%24.%0A%0A%20%20%20%203.%20Zero.%0A%20%20%20%20%2F%2F%2F%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20Go%20deeper%0A%0A%20%20%20%20-%20%5BThe%20Principle%20of%20Least%20Action%20in%20%5D(https%3A%2F%2Fwww.feynmanlectures.caltech.edu%2FII_19.html)%0A%20%20%20%20-%20Vandiver%20JK%20(MIT%20OpenCourseWare)%20%5BAn%20Introduction%20to%20Lagrangian%20Mechanics%5D(https%3A%2F%2Focw.mit.edu%2Fcourses%2Fmechanical-engineering%2F2-003sc-engineering-dynamics-fall-2011%2Flagrange-equations%2FMIT2_003SCF11_Lagrange.pdf)%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%23%20Video%20lectures%20on%20the%20Internet%0A%0A%20%20%20%20-%20iLectureOnline%3A%20%5BLectures%20in%20Lagrangian%20Mechanics%5D(http%3A%2F%2Fwww.ilectureonline.com%2Flectures%2Fsubject%2FPHYSICS%2F34%2F245)%0A%20%20%20%20-%20MIT%20OpenCourseWare%3A%20%5BIntroduction%20to%20Lagrange%20With%20Examples%5D(https%3A%2F%2Fyoutu.be%2Fzhk9xLjrmi4)%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%23%20Additional%20verified%20lecture%0A%0A%20%20%20%20%5BMIT%20OpenCourseWare%5D(https%3A%2F%2Focw.mit.edu%2Fcourses%2F2-003sc-engineering-dynamics-fall-2011%2Fpages%2Flagrange-equations%2F)%20%E2%80%94%20Lagrange%20equations%3A%20follow%20the%20energy-to-equation%20method%20in%20the%20lecture%20and%20worked%20examples.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%0A%20%20%20%20%23%23%20References%0A%0A%20%20%20%20-%20Goldstein%20H%20(1980)%20%5BClassical%20Mechanics%5D(https%3A%2F%2Fbooks.google.com.br%2Fbooks%3Fid%3DtJCuQgAACAAJ)%2C%203rd%20ed.%2C%20Addison-Wesley.%0A%0A%20%20%20%20-%20Marion%20JB%20(1970)%20%5BClassical%20Dynamics%20of%20particles%20and%20systems%5D(https%3A%2F%2Fbooks.google.com.br%2Fbooks%3Fid%3DSs43BQAAQBAJ)%2C%202nd%20ed.%2C%20Academic%20Press.%0A%0A%20%20%20%20-%20Synge%20JL%20(1949)%20%5BPrinciples%20of%20Mechanics%5D(https%3A%2F%2Fbooks.google.com.br%2Fbooks%3Fid%3DqsYfENCRG5QC)%2C%202nd%20ed.%2C%20McGraw-hill.%0A%0A%20%20%20%20-%20Taylor%20J%20(2005)%20%5BClassical%20Mechanics%5D(https%3A%2F%2Farchive.org%2Fdetails%2FJohnTaylorClassicalMechanics).%20University%20Science%20Books.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0Aif%20__name__%20%3D%3D%20%22__main__%22%3A%0A%20%20%20%20app.run()%0A
43d0faf8013024e25423ef1d7a4d45bc