# Difficulties while trying to apply the Lagrangian approach to a problem with damping

I have tried to use the Lagrangian approach to find the equation of motion for a horizontally driven damped pendulum but my solution seems quite different from the provided answer, here is the problem:

A simple pendulum has a length $l$ of $~1 ~m$. The pendulum is set into forced vibration by moving its point of suspension horizontally in SHM with an amplitude of 1 mm. Show that if the horizontal displacement of the pendulum bob is $x$, and the horizontal displacement of the support is $~a=a_0cos(\omega t)$, the equation of motion of the bob for small oscillations is: $$\frac{d^2x}{dt^2}+\gamma\frac{dx}{dt}+\frac{g}{l}x=\frac{g}{l}a$$ where $\gamma$ is the damping coefficient.

This is my attempt to the solution: Using the Lagrangian approach:

taking $~\theta~$ the angle between the vertical equilibrium position and the pendulum . we get :

$~~x=lsin\theta+a~~$
$~~y=l(1-cos\theta)~~$

(I've placed the origin at the equilibrium position)

The kinetic energy : $T=\frac{1}{2}mv^2=\frac{1}{2}m(\dot x^2+\dot y^2)=\frac{1}{2}ml^2+\frac{1}{2}ma^2+\frac{1}{2}ml^2\dot\theta^2+ml^2\dot \theta sin\theta+aml\dot \theta cos\theta$

The potential energy : $V=mgl(1-cos\theta)$

And then the Lagragian : $L=T-V= \frac{1}{2}mv^2=\frac{1}{2}m(\dot x^2+\dot y^2)=\frac{1}{2}ml^2+\frac{1}{2}ma^2+\frac{1}{2}ml^2\dot\theta^2+ml^2\dot \theta sin\theta+aml\dot \theta cos\theta + mgl(cos\theta-1)$

$\frac{\partial L}{\partial \dot \theta} = ml^2sin\theta + \dot a mlcos\theta+ml^2\dot \theta$

$\frac{d}{dt}\Big(\frac{\partial L}{\partial \dot \theta}\Big)=\dot \theta ml^2cos\theta-\dot aml\dot \theta sin\theta+ml^2\ddot \theta+\ddot a mlcos\theta$

$\frac{\partial L}{\partial \theta}=\dot \theta ml^2cos\theta-\dot a ml\dot \theta sin\theta-mglsin\theta$

Applying Euler-Lagrange : $\frac{d}{dt}\Big(\frac{\partial L}{\partial \dot \theta}\Big)-\frac{\partial L}{\partial \theta}=-(m\gamma) l\dot \theta$

Which yields after some algebra and approximations for small $\theta$:

$l^2\ddot \theta+l\ddot a+ + gl\theta+ \gamma l\dot \theta=0$

Since we know that : $\theta=\frac{x-a}{l}$ , by substituting above we get:

$\ddot x+\frac{\gamma}{l}\dot x+\frac{g}{l}x+=\frac{\gamma}{l}\dot a+\frac{g}{l} a$

I don't understand where did these extra-terms came from ?

any propositions ?

The dissipation of energy requires an explicitly time-dependent Lagrangian. Try multiplying the usual one by $e^{\omega t}$, then see which value of $\omega$ gives the right result.