Can this system be solved analytically?
That depends on how you model it.
Generally, I'd say you could probably model this as a system with very limited state:
- position of the two small magnets
The spring force is a direct result of the position, so there's no need to consider that as state. Whether the switches are on or of depend on the position of the small magnets, too.
Then, you could set up equations describing the relationships like
"The speed of m1 is the mass of m1 times gravitational pull plus the magnetic pull, which depends on the switch2 state, i.e. whether m2 is at the 'closed' position."
Speed being the derivative of position over time, you then get a system of two differential equations. Let \$p_i\$ be the position of \$m_i\$, just set the mass of the magnets to 1, so that the gravitational pull becomes \$g\$, let the "closed height" be 0, and you'd get something like:
$$\begin{align} \dot p_1 &= &-g &+ \mathbf 1\left\{p_2 = 0\right\} \cdot \frac{V_1}{R_1}\\
\dot p_2 &= &g &- \mathbf 1\left\{p_1 = 0\right\} \cdot \frac{V_2}{R_2}
\end{align}$$
with \$\mathbf 1\$ being the indicator function, ie. 1 when the condition in {} is true, 0 else.
To make this analytically easier, you'd go ahead and replace \$\mathbf 1\$ with something differentiable; I'd try an exponential function with negative exponent that departs from 1 very quickly (the larger const. \$\gamma\$, the more "noncontinuous" that will look from afar; maybe you'll find a solution that you can \$\lim\limits_{\gamma\to\infty}\$):
$$\begin{align} \dot p_1 &= &-g &+ e^{-\gamma{p_2}^{2}} \cdot \frac{V_1}{R_1}\\
\dot p_2 &= &g &- e^{-\gamma{p_1}^{2}} \cdot \frac{V_2}{R_2}
\end{align}$$
Then, find a solution for \$p_1\$ and insert that into \$\dot p_2\$ (or vice versa).
There's various tricks that help you learn, which you usually learn during one of the control and systems theory lectures when studying engineering.
From your profile, I'd assume your more of an algebraian (is that a word?), but that's simply as much analysis as you need to stand :)
Since we're directly aiming for a system that both of us expect to behave periodically, I'd say: maybe apply the Fourier transform to above equations – it has nice properties w.r.t. derivations and exponential functions, and will end up delivering a discrete solution iff the system actually is periodic.