I'm trying to understand the way my teacher found the lagrangian of an elastic pendulum. Given a spring pendulum connected to the origin, the equalibrium point is $(0,0,\frac{-mg}{k})$ The length of the relaxed spring is $0$. The lagrangian with respect to the equilibrium point is $$ L = \frac{1}{2}m \dot r^2 - \frac{k}{2} r^2. $$ I don't understand why the gravitational potential energy wasn't taken into account. Can it be related to the given initial conditions? the mass starts at the equilibrium point with velocity $v$ to the right ($x$ direction).