HP Forums
(50g) Center of Mass using Matrix - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: General Software Library (/forum-13.html)
+--- Thread: (50g) Center of Mass using Matrix (/thread-3603.html)



(50g) Center of Mass using Matrix - Eddie W. Shore - 04-10-2015 05:10 AM

Center of Mass using Matrix: CENTERMTX

Link to the original blog entry: [url] http://edspi31415.blogspot.com/2015/04/hp-prime-center-of-mass-matrix.html[/url]

Input:
1: Matrix of Masses

Program:
<< DUP SIZE OBJ→ DROP → M R C
<< M 1 C START 1 NEXT C →ARRY * AXL ∑LIST

M 1 C FOR I I NEXT C 1 2 →LIST →ARRY * TRAN
1 R START 1 NEXT R 1 2 →LIST →ARRY * OBJ→ DROP

M TRAN 1 R FOR I I NEXT R 1 2 →LIST →ARRY * TRAN
1 C START 1 NEXT C 1 2 →LIST →ARRY * OBJ→ DROP

→ tm rw cw
<< rw tm / cw tm / {1,2} →ARRY >> >> >>

Output:
[[ x center of mass point, y center of mass point ]]