0
$\begingroup$

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!

$\endgroup$
2
  • 1
    $\begingroup$ "the work done by all the forces acting on a body is equal to the variation of its kinetic energy":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$
    – Ruud3.1415
    Aug 14, 2017 at 16:48
  • 2
    $\begingroup$ This is a one dimensional problem; the force is constrained to point along or against the direction of x. I suspect you'll have more luck with: $W=\int\, dx\, F = \int \,dt\, x' F$. I recommend warming up by using the same code on simple harmonic oscillator, then Damped SHO, then Driven Damped SHO, etc. Debugging where you have complete analytic control. $\endgroup$ Aug 14, 2017 at 17:22

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.