function E = twosprings(x,m1,m2,L1,L2,k1,k2,g)
% Potential energy of the spring-mass system 
%!! See Fig. \ref{fig:fun2d-spring-mass}
E = .5*(k1*(x(1)-L1).^2 + k2*(x(2)-x(1)-L2).^2) ...
    - g*(m1*x(1) + m2*x(2));