Programmers and Teachers:
Center of Mass Calculator
Lesson on Center of Mass
How to Hand Calculate Center of Mass
For a system of point masses:
A system of point masses is defined as having discrete points that have a known mass. It is an idealized version of real-world systems and helps us simplify center of mass (COM) problems. The COM equation for a system of point masses is given as:
Where the large Σ means we sum the result of every index i, m is the mass of point i, x is the displacement of point i, and M is the total mass of the system. Displacement is a vector that tells us how far a point is away from the origin and what direction. Positive direction will be positive x and negative direction will be negative x.
By dividing the top summation of all the mass displacement products by the total mass of the system, mass cancels out and we are left with displacement. This displacement will be the distance and direction of the COM.
For complex geometries:
If we do not have a simple array of discrete point masses in the 1, 2, or 3 dimensions we are working in, finding center of mass can get tricky. Luckily, if we are dealing with a known 2D shape such as a triangle, the centroid of the shape is also the center of mass. There are centroid equations for common 2D shapes that we use as a shortcut to find the center of mass in the vertical and horizontal directions.
If a 2D shape has curved edges, then we must model it using a function and perform a special integral. If it is a 3D shape with curved or smooth outer surfaces, then we must perform a multiple integral. Before integrating, we multiply the integrand by a distance unit. After integrating, we divide by the total area or volume (depending on if it is 2D or 3D shape).
These integral methods calculate the centroid location that is bound by the function and some line or surface. The centroid of a function is effectively its center of mass since it has uniform density and the terms “centroid” and “center of mass” can be used interchangeably. Generally, we will use the term “center of mass” when describing a real, physical system and the term “centroid” when describing a graph or 2-D shape.
Let’s work together through a point mass system to exemplify the techniques just shown.
Find the center of mass of the system with given point masses.
m1 = 3, x1 = 2
m2 = 1, x2 = 4
m3 = 5, x3 = 4
1.) Since it is a point mass system, we will use the equation ∑mixi⁄M.
2.) Let’s multiply each point mass and its displacement, then sum up those products.
3.) (m1)(x1) = (3)(2) = 6, (m2)(x2) = (1)(4) = 4, (m3)(x3) = (5)(4) = 20
6 + 4 + 20 = 30
4.) Now let’s find the total mass M of the system.
m1 + m2 + m3 = 3 + 1 + 5 = 9
5.) Now let’s apply our values to the equation.
30/9 = 3.3333
6.) The center of mass is located at x = 3.3333.
How the Calculator Works
The calculator on this page can compute the center of mass for point mass systems and for functions. The code that powers it is completely different for each of the two types.
When the “points” type is selected, it uses the point mass system formula shown above. The formula is expanded and used in an iterated loop that multiplies each mass by each respective displacement. The sum of those products is divided by the sum of the masses. The resulting number is formatted and sent back to this page to be displayed.
When the “function” type is selected, it calculates the x centroid of the function. As outlined earlier in the lesson, the function is multiplied by x before the definite integral is taken within the x limits you inputted. The result of that integral is divided by the result of the original function’s definite integral. The final x coordinate is sent back to this page and displayed.
The answer itself is sent to this page in the format of LaTeX, which is a math markup and rendering language. There is a MathJax script on this page that provides the rendering functionality. When a new answer is detected, MathJax renders the answer in the form of the math image that is seen.