I am a student of physics, and I'm developing an application that involves a vertical mass-spring system, but there are two problems in my simulation. 1 - When I change the elastic constant of the spring, the energy is not conserved. There isn't any variable for this. 2 - The spring's support swings along with the movement of the mass-spring. How can I fix these problems?