%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%2C%20%22urllib3%3E%3D2.2%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(width%3D%22medium%22)%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%20Frame%20of%20reference%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%20%22Where%20is%20the%20hand%3F%22%20has%20no%20answer%20until%20someone%20says%20*relative%20to%20what*.%20Relative%20to%20the%20shoulder%2C%20a%20sprinter's%20hand%20swings%20back%20and%20forth%20over%20the%20same%20short%20arc%3B%20relative%20to%20the%20track%2C%20it%20travels%20a%20hundred%20metres%20in%20ten%20seconds.%20Every%20number%20in%20motion%20analysis%20is%20measured%20from%20somewhere%2C%20along%20some%20axes%2C%20and%20many%20confusions%20in%20kinematics%20turn%20out%20to%20be%20confusions%20about%20which%20%22somewhere%22%20was%20meant.%0A%0A%20%20%20%20This%20notebook%20is%20about%20that%20%22somewhere%22.%20It%20starts%20with%20the%20physics%3A%20why%20motion%20is%20relative%2C%20and%20why%20some%20frames%20of%20reference%20are%20better%20than%20others%20for%20writing%20Newton's%20laws.%20It%20ends%20with%20the%20practical%20recipe%20that%20turns%20three%20markers%20on%20a%20body%20segment%20into%20a%20coordinate%20system%2C%20and%20with%20an%20anatomical%20convention%20that%20says%20which%20way%20the%20axes%20of%20that%20coordinate%20system%20must%20point.%0A%0A%20%20%20%20Read%20it%20in%20order%20and%20run%20each%20cell%20as%20you%20reach%20it.%20Where%20you%20find%20a%20**Challenge**%20or%20a%20set%20of%20**Guiding%20questions**%2C%20stop%20and%20answer%20on%20a%20scratchpad%20before%20moving%20on.%20Several%20of%20them%20ask%20you%20to%20predict%20a%20result%20*before*%20the%20code%20prints%20it.%20Make%20the%20prediction%3B%20a%20wrong%20guess%20that%20the%20code%20then%20corrects%20teaches%20more%20than%20a%20right%20one.%0A%0A%20%20%20%20The%20**Exercises**%20are%20short%20practice%20problems%20placed%20where%20the%20material%20they%20need%20has%20just%20been%20covered.%20Each%20one%20has%20a%20collapsed%20solution%20right%20below%20it%3A%20try%20the%20exercise%20first%2C%20and%20open%20the%20solution%20only%20to%20check%20your%20answer%20or%20when%20you%20are%20truly%20stuck.%0A%0A%20%20%20%20You%20will%20need%20the%20vector%20operations%20from%20%5BScalar%20and%20vector%5D(https%3A%2F%2Fmolab.marimo.io%2Fgithub%2FBMClab%2FBMC%2Fblob%2Fmaster%2Fnotebooks%2Fscalar_vector.py)%3A%20the%20norm%2C%20the%20dot%20product%20and%20the%20cross%20product.%0A%0A%20%20%20%20**Challenge%200.**%20Before%20you%20begin%2C%20describe%20the%20motion%20of%20your%20hand%20as%20you%20scroll%20down%20this%20page%2C%20three%20times%3A%20relative%20to%20your%20shoulder%2C%20relative%20to%20the%20room%2C%20and%20relative%20to%20the%20screen.%20Which%20of%20the%20three%20descriptions%20is%20the%20simplest%3F%20Keep%20your%20answers%20nearby%3B%20the%20checkpoint%20questions%20ask%20you%20to%20come%20back%20to%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%20%23%23%20Running%20on%20a%20treadmill%0A%0A%20%20%20%20Treadmills%20are%20everywhere%20in%20biomechanics%20laboratories.%20They%20keep%20the%20runner%20in%20front%20of%20the%20cameras%2C%20at%20a%20speed%20the%20experimenter%20controls%2C%20for%20as%20long%20as%20the%20experiment%20needs.%20But%20a%20nagging%20question%20comes%20with%20them%3A%20**is%20running%20on%20a%20treadmill%20the%20same%20as%20running%20on%20the%20ground%3F**%0A%0A%20%20%20%20Seen%20from%20the%20laboratory%2C%20the%20two%20look%20nothing%20alike.%20On%20the%20ground%2C%20the%20runner's%20body%20travels%20forward%20at%2C%20say%2C%204%20m%2Fs%2C%20and%20each%20foot%20stays%20put%20while%20it%20is%20in%20contact%20with%20the%20ground.%20On%20the%20treadmill%2C%20the%20body%20stays%20where%20it%20is%2C%20and%20each%20foot%20is%20carried%20backward%20by%20the%20belt%20at%204%20m%2Fs%20while%20it%20is%20in%20contact.%20Different%20motions%2C%20it%20seems%3B%20so%20perhaps%20different%20forces%2C%20different%20muscle%20actions%2C%20a%20different%20energy%20cost.%0A%0A%20%20%20%20Now%20watch%20the%20treadmill%20through%20the%20eyes%20of%20an%20ant%20standing%20on%20the%20belt.%20To%20the%20ant%2C%20each%20foot%20is%20at%20rest%20while%20it%20touches%20the%20belt%2C%20and%20the%20runner's%20body%20travels%20forward%20at%204%20m%2Fs%2C%20exactly%20as%20on%20the%20ground.%0A%0A%20%20%20%20Which%20observer%20is%20right%3F%20The%20question%20was%20settled%20by%20van%20Ingen%20Schenau%20(1980)%2C%20and%20by%20the%20end%20of%20the%20next%20section%20you%20will%20be%20able%20to%20reproduce%20his%20argument%20in%20a%20few%20lines%20of%20code.%0A%0A%20%20%20%20**Guiding%20questions%200.**%0A%0A%20%20%20%201.%20The%20laboratory%20observer%20and%20the%20ant%20disagree%20about%20the%20velocity%20of%20the%20runner's%20body.%20Do%20they%20also%20disagree%20about%20its%20acceleration%3F%0A%20%20%20%202.%20Which%20of%20the%20two%20observers%20sees%20the%20runner%20the%20way%20a%20coach%20standing%20beside%20an%20athletics%20track%20would%3F%0A%20%20%20%203.%20A%20real%20treadmill%20belt%20slows%20down%20slightly%20every%20time%20a%20foot%20lands%20on%20it.%20Would%20that%20matter%20for%20the%20comparison%3F%20Why%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%20NumPy%20does%20the%20numerical%20work%20and%20Matplotlib%20draws%20the%20figures.%20The%20function%20%60CCS%60%2C%20from%20the%20%60functions%60%20folder%20of%20this%20repository%2C%20draws%20coordinate%20systems%20in%20three%20dimensions%3B%20it%20is%20loaded%20later%2C%20where%20it%20is%20first%20needed.%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%20%20%20%20import%20matplotlib%0A%20%20%20%20import%20matplotlib.pyplot%20as%20plt%0A%0A%20%20%20%20matplotlib.rc(%22axes%22%2C%20labelsize%3D13%2C%20titlesize%3D14)%0A%20%20%20%20matplotlib.rc(%22xtick%22%2C%20labelsize%3D11)%0A%20%20%20%20matplotlib.rc(%22ytick%22%2C%20labelsize%3D11)%0A%20%20%20%20matplotlib.rc(%22legend%22%2C%20fontsize%3D11)%0A%20%20%20%20return%20np%2C%20plt%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%20Motion%20is%20relative%0A%0A%20%20%20%20%3Ca%20href%3D%22https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FMotion_(physics)%22%3EMotion%3C%2Fa%3E%2C%20a%20change%20of%20position%20in%20space%20with%20respect%20to%20time%2C%20is%20not%20an%20absolute%20concept.%20A%20reference%20is%20needed%20to%20describe%20the%20motion%20of%20an%20object%2C%20and%20the%20state%20of%20that%20reference%20cannot%20be%20absolute%20either%3A%20all%20motion%20is%20relative.%0A%0A%20%20%20%20A%20%5Bframe%20of%20reference%5D(https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FFrame_of_reference)%20is%20whatever%20we%20choose%20to%20describe%20the%20motion%20with%20respect%20to%3A%20the%20laboratory%20floor%2C%20the%20treadmill%20belt%2C%20the%20pelvis%2C%20the%20Earth.%20In%20a%20frame%20of%20reference%20we%20define%20a%20%5Bcoordinate%20system%5D(https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FCoordinate_system)%2C%20a%20set%20of%20axes%20along%20which%20positions%20are%20measured.%20The%20two%20terms%20are%20often%20used%20interchangeably%2C%20but%20they%20are%20not%20the%20same%20thing.%20The%20frame%20is%20the%20physical%20reference%3B%20the%20coordinate%20system%20is%20the%20bookkeeping%20attached%20to%20it.%20The%20same%20laboratory%20floor%20can%20carry%20a%20coordinate%20system%20with%20X%20pointing%20forward%20or%20with%20X%20pointing%20to%20the%20right%2C%20with%20its%20origin%20in%20a%20corner%20or%20at%20the%20centre%20of%20a%20force%20plate.%20Choosing%20between%20them%20changes%20the%20numbers%2C%20not%20the%20motion.%0A%0A%20%20%20%20How%20much%20can%20the%20choice%20of%20frame%20change%20the%20description%3F%20Let's%20look%20at%20one%20hand%20in%20two%20frames.%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%20One%20hand%2C%20two%20frames%0A%0A%20%20%20%20A%20sprinter%20runs%20at%209%20m%2Fs.%20Seen%20from%20the%20shoulder%2C%20the%20hand%20swings%20back%20and%20forth%20like%20a%20pendulum%3A%20we%20model%20the%20arm%20as%20a%20rod%20of%200.6%20m%20from%20shoulder%20to%20hand%2C%20swinging%2050%C2%B0%20either%20side%20of%20the%20vertical%20at%202.2%20cycles%20per%20second%2C%20one%20cycle%20per%20stride.%20Seen%20from%20the%20track%2C%20the%20same%20hand%20also%20travels%20with%20the%20body.%0A%0A%20%20%20%20**Before%20you%20run%20the%20next%20cell**%2C%20predict%3A%20is%20the%20hand%20ever%20moving%20faster%20than%20the%20runner%2C%20relative%20to%20the%20track%3F%20Is%20it%20ever%20almost%20at%20rest%3F%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(np%2C%20plt)%3A%0A%20%20%20%20_V%2C%20_L%2C%20_f%20%3D%209.0%2C%200.6%2C%202.2%20%20%23%20running%20speed%20%5Bm%2Fs%5D%2C%20arm%20length%20%5Bm%5D%2C%20arm%20swing%20frequency%20%5BHz%5D%0A%20%20%20%20_amp%20%3D%20np.radians(50)%20%20%23%20amplitude%20of%20the%20arm%20swing%0A%20%20%20%20_dt%20%3D%200.001%0A%20%20%20%20_t%20%3D%20np.arange(0%2C%201%20%2B%20_dt%20%2F%202%2C%20_dt)%0A%0A%20%20%20%20_theta%20%3D%20_amp%20*%20np.sin(2%20*%20np.pi%20*%20_f%20*%20_t)%20%20%23%20arm%20angle%20from%20the%20vertical%0A%20%20%20%20_hand_shoulder%20%3D%20np.column_stack((_L%20*%20np.sin(_theta)%2C%20-_L%20*%20np.cos(_theta)))%0A%20%20%20%20_hand_track%20%3D%20_hand_shoulder%20%2B%20np.column_stack((_V%20*%20_t%2C%20np.zeros_like(_t)))%20%20%23%20Galilean%20transformation%0A%0A%20%20%20%20_speed_shoulder%20%3D%20np.linalg.norm(np.gradient(_hand_shoulder%2C%20_dt%2C%20axis%3D0%2C%20edge_order%3D2)%2C%20axis%3D1)%0A%20%20%20%20_speed_track%20%3D%20np.linalg.norm(np.gradient(_hand_track%2C%20_dt%2C%20axis%3D0%2C%20edge_order%3D2)%2C%20axis%3D1)%0A%20%20%20%20print(f%22Hand%20speed%20relative%20to%20the%20shoulder%3A%20up%20to%20%7B_speed_shoulder.max()%3A.1f%7D%20m%2Fs%22)%0A%20%20%20%20print(f%22Hand%20speed%20relative%20to%20the%20track%3A%20%20%20%20from%20%7B_speed_track.min()%3A.1f%7D%20to%20%7B_speed_track.max()%3A.1f%7D%20m%2Fs%22)%0A%0A%20%20%20%20_%2C%20_axs%20%3D%20plt.subplots(1%2C%202%2C%20figsize%3D(10%2C%203.6)%2C%20gridspec_kw%3D%7B%22width_ratios%22%3A%20%5B1%2C%202.4%5D%7D)%0A%20%20%20%20_axs%5B0%5D.plot(_hand_shoulder%5B%3A%2C%200%5D%2C%20_hand_shoulder%5B%3A%2C%201%5D%2C%20color%3D%22tab%3Ablue%22%2C%20linewidth%3D3)%0A%20%20%20%20_axs%5B0%5D.plot(0%2C%200%2C%20%22ko%22%2C%20markersize%3D8)%0A%20%20%20%20_axs%5B0%5D.set_aspect(%22equal%22)%0A%20%20%20%20_axs%5B0%5D.set_xlim(-0.7%2C%200.7)%0A%20%20%20%20_axs%5B0%5D.set_ylim(-0.75%2C%200.1)%0A%20%20%20%20_axs%5B0%5D.set_xlabel(%22x%20%5Bm%5D%22)%0A%20%20%20%20_axs%5B0%5D.set_ylabel(%22y%20%5Bm%5D%22)%0A%20%20%20%20_axs%5B0%5D.set_title(%22Relative%20to%20the%20shoulder%22)%0A%20%20%20%20_axs%5B1%5D.plot(_V%20*%20_t%2C%20np.zeros_like(_t)%2C%20%22k--%22%2C%20linewidth%3D1%2C%20label%3D%22shoulder%22)%0A%20%20%20%20_axs%5B1%5D.plot(_hand_track%5B%3A%2C%200%5D%2C%20_hand_track%5B%3A%2C%201%5D%2C%20color%3D%22tab%3Ablue%22%2C%20linewidth%3D2%2C%20label%3D%22hand%22)%0A%20%20%20%20_axs%5B1%5D.set_ylim(-0.75%2C%200.1)%0A%20%20%20%20_axs%5B1%5D.set_xlabel(%22x%20%5Bm%5D%22)%0A%20%20%20%20_axs%5B1%5D.set_title(%22Relative%20to%20the%20track%2C%20during%201%20s%22)%0A%20%20%20%20_axs%5B1%5D.legend(loc%3D%22center%20right%22)%0A%20%20%20%20plt.tight_layout()%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%20Relative%20to%20the%20shoulder%2C%20the%20hand%20moves%20back%20and%20forth%20along%20the%20same%20short%20arc%2C%20never%20faster%20than%207.2%20m%2Fs.%20Relative%20to%20the%20track%2C%20it%20never%20goes%20backwards%20at%20all.%20On%20the%20forward%20swing%20it%20races%20ahead%20at%2016.2%20m%2Fs%2C%20nearly%20twice%20the%20speed%20of%20the%20runner%3B%20at%20the%20bottom%20of%20the%20backswing%2C%20where%20it%20moves%20backwards%20relative%20to%20the%20shoulder%20almost%20as%20fast%20as%20the%20body%20carries%20it%20forwards%2C%20it%20slows%20down%20to%201.8%20m%2Fs.%20(The%20vertical%20scales%20of%20the%20two%20panels%20are%20the%20same%3B%20the%20horizontal%20scale%20of%20the%20second%20one%20is%20squeezed.)%0A%0A%20%20%20%20Both%20descriptions%20are%20correct.%20Which%20one%20is%20useful%20depends%20on%20the%20question%3A%20the%20shoulder's%20frame%20for%20the%20technique%20of%20the%20arm%20swing%2C%20the%20track's%20for%20whether%20the%20hand%20will%20hit%20a%20hurdle.%0A%0A%20%20%20%20**Exercise%201.**%20A%20400%20m%20runner%20moves%20at%207%20m%2Fs%2C%20and%20at%20the%20lowest%20point%20of%20the%20arm%20swing%20the%20hand%20moves%20at%205%20m%2Fs%20relative%20to%20the%20shoulder.%20What%20is%20the%20speed%20of%20the%20hand%20relative%20to%20the%20track%20at%20that%20point%20during%20the%20forward%20swing%3F%20And%20during%20the%20backswing%3F%0A%0A%20%20%20%20%2F%2F%2F%20details%20%7C%20Solution%20to%20Exercise%201%0A%20%20%20%20At%20the%20lowest%20point%20of%20the%20swing%20the%20velocity%20of%20the%20hand%20relative%20to%20the%20shoulder%20is%20horizontal%2C%20parallel%20to%20the%20velocity%20of%20the%20body%2C%20so%20the%20two%20velocities%20add%20as%20numbers%20along%20the%20direction%20of%20running%20(a%20Galilean%20transformation)%3A%0A%0A%20%20%20%20-%20forward%20swing%3A%20%247%20%2B%205%20%3D%2012%24%20m%2Fs%20forward%3B%0A%20%20%20%20-%20backswing%3A%20%247%20-%205%20%3D%202%24%20m%2Fs%2C%20still%20forward.%0A%0A%20%20%20%20Relative%20to%20the%20track%2C%20the%20hand%20of%20a%20runner%20moves%20backwards%20only%20if%20it%20swings%20backwards%20faster%20than%20the%20body%20moves%20forwards.%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%20Inertial%20and%20non-inertial%20frames%0A%0A%20%20%20%20Often%2C%20the%20choice%20of%20reference%20frame%20and%20coordinate%20system%20is%20made%20for%20convenience%2C%20as%20with%20the%20hand%20above.%20There%20is%20one%20distinction%20between%20frames%2C%20though%2C%20that%20is%20not%20a%20matter%20of%20taste.%0A%0A%20%20%20%20When%20we%20deal%20with%20the%20dynamics%20of%20motion%2C%20where%20we%20want%20to%20understand%20the%20forces%20related%20to%20the%20motion%2C%20frames%20of%20reference%20split%20into%20two%20kinds.%20In%20an%20%5Binertial%20frame%20of%20reference%5D(https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FInertial_frame_of_reference)%20(also%20called%20a%20Galilean%20reference%20frame)%2C%20Newton's%20laws%20of%20motion%20are%20valid%20in%20their%20simple%20form.%20In%20a%20non-inertial%20frame%20they%20are%20not%3A%20the%20accelerations%20measured%20there%20cannot%20be%20explained%20by%20the%20forces%20acting%2C%20and%20to%20make%20the%20accounts%20balance%20we%20have%20to%20add%20*fictitious*%20forces%2C%20forces%20that%20no%20body%20exerts.%0A%0A%20%20%20%20An%20inertial%20frame%20is%20at%20rest%20or%20moves%20at%20constant%20velocity%20with%20respect%20to%20another%20inertial%20frame.%20There%20is%20no%20absolute%20rest%20to%20measure%20from%2C%20so%20%22at%20rest%22%20always%20means%20at%20rest%20relative%20to%20some%20other%20frame.%20A%20non-inertial%20frame%20is%20one%20that%20accelerates%20with%20respect%20to%20an%20inertial%20frame.%0A%0A%20%20%20%20The%20concept%20of%20frame%20of%20reference%20has%20changed%20drastically%20from%20Aristotle%20to%20Galileo%2C%20Newton%20and%20Einstein.%20To%20read%20more%20about%20that%20and%20its%20philosophical%20implications%2C%20see%20%5BSpace%20and%20Time%3A%20Inertial%20Frames%5D(https%3A%2F%2Fplato.stanford.edu%2Fentries%2Fspacetime-iframes%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%20Two%20observers%20of%20the%20same%20runner%0A%0A%20%20%20%20Let's%20put%20numbers%20on%20the%20treadmill%20question.%20We%20describe%20the%20horizontal%20motion%20of%20the%20runner's%20centre%20of%20mass%20with%20a%20deliberately%20simple%20model%3A%20an%20average%20speed%20%24V%24%20%3D%204%20m%2Fs%2C%20plus%20a%20small%20fluctuation%20in%20every%20step%2C%20because%20the%20body%20is%20braked%20slightly%20in%20the%20first%20half%20of%20each%20ground%20contact%20and%20pushed%20forward%20in%20the%20second%20half.%20With%20a%20fluctuation%20of%20amplitude%20%24%5CDelta%20V%24%20%3D%200.15%20m%2Fs%20at%20a%20step%20frequency%20%24f%24%20%3D%202.8%20steps%20per%20second%2C%20the%20velocity%20relative%20to%20the%20ground%20is%0A%0A%20%20%20%20%24%24%0A%20%20%20%20v(t)%20%3D%20V%20%2B%20%5CDelta%20V%20%5Csin(2%5Cpi%20f%20t)%0A%20%20%20%20%24%24%0A%0A%20%20%20%20and%20the%20position%20is%20its%20integral%2C%0A%0A%20%20%20%20%24%24%0A%20%20%20%20x(t)%20%3D%20V%20t%20-%20%5Cfrac%7B%5CDelta%20V%7D%7B2%5Cpi%20f%7D%5Ccos(2%5Cpi%20f%20t)%0A%20%20%20%20%24%24%0A%0A%20%20%20%20A%20sinusoid%20is%20a%20caricature%20of%20a%20real%20stride%2C%20but%20it%20is%20enough%20for%20the%20argument.%20If%20running%20on%20a%20treadmill%20is%20like%20running%20on%20the%20ground%2C%20this%20is%20also%20the%20motion%20of%20the%20treadmill%20runner%20*relative%20to%20the%20belt*.%20As%20in%20a%20motion%20capture%20session%2C%20we%20sample%20it%20at%20100%20Hz%3A%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(np)%3A%0A%20%20%20%20V%2C%20dV%2C%20f%20%3D%204.0%2C%200.15%2C%202.8%20%20%23%20m%2Fs%2C%20m%2Fs%2C%20Hz%0A%20%20%20%20dt%20%3D%200.01%20%20%23%20s%2C%20100%20Hz%0A%20%20%20%20t%20%3D%20np.arange(0%2C%202%20%2B%20dt%20%2F%202%2C%20dt)%0A%0A%20%20%20%20x_belt%20%3D%20V%20*%20t%20-%20dV%20%2F%20(2%20*%20np.pi%20*%20f)%20*%20np.cos(2%20*%20np.pi%20*%20f%20*%20t)%0A%20%20%20%20return%20V%2C%20dt%2C%20t%2C%20x_belt%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%20laboratory%20sees%20the%20belt%20move%20backward%20at%20the%20constant%20speed%20%24V%24.%20The%20position%20of%20the%20runner%20relative%20to%20the%20laboratory%20is%20therefore%20the%20position%20relative%20to%20the%20belt%20minus%20the%20distance%20the%20belt%20has%20carried%20it%3A%0A%0A%20%20%20%20%24%24%0A%20%20%20%20x_%7Blab%7D(t)%20%3D%20x_%7Bbelt%7D(t)%20-%20V%20t%0A%20%20%20%20%24%24%0A%0A%20%20%20%20This%20change%20of%20frame%2C%20subtracting%20the%20displacement%20of%20one%20frame%20relative%20to%20the%20other%2C%20is%20a%20**Galilean%20transformation**.%0A%0A%20%20%20%20**Before%20you%20run%20the%20next%20cell**%2C%20predict%20three%20things.%20How%20far%20does%20the%20runner's%20centre%20of%20mass%20move%20in%20the%20laboratory%20in%20two%20seconds%3F%20How%20do%20the%20velocities%20seen%20by%20the%20two%20observers%20compare%3F%20And%20the%20accelerations%3F%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(V%2C%20dt%2C%20np%2C%20t%2C%20x_belt)%3A%0A%20%20%20%20x_lab%20%3D%20x_belt%20-%20V%20*%20t%0A%0A%20%20%20%20v_belt%20%3D%20np.gradient(x_belt%2C%20dt%2C%20edge_order%3D2)%0A%20%20%20%20a_belt%20%3D%20np.gradient(v_belt%2C%20dt%2C%20edge_order%3D2)%0A%20%20%20%20v_lab%20%3D%20np.gradient(x_lab%2C%20dt%2C%20edge_order%3D2)%0A%20%20%20%20a_lab%20%3D%20np.gradient(v_lab%2C%20dt%2C%20edge_order%3D2)%0A%0A%20%20%20%20print(f%22x_lab%20stays%20between%20%7B1000%20*%20x_lab.min()%3A.1f%7D%20and%20%7B1000%20*%20x_lab.max()%3A.1f%7D%20mm%22)%0A%20%20%20%20print(f%22v_belt%20-%20v_lab%3A%20from%20%7B(v_belt%20-%20v_lab).min()%3A.6f%7D%20to%20%7B(v_belt%20-%20v_lab).max()%3A.6f%7D%20m%2Fs%22)%0A%20%20%20%20print(f%22Largest%20%7Ca_belt%20-%20a_lab%7C%3A%20%7Bnp.abs(a_belt%20-%20a_lab).max()%3A.1e%7D%20m%2Fs2%22)%0A%20%20%20%20print(%0A%20%20%20%20%20%20%20%20f%22Peak%20horizontal%20acceleration%3A%20%7Bnp.abs(a_belt).max()%3A.2f%7D%20m%2Fs2%2C%22%0A%20%20%20%20%20%20%20%20f%22%20a%20force%20of%20%7B70%20*%20np.abs(a_belt).max()%3A.0f%7D%20N%20for%20a%2070%20kg%20runner%22%0A%20%20%20%20)%0A%20%20%20%20return%20a_belt%2C%20a_lab%2C%20v_belt%2C%20v_lab%2C%20x_lab%0A%0A%0A%40app.cell%0Adef%20_(a_belt%2C%20a_lab%2C%20plt%2C%20t%2C%20v_belt%2C%20v_lab)%3A%0A%20%20%20%20_%2C%20_axs%20%3D%20plt.subplots(2%2C%201%2C%20figsize%3D(9%2C%206)%2C%20sharex%3DTrue)%0A%20%20%20%20_axs%5B0%5D.plot(t%2C%20v_belt%2C%20color%3D%22tab%3Ablue%22%2C%20linewidth%3D2%2C%20label%3D%22relative%20to%20the%20belt%22)%0A%20%20%20%20_axs%5B0%5D.plot(t%2C%20v_lab%2C%20color%3D%22tab%3Aorange%22%2C%20linewidth%3D2%2C%20label%3D%22relative%20to%20the%20laboratory%22)%0A%20%20%20%20_axs%5B0%5D.set_ylabel(%22Velocity%20%5Bm%2Fs%5D%22)%0A%20%20%20%20_axs%5B0%5D.set_title(%22Horizontal%20motion%20of%20the%20runner's%20centre%20of%20mass%22)%0A%20%20%20%20_axs%5B0%5D.legend(loc%3D%22center%20right%22)%0A%20%20%20%20_axs%5B1%5D.plot(t%2C%20a_belt%2C%20color%3D%22tab%3Ablue%22%2C%20linewidth%3D5%2C%20alpha%3D0.5%2C%20label%3D%22relative%20to%20the%20belt%22)%0A%20%20%20%20_axs%5B1%5D.plot(t%2C%20a_lab%2C%20color%3D%22tab%3Aorange%22%2C%20linewidth%3D1.5%2C%20linestyle%3D%22--%22%2C%20label%3D%22relative%20to%20the%20laboratory%22)%0A%20%20%20%20_axs%5B1%5D.set_ylabel(%22Acceleration%20%5Bm%2Fs%24%5E2%24%5D%22)%0A%20%20%20%20_axs%5B1%5D.set_xlabel(%22Time%20%5Bs%5D%22)%0A%20%20%20%20_axs%5B1%5D.set_ylim(-3.2%2C%204.6)%0A%20%20%20%20_axs%5B1%5D.legend(loc%3D%22upper%20center%22%2C%20ncol%3D2)%0A%20%20%20%20plt.tight_layout()%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%20In%20the%20laboratory%2C%20the%20centre%20of%20mass%20barely%20moves%3A%20it%20rocks%20back%20and%20forth%20by%20less%20than%20a%20centimetre%20either%20way%2C%20which%20is%20what%20makes%20a%20treadmill%20so%20convenient%20for%20measurement.%20The%20two%20velocities%20differ%20by%20exactly%204%20m%2Fs%20at%20every%20instant%2C%20the%20speed%20of%20the%20belt.%20And%20the%20two%20accelerations%20are%20the%20same%2C%20to%20within%20%2410%5E%7B-12%7D%5C%3B%5Cmathrm%7Bm%2Fs%5E2%7D%24%2C%20which%20is%20rounding%20error.%20In%20the%20lower%20panel%20the%20dashed%20curve%20lies%20exactly%20on%20top%20of%20the%20solid%20one.%0A%0A%20%20%20%20That%20last%20result%20is%20the%20whole%20argument.%20Differentiate%20the%20Galilean%20transformation%20twice%3A%0A%0A%20%20%20%20%24%24%0A%20%20%20%20x_%7Blab%7D%20%3D%20x_%7Bbelt%7D%20-%20V%20t%0A%20%20%20%20%5Cquad%5CLongrightarrow%5Cquad%0A%20%20%20%20v_%7Blab%7D%20%3D%20v_%7Bbelt%7D%20-%20V%0A%20%20%20%20%5Cquad%5CLongrightarrow%5Cquad%0A%20%20%20%20a_%7Blab%7D%20%3D%20a_%7Bbelt%7D%0A%20%20%20%20%24%24%0A%0A%20%20%20%20Because%20%24V%24%20is%20constant%2C%20it%20disappears%20from%20the%20acceleration.%20Newton's%20second%20law%20links%20force%20to%20acceleration%2C%20so%20both%20observers%20infer%20the%20same%20horizontal%20force%20on%20the%20runner%3A%20a%20peak%20of%20about%20180%20N%20for%20a%2070%20kg%20runner%2C%20braking%20and%20then%20propelling%20the%20body%20in%20each%20step.%20A%20frame%20moving%20at%20constant%20velocity%20relative%20to%20an%20inertial%20frame%20is%20itself%20inertial%2C%20and%20in%20all%20inertial%20frames%20the%20forces%20come%20out%20the%20same.%0A%0A%20%20%20%20That%20is%20van%20Ingen%20Schenau's%20conclusion%3A%20if%20the%20belt%20speed%20is%20constant%20and%20air%20resistance%20is%20negligible%2C%20running%20on%20a%20treadmill%20is%20mechanically%20equivalent%20to%20running%20on%20the%20ground.%20The%20differences%20that%20remain%20in%20practice%20come%20from%20breaking%20those%20conditions%2C%20not%20from%20the%20change%20of%20frame%3A%20there%20is%20no%20air%20resistance%20on%20a%20treadmill%2C%20and%20a%20real%20belt%20slows%20down%20slightly%20each%20time%20a%20foot%20lands%20on%20it.%0A%0A%20%20%20%20**Guiding%20questions%201.**%0A%0A%20%20%20%201.%20Go%20back%20to%20Guiding%20question%200.1.%20Which%20kinematic%20quantities%20depend%20on%20the%20frame%20of%20reference%2C%20and%20which%20do%20not%2C%20as%20long%20as%20both%20frames%20are%20inertial%3F%0A%20%20%20%202.%20The%20laboratory%20sees%20the%20foot%20move%20backward%20at%204%20m%2Fs%20during%20contact%3B%20the%20ant%20on%20the%20belt%20sees%20it%20at%20rest.%20Do%20the%20two%20observers%20agree%20on%20the%20kinetic%20energy%20of%20the%20foot%3F%0A%20%20%20%203.%20A%20runner%20on%20a%20treadmill%20slowly%20drifts%20backward%20and%2C%20after%20a%20minute%2C%20steps%20off%20the%20back%20of%20the%20belt.%20Does%20the%20drift%20break%20the%20equivalence%20argument%3F%20What%20would%20you%20have%20to%20add%20to%20the%20model%20to%20describe%20it%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%23%20When%20the%20frame%20accelerates%0A%0A%20%20%20%20Now%20suppose%20the%20belt%20speeds%20up%2C%20at%20%24A%24%20%3D%200.5%20m%2Fs%C2%B2%2C%20and%20the%20runner%20keeps%20up%2C%20staying%20in%20the%20same%20place%20in%20the%20laboratory.%20The%20runner's%20motion%20relative%20to%20the%20laboratory%20is%20the%20same%20as%20before.%20Relative%20to%20the%20belt%2C%20the%20runner%20now%20goes%20faster%20and%20faster%3A%20to%20the%20%24V%20t%24%20of%20before%20we%20must%20add%20the%20%24A%20t%5E2%2F2%24%20by%20which%20the%20speeding%20belt%20carries%20its%20surface%20further%20back.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(V%2C%20dt%2C%20np%2C%20t%2C%20x_lab)%3A%0A%20%20%20%20_A%20%3D%200.5%20%20%23%20m%2Fs2%2C%20the%20belt%20speeds%20up%0A%20%20%20%20_x_belt_accel%20%3D%20x_lab%20%2B%20V%20*%20t%20%2B%20_A%20*%20t**2%20%2F%202%0A%0A%20%20%20%20_a_lab%20%3D%20np.gradient(np.gradient(x_lab%2C%20dt%2C%20edge_order%3D2)%2C%20dt%2C%20edge_order%3D2)%0A%20%20%20%20_a_belt_accel%20%3D%20np.gradient(np.gradient(_x_belt_accel%2C%20dt%2C%20edge_order%3D2)%2C%20dt%2C%20edge_order%3D2)%0A%20%20%20%20_diff%20%3D%20_a_belt_accel%20-%20_a_lab%0A%20%20%20%20print(f%22a_belt%20-%20a_lab%3A%20from%20%7B_diff.min()%3A.4f%7D%20to%20%7B_diff.max()%3A.4f%7D%20m%2Fs2%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%20two%20observers%20now%20disagree%20about%20the%20acceleration%2C%20by%20exactly%20the%20acceleration%20of%20the%20belt%2C%20at%20every%20instant.%20The%20laboratory%20is%20(very%20nearly)%20inertial%2C%20so%20its%20account%20is%20the%20one%20in%20which%20forces%20and%20accelerations%20match%3A%20the%20runner%20does%20not%20accelerate%20on%20average%2C%20and%20the%20average%20net%20horizontal%20force%20is%20zero.%20The%20observer%20riding%20the%20belt%20sees%20the%20runner%20accelerate%20forward%20at%20an%20extra%200.5%20m%2Fs%C2%B2%2C%20and%20no%20force%20to%20account%20for%20it.%20In%20that%20frame%20Newton's%20second%20law%20fails%2C%20unless%20we%20add%20a%20fictitious%20force%20of%20%24m%20A%24%2C%2035%20N%20for%20a%2070%20kg%20runner%2C%20pointing%20forward.%0A%0A%20%20%20%20In%20general%2C%20if%20a%20frame%20accelerates%20at%20%24%5Coverrightarrow%7B%5Cmathbf%7Ba%7D%7D_%7Bframe%7D%24%20relative%20to%20an%20inertial%20frame%2C%20accelerations%20measured%20in%20it%20are%20%24%5Coverrightarrow%7B%5Cmathbf%7Ba%7D%7D'%20%3D%20%5Coverrightarrow%7B%5Cmathbf%7Ba%7D%7D%20-%20%5Coverrightarrow%7B%5Cmathbf%7Ba%7D%7D_%7Bframe%7D%24%2C%20and%20Newton's%20second%20law%20written%20in%20that%20frame%20picks%20up%20an%20extra%20term%3A%0A%0A%20%20%20%20%24%24%0A%20%20%20%20m%5C%2C%5Coverrightarrow%7B%5Cmathbf%7Ba%7D%7D'%20%3D%20%5Coverrightarrow%7B%5Cmathbf%7BF%7D%7D%20%5C%3B%20%5Cunderbrace%7B-%5C%2C%20m%5C%2C%5Coverrightarrow%7B%5Cmathbf%7Ba%7D%7D_%7Bframe%7D%7D_%7B%5Ctext%7Bfictitious%20force%7D%7D%0A%20%20%20%20%24%24%0A%0A%20%20%20%20It%20is%20the%20same%20push%20you%20feel%20when%20a%20bus%20brakes%3A%20no%20one%20pushes%20you%20forward%3B%20the%20bus%2C%20your%20frame%20of%20reference%2C%20is%20decelerating.%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%20A%20force%20plate%20in%20a%20lift%0A%0A%20%20%20%20A%20force%20plate%20measures%20the%20force%20between%20the%20feet%20and%20the%20ground.%20Put%20one%20in%20a%20lift%2C%20with%20a%2070%20kg%20person%20standing%20still%20on%20it%2C%20and%20take%20the%20lift%20up%20one%20floor%3A%20it%20speeds%20up%20at%201.5%20m%2Fs%C2%B2%20for%201.5%20s%2C%20travels%20at%20a%20constant%20speed%20for%203%20s%2C%20and%20slows%20down%20at%201.5%20m%2Fs%C2%B2%20for%201.5%20s.%0A%0A%20%20%20%20**Before%20you%20run%20the%20next%20cell**%2C%20predict%20what%20the%20force%20plate%20reads%20in%20each%20of%20the%20three%20phases.%20Is%20the%20reading%20during%20the%20constant-speed%20part%20the%20person's%20weight%2C%20or%20more%3F%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(np%2C%20plt)%3A%0A%20%20%20%20_m%2C%20_g%20%3D%2070.0%2C%209.81%20%20%23%20kg%2C%20m%2Fs2%0A%20%20%20%20_dt%20%3D%200.01%0A%20%20%20%20_t%20%3D%20np.arange(0%2C%208%20%2B%20_dt%20%2F%202%2C%20_dt)%0A%20%20%20%20_a%20%3D%20np.where((_t%20%3E%3D%201)%20%26%20(_t%20%3C%202.5)%2C%201.5%2C%200.0)%20%2B%20np.where((_t%20%3E%3D%205.5)%20%26%20(_t%20%3C%207)%2C%20-1.5%2C%200.0)%0A%20%20%20%20_v%20%3D%20np.concatenate((%5B0%5D%2C%20np.cumsum((_a%5B1%3A%5D%20%2B%20_a%5B%3A-1%5D)%20%2F%202%20*%20_dt)))%20%20%23%20velocity%20of%20the%20lift%0A%20%20%20%20_F%20%3D%20_m%20*%20(_g%20%2B%20_a)%20%20%23%20force%20of%20the%20plate%20on%20the%20person%2C%20from%20the%20laboratory%3A%20F%20-%20m%20g%20%3D%20m%20a%0A%0A%20%20%20%20for%20_label%2C%20_time%20in%20%5B(%22at%20rest%22%2C%200.5)%2C%20(%22speeding%20up%22%2C%202)%2C%20(%22constant%20speed%22%2C%204)%2C%20(%22slowing%20down%22%2C%206)%5D%3A%0A%20%20%20%20%20%20%20%20_i%20%3D%20np.argmin(np.abs(_t%20-%20_time))%0A%20%20%20%20%20%20%20%20print(f%22%7B_label%3A15s%7D%20lift%20speed%20%7B_v%5B_i%5D%3A4.2f%7D%20m%2Fs%20%20%20plate%20reading%20%7B_F%5B_i%5D%3A6.1f%7D%20N%22)%0A%20%20%20%20print(f%22%5CnBody%20weight%3A%20%7B_m%20*%20_g%3A.1f%7D%20N%22)%0A%0A%20%20%20%20_%2C%20_axs%20%3D%20plt.subplots(2%2C%201%2C%20figsize%3D(8%2C%205)%2C%20sharex%3DTrue)%0A%20%20%20%20_axs%5B0%5D.plot(_t%2C%20_v%2C%20color%3D%22tab%3Ablue%22%2C%20linewidth%3D2)%0A%20%20%20%20_axs%5B0%5D.set_ylabel(%22Lift%20speed%20%5Bm%2Fs%5D%22)%0A%20%20%20%20_axs%5B1%5D.plot(_t%2C%20_F%2C%20color%3D%22tab%3Ared%22%2C%20linewidth%3D2%2C%20label%3D%22plate%20reading%22)%0A%20%20%20%20_axs%5B1%5D.axhline(_m%20*%20_g%2C%20color%3D%220.5%22%2C%20linestyle%3D%22--%22%2C%20label%3D%22body%20weight%22)%0A%20%20%20%20_axs%5B1%5D.set_ylabel(%22Force%20%5BN%5D%22)%0A%20%20%20%20_axs%5B1%5D.set_xlabel(%22Time%20%5Bs%5D%22)%0A%20%20%20%20_axs%5B1%5D.legend(loc%3D%22upper%20right%22)%0A%20%20%20%20plt.tight_layout()%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%20The%20plate%20reads%20791.7%20N%20while%20the%20lift%20speeds%20up%2C%2015%25%20more%20than%20the%20person's%20weight%2C%20and%20581.7%20N%20while%20it%20slows%20down.%20During%20the%20constant-speed%20part%20it%20reads%20exactly%20the%20weight%2C%20686.7%20N%2C%20although%20the%20person%20is%20moving%20upwards%20at%202.25%20m%2Fs.%0A%0A%20%20%20%20Seen%20from%20the%20laboratory%2C%20an%20inertial%20frame%2C%20the%20person%20accelerates%20with%20the%20lift%2C%20and%20Newton's%20second%20law%20needs%20a%20net%20upward%20force%3A%20%24F%20-%20m%20g%20%3D%20m%20a%24%2C%20so%20%24F%20%3D%20m(g%20%2B%20a)%24.%20Seen%20from%20the%20lift%2C%20the%20person%20is%20at%20rest%2C%20and%20the%20accounts%20balance%20only%20with%20a%20fictitious%20force%20%24-m%5C%2Ca_%7Blift%7D%24%2C%20pointing%20down%20while%20the%20lift%20accelerates%20upwards%3A%20the%20%22heavy%22%20feeling%20at%20the%20start%20of%20the%20ride.%20At%20constant%20speed%20the%20lift%20is%20an%20inertial%20frame%20again%2C%20and%20the%20fictitious%20force%20vanishes.%0A%0A%20%20%20%20The%20lesson%20for%20measurement%3A%20a%20force%20plate%20tells%20you%20about%20the%20motion%20of%20the%20body%20relative%20to%20an%20inertial%20frame%20only%20if%20the%20plate%20itself%20is%20in%20one.%0A%0A%20%20%20%20**Exercise%202.**%20Imagine%20a%20force%20plate%20on%20the%20deck%20of%20a%20ship.%20The%20deck%20heaves%20up%20and%20down%20with%20a%20vertical%20acceleration%20%24a(t)%20%3D%200.8%5Csin(2%5Cpi%5C%2C0.1%5C%2Ct)%24%20m%2Fs%C2%B2.%20A%2075%20kg%20person%20stands%20still%20on%20the%20plate.%20Between%20which%20values%20does%20the%20reading%20oscillate%2C%20and%20how%20large%20is%20the%20error%20relative%20to%20the%20person's%20weight%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%2C%20np)%3A%0A%20%20%20%20_m%2C%20_g%20%3D%2075.0%2C%209.81%0A%20%20%20%20_t%20%3D%20np.arange(0%2C%2020%2C%200.01)%0A%20%20%20%20_F%20%3D%20_m%20*%20(_g%20%2B%200.8%20*%20np.sin(2%20*%20np.pi%20*%200.1%20*%20_t))%0A%20%20%20%20_W%20%3D%20_m%20*%20_g%0A%20%20%20%20mo.accordion(%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%22Solution%20to%20Exercise%202%22%3A%20mo.md(%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20rf%22%22%22%0A%20%20%20%20As%20in%20the%20lift%2C%20the%20plate%20reads%20%24F%20%3D%20m%5C%2C(g%20%2B%20a)%24.%20Over%20one%20heave%20cycle%20of%2010%20s%2C%20the%20reading%20oscillates%20between%20**%7B_F.min()%3A.1f%7D%20N**%20and%20**%7B_F.max()%3A.1f%7D%20N**%2C%20around%20the%20weight%20of%20%7B_W%3A.1f%7D%20N%3A%20an%20error%20of%20up%20to%20%7B_F.max()%20-%20_W%3A.1f%7D%20N%2C%20or%20%7B100%20*%20(_F.max()%20-%20_W)%20%2F%20_W%3A.1f%7D%25%20of%20the%20weight%2C%20in%20each%20direction.%0A%0A%20%20%20%20The%20error%20is%20simply%20%24m%5C%2Ca_%7B%7Bmax%7D%7D%20%3D%2075%20%5Ctimes%200.8%20%3D%2060%24%20N.%20It%20is%20slow%20(a%2010%20s%20period)%20compared%20with%20a%20jump%2C%20but%20far%20from%20negligible%3A%20any%20force%20plate%20used%20on%20a%20moving%20platform%20needs%20the%20platform's%20own%20acceleration%20measured%20and%20subtracted.%0A%20%20%20%20%22%22%22%0A%20%20%20%20%20%20%20%20%20%20%20%20)%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20)%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%20Is%20the%20laboratory%20an%20inertial%20frame%3F%0A%0A%20%20%20%20Strictly%2C%20no.%20The%20laboratory%20sits%20on%20the%20surface%20of%20a%20rotating%20Earth.%20Every%20point%20of%20that%20surface%2C%20except%20at%20the%20poles%2C%20travels%20in%20a%20circle%20once%20a%20day%2C%20and%20moving%20in%20a%20circle%20means%20accelerating%20towards%20its%20centre%2C%20with%20%24a%20%3D%20%5Comega%5E2%20r%24%20(see%20%5BPath%20frame%5D(https%3A%2F%2Fmolab.marimo.io%2Fgithub%2FBMClab%2FBMC%2Fblob%2Fmaster%2Fnotebooks%2Fpath_frame.py)).%20How%20large%20is%20that%20acceleration%3F%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(np)%3A%0A%20%20%20%20_omega%20%3D%202%20*%20np.pi%20%2F%2086164%20%20%23%20rad%2Fs%2C%20one%20turn%20per%20sidereal%20day%0A%20%20%20%20_R%20%3D%206.378e6%20%20%23%20m%2C%20equatorial%20radius%20of%20the%20Earth%0A%0A%20%20%20%20_a_c%20%3D%20_omega**2%20*%20_R%0A%20%20%20%20print(f%22Centripetal%20acceleration%20at%20the%20equator%3A%20%7B_a_c%3A.4f%7D%20m%2Fs2%2C%20%7B100%20*%20_a_c%20%2F%209.81%3A.2f%7D%25%20of%20g%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%20At%20most%200.034%20m%2Fs%C2%B2%2C%20about%20a%20third%20of%20a%20percent%20of%20the%20gravitational%20acceleration%2C%20and%20far%20smaller%20than%20the%20accelerations%20of%20human%20movement.%20That%20is%20why%20biomechanics%20treats%20the%20laboratory%20as%20an%20inertial%20frame%20without%20a%20second%20thought.%20The%20Earth's%20rotation%20matters%20for%20long-range%20ballistics%2C%20for%20weather%20systems%20and%20for%20Foucault's%20pendulum%2C%20not%20for%20a%20jump%20on%20a%20force%20plate.%0A%0A%20%20%20%20**Exercise%203.**%20In%20some%20tests%20of%20the%20vestibular%20system%2C%20a%20person%20sits%20on%20a%20chair%20that%20rotates%20at%20a%20constant%20rate%20about%20a%20vertical%20axis.%20At%20half%20a%20turn%20per%20second%2C%20what%20is%20the%20centripetal%20acceleration%20of%20a%20point%20of%20the%20head%2010%20cm%20from%20the%20axis%20of%20rotation%3F%20Is%20the%20chair%20an%20inertial%20frame%3F%0A%0A%20%20%20%20%2F%2F%2F%20details%20%7C%20Solution%20to%20Exercise%203%0A%20%20%20%20Half%20a%20turn%20per%20second%20is%20%24%5Comega%20%3D%20%5Cpi%24%20rad%2Fs%2C%20so%0A%0A%20%20%20%20%24%24%0A%20%20%20%20a%20%3D%20%5Comega%5E2%20r%20%3D%20%5Cpi%5E2%20%5Ctimes%200.1%20%3D%200.99%5C%3B%5Cmathrm%7Bm%2Fs%5E2%7D%0A%20%20%20%20%24%24%0A%0A%20%20%20%20about%2010%25%20of%20%24g%24%2C%20and%20some%20thirty%20times%20the%20acceleration%20due%20to%20the%20Earth's%20rotation.%20The%20chair%20is%20not%20an%20inertial%20frame%3A%20every%20point%20of%20it%2C%20except%20those%20on%20the%20axis%2C%20accelerates%20towards%20the%20axis.%20In%20the%20chair's%20frame%2C%20a%20fictitious%20force%20%24m%5C%2C%5Comega%5E2%20r%24%20pointing%20away%20from%20the%20axis%20(the%20centrifugal%20force)%20has%20to%20be%20added%2C%20and%20a%20second%20one%20(the%20Coriolis%20force)%20for%20anything%20that%20moves%20relative%20to%20the%20chair.%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%20Frame%20of%20reference%20for%20human%20motion%20analysis%0A%0A%20%20%20%20In%20anatomy%2C%20we%20use%20a%20simplified%20reference%20frame%20made%20of%20perpendicular%20planes%20to%20provide%20a%20standard%20reference%20for%20qualitatively%20describing%20the%20structures%20and%20movements%20of%20the%20human%20body%2C%20as%20shown%20in%20the%20next%20figure.%0A%0A%20%20%20%20%3Cfigure%20aria-describedby%3D%22figure-caption-1%22%3E%3Ccenter%3E%3Cimg%20src%3D%22https%3A%2F%2Fupload.wikimedia.org%2Fwikipedia%2Fcommons%2F3%2F34%2FBodyPlanes.jpg%22%20width%3D300%20alt%3D%22Anatomical%20body%20position%20and%20body%20planes%22%2F%3E%3C%2Fcenter%3E%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%3EFigure.%20Anatomical%20body%20position%20and%20body%20planes%20(%3Ca%20href%3D%22https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FHuman_anatomical_terms%22%3Eimage%20from%20Wikipedia%3C%2Fa%3E).%3C%2Fspan%3E%0A%0A%20%20%20%20The%20planes%20are%20qualitative.%20%22The%20knee%20flexes%20in%20the%20sagittal%20plane%22%20is%20a%20description%2C%20not%20a%20measurement.%20To%20measure%2C%20we%20need%20numbers%2C%20and%20numbers%20need%20a%20coordinate%20system.%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%20Cartesian%20coordinate%20system%0A%0A%20%20%20%20As%20we%20perceive%20the%20surrounding%20space%20as%20three-dimensional%2C%20a%20convenient%20coordinate%20system%20is%20the%20%5BCartesian%20coordinate%20system%5D(https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FCartesian_coordinate_system)%20in%20%5BEuclidean%20space%5D(https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FEuclidean_space)%2C%20with%20three%20orthogonal%20axes%20as%20shown%20below.%20The%20directions%20of%20the%20axes%20are%20commonly%20defined%20by%20the%20%5Bright-hand%20rule%5D(https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FRight-hand_rule)%20and%20labelled%20X%2C%20Y%20and%20Z.%20The%20orthogonality%20of%20the%20Cartesian%20coordinate%20system%20is%20what%20makes%20it%20so%20convenient%20in%20classical%20mechanics%3A%20space%20is%20assumed%20to%20have%20%5BEuclidean%20geometry%5D(https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FEuclidean_geometry)%2C%20and%20as%20a%20consequence%2C%20the%20motions%20along%20different%20axes%20are%20independent%20of%20each%20other.%0A%0A%20%20%20%20%3Cfigure%20aria-describedby%3D%22figure-caption-2%22%3E%3Ccenter%3E%3Cimg%20src%3D%22https%3A%2F%2Fgithub.com%2FBMClab%2FBMC%2Fblob%2Fmaster%2Fimages%2FCCS.png%3Fraw%3D1%22%20width%3D350%20alt%3D%22Cartesian%20coordinate%20system%22%2F%3E%3C%2Fcenter%3E%3C%2Ffigure%3E%0A%0A%20%20%20%20%3Cspan%20id%3D%22figure-caption-2%22%20class%3D%22figure-caption%22%20style%3D%22display%3Ablock%3Btext-align%3Acenter%3Bfont-style%3Aitalic%22%3EFigure.%20A%20point%20in%20three-dimensional%20Euclidean%20space%20described%20in%20a%20Cartesian%20coordinate%20system.%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%20%23%23%23%20Many%20coordinate%20systems%20at%20once%0A%0A%20%20%20%20The%20concept%20of%20reference%20frame%20is%20central%20to%20understanding%20human%20motion%2C%20and%20not%20only%20in%20mechanics.%20Do%20we%20see%2C%20plan%20and%20control%20the%20movement%20of%20our%20hand%20with%20respect%20to%20reference%20frames%20within%20our%20body%2C%20or%20in%20the%20environment%20we%20move%20in%3F%20Or%20a%20combination%20of%20both%3F%20Questions%20like%20these%20are%20at%20the%20heart%20of%20motor%20control%20research.%0A%0A%20%20%20%20The%20figure%20below%2C%20although%20drawn%20for%20a%20robot%2C%20illustrates%20well%20that%20we%20may%20have%20to%20deal%20with%20several%20coordinate%20systems%20at%20once.%0A%0A%20%20%20%20%3Cfigure%20aria-describedby%3D%22figure-caption-3%22%3E%3Ccenter%3E%3Cimg%20src%3D%22https%3A%2F%2Fgithub.com%2FBMClab%2FBMC%2Fblob%2Fmaster%2Fimages%2Fcoordinatesystems.png%3Fraw%3D1%22%20width%3D450%20alt%3D%22multiple%20coordinate%20systems%20of%20a%20robot%22%2F%3E%3C%2Fcenter%3E%3C%2Ffigure%3E%0A%0A%20%20%20%20%3Cspan%20id%3D%22figure-caption-3%22%20class%3D%22figure-caption%22%20style%3D%22display%3Ablock%3Btext-align%3Acenter%3Bfont-style%3Aitalic%22%3EFigure.%20Multiple%20coordinate%20systems%20for%20use%20in%20robots%20(figure%20from%20Corke%20(2017)).%3C%2Fspan%3E%0A%0A%20%20%20%20In%20three-dimensional%20motion%20analysis%20we%20routinely%20use%20several%20frames%20of%20reference%2C%20and%20call%20them%20global%2C%20laboratory%2C%20local%2C%20anatomical%20or%20technical%2C%20depending%20on%20what%20they%20are%20attached%20to.%20In%20a%20standard%20gait%20analysis%20there%20is%20one%20global%2C%20or%20laboratory%2C%20coordinate%20system%20fixed%20to%20the%20floor%2C%20and%20a%20coordinate%20system%20for%20each%20segment%20of%20the%20body%2C%20so%20that%20the%20motion%20of%20a%20segment%20can%20be%20described%20in%20relation%20to%20the%20anatomical%20axes%20of%20another%20one.%20The%20knee%20angle%2C%20for%20example%2C%20is%20the%20orientation%20of%20the%20shank's%20coordinate%20system%20relative%20to%20the%20thigh's.%0A%0A%20%20%20%20The%20anatomical%20coordinate%20system%20of%20a%20segment%20is%20defined%20by%20anatomical%20landmarks.%20Other%20markers%2C%20placed%20where%20they%20are%20easier%20to%20see%20or%20less%20disturbed%20by%20the%20skin%2C%20may%20be%20used%20to%20improve%20the%20motion%20analysis%2C%20and%20they%20define%20a%20technical%20coordinate%20system%20for%20the%20segment.%20We%20come%20back%20to%20the%20difference%20at%20the%20end%20of%20this%20notebook.%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%20Standardizations%20in%20movement%20analysis%0A%0A%20%20%20%20Two%20laboratories%20that%20define%20the%20thigh%20and%20shank%20coordinate%20systems%20differently%20will%20report%20different%20knee%20angles%20for%20the%20same%20knee.%20To%20make%20results%20comparable%2C%20several%20standardizations%20have%20been%20proposed%20for%20how%20to%20define%20the%20frames%20of%20reference%20of%20the%20main%20segments%20and%20joints%20of%20the%20human%20body.%20The%20International%20Society%20of%20Biomechanics%20keeps%20a%20%5Bpage%20listing%20standardization%20proposals%5D(https%3A%2F%2Fisbweb.org%2Factivities%2Fstandards)%20by%20its%20standardization%20committee%20and%20subcommittees%3A%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.Html(%0A%20%20%20%20%20%20%20%20%22%22%22%3Ciframe%20src%3D%22https%3A%2F%2Fisbweb.org%2Factivities%2Fstandards%22%0A%20%20%20%20%20%20%20%20width%3D%22100%25%22%20height%3D%22400%22%20style%3D%22border%3Anone%22%3E%3C%2Fiframe%3E%22%22%22%0A%20%20%20%20)%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%20Another%20initiative%20for%20the%20standardization%20of%20reference%20frames%20comes%20from%20the%20%5BVirtual%20Animation%20of%20the%20Kinematics%20of%20the%20Human%20for%20Industrial%2C%20Educational%20and%20Research%20Purposes%20(VAKHUM)%5D(https%3A%2F%2Fgithub.com%2FBMClab%2FBMC%2Fblob%2Fmaster%2Fcourses%2Frefs%2FVAKHUM.pdf)%20project.%20We%20will%20use%20its%20definition%20of%20the%20femur's%20coordinate%20system%20later%20in%20this%20notebook.%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%20Determination%20of%20a%20coordinate%20system%0A%0A%20%20%20%20From%20%5Blinear%20algebra%5D(https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FLinear_algebra)%2C%20a%20set%20of%20linearly%20independent%20unit%20vectors%20that%20can%20represent%20any%20vector%20via%20%5Blinear%20combination%5D(https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FLinear_combination)%20is%20called%20a%20%3Ca%20href%3D%22https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FBasis_(linear_algebra)%22%3Ebasis%3C%2Fa%3E.%20When%20its%20vectors%20are%20also%20mutually%20orthogonal%2C%20as%20in%20the%20Cartesian%20coordinate%20system%2C%20it%20is%20an%20orthonormal%20basis.%20The%20figure%20below%20shows%20a%20point%2C%20its%20position%20vector%2C%20and%20the%20versors%20(unit%20vectors)%20of%20the%20basis%20of%20a%20Cartesian%20coordinate%20system.%20See%20%5BScalar%20and%20vector%5D(https%3A%2F%2Fmolab.marimo.io%2Fgithub%2FBMClab%2FBMC%2Fblob%2Fmaster%2Fnotebooks%2Fscalar_vector.py)%20for%20a%20description%20of%20vectors.%0A%0A%20%20%20%20%3Cfigure%20aria-describedby%3D%22figure-caption-4%22%3E%3Ccenter%3E%3Cimg%20src%3D%22https%3A%2F%2Fgithub.com%2FBMClab%2FBMC%2Fblob%2Fmaster%2Fimages%2Fvector3Dijk.png%3Fraw%3D1%22%20width%3D350%20alt%3D%22versors%20of%20the%20Cartesian%20basis%22%2F%3E%3C%2Fcenter%3E%3C%2Ffigure%3E%0A%0A%20%20%20%20%3Cspan%20id%3D%22figure-caption-4%22%20class%3D%22figure-caption%22%20style%3D%22display%3Ablock%3Btext-align%3Acenter%3Bfont-style%3Aitalic%22%3EFigure.%20Representation%20of%20a%20point%20%24%5Cmathbf%7BP%7D%24%20and%20its%20position%20vector%20%24%5Coverrightarrow%7B%5Cmathbf%7Br%7D%7D%24%20in%20a%20Cartesian%20coordinate%20system.%20The%20versors%20%24%5Chat%7B%5Cmathbf%7Bi%7D%7D%2C%5C%2C%20%5Chat%7B%5Cmathbf%7Bj%7D%7D%2C%5C%2C%20%5Chat%7B%5Cmathbf%7Bk%7D%7D%24%20form%20a%20basis%20for%20this%20coordinate%20system%20and%20are%20usually%20drawn%20in%20the%20colour%20sequence%20RGB%20(red%2C%20green%2C%20blue)%20for%20easier%20visualization.%3C%2Fspan%3E%0A%0A%20%20%20%20In%20the%20Cartesian%20coordinate%20system%20itself%2C%20the%20versors%20of%20this%20basis%20have%20the%20coordinates%0A%0A%20%20%20%20%24%24%0A%20%20%20%20%5Chat%7B%5Cmathbf%7Bi%7D%7D%20%3D%20%5Cbegin%7Bbmatrix%7D1%5C%5C0%5C%5C0%20%5Cend%7Bbmatrix%7D%2C%20%5Cquad%20%5Chat%7B%5Cmathbf%7Bj%7D%7D%20%3D%20%5Cbegin%7Bbmatrix%7D0%5C%5C1%5C%5C0%20%5Cend%7Bbmatrix%7D%2C%20%5Cquad%20%5Chat%7B%5Cmathbf%7Bk%7D%7D%20%3D%20%5Cbegin%7Bbmatrix%7D%200%20%5C%5C%200%20%5C%5C%201%20%5Cend%7Bbmatrix%7D%0A%20%20%20%20%24%24%0A%0A%20%20%20%20and%2C%20in%20the%20notation%20of%20the%20figure%2C%20the%20position%20vector%20%24%5Coverrightarrow%7B%5Cmathbf%7Br%7D%7D%24%20of%20the%20point%20%24%5Cmathbf%7BP%7D%24%20is%0A%0A%20%20%20%20%24%24%0A%20%20%20%20%5Coverrightarrow%7B%5Cmathbf%7Br%7D%7D%20%3D%20x%5Chat%7B%5Cmathbf%7Bi%7D%7D%20%2B%20y%5Chat%7B%5Cmathbf%7Bj%7D%7D%20%2B%20z%5Chat%7B%5Cmathbf%7Bk%7D%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%23%20Definition%20of%20a%20basis%0A%0A%20%20%20%20The%20mathematical%20problem%20of%20determining%20a%20coordinate%20system%20is%20to%20find%20a%20basis%20and%20an%20origin%20for%20it.%20A%20basis%20on%20its%20own%20is%20only%20a%20set%20of%20directions%2C%20with%20no%20origin.%20There%20are%20different%20methods%20to%20calculate%20a%20basis%20from%20a%20set%20of%20points%3B%20one%20can%20use%2C%20for%20example%2C%20the%20cross%20product%20or%20the%20scalar%20product.%0A%0A%20%20%20%20The%20positions%20of%20the%20points%20used%20to%20construct%20a%20coordinate%20system%20have%2C%20by%20definition%2C%20to%20be%20specified%20in%20relation%20to%20an%20already%20existing%20coordinate%20system.%20In%20motion%20analysis%2C%20this%20is%20the%20coordinate%20system%20of%20the%20motion%20capture%20system%2C%20established%20in%20the%20calibration%20phase.%20In%20that%20phase%2C%20the%20positions%20of%20markers%20placed%20on%20an%20object%20with%20perpendicular%20axes%20and%20known%20distances%20between%20the%20markers%20are%20captured%20and%20used%20as%20the%20reference%20(laboratory)%20coordinate%20system.%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%20Using%20the%20cross%20product%0A%0A%20%20%20%20Here%20is%20a%20common%20method%20in%20motion%20analysis.%20Given%20the%20coordinates%20of%20three%20noncollinear%20points%20in%203D%20space%20(points%20that%20do%20not%20all%20lie%20on%20the%20same%20line)%2C%20%24%5Coverrightarrow%7B%5Cmathbf%7Bm%7D%7D_1%2C%20%5Coverrightarrow%7B%5Cmathbf%7Bm%7D%7D_2%2C%20%5Coverrightarrow%7B%5Cmathbf%7Bm%7D%7D_3%24%2C%20which%20would%20be%20the%20positions%20of%20markers%20captured%20in%20a%20motion%20analysis%20session%2C%20a%20basis%20is%20found%20in%20four%20steps%3A%0A%0A%20%20%20%201.%20First%20axis%2C%20%24%5Coverrightarrow%7B%5Cmathbf%7Bv%7D%7D_1%24%3A%20the%20vector%20%24%5Coverrightarrow%7B%5Cmathbf%7Bm%7D%7D_2-%5Coverrightarrow%7B%5Cmathbf%7Bm%7D%7D_1%24%20(or%20any%20other%20difference%20between%20two%20of%20the%20points).%0A%20%20%20%202.%20Second%20axis%2C%20%24%5Coverrightarrow%7B%5Cmathbf%7Bv%7D%7D_2%24%3A%20the%20cross%20product%20between%20%24%5Coverrightarrow%7B%5Cmathbf%7Bv%7D%7D_1%24%20and%20%24%5Coverrightarrow%7B%5Cmathbf%7Bm%7D%7D_3-%5Coverrightarrow%7B%5Cmathbf%7Bm%7D%7D_1%24%20(or%20%24%5Coverrightarrow%7B%5Cmathbf%7Bm%7D%7D_3-%5Coverrightarrow%7B%5Cmathbf%7Bm%7D%7D_2%24).%0A%20%20%20%203.%20Third%20axis%2C%20%24%5Coverrightarrow%7B%5Cmathbf%7Bv%7D%7D_3%24%3A%20the%20cross%20product%20between%20%24%5Coverrightarrow%7B%5Cmathbf%7Bv%7D%7D_1%24%20and%20%24%5Coverrightarrow%7B%5Cmathbf%7Bv%7D%7D_2%24.%0A%20%20%20%204.%20Make%20every%20axis%20a%20versor%20by%20dividing%20it%20by%20its%20norm.%0A%0A%20%20%20%20The%20second%20axis%20is%20perpendicular%20to%20the%20plane%20of%20the%20three%20points%2C%20and%20the%20third%20lies%20in%20that%20plane%2C%20perpendicular%20to%20the%20first.%0A%0A%20%20%20%20For%20example%2C%20given%20the%20positions%20%24%5Coverrightarrow%7B%5Cmathbf%7Bm%7D%7D_1%20%3D%20%5B1%2C2%2C5%5D%2C%5C%3B%20%5Coverrightarrow%7B%5Cmathbf%7Bm%7D%7D_2%20%3D%20%5B2%2C3%2C3%5D%2C%5C%3B%20%5Coverrightarrow%7B%5Cmathbf%7Bm%7D%7D_3%20%3D%20%5B4%2C0%2C2%5D%24%2C%20a%20basis%20can%20be%20found%20with%3A%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(np)%3A%0A%20%20%20%20m1%20%3D%20np.array(%5B1%2C%202%2C%205%5D)%0A%20%20%20%20m2%20%3D%20np.array(%5B2%2C%203%2C%203%5D)%0A%20%20%20%20m3%20%3D%20np.array(%5B4%2C%200%2C%202%5D)%0A%0A%20%20%20%20v1%20%3D%20m2%20-%20m1%20%20%23%20first%20axis%0A%20%20%20%20v2%20%3D%20np.cross(v1%2C%20m3%20-%20m1)%20%20%23%20second%20axis%0A%20%20%20%20v3%20%3D%20np.cross(v1%2C%20v2)%20%20%23%20third%20axis%0A%0A%20%20%20%20%23%20Vector%20normalization%0A%20%20%20%20e1%20%3D%20v1%20%2F%20np.linalg.norm(v1)%0A%20%20%20%20e2%20%3D%20v2%20%2F%20np.linalg.norm(v2)%0A%20%20%20%20e3%20%3D%20v3%20%2F%20np.linalg.norm(v3)%0A%0A%20%20%20%20print(%22Versors%3A%22%2C%20%22%5Cne1%20%3D%22%2C%20e1%2C%20%22%5Cne2%20%3D%22%2C%20e2%2C%20%22%5Cne3%20%3D%22%2C%20e3)%0A%20%20%20%20print(%0A%20%20%20%20%20%20%20%20%22%5CnNorm%20of%20each%20versor%3A%22%2C%0A%20%20%20%20%20%20%20%20%22%5Cn%7C%7Ce1%7C%7C%20%3D%22%2C%20np.linalg.norm(e1)%2C%0A%20%20%20%20%20%20%20%20%22%5Cn%7C%7Ce2%7C%7C%20%3D%22%2C%20np.linalg.norm(e2)%2C%0A%20%20%20%20%20%20%20%20%22%5Cn%7C%7Ce3%7C%7C%20%3D%22%2C%20np.linalg.norm(e3)%2C%0A%20%20%20%20)%0A%20%20%20%20print(%0A%20%20%20%20%20%20%20%20%22%5CnTest%20of%20orthogonality%20(cross%20product%20between%20versors)%3A%22%2C%0A%20%20%20%20%20%20%20%20%22%5Cne1%20x%20e2%3A%22%2C%20np.linalg.norm(np.cross(e1%2C%20e2))%2C%0A%20%20%20%20%20%20%20%20%22%5Cne1%20x%20e3%3A%22%2C%20np.linalg.norm(np.cross(e1%2C%20e3))%2C%0A%20%20%20%20%20%20%20%20%22%5Cne2%20x%20e3%3A%22%2C%20np.linalg.norm(np.cross(e2%2C%20e3))%2C%0A%20%20%20%20)%0A%20%20%20%20return%20e1%2C%20e2%2C%20e3%2C%20m1%2C%20m2%2C%20m3%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%20Due%20to%20%5Brounding%20errors%5D(https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FRound-off_error)%20and%20to%20the%20%5Blimited%20precision%20of%20floating-point%20arithmetic%5D(https%3A%2F%2Fdocs.python.org%2F3%2Ftutorial%2Ffloatingpoint.html)%2C%20some%20of%20the%20results%20that%20should%20be%20exactly%201%20are%20not.%20We%20could%20round%20them%20if%20desired%3A%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(e1%2C%20e2%2C%20e3%2C%20np)%3A%0A%20%20%20%20print(%0A%20%20%20%20%20%20%20%20%22Test%20of%20orthogonality%20(cross%20product%20between%20versors)%3A%22%2C%0A%20%20%20%20%20%20%20%20%22%5Cne1%20x%20e2%3A%22%2C%20np.linalg.norm(np.cross(e1%2C%20e2)).round(8)%2C%0A%20%20%20%20%20%20%20%20%22%5Cne1%20x%20e3%3A%22%2C%20np.linalg.norm(np.cross(e1%2C%20e3)).round(8)%2C%0A%20%20%20%20%20%20%20%20%22%5Cne2%20x%20e3%3A%22%2C%20np.linalg.norm(np.cross(e2%2C%20e3)).round(8)%2C%0A%20%20%20%20)%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%20Or%20format%20the%20text%20that%20represents%20the%20result%3A%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(e1%2C%20e2%2C%20e3%2C%20np)%3A%0A%20%20%20%20print(%0A%20%20%20%20%20%20%20%20%22Test%20of%20orthogonality%20(cross%20product%20between%20versors)%3A%22%2C%0A%20%20%20%20%20%20%20%20f%22%5Cne1%20x%20e2%3A%20%7Bnp.linalg.norm(np.cross(e1%2C%20e2))%3Ag%7D%22%2C%0A%20%20%20%20%20%20%20%20f%22%5Cne1%20x%20e3%3A%20%7Bnp.linalg.norm(np.cross(e1%2C%20e3))%3Ag%7D%22%2C%0A%20%20%20%20%20%20%20%20f%22%5Cne2%20x%20e3%3A%20%7Bnp.linalg.norm(np.cross(e2%2C%20e3))%3Ag%7D%22%2C%0A%20%20%20%20)%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%20Here%20%60f%22%7Bx%3Ag%7D%22%60%20formats%20the%20number%20as%20a%20string%20in%20the%20%22general%22%20format%2C%20which%20drops%20trailing%20zeros%20and%20shows%20six%20significant%20digits%20by%20default%20(see%20the%20%5Bformat%20specification%5D(https%3A%2F%2Fdocs.python.org%2F3%2Flibrary%2Fstring.html%23format-specification-mini-language)%20and%20a%20%5BPython%20f-strings%20number%20formatting%20cheat%20sheet%5D(https%3A%2F%2Fcheatography.com%2Fbrianallan%2Fcheat-sheets%2Fpython-f-strings-number-formatting%2F)).%20For%20a%20permanent%20change%2C%20NumPy's%20%5B%60np.set_printoptions%60%5D(https%3A%2F%2Fnumpy.org%2Fdoc%2Fstable%2Freference%2Fgenerated%2Fnumpy.set_printoptions.html)%20sets%20the%20precision%20with%20which%20arrays%20are%20printed%3B%20it%20affects%20NumPy%20arrays%20only%2C%20not%20plain%20Python%20numbers.%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.**%20Before%20computing%20anything%2C%20predict%20the%20basis%20that%20the%20four%20steps%20give%20for%20markers%20placed%20on%20the%20laboratory's%20axes%3A%20%24%5Coverrightarrow%7B%5Cmathbf%7Bm%7D%7D_1%20%3D%20%5B0%2C0%2C0%5D%2C%5C%3B%20%5Coverrightarrow%7B%5Cmathbf%7Bm%7D%7D_2%20%3D%20%5B1%2C0%2C0%5D%2C%5C%3B%20%5Coverrightarrow%7B%5Cmathbf%7Bm%7D%7D_3%20%3D%20%5B0%2C1%2C0%5D%24.%20Which%20laboratory%20axis%20does%20each%20versor%20coincide%20with%3F%20Then%20check%20your%20answer%20with%20the%20code%20above.%0A%0A%20%20%20%20%2F%2F%2F%20details%20%7C%20Solution%20to%20Exercise%204%0A%20%20%20%20Following%20the%20steps%3A%0A%0A%20%20%20%20-%20%24%5Coverrightarrow%7B%5Cmathbf%7Bv%7D%7D_1%20%3D%20%5Coverrightarrow%7B%5Cmathbf%7Bm%7D%7D_2%20-%20%5Coverrightarrow%7B%5Cmathbf%7Bm%7D%7D_1%20%3D%20%5B1%2C%200%2C%200%5D%24%2C%20so%20%24%5Chat%7B%5Cmathbf%7Be%7D%7D_1%20%3D%20%5Chat%7B%5Cmathbf%7Bi%7D%7D%24.%0A%20%20%20%20-%20%24%5Coverrightarrow%7B%5Cmathbf%7Bv%7D%7D_2%20%3D%20%5Coverrightarrow%7B%5Cmathbf%7Bv%7D%7D_1%20%5Ctimes%20(%5Coverrightarrow%7B%5Cmathbf%7Bm%7D%7D_3%20-%20%5Coverrightarrow%7B%5Cmathbf%7Bm%7D%7D_1)%20%3D%20%5Chat%7B%5Cmathbf%7Bi%7D%7D%20%5Ctimes%20%5Chat%7B%5Cmathbf%7Bj%7D%7D%20%3D%20%5Chat%7B%5Cmathbf%7Bk%7D%7D%24%2C%20so%20%24%5Chat%7B%5Cmathbf%7Be%7D%7D_2%20%3D%20%5Chat%7B%5Cmathbf%7Bk%7D%7D%24.%0A%20%20%20%20-%20%24%5Coverrightarrow%7B%5Cmathbf%7Bv%7D%7D_3%20%3D%20%5Coverrightarrow%7B%5Cmathbf%7Bv%7D%7D_1%20%5Ctimes%20%5Coverrightarrow%7B%5Cmathbf%7Bv%7D%7D_2%20%3D%20%5Chat%7B%5Cmathbf%7Bi%7D%7D%20%5Ctimes%20%5Chat%7B%5Cmathbf%7Bk%7D%7D%20%3D%20-%5Chat%7B%5Cmathbf%7Bj%7D%7D%24%2C%20so%20%24%5Chat%7B%5Cmathbf%7Be%7D%7D_3%20%3D%20-%5Chat%7B%5Cmathbf%7Bj%7D%7D%24.%0A%0A%20%20%20%20The%20basis%20is%20not%20%24%5Chat%7B%5Cmathbf%7Bi%7D%7D%2C%20%5Chat%7B%5Cmathbf%7Bj%7D%7D%2C%20%5Chat%7B%5Cmathbf%7Bk%7D%7D%24%2C%20as%20one%20might%20guess%2C%20but%20%24%5Chat%7B%5Cmathbf%7Bi%7D%7D%2C%20%5Chat%7B%5Cmathbf%7Bk%7D%7D%2C%20-%5Chat%7B%5Cmathbf%7Bj%7D%7D%24%3A%20the%20recipe%20always%20makes%20the%20second%20versor%20perpendicular%20to%20the%20plane%20of%20the%20markers%20and%20puts%20the%20third%20one%20in%20that%20plane.%20It%20is%20still%20right-handed%2C%20since%20%24%5Chat%7B%5Cmathbf%7Bi%7D%7D%20%5Ctimes%20%5Chat%7B%5Cmathbf%7Bk%7D%7D%20%3D%20-%5Chat%7B%5Cmathbf%7Bj%7D%7D%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%23%20Is%20that%20a%20good%20test%20of%20orthogonality%3F%0A%0A%20%20%20%20The%20test%20above%20relies%20on%20a%20true%20fact%3A%20for%20two%20versors%2C%20%24%5CVert%5Chat%7B%5Cmathbf%7Ba%7D%7D%20%5Ctimes%20%5Chat%7B%5Cmathbf%7Bb%7D%7D%5CVert%20%3D%20%5Csin%5Ctheta%24%2C%20which%20equals%201%20when%20they%20are%20perpendicular.%20But%20a%20test%20is%20only%20as%20good%20as%20its%20ability%20to%20fail%20when%20something%20is%20wrong.%0A%0A%20%20%20%20**Before%20you%20run%20the%20next%20cell**%2C%20predict%3A%20if%20two%20versors%20were%2089%C2%B0%20apart%20instead%20of%2090%C2%B0%2C%20what%20would%20the%20norm%20of%20their%20cross%20product%20be%3F%20And%20their%20dot%20product%3F%0A%0A%20%20%20%20The%20function%20below%20computes%20the%20angle%20between%20two%20vectors%20from%20the%20dot%20product%20(see%20%5BScalar%20and%20vector%5D(https%3A%2F%2Fmolab.marimo.io%2Fgithub%2FBMClab%2FBMC%2Fblob%2Fmaster%2Fnotebooks%2Fscalar_vector.py)).%20We%20will%20use%20it%20again%20later.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.function%0Adef%20angle_between(u%2C%20w)%3A%0A%20%20%20%20%22%22%22Angle%20in%20degrees%20between%20the%20vectors%20%60u%60%20and%20%60w%60%20(along%20the%20last%20axis).%22%22%22%0A%20%20%20%20import%20numpy%20as%20np%0A%0A%20%20%20%20u%20%3D%20np.asarray(u%2C%20dtype%3Dfloat)%0A%20%20%20%20w%20%3D%20np.asarray(w%2C%20dtype%3Dfloat)%0A%20%20%20%20cos%20%3D%20np.sum(u%20*%20w%2C%20axis%3D-1)%20%2F%20(np.linalg.norm(u%2C%20axis%3D-1)%20*%20np.linalg.norm(w%2C%20axis%3D-1))%0A%20%20%20%20return%20np.degrees(np.arccos(np.clip(cos%2C%20-1%2C%201)))%0A%0A%0A%40app.cell%0Adef%20_(np)%3A%0A%20%20%20%20for%20_deg%20in%20%5B90%2C%2089%2C%2085%5D%3A%0A%20%20%20%20%20%20%20%20_theta%20%3D%20np.radians(_deg)%0A%20%20%20%20%20%20%20%20_a%20%3D%20np.array(%5B1%2C%200%2C%200%5D)%0A%20%20%20%20%20%20%20%20_b%20%3D%20np.array(%5Bnp.cos(_theta)%2C%20np.sin(_theta)%2C%200%5D)%0A%20%20%20%20%20%20%20%20print(%0A%20%20%20%20%20%20%20%20%20%20%20%20f%22%7Bangle_between(_a%2C%20_b)%3A4.0f%7D%20degrees%20apart%3A%22%0A%20%20%20%20%20%20%20%20%20%20%20%20f%22%20%20%7Ca%20x%20b%7C%20%3D%20%7Bnp.linalg.norm(np.cross(_a%2C%20_b))%3A.5f%7D%2C%20%20a%20.%20b%20%3D%20%7Bnp.dot(_a%2C%20_b)%3A.5f%7D%22%0A%20%20%20%20%20%20%20%20)%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%20An%20error%20of%20one%20degree%20changes%20the%20norm%20of%20the%20cross%20product%20in%20the%20fourth%20decimal%20place%2C%20and%20an%20error%20of%20five%20degrees%20only%20in%20the%20third.%20The%20sine%20is%20flat%20near%2090%C2%B0%2C%20so%20the%20cross%20product%20test%20is%20nearly%20blind%20exactly%20where%20we%20use%20it.%20The%20cosine%20is%20steep%20there%3A%20the%20dot%20product%20moves%20from%200%20to%200.017%20for%20one%20degree.%20**Test%20orthogonality%20with%20the%20dot%20product**%2C%20which%20should%20be%20zero.%0A%0A%20%20%20%20There%20is%20a%20second%20property%20that%20the%20cross%20product%20test%20cannot%20check%20at%20all%3A%20handedness.%20A%20basis%20whose%20third%20versor%20points%20the%20wrong%20way%20passes%20every%20test%20of%20length%20and%20orthogonality.%20For%20a%20right-handed%20basis%2C%20%24%5Chat%7B%5Cmathbf%7Be%7D%7D_1%20%5Ctimes%20%5Chat%7B%5Cmathbf%7Be%7D%7D_2%20%3D%20%5Chat%7B%5Cmathbf%7Be%7D%7D_3%24%3B%20equivalently%2C%20the%20determinant%20of%20the%20matrix%20with%20the%20versors%20as%20its%20rows%20is%20%24%2B1%24%20(and%20%24-1%24%20for%20a%20left-handed%20basis)%3A%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(e1%2C%20e2%2C%20e3%2C%20np)%3A%0A%20%20%20%20print(%0A%20%20%20%20%20%20%20%20%22Test%20of%20orthogonality%20(dot%20product%20between%20versors)%3A%22%2C%0A%20%20%20%20%20%20%20%20f%22%5Cne1%20.%20e2%3A%20%7Bnp.dot(e1%2C%20e2)%3A.1e%7D%22%2C%0A%20%20%20%20%20%20%20%20f%22%5Cne1%20.%20e3%3A%20%7Bnp.dot(e1%2C%20e3)%3A.1e%7D%22%2C%0A%20%20%20%20%20%20%20%20f%22%5Cne2%20.%20e3%3A%20%7Bnp.dot(e2%2C%20e3)%3A.1e%7D%22%2C%0A%20%20%20%20)%0A%20%20%20%20print(%22%5CnTest%20of%20handedness%3A%22)%0A%20%20%20%20print(%22e1%20x%20e2%20-%20e3%20%3D%22%2C%20np.cross(e1%2C%20e2)%20-%20e3)%0A%20%20%20%20print(f%22det(%5Be1%2C%20e2%2C%20e3%5D)%20%3D%20%7Bnp.linalg.det(np.vstack((e1%2C%20e2%2C%20e3)))%3Ag%7D%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%20dot%20products%20are%20zero%20to%20within%20%2410%5E%7B-16%7D%24%20and%20the%20basis%20is%20right-handed%2C%20as%20the%20construction%20guarantees%3A%20%24%5Coverrightarrow%7B%5Cmathbf%7Bv%7D%7D_3%20%3D%20%5Coverrightarrow%7B%5Cmathbf%7Bv%7D%7D_1%20%5Ctimes%20%5Coverrightarrow%7B%5Cmathbf%7Bv%7D%7D_2%24%20is%2C%20by%20definition%2C%20the%20third%20axis%20of%20a%20right-handed%20set.%0A%0A%20%20%20%20**Exercise%205.**%20A%20colleague%20hands%20you%20three%20versors%2C%20%24%5Chat%7B%5Cmathbf%7Bu%7D%7D_1%20%3D%20%5B0.6%2C%200.8%2C%200%5D%24%2C%20%24%5Chat%7B%5Cmathbf%7Bu%7D%7D_2%20%3D%20%5B-0.8%2C%200.6%2C%200%5D%24%20and%20%24%5Chat%7B%5Cmathbf%7Bu%7D%7D_3%20%3D%20%5B0%2C%200%2C%20-1%5D%24%2C%20as%20the%20basis%20of%20a%20segment.%20Is%20it%20orthonormal%3F%20Is%20it%20right-handed%3F%20If%20it%20is%20not%2C%20what%20is%20the%20smallest%20change%20that%20makes%20it%20right-handed%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%2C%20np)%3A%0A%20%20%20%20_u1%20%3D%20np.array(%5B0.6%2C%200.8%2C%200%5D)%0A%20%20%20%20_u2%20%3D%20np.array(%5B-0.8%2C%200.6%2C%200%5D)%0A%20%20%20%20_u3%20%3D%20np.array(%5B0%2C%200%2C%20-1%5D)%0A%20%20%20%20_dots%20%3D%20%5Bround(float(np.dot(_p%2C%20_q))%2C%2012)%20%2B%200.0%20for%20_p%2C%20_q%20in%20%5B(_u1%2C%20_u2)%2C%20(_u1%2C%20_u3)%2C%20(_u2%2C%20_u3)%5D%5D%0A%20%20%20%20_norms%20%3D%20%5Bnp.linalg.norm(_u)%20for%20_u%20in%20(_u1%2C%20_u2%2C%20_u3)%5D%0A%20%20%20%20_det%20%3D%20np.linalg.det(np.vstack((_u1%2C%20_u2%2C%20_u3)))%0A%20%20%20%20_cross%20%3D%20np.cross(_u1%2C%20_u2)%20%2B%200.0%0A%20%20%20%20mo.accordion(%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%22Solution%20to%20Exercise%205%22%3A%20mo.md(%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20rf%22%22%22%0A%20%20%20%20The%20dot%20products%20are%20%7B%22%2C%20%22.join(f%22%7B_d%3Ag%7D%22%20for%20_d%20in%20_dots)%7D%20and%20the%20norms%20are%20%7B%22%2C%20%22.join(f%22%7B_n%3Ag%7D%22%20for%20_n%20in%20_norms)%7D%3A%20the%20basis%20is%20**orthonormal**.%0A%0A%20%20%20%20But%20%24%5Chat%7B%7B%5Cmathbf%7B%7Bu%7D%7D%7D%7D_1%20%5Ctimes%20%5Chat%7B%7B%5Cmathbf%7B%7Bu%7D%7D%7D%7D_2%20%3D%20%7B_cross.tolist()%7D%24%2C%20which%20is%20%24-%5Chat%7B%7B%5Cmathbf%7B%7Bu%7D%7D%7D%7D_3%24%2C%20and%20the%20determinant%20of%20the%20matrix%20with%20the%20versors%20as%20rows%20is%20**%7B_det%3Ag%7D**%3A%20the%20basis%20is%20**left-handed**.%0A%0A%20%20%20%20Reversing%20any%20one%20of%20the%20versors%20makes%20it%20right-handed.%20The%20natural%20choice%20here%20is%20%24%5Chat%7B%7B%5Cmathbf%7B%7Bu%7D%7D%7D%7D_3%20%3D%20%5B0%2C%200%2C%201%5D%24%2C%20the%20cross%20product%20of%20the%20other%20two.%20Swapping%20two%20of%20the%20versors%20would%20also%20do%20it%2C%20but%20it%20changes%20which%20axis%20is%20which%2C%20which%20is%20usually%20worse.%0A%20%20%20%20%22%22%22%0A%20%20%20%20%20%20%20%20%20%20%20%20)%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20)%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%20Coordinate%20system%3A%20origin%20and%20basis%0A%0A%20%20%20%20To%20define%20a%20coordinate%20system%20from%20the%20basis%20we%20also%20need%20an%20origin.%20In%20principle%20any%20point%20would%20do%2C%20but%20if%20the%20coordinate%20system%20should%20follow%20anatomical%20conventions%2C%20with%20its%20origin%20at%20a%20joint%20centre%2C%20for%20example%2C%20then%20both%20the%20basis%20and%20the%20origin%20must%20be%20calculated%20according%20to%20the%20standards%20discussed%20before.%0A%0A%20%20%20%20If%20the%20coordinate%20system%20is%20a%20technical%20one%20and%20not%20anatomically%20based%2C%20a%20common%20procedure%20in%20motion%20analysis%20is%20to%20place%20its%20origin%20at%20the%20centroid%20(average%20position)%20of%20the%20markers.%20Averaging%20the%20positions%20of%20several%20markers%20reduces%20the%20effect%20of%20noise%2C%20for%20example%20from%20soft%20tissue%20artifacts%2C%20on%20the%20location%20of%20the%20origin.%0A%0A%20%20%20%20For%20the%20markers%20in%20the%20example%20above%2C%20the%20origin%20of%20the%20coordinate%20system%20is%3A%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(m1%2C%20m2%2C%20m3%2C%20np)%3A%0A%20%20%20%20origin%20%3D%20np.mean((m1%2C%20m2%2C%20m3)%2C%20axis%3D0)%0A%0A%20%20%20%20print(%22Origin%3A%22%2C%20origin)%0A%20%20%20%20return%20(origin%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%23%23%20Visualization%20of%20the%20coordinate%20system%0A%0A%20%20%20%20Let's%20plot%20the%20coordinate%20system%20with%20the%20function%20%60CCS%60%2C%20from%20the%20file%20%60CCS.py%60%20in%20the%20%60functions%60%20folder%20of%20this%20repository.%20The%20first%20cell%20adds%20that%20folder%20to%20Python's%20search%20path.%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_()%3A%0A%20%20%20%20try%3A%0A%20%20%20%20%20%20%20%20from%20notebook_resources%20import%20repo_file%0A%20%20%20%20except%20ModuleNotFoundError%20as%20_error%3A%0A%20%20%20%20%20%20%20%20if%20_error.name%20!%3D%20%22notebook_resources%22%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20raise%0A%20%20%20%20%20%20%20%20raise%20ModuleNotFoundError(%0A%20%20%20%20%20%20%20%20%20%20%20%20%22This%20notebook%20needs%20notebook_resources.py.%20Download%20it%20from%3A%5Cn%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%22https%3A%2F%2Fraw.githubusercontent.com%2FBMClab%2FBMC%2Fmaster%2Ffunctions%2Fnotebook_resources.py%5Cn%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%22Save%20it%20in%20the%20same%20folder%20as%20this%20notebook%2C%20then%20rerun%20this%20cell.%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20name%3D%22notebook_resources%22%2C%0A%20%20%20%20%20%20%20%20)%20from%20None%0A%20%20%20%20return%20(repo_file%2C)%0A%0A%0A%40app.cell%0Adef%20_(repo_file)%3A%0A%20%20%20%20import%20sys%0A%0A%20%20%20%20sys.path.insert(0%2C%20str(repo_file(%22functions%2FCCS.py%22).parent))%20%20%23%20add%20to%20pythonpath%0A%20%20%20%20from%20CCS%20import%20CCS%0A%0A%20%20%20%20return%20(CCS%2C)%0A%0A%0A%40app.cell%0Adef%20_(e1%2C%20e2%2C%20e3%2C%20m1%2C%20m2%2C%20m3%2C%20np)%3A%0A%20%20%20%20markers%20%3D%20np.vstack((m1%2C%20m2%2C%20m3))%0A%20%20%20%20basis%20%3D%20np.vstack((e1%2C%20e2%2C%20e3))%0A%20%20%20%20return%20basis%2C%20markers%0A%0A%0A%40app.cell%0Adef%20_(CCS%2C%20basis%2C%20markers%2C%20origin)%3A%0A%20%20%20%20_ccs%20%3D%20CCS(xyz%3D%5B%5D%2C%20Oijk%3Dorigin%2C%20ijk%3Dbasis%2C%20point%3Dmarkers%2C%20vector%3DTrue)%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%20black%20arrows%20are%20the%20axes%20of%20the%20laboratory%3B%20the%20yellow%20arrows%20are%20the%20position%20vectors%20of%20the%20three%20markers%3B%20and%20the%20red%2C%20green%20and%20blue%20arrows%2C%20which%20%60CCS%60%20labels%20i%2C%20j%20and%20k%2C%20are%20the%20versors%20%24%5Chat%7B%5Cmathbf%7Be%7D%7D_1%2C%20%5Chat%7B%5Cmathbf%7Be%7D%7D_2%2C%20%5Chat%7B%5Cmathbf%7Be%7D%7D_3%24%2C%20drawn%20from%20the%20new%20origin.%20The%20green%20versor%20is%20perpendicular%20to%20the%20triangle%20formed%20by%20the%20three%20markers.%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%20Gram%E2%80%93Schmidt%20process%0A%0A%20%20%20%20Another%20classical%20procedure%2C%20this%20one%20built%20on%20the%20scalar%20product%2C%20is%20the%20%5BGram%E2%80%93Schmidt%20process%5D(https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FGram%25E2%2580%2593Schmidt_process).%20It%20orthonormalizes%20a%20set%20of%20vectors%2C%20turning%20them%20into%20mutually%20orthogonal%20versors%2C%20and%20it%20works%20for%20any%20number%20of%20vectors.%20See%20%5BScalar%20and%20vector%5D(https%3A%2F%2Fmolab.marimo.io%2Fgithub%2FBMClab%2FBMC%2Fblob%2Fmaster%2Fnotebooks%2Fscalar_vector.py)%20for%20another%20demonstration.%0A%0A%20%20%20%20Given%20three%20vectors%20in%203D%20space%2C%20%24%5Coverrightarrow%7B%5Cmathbf%7Ba%7D%7D%2C%20%5Coverrightarrow%7B%5Cmathbf%7Bb%7D%7D%2C%20%5Coverrightarrow%7B%5Cmathbf%7Bc%7D%7D%24%2C%20a%20basis%20%24%5C%7B%5Chat%7Be%7D_a%2C%20%5Chat%7Be%7D_b%2C%20%5Chat%7Be%7D_c%5C%7D%24%20is%20found%20as%20follows.%20The%20first%20versor%20is%20in%20the%20direction%20of%20%24%5Coverrightarrow%7B%5Cmathbf%7Ba%7D%7D%24%20(or%20of%20any%20of%20the%20other%20vectors)%3A%0A%0A%20%20%20%20%24%24%0A%20%20%20%20%5Chat%7Be%7D_a%20%3D%20%5Cfrac%7B%5Coverrightarrow%7B%5Cmathbf%7Ba%7D%7D%7D%7B%7C%7C%5Coverrightarrow%7B%5Cmathbf%7Ba%7D%7D%7C%7C%7D%0A%20%20%20%20%24%24%0A%0A%20%20%20%20For%20the%20second%20versor%2C%20orthogonal%20to%20%24%5Chat%7Be%7D_a%24%2C%20write%20%24%5Coverrightarrow%7B%5Cmathbf%7Bb%7D%7D%24%20as%20a%20part%20along%20%24%5Chat%7Be%7D_a%24%20plus%20a%20part%20perpendicular%20to%20it%3A%0A%0A%20%20%20%20%24%24%0A%20%20%20%20%5Coverrightarrow%7B%5Cmathbf%7Bb%7D%7D%20%3D%20%5Coverrightarrow%7B%5Cmathbf%7Bb%7D%7D%5E%5C%7C%20%2B%20%5Coverrightarrow%7B%5Cmathbf%7Bb%7D%7D%5E%5Cbot%0A%20%20%20%20%24%24%0A%0A%20%20%20%20The%20parallel%20part%20is%20what%20the%20dot%20product%20gives%20us%2C%20so%0A%0A%20%20%20%20%24%24%0A%20%20%20%20%5Coverrightarrow%7B%5Cmathbf%7Bb%7D%7D%5E%5Cbot%20%3D%20%5Coverrightarrow%7B%5Cmathbf%7Bb%7D%7D%20-%20%5Coverrightarrow%7B%5Cmathbf%7Bb%7D%7D%5E%5C%7C%20%3D%20%5Coverrightarrow%7B%5Cmathbf%7Bb%7D%7D%20-%20(%5Coverrightarrow%7B%5Cmathbf%7Bb%7D%7D%20%5Ccdot%20%5Chat%7Be%7D_a%20)%20%5Chat%7Be%7D_a%0A%20%20%20%20%24%24%0A%0A%20%20%20%20and%20finally%0A%0A%20%20%20%20%24%24%0A%20%20%20%20%5Chat%7Be%7D_b%20%3D%20%5Cfrac%7B%5Coverrightarrow%7B%5Cmathbf%7Bb%7D%7D%5E%5Cbot%7D%7B%7C%7C%5Coverrightarrow%7B%5Cmathbf%7Bb%7D%7D%5E%5Cbot%7C%7C%7D%0A%20%20%20%20%24%24%0A%0A%20%20%20%20The%20third%20versor%2C%20orthogonal%20to%20both%20%24%5Chat%7Be%7D_a%24%20and%20%24%5Chat%7Be%7D_b%24%2C%20is%20found%20the%20same%20way%2C%20by%20removing%20from%20%24%5Coverrightarrow%7B%5Cmathbf%7Bc%7D%7D%24%20its%20parts%20along%20the%20two%20directions%20already%20fixed%3A%0A%0A%20%20%20%20%24%24%0A%20%20%20%20%5Coverrightarrow%7B%5Cmathbf%7Bc%7D%7D%20%3D%20%5Coverrightarrow%7B%5Cmathbf%7Bc%7D%7D%5E%5C%7C%20%2B%20%5Coverrightarrow%7B%5Cmathbf%7Bc%7D%7D%5E%5Cbot%2C%0A%20%20%20%20%5Cqquad%0A%20%20%20%20%5Coverrightarrow%7B%5Cmathbf%7Bc%7D%7D%5E%5C%7C%20%3D%20(%5Coverrightarrow%7B%5Cmathbf%7Bc%7D%7D%20%5Ccdot%20%5Chat%7Be%7D_a%20)%20%5Chat%7Be%7D_a%20%2B%20(%5Coverrightarrow%7B%5Cmathbf%7Bc%7D%7D%20%5Ccdot%20%5Chat%7Be%7D_b%20)%20%5Chat%7Be%7D_b%0A%20%20%20%20%24%24%0A%0A%20%20%20%20%24%24%0A%20%20%20%20%5Coverrightarrow%7B%5Cmathbf%7Bc%7D%7D%5E%5Cbot%20%3D%20%5Coverrightarrow%7B%5Cmathbf%7Bc%7D%7D%20-%20%5Coverrightarrow%7B%5Cmathbf%7Bc%7D%7D%5E%5C%7C%2C%0A%20%20%20%20%5Cqquad%0A%20%20%20%20%5Chat%7Be%7D_c%20%3D%20%5Cfrac%7B%5Coverrightarrow%7B%5Cmathbf%7Bc%7D%7D%5E%5Cbot%7D%7B%7C%7C%5Coverrightarrow%7B%5Cmathbf%7Bc%7D%7D%5E%5Cbot%7C%7C%7D%0A%20%20%20%20%24%24%0A%0A%20%20%20%20Here%20is%20an%20animation%20of%20the%20process%20at%20work%3A%0A%0A%20%20%20%20%3Cfigure%20aria-describedby%3D%22figure-caption-5%22%3E%3Ccenter%3E%3Cimg%20src%3D%22https%3A%2F%2Fupload.wikimedia.org%2Fwikipedia%2Fcommons%2Fe%2Fee%2FGram-Schmidt_orthonormalization_process.gif%22%20width%3D450%20alt%3D%22animation%20of%20the%20Gram-Schmidt%20process%22%2F%3E%3C%2Fcenter%3E%3C%2Ffigure%3E%0A%0A%20%20%20%20%3Cspan%20id%3D%22figure-caption-5%22%20class%3D%22figure-caption%22%20style%3D%22display%3Ablock%3Btext-align%3Acenter%3Bfont-style%3Aitalic%22%3EFigure.%20The%20Gram%E2%80%93Schmidt%20process%20executed%20on%20three%20vectors%20of%20a%20basis%20for%20R%3Csup%3E3%3C%2Fsup%3E%20(%3Ca%20href%3D%22https%3A%2F%2Fcommons.wikimedia.org%2Fw%2Findex.php%3Fcurid%3D24396471%22%3Eimage%20from%20Wikipedia%3C%2Fa%3E).%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%20Let's%20implement%20the%20Gram%E2%80%93Schmidt%20process%20in%20Python%2C%20using%20the%20positions%20we%20saw%20before%2C%20%24%5Coverrightarrow%7B%5Cmathbf%7Bm%7D%7D_1%20%3D%20%5B1%2C2%2C5%5D%2C%5C%3B%20%5Coverrightarrow%7B%5Cmathbf%7Bm%7D%7D_2%20%3D%20%5B2%2C3%2C3%5D%2C%5C%3B%20%5Coverrightarrow%7B%5Cmathbf%7Bm%7D%7D_3%20%3D%20%5B4%2C0%2C2%5D%24%2C%20as%20the%20three%20vectors.%20The%20first%20versor%20is%3A%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(m1%2C%20np)%3A%0A%20%20%20%20ea%20%3D%20m1%20%2F%20np.linalg.norm(m1)%0A%0A%20%20%20%20print(ea)%0A%20%20%20%20return%20(ea%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%20The%20second%20versor%3A%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(ea%2C%20m2%2C%20np)%3A%0A%20%20%20%20eb%20%3D%20m2%20-%20np.dot(m2%2C%20ea)%20*%20ea%0A%20%20%20%20eb%20%3D%20eb%20%2F%20np.linalg.norm(eb)%0A%0A%20%20%20%20print(eb)%0A%20%20%20%20return%20(eb%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%20And%20the%20third%20versor%3A%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(ea%2C%20eb%2C%20m3%2C%20np)%3A%0A%20%20%20%20ec%20%3D%20m3%20-%20np.dot(m3%2C%20ea)%20*%20ea%20-%20np.dot(m3%2C%20eb)%20*%20eb%0A%20%20%20%20ec%20%3D%20ec%20%2F%20np.linalg.norm(ec)%0A%0A%20%20%20%20print(ec)%0A%20%20%20%20return%20(ec%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%20Let's%20check%20the%20orthonormality%20of%20these%20versors%3A%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(ea%2C%20eb%2C%20ec%2C%20np)%3A%0A%20%20%20%20print(%22Versors%3A%22%2C%20%22%5Cnea%20%3D%22%2C%20ea%2C%20%22%5Cneb%20%3D%22%2C%20eb%2C%20%22%5Cnec%20%3D%22%2C%20ec)%0A%20%20%20%20print(%0A%20%20%20%20%20%20%20%20%22%5CnNorm%20of%20each%20versor%3A%22%2C%0A%20%20%20%20%20%20%20%20%22%5Cn%7C%7Cea%7C%7C%20%3D%22%2C%20np.linalg.norm(ea)%2C%0A%20%20%20%20%20%20%20%20%22%5Cn%7C%7Ceb%7C%7C%20%3D%22%2C%20np.linalg.norm(eb)%2C%0A%20%20%20%20%20%20%20%20%22%5Cn%7C%7Cec%7C%7C%20%3D%22%2C%20np.linalg.norm(ec)%2C%0A%20%20%20%20)%0A%20%20%20%20print(%0A%20%20%20%20%20%20%20%20%22%5CnTest%20of%20orthogonality%20(scalar%20product%20between%20versors)%3A%22%2C%0A%20%20%20%20%20%20%20%20%22%5Cnea%20.%20eb%3A%22%2C%20np.dot(ea%2C%20eb)%2C%0A%20%20%20%20%20%20%20%20%22%5Cneb%20.%20ec%3A%22%2C%20np.dot(eb%2C%20ec)%2C%0A%20%20%20%20%20%20%20%20%22%5Cnec%20.%20ea%3A%22%2C%20np.dot(ec%2C%20ea)%2C%0A%20%20%20%20)%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%20A%20perfectly%20good%20orthonormal%20basis.%20But%20is%20it%20a%20good%20coordinate%20system%20for%20the%20segment%20that%20carries%20the%20three%20markers%3F%0A%0A%20%20%20%20%23%23%23%20A%20basis%20that%20belongs%20to%20the%20laboratory%0A%0A%20%20%20%20Let's%20collect%20both%20methods%20in%20functions%2C%20so%20we%20can%20apply%20them%20to%20other%20markers%3A%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.function%0Adef%20gram_schmidt(a%2C%20b%2C%20c)%3A%0A%20%20%20%20%22%22%22Orthonormal%20basis%20from%20the%20vectors%20%60a%60%2C%20%60b%60%2C%20%60c%60%20by%20the%20Gram%E2%80%93Schmidt%20process.%0A%0A%20%20%20%20The%20first%20versor%20is%20along%20%60a%60%2C%20the%20second%20is%20the%20part%20of%20%60b%60%20perpendicular%0A%20%20%20%20to%20the%20first%2C%20and%20the%20third%20is%20the%20part%20of%20%60c%60%20perpendicular%20to%20both.%0A%20%20%20%20%22%22%22%0A%20%20%20%20import%20numpy%20as%20np%0A%0A%20%20%20%20ea%20%3D%20a%20%2F%20np.linalg.norm(a)%0A%20%20%20%20eb%20%3D%20b%20-%20np.dot(b%2C%20ea)%20*%20ea%0A%20%20%20%20eb%20%3D%20eb%20%2F%20np.linalg.norm(eb)%0A%20%20%20%20ec%20%3D%20c%20-%20np.dot(c%2C%20ea)%20*%20ea%20-%20np.dot(c%2C%20eb)%20*%20eb%0A%20%20%20%20ec%20%3D%20ec%20%2F%20np.linalg.norm(ec)%0A%20%20%20%20return%20ea%2C%20eb%2C%20ec%0A%0A%0A%40app.function%0Adef%20cross_product_basis(m1%2C%20m2%2C%20m3)%3A%0A%20%20%20%20%22%22%22Orthonormal%20basis%20from%20the%20positions%20of%20three%20noncollinear%20markers.%0A%0A%20%20%20%20The%20first%20versor%20is%20along%20m2%20-%20m1%2C%20the%20second%20is%20perpendicular%20to%20the%20plane%0A%20%20%20%20of%20the%20markers%2C%20and%20the%20third%20completes%20a%20right-handed%20basis.%0A%20%20%20%20%22%22%22%0A%20%20%20%20import%20numpy%20as%20np%0A%0A%20%20%20%20v1%20%3D%20m2%20-%20m1%0A%20%20%20%20v2%20%3D%20np.cross(v1%2C%20m3%20-%20m1)%0A%20%20%20%20v3%20%3D%20np.cross(v1%2C%20v2)%0A%20%20%20%20return%20tuple(v%20%2F%20np.linalg.norm(v)%20for%20v%20in%20(v1%2C%20v2%2C%20v3))%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%20imagine%20that%20the%20motion%20capture%20system%20had%20been%20calibrated%20with%20the%20origin%20of%20the%20laboratory%20one%20unit%20further%20along%20%24-X%24.%20The%20markers%20have%20not%20moved%3B%20only%20the%20numbers%20that%20describe%20them%20have%2C%20all%20of%20them%20shifted%20by%20%24%5B1%2C%200%2C%200%5D%24.%0A%0A%20%20%20%20**Before%20you%20run%20the%20next%20cell**%2C%20predict%3A%20does%20the%20basis%20from%20the%20Gram%E2%80%93Schmidt%20process%20change%3F%20Does%20the%20basis%20from%20the%20cross%20product%3F%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(m1%2C%20m2%2C%20m3%2C%20np)%3A%0A%20%20%20%20_shift%20%3D%20np.array(%5B1%2C%200%2C%200%5D)%0A%20%20%20%20_gs%20%3D%20gram_schmidt(m1%2C%20m2%2C%20m3)%0A%20%20%20%20_gs_shifted%20%3D%20gram_schmidt(m1%20%2B%20_shift%2C%20m2%20%2B%20_shift%2C%20m3%20%2B%20_shift)%0A%20%20%20%20_cp%20%3D%20cross_product_basis(m1%2C%20m2%2C%20m3)%0A%20%20%20%20_cp_shifted%20%3D%20cross_product_basis(m1%20%2B%20_shift%2C%20m2%20%2B%20_shift%2C%20m3%20%2B%20_shift)%0A%0A%20%20%20%20print(%22How%20much%20each%20versor%20turned%20when%20the%20laboratory%20origin%20moved%20%5Bdegrees%5D%3A%22)%0A%20%20%20%20print(%22%20%20Gram-Schmidt%20on%20the%20positions%3A%20%22%2C%20%5Bround(float(angle_between(u%2C%20w))%2C%202)%20for%20u%2C%20w%20in%20zip(_gs%2C%20_gs_shifted)%5D)%0A%20%20%20%20print(%22%20%20cross%20product%20of%20differences%3A%20%20%22%2C%20%5Bround(float(angle_between(u%2C%20w))%2C%202)%20for%20u%2C%20w%20in%20zip(_cp%2C%20_cp_shifted)%5D)%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%20markers%20did%20not%20move%2C%20and%20yet%20the%20Gram%E2%80%93Schmidt%20basis%20turned%20by%207%20to%2010%20degrees.%20Shift%20the%20origin%20further%20and%20it%20turns%20further.%20The%20cross-product%20basis%20did%20not%20change%20at%20all.%0A%0A%20%20%20%20The%20difference%20is%20in%20what%20each%20method%20was%20fed.%20The%20Gram%E2%80%93Schmidt%20process%20above%20was%20applied%20to%20the%20*position%20vectors*%20of%20the%20markers%2C%20the%20arrows%20from%20the%20laboratory's%20origin%20to%20each%20marker%2C%20and%20those%20arrows%20depend%20on%20where%20that%20origin%20happens%20to%20be.%20The%20cross-product%20recipe%20uses%20only%20*differences*%20between%20markers%2C%20%24%5Coverrightarrow%7B%5Cmathbf%7Bm%7D%7D_2%20-%20%5Coverrightarrow%7B%5Cmathbf%7Bm%7D%7D_1%24%20and%20%24%5Coverrightarrow%7B%5Cmathbf%7Bm%7D%7D_3%20-%20%5Coverrightarrow%7B%5Cmathbf%7Bm%7D%7D_1%24%2C%20which%20are%20the%20same%20wherever%20the%20origin%20is.%20A%20coordinate%20system%20for%20a%20body%20segment%20must%20depend%20on%20the%20segment%20alone%2C%20so%20it%20must%20be%20built%20from%20differences.%0A%0A%20%20%20%20The%20Gram%E2%80%93Schmidt%20process%20is%20not%20to%20blame%3B%20it%20was%20simply%20given%20the%20wrong%20vectors.%20Fed%20with%20differences%2C%20it%20works.%20With%20three%20markers%20there%20are%20only%20two%20independent%20differences%2C%20so%20the%20process%20gives%20two%20versors%2C%20both%20in%20the%20plane%20of%20the%20markers%2C%20and%20the%20cross%20product%20supplies%20the%20third%3A%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(e1%2C%20e2%2C%20e3%2C%20m1%2C%20m2%2C%20m3%2C%20np)%3A%0A%20%20%20%20_a%2C%20_b%20%3D%20m2%20-%20m1%2C%20m3%20-%20m1%20%20%23%20differences%20between%20markers%0A%20%20%20%20_fa%20%3D%20_a%20%2F%20np.linalg.norm(_a)%0A%20%20%20%20_fb%20%3D%20_b%20-%20np.dot(_b%2C%20_fa)%20*%20_fa%0A%20%20%20%20_fb%20%3D%20_fb%20%2F%20np.linalg.norm(_fb)%0A%20%20%20%20_fc%20%3D%20np.cross(_fa%2C%20_fb)%0A%0A%20%20%20%20print(%22Gram-Schmidt%20on%20differences%3A%22%2C%20%22%5Cnfa%20%3D%22%2C%20_fa%2C%20%22%5Cnfb%20%3D%22%2C%20_fb%2C%20%22%5Cnfc%20%3D%22%2C%20_fc)%0A%20%20%20%20print(%22%5CnCompared%20with%20the%20cross-product%20basis%3A%22)%0A%20%20%20%20print(%22fa%20equals%20%20e1%3A%22%2C%20np.allclose(_fa%2C%20e1))%0A%20%20%20%20print(%22fb%20equals%20-e3%3A%22%2C%20np.allclose(_fb%2C%20-e3))%0A%20%20%20%20print(%22fc%20equals%20%20e2%3A%22%2C%20np.allclose(_fc%2C%20e2))%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%20two%20methods%20give%20the%20same%20three%20axes%2C%20with%20different%20names%20and%20one%20of%20them%20pointing%20the%20opposite%20way.%20Neither%20is%20wrong.%20Which%20axis%20is%20called%20the%20first%20one%2C%20and%20which%20way%20each%20one%20points%2C%20are%20*conventions*%2C%20and%20conventions%20are%20exactly%20what%20an%20anatomical%20coordinate%20system%20has%20to%20fix.%0A%0A%20%20%20%20**Challenge%201.**%20In%20a%20new%20cell%2C%20plot%20the%20Gram%E2%80%93Schmidt%20basis%20built%20from%20the%20differences%20with%20%60CCS%60%2C%20using%20the%20same%20origin%20and%20markers%20as%20before%2C%20and%20compare%20the%20figure%20with%20the%20one%20for%20the%20cross-product%20basis.%20Which%20arrows%20coincide%3F%20Which%20one%20is%20reversed%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%20From%20markers%20to%20anatomy%0A%0A%20%20%20%20%23%23%23%20An%20anatomical%20frame%3A%20the%20femur%0A%0A%20%20%20%20The%20VAKHUM%20project%20defines%20the%20anatomical%20coordinate%20system%20of%20the%20femur%20from%20three%20anatomical%20landmarks%3A%20the%20centre%20of%20the%20femoral%20head%20(%24fh%24)%2C%20the%20lateral%20epicondyle%20(%24le%24)%20and%20the%20medial%20epicondyle%20(%24me%24).%20The%20laboratory%20axes%20follow%20the%20same%20convention%20as%20the%20segment%20axes%3A%20%24x%24%20points%20anteriorly%2C%20%24y%24%20upwards%20and%20%24z%24%20to%20the%20right.%20In%20VAKHUM's%20words%2C%20paraphrased%3A%0A%0A%20%20%20%20-%20The%20origin%2C%20%24O_t%24%2C%20is%20the%20midpoint%20between%20%24le%24%20and%20%24me%24.%0A%20%20%20%20-%20The%20%24y_t%24%20axis%20is%20along%20the%20line%20through%20%24O_t%24%20and%20%24fh%24%2C%20positive%20upwards.%0A%20%20%20%20-%20The%20%24z_t%24%20axis%20lies%20in%20the%20plane%20defined%20by%20%24fh%24%2C%20%24le%24%20and%20%24me%24%2C%20is%20perpendicular%20to%20%24y_t%24%2C%20and%20points%20to%20the%20right.%0A%20%20%20%20-%20The%20%24x_t%24%20axis%20is%20perpendicular%20to%20both%2C%20and%20points%20anteriorly.%0A%0A%20%20%20%20Each%20sentence%20translates%20into%20one%20of%20the%20operations%20of%20this%20notebook%3A%0A%0A%20%20%20%20%24%24%0A%20%20%20%20O_t%20%3D%20%5Cfrac%7Ble%20%2B%20me%7D%7B2%7D%2C%0A%20%20%20%20%5Cqquad%0A%20%20%20%20%5Chat%7By%7D_t%20%3D%20%5Cfrac%7Bfh%20-%20O_t%7D%7B%5CVert%20fh%20-%20O_t%20%5CVert%7D%0A%20%20%20%20%24%24%0A%0A%20%20%20%20The%20plane%20of%20the%20three%20landmarks%20contains%20both%20%24%5Chat%7By%7D_t%24%20and%20the%20line%20between%20the%20epicondyles.%20Removing%20from%20%24le%20-%20me%24%20its%20component%20along%20%24%5Chat%7By%7D_t%24%2C%20which%20is%20one%20step%20of%20the%20Gram%E2%80%93Schmidt%20process%2C%20leaves%20a%20vector%20in%20that%20plane%2C%20perpendicular%20to%20%24%5Chat%7By%7D_t%24.%20For%20a%20right%20femur%2C%20%24le%20-%20me%24%20points%20to%20the%20right%2C%20as%20the%20convention%20requires%3A%0A%0A%20%20%20%20%24%24%0A%20%20%20%20%5Chat%7Bz%7D_t%20%3D%20%5Cfrac%7B(le%20-%20me)%20-%20%5Cleft%5B(le%20-%20me)%5Ccdot%5Chat%7By%7D_t%5Cright%5D%5Chat%7By%7D_t%7D%7B%5CVert%20(le%20-%20me)%20-%20%5Cleft%5B(le%20-%20me)%5Ccdot%5Chat%7By%7D_t%5Cright%5D%5Chat%7By%7D_t%20%5CVert%7D%0A%20%20%20%20%24%24%0A%0A%20%20%20%20And%20for%20%24x_t%24%2C%20%24y_t%24%2C%20%24z_t%24%20to%20be%20right-handed%2C%20%24%5Chat%7Bx%7D_t%20%3D%20%5Chat%7By%7D_t%20%5Ctimes%20%5Chat%7Bz%7D_t%24.%0A%0A%20%20%20%20Here%20are%20hypothetical%20positions%20of%20the%20three%20landmarks%20of%20the%20right%20femur%20of%20a%20person%20standing%20upright%2C%20facing%20%24%2Bx%24%2C%20in%20metres.%0A%0A%20%20%20%20**Before%20you%20run%20the%20next%20cell**%2C%20predict%3A%20which%20laboratory%20axis%20should%20each%20axis%20of%20the%20femur%20be%20close%20to%3F%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(np)%3A%0A%20%20%20%20fh%20%3D%20np.array(%5B0.02%2C%200.92%2C%200.09%5D)%20%20%23%20centre%20of%20the%20femoral%20head%20%5Bm%5D%0A%20%20%20%20le%20%3D%20np.array(%5B0.03%2C%200.50%2C%200.14%5D)%20%20%23%20lateral%20epicondyle%20%5Bm%5D%0A%20%20%20%20me%20%3D%20np.array(%5B0.02%2C%200.49%2C%200.05%5D)%20%20%23%20medial%20epicondyle%20%5Bm%5D%0A%0A%20%20%20%20Ot%20%3D%20(le%20%2B%20me)%20%2F%202%20%20%23%20origin%2C%20midpoint%20of%20the%20epicondyles%0A%0A%20%20%20%20yt%20%3D%20(fh%20-%20Ot)%20%2F%20np.linalg.norm(fh%20-%20Ot)%20%20%23%20long%20axis%2C%20upwards%0A%0A%20%20%20%20zt%20%3D%20(le%20-%20me)%20-%20np.dot(le%20-%20me%2C%20yt)%20*%20yt%20%20%23%20epicondylar%20line%2C%20made%20perpendicular%20to%20yt%0A%20%20%20%20zt%20%3D%20zt%20%2F%20np.linalg.norm(zt)%0A%0A%20%20%20%20xt%20%3D%20np.cross(yt%2C%20zt)%20%20%23%20anterior%0A%0A%20%20%20%20print(%22Ot%20%3D%22%2C%20Ot)%0A%20%20%20%20print(%22xt%20%3D%22%2C%20xt.round(4)%2C%20%22%5Cnyt%20%3D%22%2C%20yt.round(4)%2C%20%22%5Cnzt%20%3D%22%2C%20zt.round(4))%0A%20%20%20%20return%20Ot%2C%20fh%2C%20le%2C%20me%2C%20xt%2C%20yt%2C%20zt%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%20Before%20interpreting%20anything%2C%20test%20the%20basis%3A%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(le%2C%20me%2C%20np%2C%20xt%2C%20yt%2C%20zt)%3A%0A%20%20%20%20print(f%22xt%20.%20yt%20%3D%20%7Bnp.dot(xt%2C%20yt)%3A.1e%7D%2C%20%20yt%20.%20zt%20%3D%20%7Bnp.dot(yt%2C%20zt)%3A.1e%7D%2C%20%20zt%20.%20xt%20%3D%20%7Bnp.dot(zt%2C%20xt)%3A.1e%7D%22)%0A%20%20%20%20print(f%22det(%5Bxt%2C%20yt%2C%20zt%5D)%20%3D%20%7Bnp.linalg.det(np.vstack((xt%2C%20yt%2C%20zt)))%3Ag%7D%22)%0A%20%20%20%20print(%22%5CnAngle%20between%20each%20femur%20axis%20and%20the%20laboratory%20axis%20of%20the%20same%20name%3A%22)%0A%20%20%20%20for%20_name%2C%20_axis%2C%20_lab%20in%20%5B(%22x%22%2C%20xt%2C%20%5B1%2C%200%2C%200%5D)%2C%20(%22y%22%2C%20yt%2C%20%5B0%2C%201%2C%200%5D)%2C%20(%22z%22%2C%20zt%2C%20%5B0%2C%200%2C%201%5D)%5D%3A%0A%20%20%20%20%20%20%20%20print(f%22%20%20%7B_name%7D%3A%20%7Bangle_between(_axis%2C%20_lab)%3A.1f%7D%20degrees%22)%0A%20%20%20%20print(f%22%5CnAngle%20between%20the%20epicondylar%20line%20and%20yt%3A%20%7Bangle_between(le%20-%20me%2C%20yt)%3A.1f%7D%20degrees%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%20An%20orthonormal%2C%20right-handed%20basis.%20Its%20long%20axis%2C%20%24y_t%24%2C%20is%20within%20one%20degree%20of%20the%20vertical%2C%20as%20it%20should%20be%20for%20a%20person%20standing%20upright.%20But%20%24x_t%24%20and%20%24z_t%24%20are%20both%20turned%20by%20about%206%C2%B0%20about%20the%20vertical%3A%20the%20lateral%20epicondyle%20is%201%20cm%20anterior%20to%20the%20medial%20one%2C%20so%20the%20knee%20points%20slightly%20inwards.%20That%20is%20about%206%C2%B0%20of%20internal%20rotation%20of%20the%20femur%2C%20a%20number%20that%20was%20hidden%20in%20the%20landmark%20coordinates%20until%20the%20coordinate%20system%20brought%20it%20out.%0A%0A%20%20%20%20Notice%20also%20the%20order%20of%20the%20definitions.%20The%20line%20between%20the%20epicondyles%20is%2084.4%C2%B0%20from%20the%20long%20axis%2C%20not%2090%C2%B0%2C%20so%20the%20two%20cannot%20both%20be%20axes%20of%20an%20orthogonal%20basis.%20The%20convention%20settles%20which%20one%20gives%20way%3A%20%24y_t%24%20is%20defined%20first%20and%20kept%20exactly%2C%20and%20%24z_t%24%20gets%20only%20what%20is%20left%20of%20the%20epicondylar%20line%20once%20its%20component%20along%20%24y_t%24%20is%20removed.%0A%0A%20%20%20%20**Guiding%20questions%202.**%0A%0A%20%20%20%201.%20For%20a%20left%20femur%2C%20%24le%20-%20me%24%20points%20to%20the%20left.%20What%20would%20you%20change%20in%20the%20code%20so%20that%20%24z_t%24%20still%20points%20to%20the%20right%2C%20as%20the%20convention%20requires%3F%20What%20would%20happen%20to%20%24x_t%24%20if%20you%20forgot%3F%0A%20%20%20%202.%20The%20convention%20defines%20%24y_t%24%20first%2C%20from%20the%20two%20landmarks%20that%20are%20farthest%20apart.%20Why%20is%20that%20a%20sensible%20choice%20when%20every%20landmark%20is%20located%20with%20some%20error%3F%0A%20%20%20%203.%20Why%20is%20the%20origin%20at%20the%20midpoint%20of%20the%20epicondyles%2C%20and%20not%20at%20the%20centroid%20of%20the%20three%20landmarks%2C%20as%20for%20the%20technical%20coordinate%20system%20earlier%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%23%20Using%20the%20femur's%20coordinate%20system%0A%0A%20%20%20%20A%20coordinate%20system%20earns%20its%20keep%20when%20we%20use%20it%20to%20describe%20points.%20Any%20point%20P%20can%20be%20described%20by%20its%20**local%20coordinates**%3A%20the%20projections%20of%20%24%5Coverrightarrow%7B%5Cmathbf%7Br%7D%7D_P%20-%20O_t%24%20on%20the%20three%20versors%2C%20found%20with%20the%20dot%20product.%20From%20the%20local%20coordinates%20we%20get%20back%20to%20the%20laboratory%20by%20adding%20up%20the%20versors%3A%0A%0A%20%20%20%20%24%24%0A%20%20%20%20x%5E*%20%3D%20(%5Coverrightarrow%7B%5Cmathbf%7Br%7D%7D_P%20-%20O_t)%5Ccdot%5Chat%7Bx%7D_t%2C%20%5Cquad%20y%5E*%20%3D%20(%5Coverrightarrow%7B%5Cmathbf%7Br%7D%7D_P%20-%20O_t)%5Ccdot%5Chat%7By%7D_t%2C%20%5Cquad%20z%5E*%20%3D%20(%5Coverrightarrow%7B%5Cmathbf%7Br%7D%7D_P%20-%20O_t)%5Ccdot%5Chat%7Bz%7D_t%0A%20%20%20%20%24%24%0A%0A%20%20%20%20%24%24%0A%20%20%20%20%5Coverrightarrow%7B%5Cmathbf%7Br%7D%7D_P%20%3D%20O_t%20%2B%20x%5E*%5C%2C%5Chat%7Bx%7D_t%20%2B%20y%5E*%5C%2C%5Chat%7By%7D_t%20%2B%20z%5E*%5C%2C%5Chat%7Bz%7D_t%0A%20%20%20%20%24%24%0A%0A%20%20%20%20Take%20a%20marker%20on%20the%20side%20of%20the%20thigh%2C%2015%20cm%20above%20the%20origin%20of%20the%20femur%20along%20its%20long%20axis%20and%206%20cm%20lateral%20to%20it%3A%20local%20coordinates%20%24(0%2C%5C%2C%200.15%2C%5C%2C%200.06)%24%20m%2C%20since%20lateral%20is%20%24%2Bz_t%24%20for%20the%20right%20femur.%20Where%20is%20it%20in%20the%20laboratory%3F%20Then%20flex%20the%20hip%20by%2030%C2%B0%2C%20turning%20the%20three%20landmarks%20about%20the%20centre%20of%20the%20femoral%20head%20(the%20turn%20is%20done%20with%20a%20rotation%20matrix%3B%20see%20%5BRigid-body%20transformations%20in%203D%5D(https%3A%2F%2Fmolab.marimo.io%2Fgithub%2FBMClab%2FBMC%2Fblob%2Fmaster%2Fnotebooks%2Ftransformation_3d.py))%2C%20and%20rebuild%20the%20femur's%20coordinate%20system%20from%20the%20new%20landmarks.%20The%20function%20below%20collects%20the%20recipe%20of%20the%20previous%20section.%0A%0A%20%20%20%20**Before%20you%20run%20the%20next%20cell**%2C%20predict%3A%20after%20the%20hip%20flexes%2C%20are%20the%20marker's%20local%20coordinates%20still%20%24(0%2C%5C%2C%200.15%2C%5C%2C%200.06)%24%3F%20Does%20the%20marker%20move%20more%20or%20less%20than%20the%20knee%3F%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.function%0Adef%20femur_frame(fh%2C%20le%2C%20me)%3A%0A%20%20%20%20%22%22%22Origin%20and%20basis%20(versors%20as%20rows)%20of%20the%20right%20femur%2C%20VAKHUM%20convention.%0A%0A%20%20%20%20%60fh%60%2C%20%60le%60%20and%20%60me%60%20are%20the%20positions%20of%20the%20centre%20of%20the%20femoral%20head%20and%0A%20%20%20%20of%20the%20lateral%20and%20medial%20epicondyles%2C%20in%20a%20laboratory%20with%20x%20anterior%2C%0A%20%20%20%20y%20upwards%20and%20z%20to%20the%20right.%0A%20%20%20%20%22%22%22%0A%20%20%20%20import%20numpy%20as%20np%0A%0A%20%20%20%20origin%20%3D%20(le%20%2B%20me)%20%2F%202%0A%20%20%20%20yt%20%3D%20(fh%20-%20origin)%20%2F%20np.linalg.norm(fh%20-%20origin)%0A%20%20%20%20zt%20%3D%20(le%20-%20me)%20-%20np.dot(le%20-%20me%2C%20yt)%20*%20yt%0A%20%20%20%20zt%20%3D%20zt%20%2F%20np.linalg.norm(zt)%0A%20%20%20%20xt%20%3D%20np.cross(yt%2C%20zt)%0A%20%20%20%20return%20origin%2C%20np.vstack((xt%2C%20yt%2C%20zt))%0A%0A%0A%40app.cell%0Adef%20_(Ot%2C%20fh%2C%20le%2C%20me%2C%20np%2C%20xt%2C%20yt%2C%20zt)%3A%0A%20%20%20%20_local%20%3D%20np.array(%5B0.0%2C%200.15%2C%200.06%5D)%20%20%23%20marker%20on%20the%20thigh%2C%20in%20the%20femur's%20coordinates%20%5Bm%5D%0A%20%20%20%20_basis%20%3D%20np.vstack((xt%2C%20yt%2C%20zt))%0A%20%20%20%20_p_lab%20%3D%20Ot%20%2B%20_local%20%40%20_basis%20%20%23%20local%20to%20laboratory%0A%0A%20%20%20%20print(%22Marker%20in%20the%20laboratory%2C%20standing%3A%20%20%20%22%2C%20_p_lab.round(4)%2C%20%22m%22)%0A%20%20%20%20print(%22Back%20to%20local%20coordinates%3A%20%20%20%20%20%20%20%20%20%20%20%20%22%2C%20((_p_lab%20-%20Ot)%20%40%20_basis.T).round(4)%20%2B%200.0%2C%20%22m%22)%0A%0A%20%20%20%20%23%20Flex%20the%20hip%20by%2030%20degrees%3A%20turn%20the%20landmarks%20about%20the%20femoral%20head%2C%20about%20the%20z%20axis%0A%20%20%20%20_theta%20%3D%20np.radians(30)%0A%20%20%20%20_Rz%20%3D%20np.array(%5B%5Bnp.cos(_theta)%2C%20-np.sin(_theta)%2C%200%5D%2C%20%5Bnp.sin(_theta)%2C%20np.cos(_theta)%2C%200%5D%2C%20%5B0%2C%200%2C%201%5D%5D)%0A%0A%20%20%20%20def%20_turn(p)%3A%0A%20%20%20%20%20%20%20%20return%20fh%20%2B%20_Rz%20%40%20(p%20-%20fh)%0A%0A%20%20%20%20_Ot_flex%2C%20_basis_flex%20%3D%20femur_frame(_turn(fh)%2C%20_turn(le)%2C%20_turn(me))%0A%20%20%20%20_p_flex%20%3D%20_Ot_flex%20%2B%20_local%20%40%20_basis_flex%20%20%23%20the%20same%20local%20coordinates%2C%20in%20the%20new%20frame%0A%0A%20%20%20%20print(%22Marker%20in%20the%20laboratory%2C%20hip%20flexed%3A%20%22%2C%20_p_flex.round(4)%2C%20%22m%22)%0A%20%20%20%20print(f%22Difference%20from%20turning%20the%20marker%20itself%3A%20%7Bnp.abs(_p_flex%20-%20_turn(_p_lab)).max()%3A.1e%7D%20m%22)%0A%20%20%20%20print(%0A%20%20%20%20%20%20%20%20f%22The%20marker%20moved%20%7B100%20*%20np.linalg.norm(_p_flex%20-%20_p_lab)%3A.1f%7D%20cm%2C%22%0A%20%20%20%20%20%20%20%20f%22%20the%20origin%20of%20the%20femur%20(the%20knee)%20%7B100%20*%20np.linalg.norm(_Ot_flex%20-%20Ot)%3A.1f%7D%20cm%22%0A%20%20%20%20)%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%20local%20coordinates%20do%20not%20change.%20Rebuilt%20from%20the%20flexed%20landmarks%2C%20the%20femur's%20coordinate%20system%20puts%20the%20marker%20exactly%20where%20turning%20the%20marker%20itself%20would%2C%20to%20within%20%2410%5E%7B-16%7D%24%20m%3A%20the%20frame%20carries%20every%20point%20of%20the%20segment%20with%20it%2C%20which%20is%20the%20whole%20reason%20for%20attaching%20one%20to%20the%20segment.%20The%20marker%20moved%2014.2%20cm%20and%20the%20knee%2022.0%20cm%2C%20because%20points%20nearer%20the%20hip%2C%20the%20centre%20of%20the%20rotation%2C%20travel%20along%20shorter%20arcs.%0A%0A%20%20%20%20This%20is%20also%20the%20principle%20behind%20the%20technical%20and%20anatomical%20coordinate%20systems%20of%20the%20next%20section%3A%20local%20coordinates%20measured%20once%2C%20in%20a%20calibration%20trial%2C%20give%20the%20position%20of%20a%20point%20at%20every%20later%20instant.%0A%0A%20%20%20%20**Exercise%206.**%20The%20centre%20of%20the%20femoral%20head%20cannot%20be%20palpated%3B%20it%20has%20to%20be%20estimated%2C%20and%20every%20estimate%20carries%20an%20error.%20Suppose%20the%20estimate%20is%201%20cm%20too%20medial%20(for%20the%20right%20femur%2C%201%20cm%20towards%20%24-z%24).%20Recalculate%20the%20femur's%20coordinate%20system%20with%20%60femur_frame%60.%20Which%20of%20its%20axes%20change%2C%20and%20by%20how%20much%3F%20Which%20joint%20angle%20would%20this%20error%20disturb%20the%20most%3F%0A%20%20%20%20%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(fh%2C%20le%2C%20me%2C%20mo%2C%20np)%3A%0A%20%20%20%20_%2C%20_basis%20%3D%20femur_frame(fh%2C%20le%2C%20me)%0A%20%20%20%20_%2C%20_basis_err%20%3D%20femur_frame(fh%20%2B%20np.array(%5B0%2C%200%2C%20-0.01%5D)%2C%20le%2C%20me)%0A%20%20%20%20_angles%20%3D%20angle_between(_basis_err%2C%20_basis)%0A%20%20%20%20_tilt%20%3D%20np.degrees(np.arctan(0.01%20%2F%20np.linalg.norm(fh%20-%20(le%20%2B%20me)%20%2F%202)))%0A%20%20%20%20mo.accordion(%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%22Solution%20to%20Exercise%206%22%3A%20mo.md(%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20rf%22%22%22%0A%20%20%20%20With%20the%20femoral%20head%201%20cm%20too%20medial%2C%20the%20axes%20turn%20by%20**%7B_angles%5B0%5D%3A.2f%7D%C2%B0**%20(%24x_t%24)%2C%20**%7B_angles%5B1%5D%3A.2f%7D%C2%B0**%20(%24y_t%24)%20and%20**%7B_angles%5B2%5D%3A.2f%7D%C2%B0**%20(%24z_t%24).%0A%0A%20%20%20%20The%20long%20axis%20tilts%20towards%20the%20midline%20by%20about%20the%20error%20divided%20by%20the%20length%20of%20the%20femur%2C%20%24%5Carctan(0.01%2F0.425)%20%3D%20%7B_tilt%3A.2f%7D%C2%B0%24%2C%20and%20%24z_t%24%2C%20which%20is%20kept%20perpendicular%20to%20it%2C%20tilts%20with%20it.%20Both%20turn%20about%20%24x_t%24%2C%20which%20barely%20moves.%20The%20error%20is%20a%20rotation%20in%20the%20frontal%20plane%20of%20the%20femur%2C%20so%20it%20disturbs%20the%20abduction%E2%80%93adduction%20angles%20of%20the%20hip%20and%20the%20knee%20the%20most%2C%20and%20their%20flexion%20angles%20hardly%20at%20all.%0A%20%20%20%20%22%22%22%0A%20%20%20%20%20%20%20%20%20%20%20%20)%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20)%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%20Technical%20and%20anatomical%20coordinate%20systems%0A%0A%20%20%20%20In%20practice%2C%20anatomical%20landmarks%20make%20poor%20markers.%20The%20centre%20of%20the%20femoral%20head%20is%20inside%20the%20body%2C%20and%20its%20position%20has%20to%20be%20estimated.%20The%20epicondyles%20are%20under%20skin%20that%20slides%20over%20them%20as%20the%20knee%20moves%2C%20and%20a%20marker%20on%20the%20medial%20side%20of%20the%20knee%20gets%20knocked%20off%20by%20the%20other%20leg.%0A%0A%20%20%20%20The%20usual%20solution%20(Cappozzo%20et%20al.%2C%201995)%20separates%20the%20two%20jobs.%20Markers%20placed%20where%20they%20are%20easy%20to%20see%20and%20stay%20put%20define%20a%20technical%20coordinate%20system%2C%20which%20is%20tracked%20throughout%20the%20movement.%20In%20a%20static%20calibration%20trial%2C%20the%20anatomical%20landmarks%20are%20located%2C%20by%20palpation%20or%20with%20a%20pointer%2C%20and%20their%20positions%20are%20expressed%20in%20the%20technical%20coordinate%20system.%20As%20long%20as%20the%20segment%20behaves%20as%20a%20rigid%20body%2C%20those%20positions%20do%20not%20change%2C%20so%20the%20anatomical%20coordinate%20system%20can%20be%20rebuilt%20from%20the%20technical%20one%20at%20every%20instant%20of%20the%20movement.%0A%0A%20%20%20%20The%20weak%20point%20of%20the%20method%2C%20and%20of%20all%20skin-marker%20methods%2C%20is%20that%20the%20markers%20move%20relative%20to%20the%20bone%2C%20by%20as%20much%20as%20a%20few%20centimetres%20in%20some%20places%3A%20the%20soft%20tissue%20artifact.%20Three%20practical%20defences%20follow%20from%20this%20notebook%20and%20the%20ones%20it%20links%20to%3A%0A%0A%20%20%20%20-%20Place%20the%20origin%20of%20a%20technical%20coordinate%20system%20at%20the%20centroid%20of%20its%20markers%2C%20so%20that%20the%20errors%20of%20individual%20markers%20partly%20average%20out.%0A%20%20%20%20-%20Spread%20the%20markers%20far%20apart%20compared%20with%20the%20size%20of%20their%20errors%20(Cappozzo%20et%20al.%2C%201997).%20How%20far%2C%20and%20what%20goes%20wrong%20when%20the%20markers%20are%20nearly%20in%20a%20line%2C%20is%20worked%20out%20in%20%5BDetermination%20of%20a%20coordinate%20system%5D(https%3A%2F%2Fmolab.marimo.io%2Fgithub%2FBMClab%2FBMC%2Fblob%2Fmaster%2Fnotebooks%2Fcoordinate_system.py).%0A%20%20%20%20-%20Use%20more%20than%20three%20markers%20and%20find%20the%20best-fitting%20basis%20by%20least%20squares%2C%20usually%20with%20the%20singular%20value%20decomposition%20(see%20%5BSVD%20algorithm%5D(https%3A%2F%2Fmolab.marimo.io%2Fgithub%2FBMClab%2FBMC%2Fblob%2Fmaster%2Fnotebooks%2Fsvd_algorithm.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%23%23%20Checkpoint%20questions%0A%0A%20%20%20%20Pause%20here%20before%20the%20problems.%0A%0A%20%20%20%201.%20Go%20back%20to%20your%20three%20descriptions%20from%20Challenge%200.%20Which%20frame%20of%20reference%20made%20the%20motion%20of%20your%20hand%20simplest%3F%20Which%20of%20the%20three%20frames%20are%20inertial%2C%20approximately%3F%0A%20%20%20%202.%20Two%20observers%20in%20different%20inertial%20frames%20measure%20the%20same%20runner.%20List%20what%20they%20agree%20on%20and%20what%20they%20disagree%20on%3A%20position%2C%20velocity%2C%20acceleration%2C%20force%2C%20kinetic%20energy.%0A%20%20%20%203.%20You%20film%20a%20sprinter%20with%20a%20camera%20on%20a%20trolley%20that%20runs%20alongside%20on%20a%20rail.%20What%20do%20you%20need%20to%20know%20about%20the%20trolley's%20motion%20before%20you%20can%20use%20the%20video%20to%20estimate%20forces%3F%0A%20%20%20%204.%20A%20colleague%20builds%20a%20thigh%20coordinate%20system%20by%20applying%20the%20Gram%E2%80%93Schmidt%20process%20to%20the%20raw%20marker%20positions%2C%20and%20the%20results%20look%20reasonable.%20Describe%20a%20test%20that%20would%20reveal%20the%20problem.%0A%20%20%20%205.%20A%20coordinate%20system%20needs%20a%20basis%20and%20an%20origin.%20Which%20of%20the%20two%20does%20a%20joint%20angle%20depend%20on%3F%20And%20the%20position%20of%20a%20joint%20centre%3F%0A%20%20%20%206.%20Two%20laboratories%20report%20knee%20angles%20that%20differ%20by%205%C2%B0%20for%20the%20same%20person%20walking.%20Name%20two%20reasons%2C%20related%20to%20this%20notebook%2C%20why%20that%20could%20happen.%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.%20Right%20now%2C%20how%20fast%20are%20you%20moving%3F%20In%20your%20answer%2C%20consider%20your%20motion%20in%20relation%20to%20the%20Earth%20and%20in%20relation%20to%20the%20Sun.%0A%0A%20%20%20%202.%20Given%20the%20points%20in%203D%20space%20m1%20%3D%20%5B2%2C%202%2C%200%5D%2C%20m2%20%3D%20%5B0%2C%201%2C%201%5D%2C%20m3%20%3D%20%5B1%2C%202%2C%200%5D%2C%20find%20an%20orthonormal%20basis.%0A%0A%20%20%20%203.%20Determine%20whether%20the%20following%20points%20form%20a%20basis%20in%203D%20space%3A%20m1%20%3D%20%5B2%2C%202%2C%200%5D%2C%20m2%20%3D%20%5B1%2C%201%2C%201%5D%2C%20m3%20%3D%20%5B1%2C%201%2C%200%5D.%0A%0A%20%20%20%204.%20Derive%20expressions%20for%20the%20three%20axes%20of%20the%20pelvic%20basis%20according%20to%20the%20convention%20of%20the%20%5BVirtual%20Animation%20of%20the%20Kinematics%20of%20the%20Human%20for%20Industrial%2C%20Educational%20and%20Research%20Purposes%20(VAKHUM)%5D(https%3A%2F%2Fgithub.com%2FBMClab%2FBMC%2Fblob%2Fmaster%2Fcourses%2Frefs%2FVAKHUM.pdf)%20project%20(use%20RASIS%2C%20LASIS%2C%20RPSIS%20and%20LPSIS%20as%20the%20names%20of%20the%20pelvic%20anatomical%20landmarks%2C%20and%20give%20the%20expression%20for%20each%20axis).%0A%0A%20%20%20%205.%20Determine%20the%20basis%20for%20the%20pelvis%20following%20the%20convention%20of%20the%20%5BVAKHUM%5D(https%3A%2F%2Fgithub.com%2FBMClab%2FBMC%2Fblob%2Fmaster%2Fcourses%2Frefs%2FVAKHUM.pdf)%20project%20for%20the%20following%20anatomical%20landmark%20positions%20(in%20metres)%3A%20RASIS%20%3D%20%5B0.5%2C%200.8%2C%200.4%5D%2C%20LASIS%20%3D%20%5B0.55%2C%200.78%2C%200.1%5D%2C%20RPSIS%20%3D%20%5B0.3%2C%200.85%2C%200.2%5D%2C%20LPSIS%20%3D%20%5B0.29%2C%200.78%2C%200.3%5D.%0A%0A%20%20%20%206.%20A%20treadmill's%20belt%20speeds%20up%20steadily%20from%202%20to%204%20m%2Fs%20in%204%20s%2C%20while%20a%2060%20kg%20runner%20stays%20in%20the%20same%20place%20in%20the%20laboratory.%3Cbr%3E%0A%20%20%20%20%20%20%20a.%20What%20is%20the%20acceleration%20of%20the%20belt%3F%3Cbr%3E%0A%20%20%20%20%20%20%20b.%20In%20the%20frame%20of%20reference%20of%20the%20belt%2C%20what%20fictitious%20force%20must%20be%20added%20for%20Newton's%20second%20law%20to%20hold%3F%20In%20which%20direction%20does%20it%20point%3F%3Cbr%3E%0A%20%20%20%20%20%20%20c.%20Is%20the%20frame%20of%20the%20belt%20inertial%20before%2C%20during%20and%20after%20the%20change%20of%20speed%3F%0A%0A%20%20%20%207.%20The%20landmarks%20of%20the%20left%20femur%20of%20the%20person%20in%20this%20notebook%20are%20the%20mirror%20images%20of%20those%20of%20the%20right%20femur%3A%20fh%20%3D%20%5B0.02%2C%200.92%2C%20%E2%88%920.09%5D%2C%20le%20%3D%20%5B0.03%2C%200.50%2C%20%E2%88%920.14%5D%20and%20me%20%3D%20%5B0.02%2C%200.49%2C%20%E2%88%920.05%5D%20(in%20metres).%20Calculate%20the%20anatomical%20coordinate%20system%20of%20the%20left%20femur%20according%20to%20the%20VAKHUM%20convention%2C%20check%20that%20it%20is%20right-handed%2C%20and%20compare%20it%20with%20that%20of%20the%20right%20femur.%20Is%20the%20left%20knee%20also%20rotated%20inwards%3F%0A%0A%20%20%20%208.%20A%20person%20stands%20still%20on%20a%20force%20plate%20in%20a%20lift.%20While%20the%20lift%20moves%20at%20constant%20speed%2C%20the%20plate%20reads%20600%20N%3B%20when%20the%20lift%20starts%20or%20stops%2C%20the%20reading%20changes%20to%20660%20N.%3Cbr%3E%0A%20%20%20%20%20%20%20%20a.%20What%20is%20the%20person's%20mass%3F%3Cbr%3E%0A%20%20%20%20%20%20%20%20b.%20What%20is%20the%20acceleration%20of%20the%20lift%2C%20and%20in%20which%20direction%20does%20it%20point%3F%3Cbr%3E%0A%20%20%20%20%20%20%20%20c.%20Is%20the%20lift%20starting%20to%20go%20up%2C%20or%20stopping%20on%20the%20way%20down%3F%20Can%20the%20force%20plate%20tell%20the%20two%20apart%3F%0A%0A%20%20%20%209.%20In%20the%20model%20of%20the%20sprinter's%20hand%20(%22One%20hand%2C%20two%20frames%22)%2C%20keep%20the%20running%20speed%2C%20the%20arm%20length%20and%20the%20frequency%20of%20the%20arm%20swing%2C%20and%20find%20the%20amplitude%20of%20the%20swing%20for%20which%20the%20hand%20comes%20to%20a%20complete%20stop%20relative%20to%20the%20track%20once%20per%20stride.%20Is%20that%20amplitude%20realistic%20for%20sprinting%3F%0A%0A%20%20%20%2010.%20In%20the%20standing%20posture%20of%20the%20femur%20example%2C%20the%20tibial%20tuberosity%20is%20at%20%5B0.06%2C%200.44%2C%200.10%5D%20m%20in%20the%20laboratory.%20Calculate%20its%20local%20coordinates%20in%20the%20femur's%20coordinate%20system%20and%20interpret%20their%20signs.%20Would%20they%20stay%20the%20same%20when%20the%20knee%20flexes%3F%0A%0A%20%20%20%2011.%20Write%20a%20function%20that%20receives%20three%20vectors%20and%20returns%20whether%20they%20form%20an%20orthonormal%2C%20right-handed%20basis%2C%20within%20a%20tolerance%20you%20choose.%20Test%20it%20with%20the%20bases%20of%20this%20notebook%2C%20including%20the%20one%20in%20Exercise%205%2C%20and%20with%20a%20basis%20that%20is%20orthogonal%20but%20not%20normalized.%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%20the%20problems%0A%0A%20%20%20%201.%20At%20rest%20relative%20to%20the%20ground%3A%20approximately%200%20m%2Fs%20relative%20to%20that%20surface.%20Relative%20to%20the%20Sun%3A%20approximately%2029.8%20km%2Fs%20from%20Earth%E2%80%99s%20orbit%2C%20with%20a%20smaller%20latitude-%20and%20time-dependent%20contribution%20from%20Earth%E2%80%99s%20spin.%20The%20velocity%20vector%2C%20reference%20and%20instant%20must%20be%20specified.%0A%20%20%20%202.%20One%20right-handed%20orthonormal%20basis%2C%20using%20the%20notebook%E2%80%99s%20cross-product%20recipe%2C%20is%20%24e_1%3D(-2%2C-1%2C1)%2F%5Csqrt6%24%2C%20%24e_2%3D(0%2C-1%2C-1)%2F%5Csqrt2%24%2C%20%24e_3%3D(1%2C-1%2C1)%2F%5Csqrt3%24.%0A%20%20%20%203.%20The%20position%20vectors%20do%20not%20form%20a%203D%20basis%3A%20the%20first%20is%20twice%20the%20third.%20The%20three%20*points*%20are%20noncollinear%20and%20can%20still%20define%20a%20technical%20frame%20using%20differences.%0A%20%20%20%204.%20Let%20%24A%3D(RASIS%2BLASIS)%2F2%24%2C%20%24P%3D(RPSIS%2BLPSIS)%2F2%24%20and%20%24%5Coperatorname%7Bunit%7D(v)%3Dv%2F%5C%7Cv%5C%7C%24.%20Then%20%24e_z%3D%5Coperatorname%7Bunit%7D(RASIS-LASIS)%24%2C%20%24e_y%3D%5Coperatorname%7Bunit%7D%5Be_z%5Ctimes(A-P)%5D%24%2C%20%24e_x%3De_y%5Ctimes%20e_z%24%3B%20origin%20%24A%24.%0A%20%20%20%205.%20Origin%20%24(0.525%2C0.790%2C0.250)%24%20m.%20Basis%20vectors%20as%20rows%3A%20%24%5B%5B0.980530%2C-0.098327%2C0.169977%5D%2C%5B0.107934%2C0.992988%2C-0.048210%5D%2C%5B-0.164045%2C0.065618%2C0.984268%5D%5D%24.%0A%20%20%20%206.%20With%20forward%20positive%2C%20the%20upper%20belt%20surface%20has%20%24a%3D-0.5%24%20m%2Fs%C2%B2%3B%20fictitious%20force%20on%20the%20runner%20is%20%2B30%20N%2C%20forward.%20Its%20uniformly%20translating%20frame%20is%20inertial%20before%20and%20after%2C%20but%20not%20during%20the%20speed%20change%3B%20this%20refers%20to%20the%20straight%20upper%20section%2C%20not%20a%20belt%20material%20point%20travelling%20around%20a%20roller.%0A%20%20%20%207.%20Origin%20%24(0.025%2C0.495%2C-0.095)%24%20m.%20Rows%3A%20%24%5B%5B0.993703%2C0.010378%2C0.111565%5D%2C%5B-0.011763%2C0.999862%2C0.011763%5D%2C%5B-0.111427%2C-0.013001%2C0.993688%5D%5D%24%3B%20determinant%20%2B1.%20The%20left%20knee%20is%20internally%20rotated%20by%20about%206.4%C2%B0%2C%20mirrored%20anatomically%20from%20the%20right.%0A%20%20%20%208.%20Mass%20%24600%2F9.81%3D61.16%24%20kg%3B%20acceleration%20%2B0.981%20m%2Fs%C2%B2%20upward.%20Either%20upward%20starting%20or%20downward%20stopping%20is%20compatible%3B%20the%20force%20plate%20alone%20cannot%20distinguish%20them.%0A%20%20%20%209.%20Swing%20amplitude%20%241.0851%24%20rad%2C%20or%20%2462.17%5E%5Ccirc%24%20on%20either%20side%20of%20vertical.%20This%20is%20a%20large%20but%20possible%20idealized%20arm%20swing%3B%20the%20rigid%20straight-arm%20sinusoid%20should%20not%20be%20mistaken%20for%20a%20measured%20sprint.%0A%20%20%20%2010.%20Local%20coordinates%20%24(0.033651%2C-0.055463%2C0.008153)%24%20m%3A%20anterior%2C%20below%20the%20knee%20origin%2C%20and%20to%20the%20right.%20They%20change%20when%20the%20tibia%20moves%20relative%20to%20the%20femur.%0A%20%20%20%2011.%20A%20valid%20final%20predicate%20for%20vectors%20stored%20as%20rows%20in%20%24B%24%20is%20%60np.allclose(B%20%40%20B.T%2C%20np.eye(3)%2C%20atol%3D1e-8%2C%20rtol%3D0)%20and%20np.isclose(np.linalg.det(B)%2C%201%2C%20atol%3D1e-8%2C%20rtol%3D0)%60.%20It%20accepts%20right-handed%20orthonormal%20frames%20and%20rejects%20the%20reflected%20Exercise%205%20frame%20and%20non-unit%20orthogonal%20vectors.%0A%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%20Go%20deeper%0A%0A%20%20%20%20-%20Klein%20et%20al.%20(2015)%2C%20%5BThe%20right%20frame%20of%20reference%20makes%20it%20simple%5D(https%3A%2F%2Fdoi.org%2F10.1088%2F0143-0807%2F36%2F1%2F015004)%3A%20an%20example%20of%20introductory%20mechanics%20supported%20by%20video%20analysis%20of%20motion.%0A%20%20%20%20-%20%5BDetermination%20of%20a%20coordinate%20system%5D(https%3A%2F%2Fmolab.marimo.io%2Fgithub%2FBMClab%2FBMC%2Fblob%2Fmaster%2Fnotebooks%2Fcoordinate_system.py)%3A%20how%20errors%20in%20marker%20positions%20become%20errors%20in%20the%20axes%2C%20and%20how%20to%20place%20markers%20to%20keep%20them%20small.%0A%20%20%20%20-%20%5BKinematics%20of%20a%20particle%5D(https%3A%2F%2Fmolab.marimo.io%2Fgithub%2FBMClab%2FBMC%2Fblob%2Fmaster%2Fnotebooks%2Fkinematics_particle.py)%3A%20position%2C%20velocity%20and%20acceleration%2C%20described%20in%20an%20inertial%20frame.%0A%20%20%20%20-%20%5BRigid-body%20transformations%20in%203D%5D(https%3A%2F%2Fmolab.marimo.io%2Fgithub%2FBMClab%2FBMC%2Fblob%2Fmaster%2Fnotebooks%2Ftransformation_3d.py)%3A%20how%20to%20go%20from%20one%20coordinate%20system%20to%20another.%0A%20%20%20%20-%20%5BSVD%20algorithm%5D(https%3A%2F%2Fmolab.marimo.io%2Fgithub%2FBMClab%2FBMC%2Fblob%2Fmaster%2Fnotebooks%2Fsvd_algorithm.py)%3A%20the%20best-fitting%20basis%20for%20more%20than%20three%20markers.%0A%0A%20%20%20%20%23%23%23%20Video%20lectures%20on%20the%20Internet%0A%0A%20%20%20%20-%20%5BIntroduction%20to%20reference%20frames%20-%20Khan%20Academy%5D(https%3A%2F%2Fwww.khanacademy.org%2Fscience%2Fphysics%2Fone-dimensional-motion%2Fdisplacement-velocity-time%2Fv%2Fintroduction-to-reference-frames)%0A%20%20%20%20-%20%5BIntroduction%20to%20orthonormal%20bases%20-%20Khan%20Academy%5D(https%3A%2F%2Fwww.khanacademy.org%2Fmath%2Flinear-algebra%2Falternate-bases%2Forthonormal-basis%2Fv%2Flinear-algebra-introduction-to-orthonormal-bases)%0A%20%20%20%20-%20%5BThe%20Gram-Schmidt%20process%20-%20Khan%20Academy%5D(https%3A%2F%2Fwww.khanacademy.org%2Fmath%2Flinear-algebra%2Falternate-bases%2Forthonormal-basis%2Fv%2Flinear-algebra-the-gram-schmidt-process)%0A%20%20%20%20-%20%5BBiomechanics%20of%20Movement%20%7C%20Demo%3A%20Motion%20Capture%20Placement%20and%20Reference%20Frames%5D(https%3A%2F%2Fyoutu.be%2FctwoH59Obew)%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%20assignments%20from%20the%20original%20sources%0A%0A%20%20%20%20These%20original%20reading%20assignments%20remain%20available%20for%20further%20study.%20Their%20full%20statements%20and%20source-specific%20answer%20keys%20are%20external%20to%20this%20guide.%0A%0A%20%20%20%20-%20Complete%20the%20Wisc-Online%20interactive%20lesson%20%5BAnatomical%20terminology%3A%20relative%20position%5D(https%3A%2F%2Fwww.wistechopen.org%2Fwisc-online-learning-object%2Fanatomical-terminology-relative-position)%20to%20learn%20about%20the%20anatomical%20terminology%20that%20describes%20relative%20position%20in%20the%20human%20body.%0A%0A%20%20%20%20-%20To%20learn%20more%20about%20Cartesian%20coordinate%20systems%2C%20study%20the%20material%20at%20%5BMath%20is%20Fun%3A%20Cartesian%20coordinates%5D(https%3A%2F%2Fwww.mathsisfun.com%2Fdata%2Fcartesian-coordinates.html)%20and%20answer%20the%2010%20questions%20at%20the%20end.%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-%20Cappozzo%20A%2C%20Catani%20F%2C%20Della%20Croce%20U%2C%20Leardini%20A%20(1995)%20%5BPosition%20and%20orientation%20in%20space%20of%20bones%20during%20movement%3A%20anatomical%20frame%20definition%20and%20determination%5D(https%3A%2F%2Fdoi.org%2F10.1016%2F0268-0033(95)91394-T).%20Clinical%20Biomechanics%2C%2010(4)%2C%20171%E2%80%93178.%0A%0A%20%20%20%20-%20Cappozzo%20A%2C%20Cappello%20A%2C%20Della%20Croce%20U%2C%20Pensalfini%20F%20(1997)%20%5BSurface-marker%20cluster%20design%20criteria%20for%203-D%20bone%20movement%20reconstruction%5D(https%3A%2F%2Fdoi.org%2F10.1109%2F10.649988).%20IEEE%20Transactions%20on%20Biomedical%20Engineering%2C%2044(12)%2C%201165%E2%80%931174.%0A%0A%20%20%20%20-%20Corke%20P%20(2017)%20%5BRobotics%2C%20Vision%20and%20Control%3A%20Fundamental%20Algorithms%20in%20MATLAB%5D(https%3A%2F%2Fpetercorke.com%2FRVC%2F).%202nd%20ed.%20Springer-Verlag%20Berlin.%0A%0A%20%20%20%20-%20Klein%20P%2C%20Gr%C3%B6ber%20S%2C%20Kuhn%20J%2C%20Fleischhauer%20A%2C%20M%C3%BCller%20A%20(2015)%20%5BThe%20right%20frame%20of%20reference%20makes%20it%20simple%3A%20an%20example%20of%20introductory%20mechanics%20supported%20by%20video%20analysis%20of%20motion%5D(https%3A%2F%2Fdoi.org%2F10.1088%2F0143-0807%2F36%2F1%2F015004).%20European%20Journal%20of%20Physics%2C%2036(1)%2C%20015004.%0A%0A%20%20%20%20-%20%5BStandards%20-%20International%20Society%20of%20Biomechanics%5D(https%3A%2F%2Fisbweb.org%2Factivities%2Fstandards).%0A%0A%20%20%20%20-%20Stanford%20Encyclopedia%20of%20Philosophy.%20%5BSpace%20and%20Time%3A%20Inertial%20Frames%5D(https%3A%2F%2Fplato.stanford.edu%2Fentries%2Fspacetime-iframes%2F).%0A%0A%20%20%20%20-%20van%20Ingen%20Schenau%20GJ%20(1980)%20%5BSome%20fundamental%20aspects%20of%20the%20biomechanics%20of%20overground%20versus%20treadmill%20locomotion%5D(https%3A%2F%2Fpubmed.ncbi.nlm.nih.gov%2F7421475%2F).%20Medicine%20and%20Science%20in%20Sports%20and%20Exercise%2C%2012(4)%2C%20257%E2%80%93261.%0A%0A%20%20%20%20-%20%5BVirtual%20Animation%20of%20the%20Kinematics%20of%20the%20Human%20for%20Industrial%2C%20Educational%20and%20Research%20Purposes%20(VAKHUM)%5D(https%3A%2F%2Fgithub.com%2FBMClab%2FBMC%2Fblob%2Fmaster%2Fcourses%2Frefs%2FVAKHUM.pdf).%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
479ed45f055646e2609b5be297f83df4