Ecuación diferencial de una barra $$ \begin{equation*} EA \frac{d^{2} u(x)}{d x^{2}} + q(x) = 0 \end{equation*} $$
usando el método de Galerkin $$ \begin{equation*} \int_{0}^{L} R(x) W(x) \ dx = \int_{0}^{L} \bigg( EA \frac{d^{2} u(x)}{d x^{2}} + q(x) \bigg) W(x) \ dx = 0 \end{equation*} $$
puede escribirse como la suma de integrales $$ \begin{equation*} \int_{0}^{L} EA \frac{d^{2} u(x)}{d x^{2}} W(x) \ dx + \int_{0}^{L} q(x) W(x) \ dx = 0 \end{equation*} $$
integrando por partes para reducir el orden de la derivada $$ \begin{align*} \int u \ dv &= uv - \int v \ du \\ \int_{0}^{L} W(x) E A \frac{d^{2} u(x)}{d x^{2}} \ dx &= \bigg( W(x) E A \frac{d u(x)}{d x} \bigg) \bigg|_{0}^{L} - \int_{0}^{L} E A \frac{d u(x)}{d x} \frac{d W(x)}{d x} \ dx \end{align*} $$
reemplazando $$ \begin{equation*} \bigg( E A \frac{d u(x)}{d x} W(x) \bigg) \bigg|_{0}^{L} - \int_{0}^{L} E A \frac{d u(x)}{d x} \frac{d W(x)}{d x}\ dx + \int_{0}^{L} q(x) W(x) \ dx = 0 \end{equation*} $$
reordenando $$ \begin{equation*} \int_{0}^{L} E A \frac{d u(x)}{d x} \frac{d W(x)}{d x} \ dx = \int_{0}^{L} q(x) W(x) \ dx + \bigg( E A \frac{d u(x)}{d x} W(x) \bigg) \bigg|_{0}^{L} \end{equation*} $$
para la solución se usará un elemento de dos nodos $$ \begin{align*} u(x) &= N_{1} u_{1} + N_{2} u_{2} \\ \frac{d u(x)}{d x} &= \frac{d N_{1}}{d x} u_{1} + \frac{d N_{2}}{d x} u_{2} \\ W(x) &= N_{1} \delta u_{1} + N_{2} \delta u_{2} \\ \frac{d W(x)}{d x} &= \frac{d N_{1}}{d x} \delta u_{1} + \frac{d N_{2}}{d x} \delta u_{2} \end{align*} $$
reemplazando $$ \begin{equation*} \int_{0}^{L} E A \bigg( \frac{d N_{1}}{d x} u_{1} + \frac{d N_{2}}{d x} u_{2} \bigg) \bigg( \frac{d N_{1}}{d x} \delta u_{1} + \frac{d N_{2}}{d x} \delta u_{2} \bigg) \ dx = \int_{0}^{L} q(x) (N_{1} \delta u_{1} + N_{2} \delta u_{2}) \ dx + \bigg[ E A \frac{d u(x)}{d x} (N_{1} \delta u_{1} + N_{2} \delta u_{2}) \bigg] \bigg|_{0}^{L} \end{equation*} $$
reemplazando \( E A \frac{d u(x)}{d x} = F(x) \) $$ \begin{equation*} \int_{0}^{L} E A \bigg( \frac{d N_{1}}{d x} u_{1} + \frac{d N_{2}}{d x} u_{2} \bigg) \bigg( \frac{d N_{1}}{d x} \delta u_{1} + \frac{d N_{2}}{d x} \delta u_{2} \bigg) \ dx = \int_{0}^{L} q(x) (N_{1} \delta u_{1} + N_{2} \delta u_{2}) \ dx + \bigg[ F(x) (N_{1} \delta u_{1} + N_{2} \delta u_{2}) \bigg] \bigg|_{0}^{L} \end{equation*} $$
multiplicando $$ \begin{equation*} \int_{0}^{L} E A \frac{d N_{1}}{d x} \frac{d N_{1}}{d x} u_{1} \delta u_{1} + E A \frac{d N_{1}}{d x} \frac{d N_{2}}{d x} u_{2} \delta u_{1} + E A \frac{d N_{2}}{d x} \frac{d N_{1}}{d x} u_{1} \delta u_{2} + E A \frac{d N_{2}}{d x} \frac{d N_{2}}{d x} u_{2} \delta u_{2} \ dx = \int_{0}^{L} q(x) N_{1} \delta u_{1} + q(x) N_{2} \delta u_{2} \ dx + \bigg( F(x) N_{1} \delta u_{1} + F(x) N_{2} \delta u_{2} \bigg) \bigg|_{0}^{L} \end{equation*} $$
reemplazando los límites de integración en el lado derecho $$ \begin{equation*} \int_{0}^{L} E A \frac{d N_{1}}{d x} \frac{d N_{1}}{d x} u_{1} \delta u_{1} + E A \frac{d N_{1}}{d x} \frac{d N_{2}}{d x} u_{2} \delta u_{1} + E A \frac{d N_{2}}{d x} \frac{d N_{1}}{d x} u_{1} \delta u_{2} + E A \frac{d N_{2}}{d x} \frac{d N_{2}}{d x} u_{2} \delta u_{2} \ dx = \int_{0}^{L} q(x) N_{1} \delta u_{1} + q(x) N_{2} \delta u_{2} \ dx + ( F(L) N_{1}(L) \delta u_{1} + F(L) N_{2}(L) \delta u_{2} ) - ( F(0) N_{1}(0) \delta u_{1} + F(0) N_{2}(0) \delta u_{2} ) \end{equation*} $$
reordenando y agrupando $$ \begin{equation*} \int_{0}^{L} E A \bigg( \frac{d N_{1}}{d x} \frac{d N_{1}}{d x} u_{1} + \frac{d N_{1}}{d x} \frac{d N_{2}}{d x} u_{2} \bigg) \delta u_{1} + E A \bigg( \frac{d N_{2}}{d x} \frac{d N_{1}}{d x} u_{1} + \frac{d N_{2}}{d x} \frac{d N_{2}}{d x} u_{2} \bigg) \delta u_{2} \ dx = \int_{0}^{L} q(x) N_{1} \delta u_{1} + q(x) N_{2} \delta u_{2} \ dx + ( F(L) N_{1}(L) - F(0) N_{1}(0) ) \delta u_{1} + ( F(L) N_{2}(L) - F(0) N_{2}(0) ) \delta u_{2} \end{equation*} $$
formando un sistema de ecuaciones $$ \begin{align*} \int_{0}^{L} E A \bigg( \frac{d N_{1}}{d x} \frac{d N_{1}}{d x} u_{1} + \frac{d N_{1}}{d x} \frac{d N_{2}}{d x} u_{2} \bigg) \delta u_{1} \ dx &= \int_{0}^{L} q(x) N_{1} \delta u_{1} \ dx + ( F(L) N_{1}(L) - F(0) N_{1}(0) ) \delta u_{1} \\ \int_{0}^{L} E A \bigg( \frac{d N_{2}}{d x} \frac{d N_{1}}{d x} u_{1} + \frac{d N_{2}}{d x} \frac{d N_{2}}{d x} u_{2} \bigg) \delta u_{2} \ dx &= \int_{0}^{L} q(x) N_{2} \delta u_{2} \ dx + ( F(L) N_{2}(L) - F(0) N_{2}(0) ) \delta u_{2} \end{align*} $$
las constantes se simplifican en ambos lados $$ \begin{align*} \int_{0}^{L} E A \bigg( \frac{d N_{1}}{d x} \frac{d N_{1}}{d x} u_{1} + \frac{d N_{1}}{d x} \frac{d N_{2}}{d x} u_{2} \bigg) \ dx &= \int_{0}^{L} q(x) N_{1} \ dx + F(L) N_{1}(L) - F(0) N_{1}(0) \\ \int_{0}^{L} E A \bigg( \frac{d N_{2}}{d x} \frac{d N_{1}}{d x} u_{1} + \frac{d N_{2}}{d x} \frac{d N_{2}}{d x} u_{2} \bigg) \ dx &= \int_{0}^{L} q(x) N_{2} \ dx + F(L) N_{2}(L) - F(0) N_{2}(0) \end{align*} $$
las funciones de forma tienen los siguientes valores
\begin{matrix} N_{1}(L) = 0 & N_{1}(0) = 1 \\ N_{2}(L) = 1 & N_{2}(0) = 0 \end{matrix}
reemplazando $$ \begin{align*} \int_{0}^{L} E A \bigg( \frac{d N_{1}}{d x} \frac{d N_{1}}{d x} u_{1} + \frac{d N_{1}}{d x} \frac{d N_{2}}{d x} u_{2} \bigg) \ dx &= \int_{0}^{L} q(x) N_{1} \ dx - F(0) \\ \int_{0}^{L} E A \bigg( \frac{d N_{2}}{d x} \frac{d N_{1}}{d x} u_{1} + \frac{d N_{2}}{d x} \frac{d N_{2}}{d x} u_{2} \bigg) \ dx &= \int_{0}^{L} q(x) N_{2} \ dx + F(L) \end{align*} $$
en forma matricial $$ \begin{equation*} \int_{0}^{L} E A \begin{bmatrix} \frac{d N_{1}}{d x} \frac{d N_{1}}{d x} & \frac{d N_{1}}{d x} \frac{d N_{2}}{d x} \\ \frac{d N_{2}}{d x} \frac{d N_{1}}{d x} & \frac{d N_{2}}{d x} \frac{d N_{2}}{d x} \end{bmatrix} dx \begin{bmatrix} u_{1} \\ u_{2} \end{bmatrix} = \int_{0}^{L} q(x) \begin{bmatrix} N_{1} \\ N_{2} \end{bmatrix} dx + \begin{bmatrix} -F(0) \\ F(L) \end{bmatrix} \end{equation*} $$
cambiando \( -F(0) \) y \( F(L) \) por fuerzas en los nodos 1 y 2 $$ \begin{equation*} \int_{0}^{L} E A \begin{bmatrix} \frac{d N_{1}}{d x} \frac{d N_{1}}{d x} & \frac{d N_{1}}{d x} \frac{d N_{2}}{d x} \\ \frac{d N_{2}}{d x} \frac{d N_{1}}{d x} & \frac{d N_{2}}{d x} \frac{d N_{2}}{d x} \end{bmatrix} dx \begin{bmatrix} u_{1} \\ u_{2} \end{bmatrix} = \int_{0}^{L} q(x) \begin{bmatrix} N_{1} \\ N_{2} \end{bmatrix} dx + \begin{bmatrix} F_{1} \\ F_{2} \end{bmatrix} \end{equation*} $$
factorizando matrices $$ \begin{equation*} \int_{0}^{L} \begin{bmatrix} \frac{d N_{1}}{d x} \\ \frac{d N_{2}}{d x} \end{bmatrix} E A \begin{bmatrix} \frac{d N_{1}}{d x} & \frac{d N_{2}}{d x} \end{bmatrix} dx \begin{bmatrix} u_{1} \\ u_{2} \end{bmatrix} = \int_{0}^{L} q(x) \begin{bmatrix} N_{1} \\ N_{2} \end{bmatrix} dx + \begin{bmatrix} F_{1} \\ F_{2} \end{bmatrix} \end{equation*} $$
en forma compacta $$ \begin{equation*} \int_{0}^{L} \mathbf{B}^{\mathrm{T}} \mathbf{D} \ \mathbf{B} \ dx \ \mathbf{u} = \int_{0}^{L} q \ \mathbf{N}^{\mathrm{T}} dx + \mathbf{F} \end{equation*} $$