I am trying to find the Lagrangian $L$ of a system I am studying. The equations of motion is:
$$\left\{ \begin{array}{c l} r \ddot{\phi} + 2\dot{r} \dot{\phi}+k(r) \cdot r \dot{r} \dot{\phi} = 0\\ \ddot{r} - r \dot{\phi}^2 - k(r) \cdot r^2 \dot{\phi}^2 = 0 \end{array}\right.$$
I have tried a general Ansatz $L=L_1+L_2=\Sigma_{m,n,p,q} C_{m,n,p,q} r^m \dot{r}^n \phi^p \dot{\phi}^q+L_2(k(r))$ and plugged into the Euler-Lagrange equation but find the calculation extremely tedious. Is there some systematic way to find it?
I'd really appreciate any hints. Thank you!
Update:
By a little bit rearrangement, $$\left\{ \begin{array}{c l} \ddot{\phi} + F(r) \dot{r} \dot{\phi}= 0\\ \ddot{r} +G(r) \dot{\phi}^2 = 0 \end{array}\right.$$ where \begin{equation} F(r)=\frac{2}{r} + k(r), \quad G(r)=-(r+k(r)\cdot r^2) \end{equation}
If we assume $$L=A(r) \dot{r}^2 + B(r) \dot{\phi}^2 +C(r) \dot{r} \dot{\phi}$$ (so that I can get the metric easily)
Then $$\left\{ \begin{array}{c l} \mathscr{L}_r L = 2A \ddot{r} -B_r \dot{\phi}^2+C\ddot{\phi} +A_r \dot{r}^2\\ \mathscr{L}_\phi L = 2B \ddot{\phi} +2B_r \dot{r}\dot{\phi}+C_r\dot{r}^2 + C \ddot{r} \end{array}\right.$$ where $\mathscr{L}_q L \equiv \frac{d}{dt} \left(\frac{\partial{L}}{\partial{\dot{q}}}\right)-\frac{\partial{L}}{\partial{q}}$
By comparison with the EOM, it requires $$\frac{2A}{1}= \frac{-B_r}{G(r)}, \quad \frac{2B}{1}=\frac{2B_r}{F(r)}, \quad C=0, \quad A_r=0$$
It seems fine except for $A_r=0$ is conflicting with the others.