jbriggs444
Science Advisor
Homework Helper
2024 Award
- 13,370
- 8,042
What I see that is relevant in that code segment is:
So you are counting up ##t## at an even rate. That seems fine.
But you are counting up theta at an accelerating rate. That seems broken. You are multiplying incremental time by current position instead of multiplying incremental time by current velocity.
You have also not exported the constant sub-expression outside of the main loop. But that is just a performance thing.
Wait a minute -- you have acceleration depending on theta. That's flat wrong.
Code:
while v > limite_zero:
t = t + dt
theta = theta + x / rayon_pneu * dt
dv = dt * (pression_freins * 2 * surface_plaquette * rayon_frein * theta) / (masse + 4 * moment_inertie_roue / rayon_pneu**2)
v = v - dv
x = x + v * dt
But you are counting up theta at an accelerating rate. That seems broken. You are multiplying incremental time by current position instead of multiplying incremental time by current velocity.
You have also not exported the constant sub-expression outside of the main loop. But that is just a performance thing.
Wait a minute -- you have acceleration depending on theta. That's flat wrong.