Solution (source code)

= Solution

Take laboratory displacements from the equilibrium positions with the support at $f=0$. The left spring's dynamic extension is $x_1-f(t)$ and the spring between the masses has dynamic extension $x_2-x_1$. <Hooke's law> and <Newton's second law> give
$$
\boxed{m\ddot x_1=-k(x_1-f)+2k(x_2-x_1),\qquad 2m\ddot x_2=-2k(x_2-x_1).}
$$
Equivalently,
$$
m\begin{pmatrix}1&0\\0&2\end{pmatrix}\ddot{\mathbf x}+k\begin{pmatrix}3&-2\\-2&2\end{pmatrix}\mathbf x=k\begin{pmatrix}f(t)\\0\end{pmatrix}.
$$
The natural length sets the equilibrium separations but disappears from these displacement equations. The support is externally prescribed, so no additional support equation is required.