In my mechanics class, I learned that the components of the generalized force, $Q_i$, could be calculated using:
$$\begin{equation}\tag{1}Q_i = \sum_j \frac{\partial \mathbf{r}_j}{\partial q_i}\cdot \mathbf{F}_j.\end{equation}$$
But, by solving the Euler-Lagrange equations, I should also be able to find the generalized force.
Nonetheless, they yield vastly different results.
For example, in the simple case of a particle in a universe gravitational field, i.e. $\vec{F}=mg\,\hat{e}_z$, the equation above returns:
$$Q_r=-mg\cos\theta$$ $$Q_\theta=mgr\sin\theta$$
while, when taking the lagrangian, $$L=\frac{1}{2}m\left(\dot{r}^2+(r\dot{\theta})^2+(r\dot{\phi}\sin\theta)^2\right) - mgr\cos\theta,$$ and solving the Euler-Lagrange equations, I get:
$$m\ddot{r}=Q_r=mr\dot{\theta}^2+mr\phi^2\sin^2\theta-mg\cos\theta$$
$$mr^2\ddot{\theta}=Q_\theta=mr^2\phi^2\sin\theta\cos\theta+mgr\sin\theta$$
What's wrong here?