Center of Mass
Text The center of mass of an interval is a weighted average of the positions of the particles that the interval comprises. The amount each particle counts in this weighted average is proportional to its mass.
If we wanted to find the average position of a series of particles on an interval, we could find this position by adding up the values of the xcoordinate from each point (the only coordinate in one dimension) and dividing by the number of points. This is expressed as follows:
(Σ_{n}x_{n})/n
Where x_{n} is the x coordinate of the position of the nth particle.
Suppose instead we wanted to find the center of mass of an interval as described in the first paragraph. Our expression for the x coordinate of the center of mass, given the mass m_{n} of each particle is:
(Σ_{n}x_{n}m_{n})/(Σ_{n}m_{n})
(Note that the denominator is equal to the total mass of the set of particles.)
Given a linear density function ρ(x), we can express this summation as
(Σ_{n}x_{n}*ρ(x_{n})*h_{n})/(Σ_{n}ρ(x_{n})*h_{n})
Where h_{n} is the width of the nth particle.
For an interval with domain D composed of a very large number of particles, we can change this summation to a double integral, replacing h_{n} with dx:
X = (∫_{D}x*ρ(x)dx)/(∫_{D}ρ(x)dx).
This gives us the center of mass (X) of D.
Demos
Center of Mass of a Wire
 
This demo graphs a density function ρ(x) for some interval and then finds the center of mass of that interval.
Changing "rhoMin" (estimated minimum value of ρ(x) and "rhoMax" estimated maximum value of ρ(x)) is optional. Doing so will improve the coloring of the graph (cyan at "rhoMin", red at "rhoMax").

Exercises Find a general formula for the center of mass of a wire that goes from x = 0 to x = 1 with density function ρ = x^{n} , n ≥ 0.
