The image is a conservative system where $l_{1}$ and $l_{2}$ are the lengths of the two linear elastic springs at rest, while $k_{1}$ and $k_{2}$ are the elastic constants. We let $\theta_{1}$ and $x_{1}(t)$ be the degrees of freedom identifying the position of the mass $m_{1}$ and $g$ be the acceleration of gravity.
I have to find the Lagrangian function and derive the Euler-Lagrange equations.
I'm struggling to obtain the Lagrangian. I know the quantity is given by $L=T-V$, but I don't know if I'm expressing the kinetic and potential energy with respect to the generalized coordinates $\theta_{1}$ and $x_{1}(t)$ correctly.
The length $L$ is a constraint on the system, so I was thinking of expressing the position of the mass as $r_{x} = L - (l_{1}+x_{1}(t))cos(\theta_{1}(t))$ and $r_{y} = L - (l_{1}+x_{1}(t))sin(\theta_{1}(t))$. With the position of the mass, I can express the energy with respect to the generalized coordinates.
For the kinetic energy, $T=\frac{1}{2}m(\dot{r})^2 = \frac{1}{2}m((\frac{dr_{x}}{dt})^2+(\frac{dr_{y}}{dt})^2)$. I can differentiate this; I just need to know if the expression is correct.
For the potential energy, $V = \frac{1}{2}k_{eff}(\Delta x)^2 + mgh=\frac{1}{2}(k_{1}+k_{2})(x_{1}(t))^2 + mg(l_{1}+x_{1}(t))sin(\theta_{1}(t))$.
Are these expressions correct? I only need help finding the Lagrangian. I can find the equations of motion once I have the Lagrangian.
Thanks for the help!
I personally would define the origin of the coordinate system to be the attachment point of spring 1 with the wall, and the position of the mass to be $((l_1 + x_1) cos(\theta_1), -(l_1+x_1) sin(\theta_1))$. The potential energy is \begin{equation} V = \frac{1}{2} k_1 x_1^2 + \frac{1}{2} k_2 x_2^2 + mgh \end{equation} so you want to represent $x_2$ and $h$ in terms of $x_1$ and $\theta_1$. That's relatively easy (particluarly $h$): \begin{equation} h = -(l_1+x_1) sin(\theta_1) \end{equation} \begin{equation} l_2 + x_2 = \sqrt{(l_1+x_1)^2 sin(\theta_1)^2 + (L-(l_1+x_1)cos(\theta_1))^2} \, . \end{equation} Now just start substituting in.
Your mistakes were: 1) you miscalculated the potential energy of spring 2 -- it depends on $x_2$, not $x_1$, and 2) your sign for gravitational potential energy is wrong.