2
$\begingroup$

Using Mathematica, find the center of mass of a 2D square not centered at the origin.

center: (x0, y0)

area1 = 4*Integrate[1, {x, x0, a/2}, {y, y0, b/2 }]
cm = mass/area1
$\endgroup$

2 Answers 2

5
$\begingroup$
RegionCentroid[Rectangle[{x0 - a/2, y0 - a/2}, {x0 + a/2, y0 + a/2}]]
$\endgroup$
1
$\begingroup$

The center of mass is the mass weighted mean of the position vector. Call the mass density: rho, then we have:

totmass= Integrate[rho , {x, x0 - a/2, x0 + a/2}, {y, y0 - b/2, y0 + b/2}];
cof= Integrate[rho {x,y}, {x, x0 - a/2, x0 + a/2}, {y, y0 - b/2, y0 + b/2}] /totmass  //Simplify

(*{x0,y0}*)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.