So naively I thought my students could write a program to demonstrate resonance using a vertical driven spring. The approach I used was as usual: calculate net force, update velocity and position. But there's no resonance. Amplitude stays constant.
I know there are numerical subtleties in this sort of program. For instance, if you don't update the velocity before you update the position, it is numerically unstable. That has to do with slightly overshooting the actual max position.
I'm wondering if there might be something similar going on around resonance due to the discrete nature of the numerical approximation. Can't imagine what it is but I thought I'd ask if anyone had done this successfully.