Linking to what is discussed here, writing the following code:
m := 1.52
g := 9.81
us := 0.30
uk := 0.20
k := 10.12
F := 1.00
xi := 2.20
vi := 0.00
sol = NDSolve[{
F - k x[t] - Sign[x'[t]] uk m g == m x''[t],
x[0] == xi,
x'[0] == vi,
WhenEvent[
x'[t] == 0 && us m g >= Abs[F - k x[t]],
tmax = t; "StopIntegration"]
}, x, {t, 0, 10^4}];
and recalling the theorem of work and kinetic energy: the work done by all the forces acting on a body is equal to the variation of its kinetic energy, that is $\sum_j W_j = K_f - K_i$, I calculated:
NIntegrate[Sign[x'[t]] F - k x[t] - uk m g /. sol[[1]], {t, 0, tmax}] // Chop
-19.3941
1/2 m x'[tmax]^2 - 1/2 m x'[0]^2 /. sol[[1]] // Chop
0
I don't understand why work is not zero as the kinetic energy variation! Ideas?
Writing:
NIntegrate[m x''[t] x'[t] /. sol[[1]], {t, 0, tmax}] // Chop
you have perfect match!
NIntegrate[Sign[x'[t]] F - k x[t] - uk m g /. sol[[1]], {t, 0, tmax}] // Chop
does not calculate the work but Intergates the force over time (work is force integrated over distance). $\endgroup$