%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%2C%20%22numpy%3E%3D2.0%22%2C%20%22matplotlib%3E%3D3.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%20Matrix%20Formalism%20of%20the%20%20Equations%20of%20Movement%0A%0A%20%20%20%20%3E%20Renato%20Naville%20Watanabe%2C%20Marcos%20Duarte%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%20collect%20the%20same%20equations%20into%20a%20mass%20matrix%20and%20force%20vectors%2C%20solve%20for%20accelerations%2C%20and%20integrate%20a%20state%20vector.%20Keep%20the%20ordering%20of%20coordinates%2C%20velocities%20and%20torques%20consistent.%20The%20symbolic%20inverse%20explains%20the%20algebra%3B%20a%20numerical%20linear%20solve%20implements%20it.%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.**%20If%20you%20apply%20a%20torque%20to%20one%20joint%20of%20a%20two-link%20arm%2C%20can%20the%20other%20joint%20accelerate%20even%20when%20its%20own%20applied%20torque%20is%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%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%20In%20this%20notebook%20will%20be%20shown%20two%20examples%20of%20how%20to%20use%20a%20matrix%20formalism%20to%20perform%20forward%20dynamics.%20It%20does%20not%20consist%20a%20comprehensive%20treatise%20about%20the%20subject.%20It%20is%20rather%20an%20introduction%20based%20on%20examples.%20Nevertheless%2C%20the%20reader%20of%20this%20notebook%20will%20have%20sufficient%20knowledge%20to%20read%20recent%20texts%20on%20biomechanics%20and%20other%20multibody%20dynamic%20analysis.%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%20Forward%20Dynamics%0A%0A%20%20%20%20For%20the%20forward%20dynamics%20analysis%2C%20we%20will%20consider%20that%20we%20know%20the%20torques%20and%20find%20the%20angular%20accelerations.%20Naturally%2C%20we%20could%20begin%20our%20analysis%20from%20the%20muscle%20forces%2C%20from%20the%20muscle%20activations%20or%20even%20from%20the%20neural%20commands%20from%20the%20motor%20cortex.%0A%0A%20%20%20%20%3Cfigure%20aria-describedby%3D%22figure-caption-1%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fgithub.com%2FBMClab%2FBMC%2Fblob%2Fmaster%2Fimages%2Ffoward.png%3Fraw%3D1%22%20width%3D600%2F%3E%20%3C%2Ffigure%3E%0A%0A%20%20%20%20%3Cspan%20id%3D%22figure-caption-1%22%20class%3D%22figure-caption%22%20style%3D%22display%3Ablock%3Btext-align%3Acenter%3Bfont-style%3Aitalic%22%3EAdapted%20from%20Erdemir%20et%20al.%20(2007)%3C%2Fspan%3E%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%20As%20an%20introduction%20to%20the%20matrix%20formalism%20used%20in%20multibody%20analysis%2C%20we%20will%20consider%20the%20double-pendulum%20system.%20This%20system%20could%20be%20used%20as%20a%20%20model%20from%20the%20arm%20and%20forearm%20of%20a%20subject%2C%20for%20example%2C%20and%20is%20an%20example%20of%20chaotic%20system.%0A%0A%20%20%20%20In%20the%20notebook%20about%20%5Bfree-body%20diagram%5D(free_body_diagram_for_rigid_bodies.py%23double-pendulum-with-actuators)%2C%20we%20found%20the%20following%20equations%20of%20motion%20to%20the%20double-pendulum%20with%20actuators.%0A%0A%20%20%20%20%24%24%0A%20%20%20%20%5Cbegin%7Balign%7D%0A%20%20%20%20%5Cbegin%7Bsplit%7D%0A%20%20%20%20%20%20%20%20%20%5Cleft(%5Cfrac%7Bm_1l_1%5E2%7D%7B3%7D%20%2Bm_2l_1%5E2%5Cright)%5Cfrac%7Bd%5E2%5Ctheta_1%7D%7Bdt%5E2%7D%20%2B%20%5Cfrac%7Bm_2l_1l_2%7D%7B2%7D%20%5Ccos(%5Ctheta_1-%5Ctheta_2)%5Cfrac%7Bd%5E2%5Ctheta_2%7D%7Bdt%5E2%7D%20%20%26%3D%20%20-%5Cfrac%7Bm_1gl_1%7D%7B2%7D%5Csin(%5Ctheta_1)-%20m_2l_1g%20%5Csin(%5Ctheta_1)%20%20%20-%20%5Cfrac%7Bm_2l_1l_2%7D%7B2%7D%5Cleft(%5Cfrac%7Bd%5Ctheta_2%7D%7Bdt%7D%5Cright)%5E2%20%5Csin(%5Ctheta_1-%5Ctheta_2)%20%20%2B%20M_1%20-%20M_%7B12%7D%20%5C%5C%0A%20%20%20%20%20%20%20%20%5Cfrac%7Bm_2l_1l_2%7D%7B2%7D%5Ccos(%5Ctheta_1-%5Ctheta_2)%5Cfrac%7Bd%5E2%5Ctheta_1%7D%7Bdt%5E2%7D%20%2B%20%5Cfrac%7Bm_2l_2%5E2%7D%7B3%7D%5Cfrac%7Bd%5E2%5Ctheta_2%7D%7Bdt%5E2%7D%20%26%3D%20-%5Cfrac%7Bm_2gl_2%7D%7B2%7D%5Csin(%5Ctheta_2)%20%2B%20%5Cfrac%7Bm_2l_1l_2%7D%7B2%7D%5Cleft(%5Cfrac%7Bd%5Ctheta_1%7D%7Bdt%7D%5Cright)%5E2%20%5Csin(%5Ctheta_1-%5Ctheta_2)%2B%20M_%7B12%7D%0A%20%20%20%20%20%20%20%20%5Cend%7Bsplit%7D%0A%20%20%20%20%5Cend%7Balign%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%20If%20we%20wanted%20to%20simulate%20this%20double%20pendulum%20we%20still%20need%20to%20isolate%20the%20angular%20accelerations%20of%20each%20of%20the%20bars.%20As%20can%20be%20easily%20noted%2C%20this%20would%20be%20too%20laborious%20to%20do%20by%20hand.%20Luckily%2C%20numerical%20integration%20is%20performed%20by%20computers.%20The%20easiest%20way%20to%20isolate%20these%20angular%20accelerations%20is%20to%20note%20that%20we%20can%20write%20the%20angular%20accelerations%20and%20the%20numbers%20multiplying%20them%20as%20a%20matrix%20and%20a%20vector.%0A%0A%20%20%20%20%3Cspan%20class%3D%22notranslate%22%3E%24%5Cleft%5B%5Cbegin%7Barray%7D%7Bcc%7D%5Cfrac%7Bm_1l_1%5E2%7D%7B3%7D%20%2Bm_2l_1%5E2%26%5Cfrac%7Bm_2l_1l_2%7D%7B2%7D%20%5Ccos(%5Ctheta_1-%5Ctheta_2)%5C%5C%5Cfrac%7Bm_2l_1l_2%7D%7B2%7D%5Ccos(%5Ctheta_1-%5Ctheta_2)%26%5Cfrac%7Bm_2l_2%5E2%7D%7B3%7D%5Cend%7Barray%7D%5Cright%5D%5Ccdot%5Cleft%5B%5Cbegin%7Barray%7D%7Bc%7D%5Cfrac%7Bd%5E2%5Ctheta_1%7D%7Bdt%5E2%7D%5C%5C%5Cfrac%7Bd%5E2%5Ctheta_2%7D%7Bdt%5E2%7D%20%5Cend%7Barray%7D%5Cright%5D%20%3D%20%5Cleft%5B%5Cbegin%7Barray%7D%7Bc%7D-%20%5Cfrac%7Bm_2l_1l_2%7D%7B2%7D%5Cleft(%5Cfrac%7Bd%5Ctheta_2%7D%7Bdt%7D%5Cright)%5E2%20%5Csin(%5Ctheta_1-%5Ctheta_2)-%5Cfrac%7Bm_1gl_1%7D%7B2%7D%5Csin(%5Ctheta_1)-%20m_2l_1g%20%5Csin(%5Ctheta_1)%20%2B%20M_1%20-%20M_%7B12%7D%5C%5C%20%5Cfrac%7Bm_2l_1l_2%7D%7B2%7D%5Cleft(%5Cfrac%7Bd%5Ctheta_1%7D%7Bdt%7D%5Cright)%5E2%20%5Csin(%5Ctheta_1-%5Ctheta_2)-%5Cfrac%7Bm_2gl_2%7D%7B2%7D%5Csin(%5Ctheta_2)%20%2B%20M_%7B12%7D%20%5Cend%7Barray%7D%5Cright%5D%24%3C%2Fspan%3E%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%20Typically%20the%20equations%20of%20motion%20are%20divided%20into%20a%20matrix%20corresponding%20to%20the%20terms%20involving%20the%20angular%20velocities%20(centrifugal%20and%20Coriolis%20forces)%2C%20a%20%20matrix%20corresponding%20to%20gravitational%20force%20and%20another%20matrix%20corresponding%20to%20the%20forces%20and%20torques%20being%20applied%20to%20the%20system.%0A%0A%20%20%20%20%3Cspan%20class%3D%22notranslate%22%3E%24M(q)%5Cddot%7Bq%7D%20%3D%20C(q%2C%5Cdot%7Bq%7D)%20%2B%20G(q)%20%2B%20Q%20%2B%20%20E%24%3C%2Fspan%3E%0A%0A%20%20%20%20where%0A%0A%20%20%20%20-%20%3Cspan%20class%3D%22notranslate%22%3E%24q%24%3C%2Fspan%3E%20is%20the%20vector%20of%20the%20generalized%20coordinates%2C%20like%20angles%20and%20positions%3B%0A%20%20%20%20-%20%3Cspan%20class%3D%22notranslate%22%3E%24M(q)%24%3C%2Fspan%3E%20is%20the%20matrix%20containing%20the%20inertia%20elements%20like%20mass%20and%20moments%20of%20inertia%3B%0A%20%20%20%20-%20%3Cspan%20class%3D%22notranslate%22%3E%24C(q%2C%5Cdot%7Bq%7D)%24%3C%2Fspan%3E%20%20is%20the%20vector%20with%20the%20forces%20and%20moments%20dependent%20from%20the%20velocities%20and%20angular%20velocities%2C%20like%20centrifugal%20and%20Coriolis%20forces%3B%0A%20%20%20%20-%20%3Cspan%20class%3D%22notranslate%22%3E%24G(q)%24%3C%2Fspan%3E%20is%20the%20vector%20with%20the%20forces%20and%20torques%20caused%20by%20the%20gravitational%20force%3B%0A%20%20%20%20-%20%3Cspan%20class%3D%22notranslate%22%3E%24Q%24%3C%2Fspan%3E%20is%20the%20vector%20with%20forces%20and%20torques%20being%20applied%20to%20the%20body%2C%20like%20muscular%20torques%20and%20forces%20due%20to%20the%20constraints.%0A%20%20%20%20-%20%3Cspan%20class%3D%22notranslate%22%3E%24E%24%3C%2Fspan%3E%20is%20the%20vector%20with%20the%20forces%20and%20torques%20due%20to%20some%20external%20element%2C%20like%20springs%20or%20the%20Ground%20reaction%20Force.%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%20We%20can%20divide%20the%20equation%20describing%20the%20behavior%20of%20the%20double-pendulum%20in%20the%20matrices%20above%3A%0A%0A%20%20%20%20%3Cspan%20class%3D%22notranslate%22%3E%24%5Cunderbrace%7B%5Cleft%5B%5Cbegin%7Barray%7D%7Bcc%7D%5Cfrac%7Bm_1l_1%5E2%7D%7B3%7D%20%2Bm_2l_1%5E2%26%5Cfrac%7Bm_2l_1l_2%7D%7B2%7D%20%5Ccos(%5Ctheta_1-%5Ctheta_2)%5C%5C%5Cfrac%7Bm_2l_1l_2%7D%7B2%7D%5Ccos(%5Ctheta_1-%5Ctheta_2)%26%5Cfrac%7Bm_2l_2%5E2%7D%7B3%7D%5Cend%7Barray%7D%5Cright%5D%7D_%7BM%7D%5Ccdot%5Cunderbrace%7B%5Cleft%5B%5Cbegin%7Barray%7D%7Bc%7D%5Cfrac%7Bd%5E2%5Ctheta_1%7D%7Bdt%5E2%7D%5C%5C%5Cfrac%7Bd%5E2%5Ctheta_2%7D%7Bdt%5E2%7D%20%5Cend%7Barray%7D%5Cright%5D%7D_%7B%5Cddot%7Bq%7D%7D%20%3D%20%5Cunderbrace%7B%5Cleft%5B%5Cbegin%7Barray%7D%7Bc%7D-%20%5Cfrac%7Bm_2l_1l_2%7D%7B2%7D%5Cleft(%5Cfrac%7Bd%5Ctheta_2%7D%7Bdt%7D%5Cright)%5E2%20%5Csin(%5Ctheta_1-%5Ctheta_2)%5C%5C%20%5Cfrac%7Bm_2l_1l_2%7D%7B2%7D%5Cleft(%5Cfrac%7Bd%5Ctheta_1%7D%7Bdt%7D%5Cright)%5E2%20%5Csin(%5Ctheta_1-%5Ctheta_2)%5Cend%7Barray%7D%5Cright%5D%7D_%7BC%7D%20%2B%20%5Cunderbrace%7B%5Cleft%5B%5Cbegin%7Barray%7D%7Bc%7D-%5Cfrac%7Bm_1gl_1%7D%7B2%7D%5Csin(%5Ctheta_1)-%20m_2l_1g%20%5Csin(%5Ctheta_1)%5C%5C%20-%5Cfrac%7Bm_2gl_2%7D%7B2%7D%5Csin(%5Ctheta_2)%20%5Cend%7Barray%7D%5Cright%5D%7D_%7BG%7D%20%2B%20%5Cunderbrace%7B%5Cleft%5B%5Cbegin%7Barray%7D%7Bc%7D%20M_1%20-%20M_%7B12%7D%5C%5CM_%7B12%7D%20%5Cend%7Barray%7D%5Cright%5D%7D_%7BQ%7D%24%3C%2Fspan%3E%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%20To%20solve%20this%20differential%20equation%20numerically%2C%20we%20must%20obtain%20the%20expression%20of%20the%20angular%20accelerations.%20Algebraically%20this%20is%20multiplication%20by%20the%20inverse%20of%20%24M%24.%20In%20numerical%20code%2C%20solve%20%24M%20a%3Df%24%20with%20%60numpy.linalg.solve%60%3B%20there%20is%20no%20need%20to%20form%20the%20inverse.%0A%0A%20%20%20%20%24%24%0A%20%20%20%20%5Cleft%5B%5Cbegin%7Barray%7D%7Bc%7D%5Cfrac%7Bd%5E2%5Ctheta_1%7D%7Bdt%5E2%7D%5C%5C%5Cfrac%7Bd%5E2%5Ctheta_2%7D%7Bdt%5E2%7D%20%5Cend%7Barray%7D%5Cright%5D%20%3D%20%5Cleft%5B%5Cbegin%7Barray%7D%7Bcc%7D%5Cfrac%7Bm_1l_1%5E2%7D%7B3%7D%20%2Bm_2l_1%5E2%26%5Cfrac%7Bm_2l_1l_2%7D%7B2%7D%20%5Ccos(%5Ctheta_1-%5Ctheta_2)%5C%5C%5Cfrac%7Bm_2l_1l_2%7D%7B2%7D%5Ccos(%5Ctheta_1-%5Ctheta_2)%26%5Cfrac%7Bm_2l_2%5E2%7D%7B3%7D%5Cend%7Barray%7D%5Cright%5D%5E%7B-1%7D%5Ccdot%5Cleft(%5Cleft%5B%5Cbegin%7Barray%7D%7Bc%7D-%20%5Cfrac%7Bm_2l_1l_2%7D%7B2%7D%5Cleft(%5Cfrac%7Bd%5Ctheta_2%7D%7Bdt%7D%5Cright)%5E2%20%5Csin(%5Ctheta_1-%5Ctheta_2)%5C%5C%20%5Cfrac%7Bm_2l_1l_2%7D%7B2%7D%5Cleft(%5Cfrac%7Bd%5Ctheta_1%7D%7Bdt%7D%5Cright)%5E2%20%5Csin(%5Ctheta_1-%5Ctheta_2)%5Cend%7Barray%7D%5Cright%5D%20%2B%20%5Cleft%5B%5Cbegin%7Barray%7D%7Bc%7D-%5Cfrac%7Bm_1gl_1%7D%7B2%7D%5Csin(%5Ctheta_1)-%20m_2l_1g%20%5Csin(%5Ctheta_1)%5C%5C%20-%5Cfrac%7Bm_2gl_2%7D%7B2%7D%5Csin(%5Ctheta_2)%20%5Cend%7Barray%7D%5Cright%5D%20%2B%20%5Cleft%5B%5Cbegin%7Barray%7D%7Bc%7D%20M_1%20-%20M_%7B12%7D%5C%5CM_%7B12%7D%20%5Cend%7Barray%7D%5Cright%5D%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%20Generically%2C%20having%20the%20differential%20equations%20in%20the%20format%3A%0A%0A%20%20%20%20%3Cspan%20class%3D%22notranslate%22%3E%24M(q)%5Cddot%7Bq%7D%20%3D%20C(q%2C%5Cdot%7Bq%7D)%20%2B%20G(q)%20%2B%20Q%20%2B%20%20E%24%3C%2Fspan%3E%0A%0A%20%20%20%20we%20can%20obtain%20the%20equation%20to%20perform%20the%20forward%20dynamics%20by%3A%0A%0A%20%20%20%20%3Cspan%20class%3D%22notranslate%22%3E%24%5Cddot%7Bq%7D%20%3D%20M(q)%5E%7B-1%7D%5Cleft%5BC(q%2C%5Cdot%7Bq%7D)%20%2B%20G(q)%20%2B%20Q%20%2B%20%20E%5Cright%5D%24%3C%2Fspan%3E%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%20that%20we%20have%20the%20angular%20accelerations%2C%20to%20solve%20the%20equation%20numerically%20we%20must%20transform%20the%20second-order%20differential%20equations%20in%20first-order%20differential%20equations%3A%0A%0A%20%20%20%20%3Cspan%20class%3D%22notranslate%22%3E%24%5Cleft%5B%5Cbegin%7Barray%7D%7Bc%7D%5Cfrac%7Bd%5Comega_1%7D%7Bdt%7D%5C%5C%5Cfrac%7Bd%5Comega_2%7D%7Bdt%7D%5C%5C%5Cfrac%7Bd%5Ctheta_1%7D%7Bdt%7D%5C%5C%5Cfrac%7Bd%5Ctheta_2%7D%7Bdt%7D%20%5Cend%7Barray%7D%5Cright%5D%20%3D%20%20%5Cleft%5B%5Cbegin%7Barray%7D%7Bc%7D%5Cleft%5B%5Cbegin%7Barray%7D%7Bcc%7D%5Cfrac%7Bm_1l_1%5E2%7D%7B3%7D%20%2Bm_2l_1%5E2%26%5Cfrac%7Bm_2l_1l_2%7D%7B2%7D%20%5Ccos(%5Ctheta_1-%5Ctheta_2)%5C%5C%5Cfrac%7Bm_2l_1l_2%7D%7B2%7D%5Ccos(%5Ctheta_1-%5Ctheta_2)%26%5Cfrac%7Bm_2l_2%5E2%7D%7B3%7D%5Cend%7Barray%7D%5Cright%5D%5E%7B-1%7D%5Cleft(%5Cleft%5B%5Cbegin%7Barray%7D%7Bc%7D-%20%5Cfrac%7Bm_2l_1l_2%7D%7B2%7D%5Comega_2%5E2%20%5Csin(%5Ctheta_1-%5Ctheta_2)%5C%5C%20%5Cfrac%7Bm_2l_1l_2%7D%7B2%7D%5Comega_1%5E2%20%5Csin(%5Ctheta_1-%5Ctheta_2)%5Cend%7Barray%7D%5Cright%5D%2B%5Cleft%5B%5Cbegin%7Barray%7D%7Bc%7D%20-%5Cfrac%7Bm_1gl_1%7D%7B2%7D%5Csin(%5Ctheta_1)-%20m_2l_1g%20%5Csin(%5Ctheta_1)%20%5C%5C-%5Cfrac%7Bm_2gl_2%7D%7B2%7D%5Csin(%5Ctheta_2)%20%20%5Cend%7Barray%7D%5Cright%5D%20%2B%20%5Cleft%5B%20%5Cbegin%7Barray%7D%7Bc%7DM_1%20-%20M_%7B12%7D%5C%5CM_%7B12%7D%5Cend%7Barray%7D%5Cright%5D%5Cright)%5C%5C%20%5Comega_1%5C%5C%20%5Comega_2%5Cend%7Barray%7D%5Cright%5D%24%3C%2Fspan%3E%0A%0A%20%20%20%20Below%20is%20the%20numerical%20solution%20of%20a%20double-pendulum%20with%20masses%201%20kg%20and%20lengths%201%20m%20and%200.5%20m.%20The%20forward-Euler%20demonstration%20uses%20a%20small%20fixed%20step%3B%20compare%20energy%20drift%20when%20changing%20its%20step%20size.%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%20numpy%20as%20np%0A%0A%20%20%20%20g%20%3D%209.81%0A%20%20%20%20m1%20%3D%201%0A%20%20%20%20m2%20%3D%201%0A%20%20%20%20l1%20%3D%201%0A%20%20%20%20l2%20%3D%200.5%0A%20%20%20%20theta10%20%3D%20np.pi%20%2F%2010%0A%20%20%20%20theta20%20%3D%20np.pi%20%2F%203%0A%20%20%20%20omega10%20%3D%202%20*%20np.pi%0A%20%20%20%20omega20%20%3D%20-6%20*%20np.pi%0A%20%20%20%20dt%20%3D%200.0001%0A%20%20%20%20t%20%3D%20np.arange(0%2C%2020%2C%20dt)%0A%20%20%20%20state%20%3D%20np.zeros((4%2C%20len(t)))%0A%20%20%20%20state%5B%3A%2C%200%5D%20%3D%20np.array(%5Bomega10%2C%20omega20%2C%20theta10%2C%20theta20%5D)%0A%20%20%20%20M1%20%3D%200%0A%20%20%20%20M12%20%3D%200%0A%20%20%20%20for%20_i%20in%20range(1%2C%20len(t))%3A%0A%20%20%20%20%20%20%20%20thetaDiff%20%3D%20state%5B2%2C%20_i%20-%201%5D%20-%20state%5B3%2C%20_i%20-%201%5D%0A%20%20%20%20%20%20%20%20M%20%3D%20np.array(%0A%20%20%20%20%20%20%20%20%20%20%20%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%5Bm1%20*%20l1**2%20%2F%203%20%2B%20m2%20*%20l1**2%2C%20m2%20*%20l1%20*%20l2%20*%20np.cos(thetaDiff)%20%2F%202%5D%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%5Bm2%20*%20l1%20*%20l2%20*%20np.cos(thetaDiff)%20%2F%202%2C%20m2%20*%20l2**2%20%2F%203%5D%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%5D%0A%20%20%20%20%20%20%20%20)%0A%20%20%20%20%20%20%20%20C%20%3D%20np.array(%0A%20%20%20%20%20%20%20%20%20%20%20%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%5B-m2%20*%20l1%20*%20l2%20*%20np.sin(thetaDiff)%20*%20state%5B1%2C%20_i%20-%201%5D%20**%202%20%2F%202%5D%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%5Bm2%20*%20l1%20*%20l2%20*%20np.sin(thetaDiff)%20*%20state%5B0%2C%20_i%20-%201%5D%20**%202%20%2F%202%5D%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%5D%0A%20%20%20%20%20%20%20%20)%0A%20%20%20%20%20%20%20%20G%20%3D%20np.array(%0A%20%20%20%20%20%20%20%20%20%20%20%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20-m1%20*%20g%20*%20l1%20%2F%202%20*%20np.sin(state%5B2%2C%20_i%20-%201%5D)%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20-%20m2%20*%20g%20*%20l1%20*%20np.sin(state%5B2%2C%20_i%20-%201%5D)%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%5D%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%5B-m2%20*%20g%20*%20l2%20%2F%202%20*%20np.sin(state%5B3%2C%20_i%20-%201%5D)%5D%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%5D%0A%20%20%20%20%20%20%20%20)%0A%20%20%20%20%20%20%20%20Q%20%3D%20np.array(%5B%5BM1%20-%20M12%5D%2C%20%5BM12%5D%5D)%0A%20%20%20%20%20%20%20%20dstatedt%20%3D%20np.vstack(%0A%20%20%20%20%20%20%20%20%20%20%20%20(np.linalg.solve(M%2C%20C%20%2B%20G%20%2B%20Q)%2C%20state%5B0%2C%20%5B_i%20-%201%5D%5D%2C%20state%5B1%2C%20%5B_i%20-%201%5D%5D)%0A%20%20%20%20%20%20%20%20)%0A%20%20%20%20%20%20%20%20state%5B%3A%2C%20%5B_i%5D%5D%20%3D%20state%5B%3A%2C%20%5B_i%20-%201%5D%5D%20%2B%20dt%20*%20dstatedt%0A%20%20%20%20return%20l1%2C%20l2%2C%20np%2C%20state%2C%20t%0A%0A%0A%40app.cell%0Adef%20_(state%2C%20t)%3A%0A%20%20%20%20import%20matplotlib.pyplot%20as%20plt%0A%0A%20%20%20%20plt.figure()%0A%20%20%20%20plt.plot(t%5B0%3A%3A10%5D%2C%20state%5B3%2C%200%3A%3A10%5D.T)%0A%20%20%20%20%23%20plt.plot(t%5B0%3A%3A10%5D%2C%20r*np.ones_like(t%5B0%3A%3A10%5D))%0A%20%20%20%20plt.show()%0A%20%20%20%20return%20(plt%2C)%0A%0A%0A%40app.cell%0Adef%20_(l1%2C%20l2%2C%20np%2C%20plt%2C%20state)%3A%0A%20%20%20%20plt.figure()%0A%20%20%20%20step%20%3D%203000%0A%20%20%20%20for%20_i%20in%20range(len(state%5B2%2C%200%3A%3Astep%5D))%3A%0A%20%20%20%20%20%20%20%20plt.plot(%0A%20%20%20%20%20%20%20%20%20%20%20%20%5B0%2C%20l1%20*%20np.sin(state%5B2%2C%20_i%20*%20step%5D)%5D%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%5B0%2C%20-l1%20*%20np.cos(state%5B2%2C%20_i%20*%20step%5D)%5D%2C%0A%20%20%20%20%20%20%20%20)%0A%20%20%20%20%20%20%20%20plt.plot(%0A%20%20%20%20%20%20%20%20%20%20%20%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20l1%20*%20np.sin(state%5B2%2C%20_i%20*%20step%5D)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20l1%20*%20np.sin(state%5B2%2C%20_i%20*%20step%5D)%20%2B%20l2%20*%20np.sin(state%5B3%2C%20_i%20*%20step%5D)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%5D%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20-l1%20*%20np.cos(state%5B2%2C%20_i%20*%20step%5D)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20-l1%20*%20np.cos(state%5B2%2C%20_i%20*%20step%5D)%20-%20l2%20*%20np.cos(state%5B3%2C%20_i%20*%20step%5D)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%5D%2C%0A%20%20%20%20%20%20%20%20)%0A%20%20%20%20plt.show()%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%20Solve%20a%20coupled%20system.**%20Given%20%24M%3D%5Cbegin%7Bbmatrix%7D2%261%5C%5C1%262%5Cend%7Bbmatrix%7D%24%20kg%20m%C2%B2%20and%20net%20torque%20%24f%3D(3%2C0)%24%20N%20m%2C%20find%20both%20angular%20accelerations.%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%20From%20%242a_1%2Ba_2%3D3%24%20and%20%24a_1%2B2a_2%3D0%24%2C%20%24a_1%3D2%24%20and%20%24a_2%3D-1%24%20rad%2Fs%C2%B2.%20The%20off-diagonal%20inertia%20couples%20the%20joints%3B%20zero%20second%20torque%20does%20not%20imply%20zero%20second%20acceleration.%20In%20code%20use%20%60np.linalg.solve(M%2C%20f)%60.%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%20Automating%20equations%20of%20motion%20in%20matrix%20form%20using%20symbolic%20computation%0A%0A%20%20%20%20Sympy%20can%20be%20used%20to%20write%20the%20equation%20of%20motion%20and%20express%20them%20in%20matrix%20form%2C%20see%20an%20example%20in%20the%20notebook%20%5BMultibody%20Dynamics%5D(https%3A%2F%2Fmolab.marimo.io%2Fgithub%2FBMClab%2FBMC%2Fblob%2Fmaster%2Fnotebooks%2Fmultibody_dynamics.py).%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%20Audit%20gravity%20before%20integrating.**%20For%20the%20double%20rod%20in%20this%20guide%2C%20the%20second%20rod%E2%80%99s%20center%20is%20displaced%20by%20the%20full%20first-link%20length%20when%20%24%5Ctheta_1%24%20changes.%20Should%20its%20contribution%20to%20the%20first%20gravity%20torque%20contain%20%24l_1%24%20or%20%24l_2%24%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%20contains%20%24l_1%24%3A%20the%20contribution%20is%20%24-m_2gl_1%5Csin%5Ctheta_1%24.%20This%20follows%20from%20the%20second%20center%20height%20%24y_2%3D-l_1%5Ccos%5Ctheta_1-(l_2%2F2)%5Ccos%5Ctheta_2%24.%20The%20other%20gravity%20entry%20contains%20%24l_2%2F2%24.%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%20Examples%0A%0A%20%20%20%20See%20examples%20of%20the%20deduction%20of%20the%20equations%20of%20motion%20in%20matrix%20form%20for%20the%20following%20systems%3A%0A%20%20%20%20-%20%5BA%20cart%20attached%20to%20a%20spring%20and%20a%20pendulum%5D(https%3A%2F%2Fyoutu.be%2Fgsi_0cVZ5-s)%0A%20%20%20%20-%20%5BTwo%20sliding%20masses%20attached%20to%20two%20springs%5D(https%3A%2F%2Fyoutu.be%2FdqtZwZmMh4w)%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%20Make%20a%20first-order%20state.**%20For%20%24M(q)%5Cddot%20q%3Df(q%2C%5Cdot%20q)%24%20with%20two%20coordinates%2C%20write%20the%20derivative%20for%20the%20ordering%20%24y%3D(q_1%2Cq_2%2C%5Cdot%20q_1%2C%5Cdot%20q_2)%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%2F%2F%2F%20details%20%7C%20Solution%20to%20Exercise%203%0A%0A%20%20%20%20The%20derivative%20is%20%24%5Cdot%20y%3D(%5Cdot%20q_1%2C%5Cdot%20q_2%2Ca_1%2Ca_2)%24%2C%20where%20%24Ma%3Df%24.%20The%20example%20uses%20a%20different%20but%20valid%20ordering%2C%20velocities%20first%3B%20the%20derivative%20and%20initial%20state%20must%20match%20whichever%20ordering%20you%20choose.%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.%20Why%20is%20the%20mass%20matrix%20symmetric%3F%0A%20%20%20%202.%20What%20physical%20quantity%20is%20%24%5Cdot%20q%5ET%20M%5Cdot%20q%2F2%24%3F%0A%20%20%20%203.%20How%20would%20you%20detect%20a%20sign%20or%20lever-arm%20error%20without%20waiting%20for%20a%20long%20simulation%3F%0A%20%20%20%204.%20Which%20numerical%20check%20matters%20for%20an%20unforced%20frictionless%20simulation%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.%20It%20comes%20from%20a%20quadratic%20kinetic-energy%20form.%0A%20%20%20%202.%20Kinetic%20energy.%0A%20%20%20%203.%20Test%20simple%20configurations%20and%20compare%20gravity%20torques%20with%20derivatives%20of%20potential%20energy.%0A%20%20%20%204.%20Energy%20drift%20and%20convergence%20as%20solver%20tolerances%20or%20step%20size%20are%20reduced.%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%202.%20Derive%20the%20equations%20of%20motion%20in%20matrix%20form%20for%20the%20system%20below%20(see%20solution%20at%20https%3A%2F%2Fyoutu.be%2FositbkD5J2M)%3A%0A%20%20%20%20%3Cfigure%3E%3Cimg%20src%3D%22https%3A%2F%2Fgithub.com%2FBMClab%2FBMC%2Fblob%2Fmaster%2Fimages%2Fmasses_springs_gravity.png%3Fraw%3D1%22%20width%3D%22200%22%20alt%3D%22masses_springs_gravity%22%2F%3E%3C%2Ffigure%3E%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%20original%20Problems%0A%0A%20%20%20%202.%20Take%20downward%20displacements%20%24(x_1%2Cx_2%2Cx_3)%24%20of%20the%20upper%2C%20lower-left%20and%20lower-right%20masses%20from%20the%20unstretched%20configuration.%20Then%20%24M%3D%5Coperatorname%7Bdiag%7D(2m%2Cm%2Cm)%24%2C%20%24K%3Dk%5Cbegin%7Bbmatrix%7D3%26-1%26-1%5C%5C-1%261%260%5C%5C-1%260%261%5Cend%7Bbmatrix%7D%24%20and%20%24M%5Cddot%20x%2BKx%3D(2mg%2Cmg%2Cmg)%5ET%24.%20About%20static%20equilibrium%2C%20%24M%5Cddot%20u%2BKu%3D0%24.%20The%20accelerations%20are%20the%20solution%20of%20this%20linear%20system.%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-%20Nikooyan%20and%20Zadpoor%20(2011)%20reviews%20mass-spring-damper%20models%20developed%20to%20study%20the%20response%20of%20the%20human%20body%20to%20the%20collision%20with%20the%20ground%20during%20hopping%2C%20trotting%2C%20or%20running%2C%20and%20presents%20the%20parameters%20of%20these%20models%20as%20terms%20of%20the%20equations%20of%20motion%20in%20matrix%20form.%0A%20%20%20%20-%20Hollerbach%20and%20Flash%20(1982)%20used%20a%20planar%20two-link%20system%20model%20to%20investigate%20the%20dynamics%20of%20the%20upper%20limb%20during%20reaching%20movements.%20In%20such%20model%2C%20the%20two%20terms%20off%20the%20main%20diagonal%20in%20the%20inertia%20matrix%20(which%20are%20the%20same)%20and%20the%20centripetal%20and%20Coriolis%20terms%20represent%20the%20effects%20of%20the%20movement%20(nonzero%20velocity)%20of%20one%20joint%20over%20the%20other.%20These%20torques%20are%20referred%20as%20coupling%20or%20interaction%20effects.%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%20Optional%20textbook%20investigations%0A%0A%20%20%20%20These%20original%20external%20assignments%20require%20the%20stated%20edition%20and%20its%20figures.%20They%20are%20retained%20as%20optional%20reading%3B%20the%20self-contained%20Problems%20above%20have%20answer%20panels.%0A%0A%20%20%20%201.%20Solve%20the%20problems%2019.3.20%20and%2019.3.24%20of%20the%20Ruina%20and%20Rudra's%20book%20using%20the%20Lagrangian%20formalism%20(it%20is%20much%20easier%20than%20use%20the%20Newton-Euler%20formalism)%20and%20then%20use%20the%20matrix%20formalism%20to%20obtain%20the%20expressions%20of%20the%20angular%20accelerations.%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-%20YAMAGUCHI%2C%20G.%20T.%20Dynamic%20modeling%20of%20musculoskeletal%20motion%3A%20a%20vectorized%20approach%20for%20biomechanical%20analysis%20in%20three%20dimensions.%2C%202001.%0A%0A%20%20%20%20-%20CRAIG%2C%20J.%20Introduction%20to%20robotics.%20%2C%201989.%0A%0A%20%20%20%20-%20JAIN%2C%20A.%20Robot%20and%20multibody%20dynamics.%20%2C%202011.%0A%0A%20%20%20%20-%20SPONG%2C%20M.%20W.%3B%20HUTCHINSON%2C%20S.%3B%20VIDYASAGAR%2C%20M.%20Robot%20modeling%20and%20control.%2C%202006.%0A%0A%20%20%20%20-%20ERDEMIR%2C%20A.%20et%20al.%20Model-based%20estimation%20of%20muscle%20forces%20exerted%20during%20movements.%20Clinical%20Biomechanics%2C%20v.%2022%2C%20n.%202%2C%20p.%20131%E2%80%93154%2C%202007.%0A%0A%20%20%20%20-%20Hollerbach%20JM%2C%20Flash%20T%20(1982)%20%5BDynamic%20interactions%20between%20limb%20segments%20during%20planar%20arm%20movement%5D(http%3A%2F%2Flink.springer.com%2Farticle%2F10.1007%252FBF00353957).%20Biological%20Cybernetics%2C%2044%2C%2067-77.%0A%0A%20%20%20%20-%20Nikooyan%20AA%2C%20Zadpoor%20AA.%20Mass-spring-damper%20modelling%20of%20the%20human%20body%20to%20study%20running%20and%20hopping--an%20overview.%20Proc%20Inst%20Mech%20Eng%20H.%202011%20Dec%3B225(12)%3A1121-35.%20doi%3A%2010.1177%2F0954411911424210.%20PMID%3A%2022320052.%0A%0A%20%20%20%20-%20STANEV%2C%20D.%3B%20MOUSTAKAS%2C%20K.%20Simulation%20of%20constrained%20musculoskeletal%20systems%20in%20task%20space.%20IEEE%20Transactions%20on%20Biomedical%20Engineering%2C%20v.%2065%2C%20n.%202%2C%20p.%20307%E2%80%93318%2C%202018.%0A%0A%20%20%20%20-%20ZAJAC%20FE%2C%20GORDON%20ME%20%2C%20%5BDetermining%20muscle's%20force%20and%20action%20in%20multi-articular%20movement%5D(https%3A%2F%2Fdrive.google.com%2Fopen%3Fid%3D0BxbW72zV7WmUcC1zSGpEOUxhWXM%26authuser%3D0).%20Exercise%20and%20Sport%20Sciences%20Reviews%2C%2017%2C%20187-230.%20%2C%201989.%0A%0A%20%20%20%20-%20RUINA%20A%2C%20RUDRA%20P.%20%5BIntroduction%20to%20Statics%20and%20Dynamics%5D(https%3A%2F%2Fruina.tam.cornell.edu%2FBook%2Findex.html).%20Oxford%20University%20Press.%20%2C%202015.%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
eb7cc6bb2357c94892601d90cea9ccb4