Suppose we have a spring placed vertically on a table. We put a body with mass "m" on it. The spring compresses by "x". Then sum of forces is zero, therefore: kx=mg, so k=mg/x But if we look on it as the energy problem, then: we hold the body on the string, then we release it, so loss of gravitational potential energy is "mgx" and gain of spring energy is 0.5*k*x^2. From that: k=2mg/x, which contradicts previous equation. Where I did a mistake?