function K = kinetic_energy(Y)

global N m

 totalV2 = 0;
 for i = 1:N
     V2 = Y(4,i)^2 + Y(5,i)^2 + Y(6,i)^2;
     totalV2 = totalV2 + V2;
 end
     
     
 K = .5*m*totalV2;
 