Consider two masses m1 and m2, connected by a spring of spring constant k and an uncompressed length L. The masses are on a frictionless surface. Initially, m2 compresses the spring to L/2 length. At t=0 the system is released. Find the position of the center of mass of the system as a function of time.

To find the position of the center of mass of the system as a function of time, we need to consider the motion of both masses and how they affect the position of the center of mass.

First, let's define the position of mass m1 as x1 and the position of mass m2 as x2. The position of the center of mass, denoted as Xc, is given by the equation:

Xc = (m1 * x1 + m2 * x2) / (m1 + m2)

Since the masses are connected by a spring, their individual motions will be affected by the spring force.

Let's start with mass m1. The force acting on m1 is the spring force exerted by the compressed spring. According to Hooke's Law, the spring force is given by:

F1 = -k * (x1 - L)

where k is the spring constant and L is the uncompressed length of the spring.

Using Newton's second law, we can derive the equation of motion for m1:

m1 * d^2x1/dt^2 = -k * (x1 - L)

Similarly, for mass m2, the spring force is given by:

F2 = -k * (x2 - L)

and the equation of motion is:

m2 * d^2x2/dt^2 = -k * (x2 - L/2)

Note that the spring exerts a force on both masses in the opposite direction to their displacements from the equilibrium position (L or L/2).

To find the positions x1 and x2 as functions of time, we need to solve these second-order differential equations. The general solutions will involve trigonometric functions, which can be found by assuming harmonic motion.

Assuming the solutions have the form:

x1(t) = A1 * cos(ωt + φ1)
x2(t) = A2 * cos(ωt + φ2)

where A1, A2 are the amplitudes of oscillation, ω is the angular frequency, and φ1, φ2 are the phase angles.

After differentiating the above equations twice, substituting them into the respective equation of motion, and comparing the coefficients of cos(ωt) and sin(ωt), you can solve for the angular frequency ω and the phase angles φ1, φ2.

Finally, using the initial conditions given, where m2 compresses the spring to L/2 length, you can determine the amplitude A2.

Once you have found the expressions for x1(t) and x2(t), you can substitute them into the equation for the position of the center of mass:

Xc = (m1 * x1 + m2 * x2) / (m1 + m2)

Substituting the respective expressions and simplifying will give you the position of the center of mass, Xc, as a function of time.