%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%20Principle%20of%20least%20action%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%20This%20short%20guide%20introduces%20action%20as%20a%20number%20assigned%20to%20a%20whole%20candidate%20path.%20Keep%20both%20endpoint%20positions%20and%20endpoint%20times%20fixed%20while%20comparing%20paths.%20We%20will%20connect%20stationarity%20to%20an%20equation%20of%20motion%20and%20distinguish%20it%20from%20a%20guaranteed%20minimum.%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%20free%20particle%20travels%20a%20fixed%20distance%20in%20a%20fixed%20time.%20Would%20alternating%20fast%20and%20slow%20motion%20give%20a%20smaller%20action%20than%20moving%20at%20constant%20velocity%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%20%5Bprinciple%20of%20least%20action%5D(https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FPrinciple_of_least_action)%20applied%20to%20the%20movement%20of%20a%20mechanical%20system%20states%20that%20%22the%20average%20kinetic%20energy%20less%20the%20average%20potential%20energy%20is%20as%20little%20as%20possible%20for%20the%20path%20of%20an%20object%20going%20from%20one%20point%20to%20another%22%20(Prof.%20Richard%20Feynman%20in%20%5BThe%20Feynman%20Lectures%20on%20Physics%5D(https%3A%2F%2Fwww.feynmanlectures.caltech.edu%2FII_19.html)).%0A%0A%20%20%20%20This%20principle%20is%20so%20fundamental%20that%20it%20can%20be%20used%20to%20derive%20the%20equations%20of%20motion%20of%20a%20system%2C%20for%20example%2C%20independent%20of%20the%20Newton's%20laws%20of%20motion.%20Let's%20now%20see%20the%20principle%20of%20least%20action%20in%20mathematical%20terms.%0A%0A%20%20%20%20The%20difference%20between%20the%20kinetic%20and%20potential%20energy%20in%20a%20system%20is%20known%20as%20the%20%5BLagrange%20or%20Lagrangian%20function%5D(https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FLagrangian_mechanics)%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%20The%20%5Bprinciple%20of%20least%20action%5D(https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FPrinciple_of_least_action)%20states%20that%20the%20actual%20path%20which%20a%20system%20follows%20between%20two%20points%20in%20the%20time%20interval%20%24t_1%24%20and%20%24t_2%24%20is%20such%20that%20the%20integral%0A%0A%20%20%20%20%24%24%0A%20%20%20%20%5Cmathcal%7BS%7D%5C%3B%20%3D%5C%3B%20%5Cint%20_%7Bt_1%7D%5E%7Bt_2%7D%20%5Cmathcal%7BL%7D%20%5C%3B%20dt%0A%20%20%20%20%24%24%0A%0A%20%20%20%20is%20stationary%2C%20meaning%20that%20%24%5Cdelta%20%5Cmathcal%7BS%7D%3D0%24%20for%20variations%20with%20fixed%20endpoint%20positions%20and%20times.%20Stationarity%20is%20a%20first-variation%20condition%3A%20depending%20on%20the%20system%20and%20interval%2C%20the%20path%20may%20be%20a%20minimum%20or%20a%20saddle.%20It%20is%20not%20necessarily%20a%20global%20minimum.%20The%20integral%20above%20is%20known%20as%20the%20action%20integral%20and%20%24%5Cmathcal%7BS%7D%24%20is%20known%20as%20the%20action.%0A%0A%20%20%20%20A%20formal%20demonstration%20that%20the%20the%20value%20of%20this%20integral%20above%20is%20stationary%20and%20that%20one%20can%20derive%20the%20Euler-Lagrange%20equation%20in%20the%20present%20form%20we%20use%20today%20was%20first%20formulated%20by%20the%20mathematician%20%5BWilliam%20Hamilton%5D(https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FWilliam_Rowan_Hamilton)%20in%20the%20XIXth%20century%3B%20because%20that%20the%20principle%20of%20least%20action%20as%20presented%20above%20is%20also%20known%20as%20%5BHamilton's%20principle%5D(https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FHamilton%2527s_principle).%0A%0A%20%20%20%20For%20a%20simple%20and%20didactic%20example%20where%20the%20integral%20above%20is%20stationary%2C%20see%20%5BThe%20Feynman%20Lectures%20on%20Physics%5D(https%3A%2F%2Fwww.feynmanlectures.caltech.edu%2FII_19.html).%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%20Compare%20two%20paths.**%20A%201%20kg%20free%20particle%20moves%202%20m%20in%202%20s.%20Compare%20constant%20speed%20with%202%20m%2Fs%20for%20the%20first%20second%20and%20zero%20for%20the%20second.%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%20Constant%20speed%20is%201%20m%2Fs%20and%20has%20action%20%24S%3D%5Cint%20Tdt%3D(1%2F2)(1)(1%5E2)(2)%3D1%24%20J%20s.%20The%20uneven%20path%20has%20%24S%3D(1%2F2)(1)(2%5E2)(1)%3D2%24%20J%20s.%20Both%20reach%20the%20same%20endpoint%20at%20the%20same%20time%3B%20the%20uneven%20speed%20increases%20this%20free-particle%20action.%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**Exercise%202%20%E2%80%94%20Vary%20a%20whole%20trajectory.**%20Let%20%24q_%5Cepsilon(t)%3Dq(t)%2B%5Cepsilon%5Ceta(t)%24%20with%20%24%5Ceta(t_1)%3D%5Ceta(t_2)%3D0%24.%20What%20does%20stationarity%20require%20of%20%24dS%5Bq_%5Cepsilon%5D%2Fd%5Cepsilon%24%20at%20zero%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%202%0A%0A%20%20%20%20It%20must%20vanish%20for%20every%20admissible%20%24%5Ceta%24.%20Integrating%20the%20velocity-variation%20term%20by%20parts%20gives%20%24%5Cdelta%20S%3D%5Cint%5B%5Cpartial%20L%2F%5Cpartial%20q-d(%5Cpartial%20L%2F%5Cpartial%5Cdot%20q)%2Fdt%5D%5Ceta%5C%2Cdt%24.%20The%20endpoint%20term%20vanishes%2C%20yielding%20the%20Euler%E2%80%93Lagrange%20equation.%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**Exercise%203%20%E2%80%94%20Test%20the%20word%20least.**%20For%20a%20harmonic%20oscillator%2C%20examine%20the%20change%20in%20action%20along%20%24q(t)%3D%5Cepsilon%5Csin(%5Cpi%20t%2FT)%24%20around%20the%20stationary%20path%20%24q%3D0%24%2C%20with%20endpoints%20zero.%20What%20is%20its%20sign%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%203%0A%0A%20%20%20%20For%20%24L%3Dm%5Cdot%20q%5E2%2F2-kq%5E2%2F2%24%2C%20direct%20integration%20gives%20%24%5CDelta%20S%3D%5Cepsilon%5E2%5Bm%5Cpi%5E2%2FT-kT%5D%2F4%24.%20It%20is%20negative%20when%20%24T%3E%5Cpi%5Csqrt%7Bm%2Fk%7D%24.%20Other%20higher-frequency%20variations%20can%20give%20positive%20changes%2C%20so%20the%20stationary%20path%20is%20then%20a%20saddle%2C%20not%20a%20minimum.%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.%20What%20are%20the%20units%20of%20action%3F%0A%20%20%20%202.%20What%20is%20held%20fixed%20in%20Hamilton%E2%80%99s%20endpoint%20principle%3F%0A%20%20%20%203.%20Does%20stationary%20mean%20the%20particle%20is%20at%20rest%3F%0A%20%20%20%204.%20Why%20does%20the%20traditional%20title%20%E2%80%9Cleast%20action%E2%80%9D%20require%20care%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.%20J%20s.%0A%20%20%20%202.%20Endpoint%20configurations%20and%20endpoint%20times.%0A%20%20%20%203.%20No%3B%20the%20first%20variation%20of%20action%20is%20zero.%0A%20%20%20%204.%20A%20stationary%20path%20need%20not%20minimize%20action%20over%20all%20admissible%20paths.%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.%20A%202%20kg%20free%20particle%20travels%203%20m%20in%201.5%20s%20at%20constant%20velocity.%20Find%20its%20action.%0A%0A%20%20%20%202.%20For%20%24L%3Dm%5Cdot%20x%5E2%2F2-mgx%24%2C%20give%20the%20equation%20of%20motion.%0A%0A%20%20%20%203.%20For%20the%20oscillator%20in%20Exercise%203%2C%20give%20the%20interval%20length%20at%20which%20the%20displayed%20variation%20changes%20sign.%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.%206%20J%20s.%0A%0A%20%20%20%202.%20%24%5Cddot%20x%3D-g%24.%0A%0A%20%20%20%203.%20%24T%3D%5Cpi%5Csqrt%7Bm%2Fk%7D%24%3B%20this%20variation%20has%20zero%20quadratic%20action%20change%20at%20that%20value.%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%20Use%20%5BKineticsFundamentalConcepts%5D(https%3A%2F%2Fmolab.marimo.io%2Fgithub%2FBMClab%2FBMC%2Fblob%2Fmaster%2Fnotebooks%2Fkinetics_fundamental_concepts.py)%20to%20connect%20this%20guide%20with%20the%20surrounding%20mechanics%20and%20modeling%20material.%20Return%20to%20the%20assumptions%20behind%20each%20equation%20when%20applying%20it%20to%20a%20new%20experiment.%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%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-%20Feynman%20R%2C%20Leighton%20R%2C%20Sands%20M%20(2013)%20%5BThe%20Feynman%20Lectures%20on%20Physics%20-%20HTML%20edition%5D(https%3A%2F%2Fwww.feynmanlectures.caltech.edu%2F).%0A%0A%20%20%20%20-%20Taylor%20JR%20(2005)%20%5BClassical%20Mechanics%5D(https%3A%2F%2Fbooks.google.com.br%2Fbooks%3Fid%3DP1kCtNr-pJsC).%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
a717def11dc0770bda16a0ef53be9f16