second order coupled ODEs

I need help with the following problem:

Two balls connected by a spring have displacement in the plane given by x1(t) and x2(t). They obey the differential equations:

| (d^2 x1 / d t^2) = - x1 - 3 * (x1 - x2)
|
| (d^2 x2 / d t^2) = - x2 - 3 * (x2 - x1)

Use the leapfrog integrator to find their paths, knowing that initially they are both at rest but have the displacements x1 = (1, 0) and x2 = (0.6, 0.3). Plot their trajectories and compute their location at t2 to 5 significant figures. [Here I believe I should have only two straight co-linear lines, their center of mass should remain constant]

My question isn't related to the code writing itself, as much as what are the equations for the cartesian axes themselves. I don't think it's physically sensible to split the equations simply in x and y coordinates, as:

(d^2 y1 / d t^2) = - y1 - 3 * (y1 - y2)

(d^2 y2 / d t^2) = - y2 - 3 * (y2 - y1) [ibid for x coordinates]

although I could be wrong and the equations themselves could be written as to take that into account. So, how do I fiind the eq for the cartesian coordinates from the abovementioned equations?

Thanks!

Posted Dec 2, 2011, 12:17 AM UTC

23
Loading comments…