Find the distance $\mu$ such that the mass center is closest to the line $\hat{\mathbf{n}}$.
import sympy as sm
import sympy.physics.mechanics as me
me.init_vprinting()
m, u = sm.symbols('m, mu')
A = me.ReferenceFrame('A')
Locations of each particle:
p1 = A.y + A.z
p2 = A.x + A.z
p3 = A.x + A.y
Mass center vector:
p_star = (m*p1 + 2*m*p2 + u*p3)/(m + 2*m + u)
p_star
Define the line:
n = (A.x + A.y + A.z)/sm.sqrt(3)
n
Form a vector that has a magnitude equal to the distance of interest:
D = p_star - (p_star.dot(n)*n)
D.simplify()
D_mag = D.magnitude().simplify()
D_mag
Find $\mu$ such that
D_mag.diff(u)
sm.solve(D_mag.diff(u), u)[0]