function df = twospringsgradient(x,m1,m2,L1,L2,k1,k2,g)
% The gradient of potential energy of the 
% spring-mass system in Fig. XXX
df = [k1*(x(1)-L1) - k2*(x(2)-x(1)-L2) - g*m1,  ...
        k2*(x(2)-x(1)-L2) - g*m2 ];