Se utilizaran tres términos en la aproximación
\begin{equation*} u(x) \approx \hat u(x) = \sum_{i=0}^{2} a_{i} x^{i} = a_{0} + a_{1} x + a_{2} x^{2} \end{equation*}reemplazando las condiciones de contorno
\begin{align*} \require{cancel} \hat u(0) &= a_{0} + a_{1} (0) + a_{2} (0)^{2} = 0 \\ \hat u(1) &= \cancel{a_{0}} + a_{1} (1) + a_{2} (1)^{2} = 0 \end{align*}resolviendo el sistema
\begin{align*} a_{0} &= 0 \\ a_{1} &= -a_{2} \end{align*}reemplazando las constantes
\begin{equation*} \hat u(x) = -a_{2} x + a_{2} x^{2} = a_{2} (x^{2} - x) \end{equation*}$\hat u_{x}$ es
\begin{equation*} \frac{d \hat u(x)}{d x} = -a_{1} + 2 a_{2} x \end{equation*}$\hat u_{xx}$ es
\begin{equation*} \frac{d^{2} \hat u(x)}{d x^{2}} = 2 a_{2} \end{equation*}la función residual es
\begin{equation*} R(x) = \frac{d^{2} \hat u(x)}{d x^{2}} + x^{2} = 2 a_{2} + x^{2} \end{equation*}la función ponderada es
\begin{equation*} W(x) = \frac{d \hat u(x)}{d a_{2}} = (x^{2} - x) \end{equation*}la forma débil de la ecuación diferencial es
\begin{equation*} \int_{0}^{1} R(x) W(x) \ dx = \int_{0}^{1} (2 a_{2} + x^{2}) (x^{2} - x) \ dx = 0 \end{equation*}multiplicando y ordenando
\begin{equation*} \int_{0}^{1} - 2 a_{2} x + 2 a_{2} x^{2} - x^{3} + x^{4} \ dx = 0 \end{equation*}integrando
\begin{equation*} \bigg(- a_{2} x^{2} + \frac{2}{3} a_{2} x^{3} - \frac{1}{4} x^{4} + \frac{1}{5} x^{5} \bigg) \bigg|_{0}^{1} = 0 \end{equation*}reemplazando límites de integración y simplificando
\begin{equation*} -\frac{1}{3} a_{2} = \frac{1}{20} \end{equation*}despejando
\begin{equation*} a_{2} = -\frac{3}{20} \end{equation*}reemplazando en la solución aproximada
\begin{equation*} \hat u(x) = - \frac{3}{20} (x^{2} - x) = \frac{3}{20} x - \frac{3}{20} x^{2} \end{equation*}Se utilizaran cuatro términos en la aproximación
\begin{equation*} u(x) \approx \hat u(x) = \sum_{i=0}^{3} a_{i} x^{i} = a_{0} + a_{1} x + a_{2} x^{2} + a_{3} x^{3} \end{equation*}reemplazando las condiciones de contorno
\begin{align*} \require{cancel} \hat u(0) &= a_{0} + a_{1} (0) + a_{2} (0)^{2} + a_{3} (0)^{3} = 0 \\ \hat u(1) &= \cancel{a_{0}} + a_{1} (1) + a_{2} (1)^{2} + a_{3} (1)^{3} = 0 \end{align*}resolviendo el sistema
\begin{align*} a_{0} &= 0 \\ a_{1} &= - a_{2} - a_{3} \end{align*}reemplazando las constantes
\begin{equation*} \hat u(x) = - a_{2} x - a_{3} x + a_{2} x^{2} + a_{3} x^{3} = a_{2} (x^{2} - x) + a_{3} (x^{3} - x) \end{equation*}la anterior puede escribirse como
\begin{equation*} \hat u(x) = \hat u_{1}(x) + \hat u_{2}(x) \end{equation*}$\hat u_{x}$ es
\begin{equation*} \frac{d \hat u(x)}{d x} = - a_{2} - a_{3} + 2 a_{2} x + 3 a_{3} x^{2} \end{equation*}$\hat u_{xx}$ es
\begin{equation*} \frac{d^{2} \hat u(x)}{d x^{2}} = 2 a_{2} + 6 a_{3} x \end{equation*}la función residual es
\begin{equation*} R(x) = \frac{d^{2} \hat u(x)}{d x^{2}} + x^{2} = 2 a_{2} + 6 a_{3} x + x^{2} \end{equation*}la función ponderada puede escribirse como
\begin{equation*} W(x) = W_{1}(x) + W_{2}(x) \end{equation*}derivando respecto a las variables desconocidas
\begin{align*} W_{1}(x) = \frac{d \hat u_{1}(x)}{d a_{2}} &= x^{2} - x \\ W_{2}(x) = \frac{d \hat u_{2}(x)}{d a_{3}} &= x^{3} - x \end{align*}reemplazando en la función ponderada
\begin{equation*} W(x) = (x^{2} - x) + (x^{3} - x) \end{equation*}la forma débil de la ecuación diferencial es
\begin{equation*} \int_{0}^{1} R(x) W(x) \ dx = \int_{0}^{1} (2 a_{2} + 6 a_{3} x + x^{2}) [(x^{2} - x) + (x^{3} - x)] \ dx = 0 \end{equation*}puede escribirse como la suma de integrales
\begin{equation*} \int_{0}^{1} R(x) W_{1}(x) \ dx + \int_{0}^{1} R(x) W_{2}(x) \ dx = 0 \end{equation*}y también como un sistema de ecuaciones
\begin{align*} \int_{0}^{1} R(x) W_{1}(x) \ dx &= 0 \\ \int_{0}^{1} R(x) W_{2}(x) \ dx &= 0 \end{align*}reemplazando en la anterior fórmula
\begin{align*} \int_{0}^{1} (2 a_{2} + 6 a_{3} x + x^{2}) (x^{2} - x) \ dx &= 0 \\ \int_{0}^{1} (2 a_{2} + 6 a_{3} x + x^{2}) (x^{3} - x) \ dx &= 0 \end{align*}multiplicando y ordenando
\begin{align*} \int_{0}^{1} 2 a_{2} x^{2} + 6 a_{3} x^{3} + x^{4} - 2 a_{2} x - 6 a_{3} x^{2} - x^{3} \ dx &= 0 \\ \int_{0}^{1} 2 a_{2} x^{3} + 6 a_{3} x^{4} + x^{5} - 2 a_{2} x - 6 a_{3} x^{2} - x^{3} \ dx &= 0 \end{align*}integrando
\begin{align*} \bigg( \frac{2}{3} a_{2} x^{3} + \frac{3}{2} a_{3} x^{4} + \frac{1}{5} x^{5} - a_{2} x^{2} - 2 a_{3} x^{3} - \frac{1}{4} x^{4} \bigg) \bigg|_{0}^{1} &= 0 \\ \bigg( \frac{1}{2} a_{2} x^{4} + \frac{6}{5} a_{3} x^{5} + \frac{1}{6} x^{6} - a_{2} x^{2} - 2 a_{3} x^{3} - \frac{1}{4} x^{4} \bigg) \bigg|_{0}^{1} &= 0 \end{align*}reemplazando límites de integración y simplificando
\begin{align*} - \frac{1}{3} a_{2} - \frac{1}{2} a_{3} &= \frac{1}{20} \\ - \frac{1}{2} a_{2} - \frac{4}{5} a_{3} &= \frac{1}{12} \end{align*}resolviendo el sistema
\begin{align*} a_{2} &= \frac{1}{10} \\ a_{3} &= - \frac{1}{6} \end{align*}reemplazando en la solución aproximada
\begin{equation*} \hat u(x) = \frac{1}{10} (x^{2} - x) - \frac{1}{6} (x^{3} - x) = \frac{1}{15} x + \frac{1}{10} x^{2} - \frac{1}{6} x^{3} \end{equation*}La solución puede escribirse como
\begin{equation*} u(x) \approx \hat u(x) = \sum_{i=0}^{n} a_{i} N_{i} \end{equation*}y la función ponderada como
\begin{equation*} W(x) = \sum_{i=0}^{n} \delta a_{i} N_{i} \end{equation*}donde $N$ es una función de aproximación o interpolante, también llamada función de forma
Se utilizaran cuatro términos en la aproximación
\begin{equation*} \hat u(x) = a_{0} + a_{1} x + a_{2} x^{2} - a_{3} x^{3} \end{equation*}reemplazando las condiciones de contorno
\begin{align*} \require{cancel} \hat u(0) &= a_{0} + a_{1} (0) + a_{2} (0)^{2} - a_{3} (0)^{3} = 0 \\ \hat u(1) &= \cancel{a_{0}} + a_{1} (1) + a_{2} (1)^{2} - a_{3} (1)^{3} = 0 \end{align*}resolviendo el sistema
\begin{align*} a_{0} &= 0 \\ a_{2} &= a_{3} - a_{1} \end{align*}reemplazando las constantes
\begin{equation*} \hat u(x) = a_{1} x + a_{3} x^{2} - a_{1} x^{2} - a_{3} x^{3} = a_{1} x (1- x) + a_{3} x^{2} (1 - x) \end{equation*}$\hat u_{x}$ es
\begin{equation*} \frac{d \hat u(x)}{d x} = a_{1} + 2 a_{3} x - 2 a_{1} x - 3 a_{3} x^{2} \end{equation*}$\hat u_{xx}$ es
\begin{equation*} \frac{d^{2} \hat u(x)}{d x^{2}} = 2 a_{3} - 2 a_{1} - 6 a_{3} x = 2(a_{3} - a_{1}) - 6 a_{3} x \end{equation*}la función residual es
\begin{equation*} R(x) = \frac{d^{2} \hat u(x)}{d x^{2}} + x^{2} = 2(a_{3} - a_{1}) - 6 a_{3} x + x^{2} \end{equation*}la función ponderada es
\begin{equation*} W(x) = \delta a_{1} x (1- x) + \delta a_{3} x^{2} (1 - x) \end{equation*}la forma débil de la ecuación diferencial es
\begin{equation*} \int_{0}^{1} R(x) W(x) \ dx = \int_{0}^{1} [2(a_{3} - a_{1}) - 6 a_{3} x + x^{2}] [\delta a_{1} x (1- x) + \delta a_{3} x^{2} (1 - x)] \ dx = 0 \end{equation*}puede escribirse como la suma de integrales
\begin{equation*} \int_{0}^{1} [2(a_{3} - a_{1}) - 6 a_{3} x + x^{2}] [\delta a_{1} x (1- x)] \ dx + \int_{0}^{1} [2(a_{3} - a_{1}) - 6 a_{3} x + x^{2}] [\delta a_{3} x^{2} (1 - x)] \ dx = 0 \end{equation*}las constantes salen de la integral
\begin{align*} \delta a_{1} \int_{0}^{1} [2(a_{3} - a_{1}) - 6 a_{3} x + x^{2}] [x (1- x)] \ dx &= 0 \\ \delta a_{3} \int_{0}^{1} [2(a_{3} - a_{1}) - 6 a_{3} x + x^{2}] [x^{2} (1 - x)] \ dx &= 0 \end{align*}multiplicando y ordenando
\begin{align*} \int_{0}^{1} - 2 a_{1} x + 2 a_{3} x + 2 a_{1} x^{2} - 8 a_{3} x^{2} + 6 a_{3} x^{3} + x^{3} - x^{4} \ dx &= 0 \\ \int_{0}^{1} - 2 a_{1} x^{2} + 2 a_{3} x^{2} + 2 a_{1} x^{3} - 8 a_{3} x^{3} + 6 a_{3} x^{4} + x^{4} - x^{5} \ dx &= 0 \end{align*}integrando
\begin{align*} \bigg( - a_{1} x^{2} + a_{3} x^{2} + \frac{2}{3} a_{1} x^{3} - \frac{8}{3} a_{3} x^{3} + \frac{3}{2} a_{3} x^{4} + \frac{1}{4} x^{4} - \frac{1}{5} x^{5} \bigg) \bigg|_{0}^{1} &= 0 \\ \bigg( - \frac{2}{3} a_{1} x^{3} + \frac{2}{3} a_{3} x^{3} + \frac{1}{2} a_{1} x^{4} - 2 a_{3} x^{4} + \frac{6}{5} a_{3} x^{5} + \frac{1}{5} x^{5} - \frac{1}{6} x^{6} \bigg) \bigg|_{0}^{1} &= 0 \end{align*}reemplazando límites de integración y simplificando
\begin{align*} - \frac{1}{3} a_{1} - \frac{1}{6} a_{3} &= - \frac{1}{20} \\ - \frac{1}{6} a_{1} - \frac{2}{15} a_{3} &= - \frac{1}{30} \end{align*}resolviendo el sistema
\begin{align*} a_{1} &= \frac{1}{15} \\ a_{3} &= \frac{1}{6} \end{align*}reemplazando en la solución aproximada
\begin{equation*} \hat u(x) = \frac{1}{15} x (1 - x) + \frac{1}{6} x^{2} (1 - x) = \frac{1}{15} x + \frac{1}{10} x^{2} - \frac{1}{6} x^{3} \end{equation*}puede escribirse como la suma de integrales
\begin{equation*} \int_{0}^{1} \frac{d^{2} u(x)}{d x^{2}} W(x) \ dx + \int_{0}^{1} x^{2} 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}^{1} W(x) \frac{d^{2} u(x)}{d x^{2}} \ dx &= \bigg( W(x) \frac{d u(x)}{d x} \bigg) \bigg|_{0}^{1} - \int_{0}^{1} \frac{d u(x)}{d x} \frac{d W(x)}{d x}\ dx \end{align*}reemplazando
\begin{equation*} \bigg( \frac{d u(x)}{d x} W(x) \bigg) \bigg|_{0}^{1} - \int_{0}^{1} \frac{d u(x)}{d x} \frac{d W(x)}{d x}\ dx + \int_{0}^{1} x^{2} W(x) \ dx = 0 \end{equation*}reordenando
\begin{equation*} \int_{0}^{1} \frac{d u(x)}{d x} \frac{d W(x)}{d x} \ dx = \int_{0}^{1} x^{2} W(x) \ dx + \bigg( \frac{d u(x)}{d x} W(x) \bigg) \bigg|_{0}^{1} \end{equation*}para la solución se usara un elemento de dos nodos
\begin{align*} u(x) &= \sum_{i=1}^{2} N_{i} a_{i} = N_{1} a_{1} + N_{2} a_{2} \\ \frac{d u(x)}{d x} &= \frac{d N_{1}}{d x} a_{1} + \frac{d N_{2}}{d x} a_{2} \\ W(x) &= \sum_{i=1}^{2} N_{i} \delta a_{i} = N_{1} \delta a_{1} + N_{2} \delta a_{2} \\ \frac{d W(x)}{d x} &= \frac{d N_{1}}{d x} \delta a_{1} + \frac{d N_{2}}{d x} \delta a_{2} \end{align*}reemplazando
\begin{equation*} \int_{0}^{1} \bigg( \frac{d N_{1}}{d x} a_{1} + \frac{d N_{2}}{d x} a_{2} \bigg) \bigg( \frac{d N_{1}}{d x} \delta a_{1} + \frac{d N_{2}}{d x} \delta a_{2} \bigg) \ dx = \int_{0}^{1} x^{2} (N_{1} \delta a_{1} + N_{2} \delta a_{2}) \ dx + \bigg[ \frac{d u(x)}{d x} (N_{1} \delta a_{1} + N_{2} \delta a_{2}) \bigg] \bigg|_{0}^{1} \end{equation*}multiplicando
\begin{equation*} \int_{0}^{1} \frac{d N_{1}}{d x} \frac{d N_{1}}{d x} a_{1} \delta a_{1} + \frac{d N_{1}}{d x} \frac{d N_{2}}{d x} a_{2} \delta a_{1} + \frac{d N_{2}}{d x} \frac{d N_{1}}{d x} a_{1} \delta a_{2} + \frac{d N_{2}}{d x} \frac{d N_{2}}{d x} a_{2} \delta a_{2} \ dx = \int_{0}^{1} x^{2} N_{1} \delta a_{1} + x^{2} N_{2} \delta a_{2} \ dx + \bigg( \frac{d u(x)}{d x} N_{1} \delta a_{1} + \frac{d u(x)}{d x} N_{2} \delta a_{2} \bigg) \bigg|_{0}^{1} \end{equation*}reemplazando los límites de integración en el lado derecho
\begin{equation*} \int_{0}^{1} \frac{d N_{1}}{d x} \frac{d N_{1}}{d x} a_{1} \delta a_{1} + \frac{d N_{1}}{d x} \frac{d N_{2}}{d x} a_{2} \delta a_{1} + \frac{d N_{2}}{d x} \frac{d N_{1}}{d x} a_{1} \delta a_{2} + \frac{d N_{2}}{d x} \frac{d N_{2}}{d x} a_{2} \delta a_{2} \ dx = \int_{0}^{1} x^{2} N_{1} \delta a_{1} + x^{2} N_{2} \delta a_{2} \ dx + \bigg( \frac{d u(1)}{d x} N_{1}(1) \delta a_{1} + \frac{d u(1)}{d x} N_{2}(1) \delta a_{2} \bigg) - \bigg( \frac{d u(0)}{d x} N_{1}(0) \delta a_{1} + \frac{d u(0)}{d x} N_{2}(0) \delta a_{2} \bigg) \end{equation*}reordenando y agrupando
\begin{equation*} \int_{0}^{1} \bigg( \frac{d N_{1}}{d x} \frac{d N_{1}}{d x} a_{1} + \frac{d N_{1}}{d x} \frac{d N_{2}}{d x} a_{2} \bigg) \delta a_{1} + \bigg( \frac{d N_{2}}{d x} \frac{d N_{1}}{d x} a_{1} + \frac{d N_{2}}{d x} \frac{d N_{2}}{d x} a_{2} \bigg) \delta a_{2} \ dx = \int_{0}^{1} x^{2} N_{1} \delta a_{1} + x^{2} N_{2} \delta a_{2} \ dx + \bigg( \frac{d u(1)}{d x} N_{1}(1) - \frac{d u(0)}{d x} N_{1}(0) \bigg) \delta a_{1} + \bigg( \frac{d u(1)}{d x} N_{2}(1) - \frac{d u(0)}{d x} N_{2}(0) \bigg) \delta a_{2} \end{equation*}formando un sistema de ecuaciones
\begin{align*} \int_{0}^{1} \bigg( \frac{d N_{1}}{d x} \frac{d N_{1}}{d x} a_{1} + \frac{d N_{1}}{d x} \frac{d N_{2}}{d x} a_{2} \bigg) \delta a_{1} \ dx &= \int_{0}^{1} x^{2} N_{1} \delta a_{1} \ dx + \bigg( \frac{d u(1)}{d x} N_{1}(1) - \frac{d u(0)}{d x} N_{1}(0) \bigg) \delta a_{1} \\ \int_{0}^{1} \bigg( \frac{d N_{2}}{d x} \frac{d N_{1}}{d x} a_{1} + \frac{d N_{2}}{d x} \frac{d N_{2}}{d x} a_{2} \bigg) \delta a_{2} \ dx &= \int_{0}^{1} x^{2} N_{2} \delta a_{2} \ dx + \bigg( \frac{d u(1)}{d x} N_{2}(1) - \frac{d u(0)}{d x} N_{2}(0) \bigg) \delta a_{2} \end{align*}las constantes se simplifican en ambos lados
\begin{align*} \int_{0}^{1} \frac{d N_{1}}{d x} \frac{d N_{1}}{d x} a_{1} + \frac{d N_{1}}{d x} \frac{d N_{2}}{d x} a_{2} \ dx &= \int_{0}^{1} x^{2} N_{1} \ dx + \frac{d u(1)}{d x} N_{1}(1) - \frac{d u(0)}{d x} N_{1}(0) \\ \int_{0}^{1} \frac{d N_{2}}{d x} \frac{d N_{1}}{d x} a_{1} + \frac{d N_{2}}{d x} \frac{d N_{2}}{d x} a_{2} \ dx &= \int_{0}^{1} x^{2} N_{2} \ dx + \frac{d u(1)}{d x} N_{2}(1) - \frac{d u(0)}{d x} N_{2}(0) \end{align*}las funciones de forma obtenidas anteriomente, tienen los siguientes valores
\begin{matrix} N_{1}(1) = 0 & N_{1}(0) = 0 \\ N_{2}(1) = 0 & N_{2}(0) = 0 \end{matrix}reemplazando
\begin{align*} \int_{0}^{1} \frac{d N_{1}}{d x} \frac{d N_{1}}{d x} a_{1} + \frac{d N_{1}}{d x} \frac{d N_{2}}{d x} a_{2} \ dx &= \int_{0}^{1} x^{2} N_{1} \ dx \\ \int_{0}^{1} \frac{d N_{2}}{d x} \frac{d N_{1}}{d x} a_{1} + \frac{d N_{2}}{d x} \frac{d N_{2}}{d x} a_{2} \ dx &= \int_{0}^{1} x^{2} N_{2} \ dx \end{align*}en forma matricial
\begin{equation*} \int_{0}^{1} \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} a_{1} \\ a_{2} \end{bmatrix} = \int_{0}^{1} x^{2} \begin{bmatrix} N_{1} \\ N_{2} \end{bmatrix} dx \end{equation*}factorizando matrices
\begin{equation*} \int_{0}^{1} \begin{bmatrix} \frac{d N_{1}}{d x} \\ \frac{d N_{2}}{d x} \end{bmatrix} \begin{bmatrix} \frac{d N_{1}}{d x} & \frac{d N_{2}}{d x} \end{bmatrix} dx \begin{bmatrix} a_{1} \\ a_{2} \end{bmatrix} = \int_{0}^{1} x^{2} \begin{bmatrix} N_{1} \\ N_{2} \end{bmatrix} dx \end{equation*}