HP Forums

Full Version: (50g) Center of Mass using Matrix
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Center of Mass using Matrix: CENTERMTX

Link to the original blog entry: [url] http://edspi31415.blogspot.com/2015/04/h....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 ]]
Reference URL's