Lagrangian Equations for a Beam in Simple Bending
The typical derivation for the equations of motion of a beam uses a free-body diagram with shear and moment forces to derive the equations of motion. This derivation suffers from the usual lack of clarity in differential diagrams – it’s not immediately clear, for example, what conditions of smoothness need to be satisfied for the equation to hold. It’s also more difficult to generalize to beams with odd shapes or varying properties.
Here’s a derivation of the equations of motion of the beam using energy methods. We’ll take the (complementary) strain energy
$$ V = \int_L {M^2(x) \over 2 EI} dx $$where \(M(x) = EI w''(x)\) is the bending moment at point \(x\) along the beam, \(w\) is the deflection of the beam, and \( EI \) is the stiffness of the beam.
The (complementary) kinetic energy of the beam is
$$ T = \int_L {\rho A (\dot{w}(x))^2 \over 2} dx $$where \(\rho A\) is the linear density of the beam and \( \dot{w} \) is its local velocity.
Note that we distinguish between time and space derivatives in the usual way:
$$ {dw \over dt} = \dot{w}, \hspace{2em} {dw \over dx} = w' $$Now we can form the Lagrangian
$$ \mathcal{L}(\dot{w}, w'') = T - V = \int_L \left[ {\rho A (\dot{w}(x))^2 \over 2} - {M^2(x) \over 2 EI} \right]dx $$and find the stationary points
$$ \delta \mathcal{L} = 0 = {\partial \mathcal{L} \over \partial \dot{w}}\delta \dot{w} +{\partial \mathcal{L} \over \partial w''}\delta w'' $$which we plug into the equation of motion (using the smoothness of the Lagrangian to interchange variation and spatial integration):
$$ \int_L \left[ \frac{\partial}{\partial \dot w}{\rho A \dot{w}(x)^2 \over 2}\delta \dot{w} - \frac{\partial}{\partial w''}{(EI w'')^2 \over 2 EI} \delta w'' \right]dx = 0 $$giving
$$ \int_L \left[ {\rho A \dot{w}(x)}\delta \dot{w} - {EI w''(x)} \delta w'' \right]dx = 0 $$Now we can use integration by parts, along with the boundary conditions \((\delta w)(t_0) = (\delta w)(t_f) = 0\) and \( (\delta w)(0) = (\delta w)(L) = (\delta w')(0) = (\delta w')(L) = 0 \) to move the derivatives off of the variations:
$$ \int_L \left[ - \frac{d}{dt}(\rho A \dot{w}(x)) - \frac{d^2}{dx^2} (EI w''(x)) \right]\delta w \ dx = 0 $$(The first term picked up a negative sign due to the asymmetry of the first derivative operator)
Finally, since the integral across the beam holds for any permissible variation \(\delta w\), the term inside brackets is zero:
\[ -\frac{d}{dt}(\rho A \dot{w}(x)) - \frac{d^2}{dx^2} (EI w''(x)) = 0 \]thus recovering (for constant \(EI\)) the usual differential equations of motion for a beam in simple bending:
$$ \rho A \ddot{w}(x) + EI w^{(4)}(x) = 0 $$Using this structure for the equations of motion immediately makes it clear what would be necessary to account for shear loading, axial loading, or torsion – simply add those equations into the term for the potential energy \(V\), and add generalized coordinates as required. It’s also clear how it would generalize to curved or arbitrarily shaped beams.
Additionally, I believe that this form of the equations of motion is exactly the one that is used in finite element solvers – rather than use integration by parts, they create a linear system by solving with families of simply-supported variations \(\delta \dot w\) and \( \delta w''\).