Consider a spring pendulum like in this figure
suppose the spring is arranged to lie in a straight line and its equilibrium lenght is $l$.
Consider the unit vectors $e_1, e_2$, $e_x, e_{\theta}$ like here
I have some trouble expressing the weight of $m$ and its potential using $e_x, e_{\theta}$.
We have $W=mge_1$ and it seems to me that $e_1 = \cos{\theta}e_x-\sin{\theta}e_{\theta}$, so $W=mg\cos{\theta}e_x-mg\sin{\theta}e_{\theta}$.
Now consider the potential (relative to the weight) $V(x_1, x_2)=-mgx_1$ with $x_1=(x+l)\cos{\theta}$.
We can also write $V(x, \theta)=-mg(x+l)\cos{\theta}$ (or at least this is what my text does) getting $P=-\partial_xVe_x-\partial_{\theta}Ve_{\theta}=mg\cos{\theta}e_x-mg(x+l)\sin{\theta}e_{\theta}$ which is in contradiction with what I wrote above.
Could you help me understand what I'm doing wrong? Thanks