1. The problem statement, all variables and given/known data I am trying to solve a spring mass system (mass m and constant spring stiffness k) where instead of applied force a displacement is applied as u=sin(ωt) where ω is the frequency and t is the time. I need to find the difference of the total work done and the energy (KE and PE) of the system. The spring constant is k and the mass of the spring is m. The spring is tied at one end and at the other end mass is attached to which the displacement u is applied. 2. Relevant equations The equation of motion is m*a(t) + k *u(t) = F(u) where F(u) is the unknown force which depends on the displacement applied u. The total work done during a time interval Δt is given by ∫[F(u)*du] with limits from t to t + Δt. The total change in the KE (=ΔKE) and PE (=ΔPE) is (I think) given by ΔKE = 0.5*m*(V_t+Δt - V_t)^2 and ΔPE as 0.5*k*(u_t+Δt-u_t)^2. 3. The attempt at a solution Now, since there is no dissipation the total work done, W, from t to t + Δt should be equal to ΔKE+ΔPE i.e. change in KE and PE from t to t + Δt . I am calculating the work done as integral from t to t + Δt of F(u)*du where F(u) = m*a + k*u where a = double derivative of u. The change in KE and PE is computed from the formula ΔKE = 0.5*m*(V_t+Δt - V_t)^2 and ΔPE as 0.5*k*(u_t+Δt-u_t)^2. However, I do not get W = ΔKE+ΔPE. I have also tried getting the ΔKE and ΔPE using the integration from t to t+Δt. Can somebody suggest what is wrong that I am doing. Your advice, suggestions is highly appreciated. Thank you.