Los métodos vistos hasta ahora son métodos de un paso debido a que para calcular la solución aproximada \(\hat{y}_{i+1}=\hat{y}(t_{i+1})\) en \(t=t_{i+1}\) sólo usamos el valor de la solución aproximada en el tiempo anterior \(t_i\), \(\hat{y}_i=\hat{y}(t_i)\).
Ahora bien, como en general, el error cometido entre los valores de la solución aproximada \(\hat{y}_i=\hat{y}(t_i)\) y los valores de la solución exacta \(y_i=y(t_i)\), \(|y_i-\hat{y}_i|\) tienden a crecer a medida que el índice \(i\) aumenta, o a medida que nos acercamos al tiempo final \(t=b\), parece razonable de cara a que dicho error no crezca demasiado desarrollar métodos numéricos que, de cara a calcular el valor de la solución aproximada \(\hat{y}_{i+1}=\hat{y}(t_{i+1})\) usen no sólo el valor de la solución aproximada en el tiempo anterior \(t_i\), \(\hat{y}_i=\hat{y}(t_i)\) sino valores previos a éste, \(\hat{y}_{i-1}=\hat{y}(t_{i-1}),\hat{y}_{i-2}=\hat{y}(t_{i-2})\ldots,\hat{y}_{i-m}=\hat{y}(t_{i-m})\) para un \(m>0\) fijado.
Dichos métodos se denominan métodos multipaso cuya definición formal es la siguiente:
Consideremos el problema de valores iniciales \(y'=f(t,y),\ a\leq t\leq b,\ y(a)=y_0\).
Sea \(n\) un entero positivo y \(h=\frac{b-a}{n}\) el paso elegido. Consideramos el mallado \(t_i=a+i\cdot h\), \(i=0,\ldots,n\). Diremos que un método numérico es un método multipaso de orden \(m\) si la ecuación en diferencias correspondiente es de la forma: \[ \begin{align*} \hat{y}_{i+1} & = a_{m-1}\hat{y}_i +a_{m-2}\hat{y}_{i-1}+\cdots +a_0 \hat{y}_{i+1-m}+\\ &\quad h(b_m f(t_{i+1},\hat{y}_{i+1})+b_{m-1}f(t_i,\hat{y}_i)+\cdots +b_0 f(t_{i+1-m},\hat{y}_{i+1-m})), \end{align*} \] para \(i=m-1,m,\ldots,n-1\), donde se tienen que especificar los valores iniciales siguientes: \[ \hat{y}_0=y_0,\ \hat{y}_1=\tilde{y}_1,\ldots,\hat{y}_{m-1}=\tilde{y}_{m-1}. \]
Para calcular los valores iniciales \[ \hat{y}_0=y_0,\ \hat{y}_1=\tilde{y}_1,\ldots,\hat{y}_{m-1}=\tilde{y}_{m-1}, \] se suele usar un método de un paso como por ejemplo Runge-Kutta 4.
Para ver que un método multipaso tiene orden de consistencia \(k\), hay que demostrar la expresión siguiente tiene \(O(h^k)\): \[ \begin{align*} \tau_{i+1}(h) & =\frac{y_{i+1}-(a_{m-1}y_i +a_{m-2}y_{i-1}+\cdots +a_0 y_{i+1-m})}{h}\\ &\quad -(b_m f(t_{i+1},y_{i+1})+b_{m-1}f(t_i,y_i)+\cdots +b_0 f(t_{i+1-m},y_{i+1-m})\\ & =O(h^k), \end{align*} \] donde recordemos que \(y_i=y(t_i)\), el valor de la solución exacta del problema de valores iniciales en \(t=t_i\).
Vamos a ver una metodología para deducir métodos multipaso basada en usar fórmulas de interpolación numérica para integrar una función real de variable real en nodos equiespaciados. Ver el curso Métodos numéricos con Python. Cálculo numérico para más detalles.
Recordemos el problema de valores iniciales a resolver: hallar una función \(y(t)\) tal que \(y'=f(t,y),\ a\leq t\leq b,\ y(a)=y_0\).
Si consideramos el intervalo \([t_i,t_{i+1}]\) donde \(t_i=a+i\cdot h\) y \(t_{i+1}=a+(i+1)\cdot h\), \(h=\frac{b-a}{n}\) son dos puntos del mallado, podemos escribir: \[ y_{i+1}-y_i =y(t_{i+1})-y(t_i)=\int_{t_i}^{t_{i+1}}y'(t)\, dt. \] Ahora bien, como \(y'(t)=f(t,y(t))\) la expresión anterior será: \[ y_{i+1}-y_i = \int_{t_i}^{t_{i+1}}f(t,y(t))\, dt. \]
A continuación, consideramos el polinomio interpolador de grado \(m\) de la función \(f(t,y(t))\), \(P_m(t)\), en los nodos equiespaciados del mallado \(t_i, t_{i-1},\ldots t_{i+1-m}\). Podemos escribir la expresión siguiente: \[ f(t,y(t))=P_m(t)+\frac{f^{(m)}(\xi_i(t),y(\xi_i(t)))}{m!}(t-t_i)(t-t_{i-1})\cdots (t-t_{i+1-m}), \] con \(\xi_i(t)\in (t_i,t)\).
Como los nodos \(t_j\), \(j=i,i-1,\ldots,i+1-m\) son equiespaciados, tenemos que el polinomio interpolador se puede escribir de la forma siguiente basado en las diferencias hacia atrás: \[ P_m(t)=\sum_{k=0}^{m-1}(-1)^{k}\binom{s}{k}\nabla^{k} f(t_i,y(t_i)), \]
donde \(s\) es la nueva variable que vale \(s=\frac{t_i-t}{h}\), \(\binom{s}{k}=\frac{s(s-1)\cdots (s-k+1)}{k!}\), y \[ \begin{align*} \nabla^0 f(t_i,y(t_i)) & =f(t_i,y(t_i)),\\ \nabla^k f(t_i,y(t_i)) & =\nabla^{k-1}f(t_{i},y(t_i))-\nabla^{k-1}f(t_{i-1},y(t_{i-1})). \end{align*} \]
Fijémonos que, como \(t\in [t_i,t_{i+1}]\), entonces \(s\in [-1,0]\). Por tanto, haciendo el cambio de variable \(s=\frac{t_i-t}{h}\), \(dt=-hds\), tenemos que: \[ \begin{align*} y_{i+1}-y_i & = \int_{t_i}^{t_{i+1}}f(t,y(t))\, dt =-h\int_0^{-1}\sum_{k=0}^{m-1}(-1)^{k}\binom{s}{k}\nabla^{k} f(t_i,y(t_i))\,ds\\ & \quad +\frac{h^{m+1}(-1)^{m+1}}{m!}\int_{0}^{-1}f^{(m)}(\xi_i(s),y(\xi_i(s)))s (s-1)\cdots (s-(m-1))\, ds, \end{align*} \] con \(\xi_i(s)\in (-1,0)\).
En las integrales anteriores, hacemos otro cambio de variable \(\hat{s}=-s\), con \(ds=-d\hat{s}\) y nos queda: \[ \begin{align*} y_{i+1}-y_i & = h\int_0^{1}\sum_{k=0}^{m-1}(-1)^{k}\binom{-\hat{s}}{k}\nabla^{k} f(t_i,y(t_i))\,d\hat{s}\\ & \quad +\frac{h^{m+1}}{m!}\int_{0}^{1}f^{(m)}(\hat{\xi}_i(\hat{s}),y(\hat{\xi}_i(\hat{s}))\hat{s} (\hat{s}+1)\cdots (\hat{s}+(m-1))\, d\hat{s} \\ & = h \sum_{k=0}^{m-1} \nabla^{k} f(t_i,y(t_i))(-1)^k \int_0^1 \binom{-\hat{s}}{k}\,d\hat{s}\\ & \quad +\frac{h^{m+1}}{m!}\int_{0}^{1}f^{(m)}(\hat{\xi}_i(\hat{s}),y(\hat{\xi}_i(\hat{s})))\hat{s} (\hat{s}+1)\cdots (\hat{s}+(m-1))\, d\hat{s}, \end{align*} \] con \(\hat{\xi}_i(\hat{s})\in (0,1)\).
En definitiva, podemos escribir: \[ \begin{align*} y_{i+1}-y_i & = h \sum_{k=0}^{m-1}C_k \nabla^{k} f(t_i,y(t_i))\\ & \quad +\frac{h^{m+1}}{m!}\int_{0}^{1}f^{(m)}(\hat{\xi}_i(\hat{s}),y(\hat{\xi}_i(\hat{s})))\hat{s} (\hat{s}+1)\cdots (\hat{s}+(m-1))\, d\hat{s}, \end{align*} \] con \(\displaystyle C_k = (-1)^k\int_0^1 \binom{-\hat{s}}{k}\,d\hat{s}\).
Hallemos los primeros \(C_k\): \[ \begin{align*} C_0 & = (-1)^0\int_0^1 \binom{-\hat{s}}{0}\,d\hat{s} =\int_0^1 1\, d\hat{s}=1,\\ C_1 & = (-1)^1\int_0^1 \binom{-\hat{s}}{1}\,d\hat{s} =-\int_0^1 -\hat{s}\, d\hat{s}=\left[\frac{\hat{s}^2}{2}\right]_0^1=\frac{1}{2},\\ C_2 & = (-1)^2\int_0^1 \binom{-\hat{s}}{2}\,d\hat{s} =\int_0^1 \frac{-\hat{s}(-\hat{s}-1)}{2}\, d\hat{s}=\frac{1}{2}\int_0^1 (\hat{s}^2+\hat{s})\,d\hat{s}\\ & =\frac{1}{2}\left[\frac{\hat{s}^3}{3}+\frac{\hat{s}^2}{2}\right]_0^1=\frac{1}{2}\left(\frac{1}{3}+\frac{1}{2}\right)=\frac{5}{12}, \end{align*} \]
\[ \begin{align*} C_3 & = (-1)^3\int_0^1 \binom{-\hat{s}}{3}\,d\hat{s} =-\int_0^1 \frac{-\hat{s}(-\hat{s}-1)(-\hat{s}-2)}{6}\, d\hat{s}\\ & =\frac{1}{6}\int_0^1 (\hat{s}^3+3\hat{s}^2+2\hat{s})\,d\hat{s} =\frac{1}{6}\left[\frac{\hat{s}^4}{4}+\hat{s}^3+\hat{s}^2\right]_0^1 \\ & =\frac{1}{6}\left(\frac{1}{4}+1+1\right)=\frac{3}{8}. \end{align*} \]
La tabla siguiente nos muestra los valores de los primeros \(C_k\):
\(k\) | \(C_k\) |
---|---|
\(0\) | \(1\) |
\(1\) | \(\frac{1}{2}\) |
\(2\) | \(\frac{5}{12}\) |
\(3\) | \(\frac{3}{8}\) |
\(4\) | \(\frac{251}{720}\) |
\(5\) | \(\frac{95}{288}\) |
\(6\) | \(\frac{19087}{60480}\) |
\(k\) | \(C_k\) |
---|---|
\(7\) | \(\frac{5257}{17280}\) |
\(8\) | \(\frac{1070017}{3628800}\) |
\(9\) | \(\frac{25713}{89600}\) |
\(10\) | \(\frac{26842253}{95800320}\) |
\(11\) | \(\frac{4777223}{17418240}\) |
\(12\) | \(\frac{703604254357}{2615348736000}\) |
A continuación, tratemos el término del error: \[ \frac{h^{m+1}}{m!}\int_{0}^{1}f^{(m)}(\hat{\xi}_i(\hat{s}),y(\hat{\xi}_i(\hat{s})))\hat{s} (\hat{s}+1)\cdots (\hat{s}+(m-1))\, d\hat{s}. \]
Teniendo en cuenta que la función \(\hat{s} (\hat{s}+1)\cdots (\hat{s}+(m-1))\) no cambia de signo en el intervalo \([0,1]\), usando el Teorema del valor medio para integrales podemos afirmar que existe un valor \(\hat{\xi}_i\in (0,1)\) tal que:
\[ \begin{align*} & \frac{h^{m+1}}{m!}\int_{0}^{1}f^{(m)}(\hat{\xi}_i(\hat{s}),y(\hat{\xi}_i(\hat{s})))\hat{s} (\hat{s}+1)\cdots (\hat{s}+(m-1))\, d\hat{s} \\ & =\frac{h^{m+1}f^{(m)}(\hat{\xi}_i,y(\hat{\xi}_i))}{m!}\int_{0}^{1}\hat{s} (\hat{s}+1)\cdots (\hat{s}+(m-1))\, d\hat{s}\\ & =h^{m+1} f^{(m)}(\hat{\xi}_i,y(\hat{\xi}_i))(-1)^m \int_{0}^{1} (-1)^m \binom{-\hat{s}}{m}\, d\hat{s}\\ & =h^{m+1} f^{(m)}(\hat{\xi}_i,y(\hat{\xi}_i))(-1)^m C_m. \end{align*} \]
En resumen, tenemos la expresión siguiente que nos relaciona \(y_{i+1}\) con \(y_i\): \[ y_{i+1}-y_i = h \sum_{k=0}^{m-1} C_k\nabla^{k} f(t_i,y(t_i))+h^{m+1} f^{(m)}(\hat{\xi}_i,y(\hat{\xi}_i))(-1)^m C_m. \]
La expresión anterior motiva la definición del método multipaso de orden \(m\) siguiente: \[ \hat{y}_{i+1} = \hat{y}_i+ h \sum_{k=0}^{m-1} C_k\nabla^{k} f(t_i,\hat{y}_i). \]
Dicho método se denomina método multipaso de Adams-Bashforth de orden \(m\) donde:
Calculemos la expresión de los métodos multipaso de Adams-Bashford para \(m=1,2,3,4\):
\(m=1\): \[ \hat{y}_{i+1} = \hat{y}_i+ hf(t_i,\hat{y}_i), \] es el conocido método de Euler al ser un método de \(m=1\) paso.
\(m=2\): \[ \begin{align*} \hat{y}_{i+1} & = \hat{y}_i+ h \sum_{k=0}^{1} C_k\nabla^{k} f(t_i,\hat{y}_i) =\hat{y}_i +h\left(f(t_i,\hat{y}_i)+\frac{1}{2}\nabla f(t_i,\hat{y}_i)\right)\\ & = \hat{y}_i +h\left(f(t_i,\hat{y}_i)+\frac{1}{2}( f(t_i,\hat{y}_i)-f(t_{i-1},\hat{y}_{i-1}))\right)\\ & = \hat{y}_i + \frac{h}{2}(3 f(t_i,\hat{y}_i)-f(t_{i-1},\hat{y}_{i-1})). \end{align*} \]
INPUT valores inicial y final
\(a\), \(b\), entero
\(n\), condición inicial
\(y_0\) y función
\(f(t,y)\)Set
\(h=\frac{b-a}{n}\).Set
\(t=a\).Set
\(\mathbf{\hat{y}}=\mathbf{0}\). (Definimos inicialmente el vector de aproximaciones como
\(0\))Set
\(\hat{y}_1=y_0\). (Definimos la primera componente del vector de aproximaciones como la condición inicial
)For i=1,2,3
(Calculamos los valores iniciales restantes \(\tilde{y}_1,\tilde{y}_2,\tilde{y}_3\) usando el método de RK-4. Supongamos que hemos definido la rutina RK4 de parámetros \(a\), \(b\), \(n\), \(y_0\), y \(f\), \(RK4(a,b,n,y_0,f)\))
Set
\(t=t+h\)Set
\(\tilde{y}_i=RK4(a,t,i,y_0,f)\)Set
\(\mathbf{\hat{y}}_{i+1}=\tilde{y}_i\) (la componente \(i+1\)-ésima del vector de aproximaciones será la aproximación inicial \(i\)-ésima, \(i=1,2,3\))For i=4,...,n
(Calculamos las demás aproximaciones)
Set
\[
\begin{align*}
\hat{y}_{i+1} & =\hat{y}_{i}+\frac{h}{24}(55\cdot f(t,\hat{y}_{i})-59\cdot f(t-h,\hat{y}_{i-1})\\ & \quad +37\cdot f(t-2\cdot h,\hat{y}_{i-2})-9f(t-3\cdot h,\hat{y}_{i-3}))
\end{align*}
\]Set
\(t=t+ h\). (actualizamos el tiempo
\(t\))Print
\(\mathbf{\hat{y}}\) (Damos el vector de aproximaciones
).Recordemos el siguiente problema de valores iniciales: \[ y'=f(t,y)=t\mathrm{e}^{3t}-2y,\ 0\leq t\leq 1,\ y(0)=0, \] de solución exacta \(y(t)=\frac{1}{5}t\mathrm{e}^{3t}-\frac{1}{25}\mathrm{e}^{3t}+\frac{1}{25}\mathrm{e}^{-2t}\).
Vamos a aplicar el método de Adams-Bashford de orden \(4\) para hallar una solución aproximada en el mallado siguiente usando \(h=0.1\): \[ t_i=0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1. \]
En primer lugar, usando el método de Runge-Kutta 4, calculamos las aproximaciones iniciales \(\hat{y}(0.1)\), \(\hat{y}(0.2)\) y \(\hat{y}(0.3)\).
Seguidamente calculamos el valor de \(\hat{y}(0.4)\): \[ \begin{align*} \hat{y}(0.4) & =\hat{y}(0.3)+\frac{h}{24}(55\cdot f(0.3,0.0711552)-59\cdot f(0.2,0.0268188)\\ & \quad +37\cdot f(0.1,0.0057546)-9\cdot f(0,0))\\ & = 0.0711552+\frac{0.1}{24}(55\cdot 0.5955706-59\cdot 0.3107862+37\cdot0.1234766-9\cdot0)\\ & =0.1502745. \end{align*} \]
A continuación, calculamos \(\hat{y}(0.5)\): \[ \begin{align*} \hat{y}(0.5) & =\hat{y}(0.4)+\frac{h}{24}(55\cdot f(0.4,0.1502745)-59\cdot f(0.3,0.0711552)\\ & \quad +37\cdot f(0.2,0.0268188)-9\cdot f(0.1,0.0057546))\\ & = 0.1507951+\frac{0.1}{24}(55\cdot 1.0274978-59\cdot 0.5955706+37\cdot0.3107862-9\cdot0.1234766)\\ & =0.2826141. \end{align*} \]
Y asi sucesivamente.
La siguiente tabla muestra los valores de las soluciones aproximada y exacta en los puntos del mallado:
\(t_i\) | \(\hat{y}_i\) | \(y_{i}\) | \(|y_i-\hat{y}_i|\) |
---|---|---|---|
0 | 0 | 0 | 0 |
0.1 | 0.0057546 | 0.0057521 | \(0.0000026\) |
0.2 | 0.0268188 | 0.0268128 | \(0.000006\) |
0.3 | 0.0711552 | 0.0711445 | \(0.0000106\) |
0.4 | 0.1502745 | 0.1507778 | \(0.0005034\) |
0.5 | 0.2826141 | 0.2836165 | \(0.0010024\) |
0.6 | 0.4941789 | 0.4960196 | \(0.0018406\) |
Recordemos que para deducir los métodos explícitos de Adams-Bashford, usábamos el polinomio de interpolación de la función \(f(t,y(t))\) en los nodos \(t_i,t_{i-1},\ldots,t_{i+1-m}\) para aproximar el valor de \(y(t_{i+1})=y_{i+1}\) en la integral de la expresión siguiente: \[ y_{i+1}=y_i+\int_{t_i}^{t_{i+1}}f(t,y(t))\,dt. \] Si añadimos el nodo \(t_{i+1}\) a los nodos anteriores \(t_i,t_{i-1},\ldots,t_{i+1-m}\), y repetimos todo el proceso realizado para deducir los métodos de Adams-Bashford, obtendremos los denominados métodos implícitos multipaso de Adams-Moulton de \(m\) pasos.
En primer lugar, podemos escribir la función \(f(t,y(t))\) como: \[ f(t,y(t))=P_{m+1}(t)+\frac{f^{(m+1)}(\xi_i(t),y(\xi_i(t)))}{(m+1)!}(t-t_{i+1})(t-t_{i})\cdots (t-t_{i+1-m}), \] donde \(P_{m+1}(t)\) es el polinomio interpolador de la función \(f(t,y(t))\) en los nodos equiespaciados \(t_{i+1},t_i,t_{i-1},\ldots,t_{i+1-m}\) que puede escribirse de la forma siguiente usando las diferencias hacia atrás: \[ P_{m+1}(t)=\sum_{k=0}^m (-1)^k \binom{s}{k}\nabla^k f(t_{i+1},y(t_{i+1})), \]
donde recordemos que \(s\) es la nueva variable que vale \(s=\frac{t_{i+1}-t}{h}\), \(\binom{s}{k}=\frac{s(s-1)\cdots (s-k+1)}{k!}\), y \[ \begin{align*} \nabla^0 f(t_{i+1},y(t_{i+1})) & =f(t_{i+1},y(t_{i+1})),\\ \nabla^k f(t_{i+1},y(t_{i+1})) & =\nabla^{k-1}f(t_{i+1},y(t_{i+1}))-\nabla^{k-1}f(t_{i},y(t_{i})). \end{align*} \]
Fijémonos que, como \(t\in [t_i,t_{i+1}]\), entonces \(s\in [0,1]\). Por tanto, haciendo el cambio de variable \(s=\frac{t_{i+1}-t}{h}\), \(dt=-hds\), tenemos que: \[ \begin{align*} y_{i+1}-y_i & = \int_{t_i}^{t_{i+1}}f(t,y(t))\, dt =h\int_0^{1}\sum_{k=0}^{m}(-1)^{k}\binom{s}{k}\nabla^{k} f(t_{i+1},y(t_{i+1}))\,ds\\ & \quad +\frac{h^{m+2}(-1)^{m+1}}{(m+1)!}\int_{0}^{1}f^{(m+1)}(\xi_i(s),y(\xi_i(s)))s (s-1)\cdots (s-m)\, ds, \end{align*} \] con \(\xi_i(s)\in (0,1)\).
En definitiva, podemos escribir: \[ \begin{align*} y_{i+1}-y_i & = h \sum_{k=0}^{m} \tilde{C}_k\nabla^{k} f(t_{i+1},y(t_{i+1}))\\ & \quad +\frac{h^{m+2}(-1)^{m+1}}{(m+1)!}\int_{0}^{1}f^{(m+1)}(\hat{\xi}_i(s),y(\hat{\xi}_i(s)))s (s-1)\cdots (s-m)\, ds, \end{align*} \] donde \(\displaystyle \tilde{C}_k = (-1)^k\int_0^1 \binom{s}{k}\,ds\).
Hallemos los primeros \(\tilde{C}_k\): \[ \begin{align*} \tilde{C}_0 & = (-1)^0\int_0^1 \binom{s}{0}\,ds =\int_0^1 1\, ds=1,\\ \tilde{C}_1 & = (-1)^1\int_0^1 \binom{s}{1}\,d\hat{s} =-\int_0^1 s\, ds=-\left[\frac{s^2}{2}\right]_0^1=-\frac{1}{2},\\ \tilde{C}_2 & = (-1)^2\int_0^1 \binom{s}{2}\,ds =\int_0^1 \frac{s(s-1)}{2}\, ds=\frac{1}{2}\int_0^1 (s^2-s)\,ds\\ & =\frac{1}{2}\left[\frac{s^3}{3}-\frac{s^2}{2}\right]_0^1=\frac{1}{2}\left(\frac{1}{3}-\frac{1}{2}\right)=-\frac{1}{12}, \end{align*} \]
\[ \begin{align*} \tilde{C}_3 & = (-1)^3\int_0^1 \binom{s}{3}\,d\hat{s} =-\int_0^1 \frac{s(s-1)(s-2)}{6}\, ds\\ & =-\frac{1}{6}\int_0^1 (s^3-3s^2+2s)\,ds =-\frac{1}{6}\left[\frac{s^4}{4}-s^3+s^2\right]_0^1 \\ & =-\frac{1}{6}\left(\frac{1}{4}-1+1\right)=-\frac{1}{24}. \end{align*} \]
La tabla siguiente nos muestra los valores de los primeros \(\tilde{C}_k\):
\(k\) | \(\tilde{C}_k\) |
---|---|
\(0\) | \(1\) |
\(1\) | \(\frac{-1}{2}\) |
\(2\) | \(\frac{-1}{12}\) |
\(3\) | \(\frac{-1}{24}\) |
\(4\) | \(\frac{-19}{720}\) |
\(5\) | \(\frac{-3}{160}\) |
\(6\) | \(\frac{-863}{60480}\) |
\(k\) | \(\tilde{C}_k\) |
---|---|
\(7\) | \(\frac{-275}{24192}\) |
\(8\) | \(\frac{-33953}{3628800}\) |
\(9\) | \(\frac{-8183}{1036800}\) |
\(10\) | \(\frac{-3250433}{479001600}\) |
\(11\) | \(\frac{-4671}{788480}\) |
\(12\) | \(\frac{-13695779093}{2615348736000}\) |
A continuación, tratemos el término del error: \[ \frac{h^{m+2}(-1)^{m+1}}{(m+1)!}\int_{0}^{1}f^{(m+1)}(\hat{\xi}_i(s),y(\hat{\xi}_i(s)))s (s-1)\cdots (s-m)\, ds. \]
Teniendo en cuenta que la función \(s (s-1)\cdots (s-m)\) no cambia de signo en el intervalo \([0,1]\), usando el Teorema del valor medio para integrales podemos afirmar que existe un valor \(\hat{\xi}_i\in (0,1)\) tal que:
\[ \begin{align*} & \frac{h^{m+2}(-1)^{m+1}}{(m+1)!}\int_{0}^{1}f^{(m+1)}(\hat{\xi}_i(s),y(\hat{\xi}_i(s)))s (s-1)\cdots (s-m)\, ds \\ & =h^{m+2}f^{(m+1)}(\xi_i,y(\xi_i))\int_{0}^{1}(-1)^{m+1}\binom{s}{m+1}\, ds\\ & =h^{m+2}f^{(m+1)}(\xi_i,y(\xi_i)) \tilde{C}_{m+1}. \end{align*} \]
En resumen, tenemos la expresión siguiente que nos relaciona \(y_{i+1}\) con \(y_i\): \[ y_{i+1}-y_i = h \sum_{k=0}^{m} \tilde{C}_k\nabla^{k} f(t_{i+1},y(t_{i+1}))+h^{m+2}f^{(m+1)}(\xi_i,y(\xi_i)) \tilde{C}_{m+1}. \]
La expresión anterior motiva la definición del método multipaso de orden \(m\) siguiente: \[ \hat{y}_{i+1} = \hat{y}_i+ h \sum_{k=0}^{m} \tilde{C}_k\nabla^{k} f(t_{i+1},\hat{y}_{i+1}). \]
Dicho método se denomina método multipaso de Adams-Moulton de orden \(m\) donde:
Calculemos la expresión de los métodos multipaso de Adams-Moulton para \(m=1,2,3\):
INPUT valores inicial y final
\(a\), \(b\), entero
\(n\), condición inicial
\(y_0\) y función
\(f(t,y)\)Set
\(h=\frac{b-a}{n}\).Set
\(t=a\).Set
\(\mathbf{\hat{y}}=\mathbf{0}\). (Definimos inicialmente el vector de aproximaciones como
\(0\))Set
\(\hat{y}_1=y_0\). (Definimos la primera componente del vector de aproximaciones como la condición inicial
)For i=1,2
(Calculamos los valores iniciales restantes \(\tilde{y}_1,\tilde{y}_2\) usando el método de RK-4. Supongamos que hemos definido la rutina RK4 de parámetros \(a\), \(b\), \(n\), \(y_0\), y \(f\), \(RK4(a,b,n,y_0,f)\))
Set
\(t=t+h\)Set
\(\tilde{y}_i=RK4(a,t,i,y_0,f)\)Set
\(\mathbf{\hat{y}}_{i+1}=\tilde{y}_i\) (la componente \(i+1\)-ésima del vector de aproximaciones será la aproximación inicial \(i\)-ésima, \(i=1,2\))For i=3,...,n
(Calculamos las demás aproximaciones)
Set
\(t=t+ h\). (actualizamos el tiempo
\(t\))Print
\(\mathbf{\hat{y}}\) (Damos el vector de aproximaciones
).La ecuación a resolver en el paso \(i\)-ésimo es la siguiente: \[ \begin{align*} g(\hat{y}_{i+1}) & =\hat{y}_{i+1} -\hat{y}_{i} -\frac{h}{24}(9f(t+h,\hat{y}_{i+1})+19f(t,\hat{y}_{i})-5f(t-h,\hat{y}_{i-1})\\ & \quad +f(t-2\cdot h,\hat{y}_{i-2})) =0, \end{align*} \] donde recordemos que \(\hat{y}_{i+1}\) es la incógnita a calcular.
Si queremos usar el método de Newton-Raphson, tenemos que calcular la derivada de la función \(g(\hat{y}_{i+1})\): \[ g'(\hat{y}_{i+1})=1-\frac{3h}{8}\cdot \frac{\partial f}{\partial y}(t+h,\hat{y}_{i+1}). \]
Entonces, la sucesión de Newton-Raphson \((\hat{y}_{i+1})^{(n)}\) que converge a \(\hat{y}_{i+1}\) se tiene que calcular usando la recurrencia siguiente: \[ \hat{y}_{i+1}^{(n)}=\hat{y}_{i+1}^{(n-1)}-\frac{g(\hat{y}_{i+1}^{(n-1)})}{g'(\hat{y}_{i+1}^{(n-1)})}=\hat{y}_{i+1}^{(n-1)}-\frac{g(\hat{y}_{i+1}^{(n-1)})}{1-\frac{3h}{8}\cdot \frac{\partial f}{\partial y}(t+h,\hat{y}_{i+1}^{(n-1)})}, \] con \(\hat{y}_{i+1}^{(0)}=\hat{y}_{i}\).
Recordemos el siguiente problema de valores iniciales: \[ y'=f(t,y)=t\mathrm{e}^{3t}-2y,\ 0\leq t\leq 1,\ y(0)=0, \] de solución exacta \(y(t)=\frac{1}{5}t\mathrm{e}^{3t}-\frac{1}{25}\mathrm{e}^{3t}+\frac{1}{25}\mathrm{e}^{-2t}\).
Vamos a aplicar el método de Adams-Moulton de orden \(4\) para hallar una solución aproximada en el mallado siguiente usando \(h=0.1\): \[ t_i=0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1. \]
Las aproximaciones iniciales \(\hat{y}(0.1)\) y \(\hat{y}(0.2)\) usando el método de Runge-Kutta 4 recordemos que eran \[ \hat{y}(0.1)=0.0057546,\quad \hat{y}(0.2)=0.0268188 \]
Para ello, tenemos que resolver la ecuación siguiente: \[ \begin{align*} g(\hat{y}(0.3)) & =\hat{y}(0.3) -\hat{y}(0.2) -\frac{h}{24}(9f(0.3,\hat{y}(0.3))+19f(0.2,\hat{y}(0.2))-5f(0.1,\hat{y}(0.1)) +f(0,\hat{y}(0))) =0,\\ g(\hat{y}(0.3)) & =\hat{y}(0.3) -0.0268188 -\frac{h}{24}(9f(0.3,\hat{y}(0.3))+19f(0.2,0.0268188)-5f(0.1,0.0057546) +f(0,0)) =0,\\ g(\hat{y}(0.3)) & = \hat{y}(0.3)-0.0268188 -\frac{0.1}{24}(9( 0.3\cdot \mathrm{e}^{3\cdot 0.3}-2\cdot\hat{y}(0.3)+19\cdot 0.3107862-5\cdot 0.1234766 +0) =0,\\ g(\hat{y}(0.3)) & =\hat{y}(0.3)-0.0268188 -0.0041667\cdot (6.6409284-18\cdot\hat{y}(0.3)+5.2875551) =0,\\ g(\hat{y}(0.3)) & =\hat{y}(0.3)+0.075\cdot\hat{y}(0.3)-0.0765208=0,\\ g(\hat{y}(0.3)) & = 1.075\cdot \hat{y}(0.3)-0.0765208=0. \end{align*} \]
La solución de la ecuación anterior vale: \[ \hat{y}(0.3)=\frac{0.0765208}{1.075}=0.0711821. \]
Para ello, tenemos que resolver la ecuación siguiente: \[ \begin{align*} g(\hat{y}(0.4)) & =\hat{y}(0.4) -\hat{y}(0.3) -\frac{h}{24}(9f(0.4,\hat{y}(0.4))+19f(0.3,\hat{y}(0.3))-5f(0.2,\hat{y}(0.2)) +f(0.1,\hat{y}(0.1))) =0,\\ g(\hat{y}(0.4)) & =\hat{y}(0.4) -0.0711821 -\frac{h}{24}(9f(0.4,\hat{y}(0.4))+19f(0.3,0.0711821)-5f(0.2,0.0268188) \\ & \quad +f(0.1,0.0057546)) =0,\\ g(\hat{y}(0.4)) & = \hat{y}(0.4)-0.0711821 -\frac{0.1}{24}(9( 0.4\cdot \mathrm{e}^{3\cdot 0.4}-2\cdot\hat{y}(0.4)+19\cdot 0.5955167-5\cdot 0.3107862 +0.1234766) =0,\\ g(\hat{y}(0.4)) & =\hat{y}(0.4)-0.0711821 -0.0041667\cdot (11.9524209-18\cdot\hat{y}(0.4)+9.8843625) =0,\\ g(\hat{y}(0.4)) & =\hat{y}(0.4)+0.075\cdot\hat{y}(0.4)-0.1621687=0,\\ g(\hat{y}(0.4)) & = 1.075\cdot \hat{y}(0.4)-0.1621687=0. \end{align*} \]
La solución de la ecuación anterior vale: \[ \hat{y}(0.4)=\frac{0.1621687}{1.075}=0.1508546. \]
La siguiente tabla muestra los valores de las soluciones aproximada y exacta en los puntos del mallado:
\(t_i\) | \(\hat{y}_i\) | \(y_{i}\) | \(|y_i-\hat{y}_i|\) |
---|---|---|---|
0 | 0 | 0 | 0 |
0.1 | 0.0057546 | 0.0057521 | \(0.0000026\) |
0.2 | 0.0268188 | 0.0268128 | \(0.000006\) |
0.3 | 0.0711821 | 0.0711445 | \(0.0000376\) |
0.4 | 0.1508546 | 0.1507778 | \(0.0000768\) |
0.5 | 0.2837455 | 0.2836165 | \(0.0001289\) |
0.6 | 0.4962192 | 0.4960196 | \(0.0001996\) |
En este ejemplo hemos visto que hemos sido capaces de despejar \(\hat{y}_{i}\) en la ecuación \[ g(\hat{y}_i) =\hat{y}_{i} -\hat{y}_{i-1} -\frac{h}{24}(9f(t_{i},\hat{y}_{i})+19f(t_{i-1},\hat{y}_{i-1})-5f(t_{i-2},\hat{y}_{i-2}) +f(t_{i-3},\hat{y}_{i-3})) =0, \] básicamente debido a la expresión de \(f(t_i,\hat{y}_i)=t_i\mathrm{e}^{3t_i}-2\hat{y}_i\), en la que la dependencia de \(f\) respecto la variable \(\hat{y}_i\) es lineal.
Sin embargo, hubiésemos podido calcular el valor de \(\hat{y}(0.3)\) usando el método de Newton-Raphson.
Como \(\frac{\partial f}{\partial y}(t_i,\hat{y}_i)=-2\), la sucesión \(\hat{y}(0.3)^{(n)}\) que converge a \(\hat{y}(0.3)\) con \(\hat{y}(0.3)^{(0)}=\hat{y}(0.2)=0.0268188\) verificaría la recurrencia siguiente: \[ \begin{align*} \hat{y}(0.3)^{(n)} & =\hat{y}(0.3)^{(n-1)}-\frac{g(\hat{y}(0.3)^{(n-1)})}{g'(\hat{y}(0.3)^{(n-1)})}=\hat{y}(0.3)^{(n-1)}-\frac{g(\hat{y}(0.3)^{(n-1)})}{1-\frac{3h}{8}\cdot \frac{\partial f}{\partial y}(0.3,\hat{y}(0.3))}\\ & =\hat{y}(0.3)^{(n-1)}-\frac{g(\hat{y}(0.3)^{(n-1)})}{1-\frac{3h}{8}\cdot (-2))}=\hat{y}(0.3)^{(n-1)}-\frac{g(\hat{y}(0.3)^{(n-1)})}{1+\frac{3h}{4}}, \end{align*} \]
El primer término de la sucesión \(\hat{y}(0.3)^{(n)}\) sería:
\[ \begin{align*} \hat{y}(0.3)^{(1)} & = \hat{y}(0.3)^{(0)}-\frac{g(\hat{y}(0.3)^{(0)})}{1+\frac{3h}{4}}=\hat{y}(0.3)^{(0)}\\ & -\frac{\hat{y}(0.3)^{(0)}-\hat{y}(0.2)-\frac{h}{24}(9\cdot f(0.3,\hat{y}(0.3)^{(0)})+19f(0.2,\hat{y}(0.2))-5f(0.1,\hat{y}(0.1)) +f(0,\hat{y}(0))))}{1+\frac{3\cdot h}{4}} \\ & = 0.0268188\\ & -\frac{0.0268188-0.0268188-\frac{0.1}{24}(9\cdot f(0.3,0.0268188)+19f(0.2,0.0268188)-5f(0.1,0.0057546) +f(0,0))}{1+\frac{3\cdot0.1}{4}} \\ & = 0.0268188\\ & +\frac{0.0041667\cdot (9\cdot 0.6842434+19\cdot 0.3107862-5\cdot 0.1234766 +0)}{1.075} =0.0711821, \end{align*} \]
\[ \begin{align*} \hat{y}(0.3)^{(2)} & = \hat{y}(0.3)^{(1)}-\frac{g(\hat{y}(0.3)^{(1)})}{1+\frac{3h}{4}}=\hat{y}(0.3)^{(1)}\\ & -\frac{\hat{y}(0.3)^{(1)}-\hat{y}(0.2)-\frac{h}{24}(9\cdot f(0.3,\hat{y}(0.3)^{(1)})+19f(0.2,\hat{y}(0.2))-5f(0.1,\hat{y}(0.1)) +f(0,\hat{y}(0))))}{1+\frac{3\cdot h}{4}} \\ & = 0.0711821\\ & -\frac{0.0711821-0.0268188-\frac{0.1}{24}(9\cdot f(0.3,0.0711821)+19f(0.2,0.0268188)-5f(0.1,0.0057546) +f(0,0))}{1+\frac{3\cdot0.1}{4}} \\ & = 0.0711821\\ & +\frac{0.0041667\cdot (9\cdot 0.5955167+19\cdot 0.3107862-5\cdot 0.1234766 +0)}{1.075} =0.0711821, \end{align*} \] y así sucesivamente.
Los demás términos son los siguientes: \[ 0.0268188, 0.0711821, 0.0711821, 0.0711821, 0.0711821. \]
En el ejemplo anterior, vimos que el método de Adams-Moulton de orden \(3\) con error de consistencia de orden \(4\), \(O(h^4)\) da mejores resultados que el método de Adams-Bashford de orden \(4\) con el mismo orden de consistencia.
En general, los métodos implícitos de Adams-Moulton tienen mejores resultados que los métodos explícitos de Adams-Bashsford.
Sin embargo, recordemos que los métodos implícitos son computacionalmente más costosos que los métodos explícitos al tener que hallar un cero de una función en cada paso de la iteración.
Por dicho motivo, los métodos implícitos son raramente usados ya que pesa más el coste computacional que la ganancia en los resultados obtenidos.
Una solución de compromiso es usar los denominados métodos predictor-corrector.
Éstos consisten en combinar un método explícito de Adams-Bashford al que llamamos predictor, \[ \hat{y}_{i+1}^{(p)}=\hat{y}_i^{(p)} + h\sum_{k=0}^{m-1}C_k\nabla^k f(t_i,\hat{y}_i^{(p)}), \] y un método implícito de Adams-Moulton, al que llamamos corrector, \[ \hat{y}_{i+1}^{(c)}=\hat{y}_i^{(c)} + h\sum_{k=0}^{m-1}\tilde{C}_k\nabla^k f(t_{i+1},\hat{y}_{i+1}^{(c)}), \] los dos del mismo orden de consistencia, \(O(h^{m})\) de la forma siguiente:
Veamos cuál sería la expresión si usamos el método de Adams-Bashford de orden \(4\) y el método de Adams-Moulton de orden \(3\), los dos con orden de consistencia \(4\), \(O(h^4)\).
Si iteramos el segundo paso, se pueden conseguir mejores aproximaciones \(\hat{y}_{i+1}\), pero dichas aproximaciones tienden al valor que obtendríamos si usamos el método de Adams-Moulton correspondiente.
INPUT valores inicial y final
\(a\), \(b\), entero
\(n\), condición inicial
\(y_0\) y función
\(f(t,y)\)Set
\(h=\frac{b-a}{n}\).Set
\(t=a\).Set
\(\mathbf{\hat{y}}=\mathbf{0}\). (Definimos inicialmente el vector de aproximaciones como
\(0\))Set
\(\hat{y}_1=y_0\). (Definimos la primera componente del vector de aproximaciones como la condición inicial
)For i=1,2,3
(Calculamos los valores iniciales restantes \(\tilde{y}_1,\tilde{y}_2,\tilde{y}_3\) usando el método de RK-4. Supongamos que hemos definido la rutina RK4 de parámetros \(a\), \(b\), \(n\), \(y_0\), y \(f\), \(RK4(a,b,n,y_0,f)\))
Set
\(t=t+h\)Set
\(\tilde{y}_i=RK4(a,t,i,y_0,f)\)Set
\(\mathbf{\hat{y}}_{i+1}=\tilde{y}_i\) (la componente \(i+1\)-ésima del vector de aproximaciones será la aproximación inicial \(i\)-ésima, \(i=1,2,3\))For i=4,...,n
(Calculamos las demás aproximaciones)
Set
\[
\begin{align*}
\hat{y}_{i+1}^{(p)} & =\hat{y}_{i}+\frac{h}{24}(55\cdot f(t,\hat{y}_{i})-59\cdot f(t-h,\hat{y}_{i-1})\\ & \quad +37\cdot f(t-2\cdot h,\hat{y}_{i-2})-9f(t-3\cdot h,\hat{y}_{i-3}))
\end{align*}
\]Set
\[
\begin{align*}
\hat{y}_{i+1} & =\hat{y}_{i} +\frac{h}{24}(9f(t+h,\hat{y}_{i+1}^{(p)})+19f(t,\hat{y}_{i})-5f(t-h,\hat{y}_{i-1})\\ & \quad +f(t-2\cdot h,\hat{y}_{i-2}))
\end{align*}
\]Set
\(t=t+ h\). (actualizamos el tiempo
\(t\))Print
\(\mathbf{\hat{y}}\) (Damos el vector de aproximaciones
).Recordemos el siguiente problema de valores iniciales: \[ y'=f(t,y)=t\mathrm{e}^{3t}-2y,\ 0\leq t\leq 1,\ y(0)=0, \] de solución exacta \(y(t)=\frac{1}{5}t\mathrm{e}^{3t}-\frac{1}{25}\mathrm{e}^{3t}+\frac{1}{25}\mathrm{e}^{-2t}\).
Vamos a aplicar el método predictor-corrector de orden \(4\) para hallar una solución aproximada en el mallado siguiente usando \(h=0.1\): \[ t_i=0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1. \]
Las aproximaciones iniciales \(\hat{y}(0.1)\), \(\hat{y}(0.2)\) y \(\hat{y}(0.3)\) usando el método de Runge-Kutta 4 recordemos que eran \[ \hat{y}(0.1)=0.0057546,\quad \hat{y}(0.2)=0.0268188,\quad \hat{y}(0.3)=0.0711552. \]
La siguiente tabla muestra los valores de las soluciones aproximada y exacta en los puntos del mallado:
\(t_i\) | \(\hat{y}_i\) | \(y_{i}\) | \(|y_i-\hat{y}_i|\) |
---|---|---|---|
0 | 0 | 0 | 0 |
0.1 | 0.0057546 | 0.0057521 | \(0.0000026\) |
0.2 | 0.0268188 | 0.0268128 | \(0.000006\) |
0.3 | 0.0711552 | 0.0711445 | \(0.0000106\) |
0.4 | 0.1508754 | 0.1507778 | \(0.0000976\) |
0.5 | 0.2838223 | 0.2836165 | \(0.0002058\) |
0.6 | 0.4963667 | 0.4960196 | \(0.0003472\) |
\(t_i\) | \(\hat{y}_i\) | \(y_{i}\) | \(|y_i-\hat{y}_i|\) |
---|---|---|---|
0.7 | 0.8270197 | 0.8264809 | \(0.0005388\) |
0.8 | 1.331659 | 1.330857 | \(0.000802\) |
0.9 | 2.0909412 | 2.0897744 | \(0.0011668\) |
1 | 3.2207746 | 3.2190993 | \(0.0016753\) |
Observamos que los resultados son mejores que los obtenidos usando el método de Adams-Bashford de orden \(4\) pero ligeramente peores que los obtenidos usando el método de Adams-Moulton de orden \(3\).
Por tanto, los métodos predictor-corrector serían unos métodos que, en general, serían mejores que los correspondientes métodos predictores pero ligeramente peores que los correspondientes métodos correctores.
Recordemos que un método multipaso para resolver el problema de valores iniciales \(y'=f(t,y),\ a\leq t\leq b,\ y(a)=y_0\) tenía como ecuación en diferencias:
\[ \begin{align*} \hat{y}_{i+1} & = a_{m-1}\hat{y}_i +a_{m-2}\hat{y}_{i-1}+\cdots +a_0 \hat{y}_{i+1-m}+\\ &\quad h(b_m f(t_{i+1},\hat{y}_{i+1})+b_{m-1}f(t_i,\hat{y}_i)+\cdots +b_0 f(t_{i+1-m},\hat{y}_{i+1-m})), \end{align*} \] para \(i=m-1,m,\ldots,n-1\), donde se tienen que especificar los valores iniciales siguientes: \[ \hat{y}_0=y_0,\ \hat{y}_1=\tilde{y}_1,\ldots,\hat{y}_{m-1}=\tilde{y}_{m-1}. \]
La definición de convergencia para un método multipaso es la misma que para un método de un paso:
Diremos que el método multipaso anterior es convergente si el error entre la solución aproximada y la solución exacta en los puntos del mallado \(t_i\) tiende a cero cuando \(h\) tiende a cero para todos los puntos de dicho mallado: \[ \lim_{h\to 0} |y(t_i)-\hat{y}_i| =0,\ i=0,\ldots,n. \]
Sin embargo, de cara a la consistencia, la definición es ligeramente diferente:
Diremos que el método anterior es consistente si el error local de truncamiento \(\tau_{i+1}(h)\) tiende a cero si \(h\) tiende a cero: \[ \begin{align*} \lim_{h\to 0}\tau_{i+1}(h)= & \lim_{h\to 0}\frac{y(t_{i+1})-(a_{m-1}y_i +a_{m-2}y_{i-1}+\cdots +a_0 y_{i+1-m})}{h}\\ & -(b_m f(t_{i+1},\hat{y}_{i+1})+b_{m-1}f(t_i,\hat{y}_i)+\cdots +b_0 f(t_{i+1-m},\hat{y}_{i+1-m}))=0, \end{align*} \] \(i=0\ldots,n-1\), donde \(y_i=y(t_i)\) y además \(\displaystyle\lim_{h\to 0}|\tilde{y}_i-y(t_i)|=0,\ i=1,\ldots,m-1\).
El resultado siguiente nos dice cómo se comporta un método predictor-corrector con respecto a la consistencia y la convergencia:
Consideremos un problema de valores iniciales \(y'=f(t,y),\ a\leq t\leq b,\ y(a)=y_0\) a la que hemos hallado una solución aproximada usando un método predictor de Adams-Bashford de orden \(m\) \[ \hat{y}_{i+1}=\hat{y}_i +h(b_{m-1}f(t_i,\hat{y}_i)+\cdots +b_0 f(t_{i+1-m},\hat{y}_{i+1-m})), \] con error local de truncamiento \(\tau_{i+1}^{(p)}(h)\) y un método corrector de Adams-Moulton de orden \(m-1\) \[ {\hat{y}}_{i+1}=\hat{y}_i +h(\tilde{b}_{m-1}f(t_{i+1},\hat{y}_{i+1})+\tilde{b}_{m-2}f(t_{i},\hat{y}_{i})+\cdots +\tilde{b}_0 f(t_{i+2-m},\hat{y}_{i+2-m})), \] con error local de truncamiento \(\tau_{i+1}^{(c)}(h)\).
Supongamos además que \(f(t,y)\) y \(\frac{\partial f}{\partial y}\) son continuas en \(D=\{(t,y),\ |\ a\leq t\leq b,\ -\infty <y<\infty\}\) y que \(\frac{\partial f}{\partial y}\) está acotada.
Entonces, el error local de truncamiento \(\tau_{i+1}(h)\) del método predictor-corrector es el siguiente: \[ \tau_{i+1}(h)=\tau_{i+1}^{(c)}(h)+\tau_{i+1}^{(p)}(h)\tilde{b}_{m-1}\frac{\partial f}{\partial y}(t_{i+1},\theta_{i+1}), \] donde \(\theta_{i+1}\in <0,h\tau_{i+1}^{(p)}(h)>\).
Además, existen constantes \(k_1\) y \(k_2\) tal que: \[ |\hat{y}_i-y_i|\leq \left(\max_{0\leq j\leq m-1}|\hat{y}_j-y_j|+k_1\tau(h)\right)\mathrm{e}^{k_2 (t_i-a)}, \] donde \(\tau(h)=\max_{m\leq j\leq n}|\tau_j(h)|.\)
El resultado anterior nos dice que un método predictor-corrector con orden de consistencia \(m\) para los métodos predictor y corrector tiene orden de consistencia \(m\) y además el método es convergente, siempre y cuando el método para hallar las aproximaciones de las condiciones iniciales tenga también orden de consistencia \(m\).
Recordemos que un sistema de ecuaciones diferenciales de \(m\) ecuaciones con \(m\) incógnitas o \(m\) funciones reales de variable real es un sistema de ecuaciones del tipo: \[ \begin{align*} \frac{dy_1}{dt}=y_1'(t) & = f_1(t,y_1(t),\ldots,y_m(t)),\\ \frac{dy_2}{dt}=y_2'(t) & = f_2(t,y_1(t),\ldots,y_m(t)),\\ & \vdots\\ \frac{dy_m}{dt}=y_m'(t) & = f_m(t,y_1(t),\ldots,y_m(t)), \end{align*} \] donde ahora las “incógnitas” son las funciones \(y_1(t),y_2(t),\ldots,y_m(t)\), para \(t\in [a,b]\) y condiciones iniciales: \[ y_1(a)=y_{01},\ y_2(a)=y_{02},\ldots,y_m(a)=y_{0m}. \]
El objetivo es hallar unas soluciones aproximadas \(\hat{y}_1(t),\hat{y}_2(t),\ldots,\hat{y}_m(t)\).
Los valores en los que se hallarán dichas soluciones aproximadas serán en valores discretos de \(t\).
Es decir, fijado un valor \(h>0\), consideramos el mallado siguiente \(t_i=a+i\cdot h\), donde \(i=0,\ldots,n\) y por tanto, la relación entre \(h\) y \(n\) tiene que ser \(h=\frac{b-a}{n}\) para que el último valor del mallado sea \(t_n=b\), el valor final de \(t\) en el intervalo de integración.
Entonces las soluciones aproximadas se hallarán en los valores de mallado \(t_i\): \[ \hat{y}_1(t_i),\hat{y}_2(t_i),\ldots,\hat{y}_m(t_i),\ i=0,\ldots,m, \] con \[ \hat{y}_1(a)=y_{01},\ \hat{y}_2(a)=y_{02},\ldots,\hat{y}_m(a)=y_{0m}. \]
Para que un sistema de ecuaciones diferenciales tenga solución, necesitamos que las funciones \(f_i\) verifiquen la condición de Lipschitz respecto las \(m\) últimas variables:
Sea \(f(t,y_1,\ldots,y_m)\) una función de \(m+1\) variables definida en el dominio: \[ D=\{(t,u_1,\ldots,u_m),\ |\ a\leq t\leq b,\ -\infty <u_i <\infty,\ i=1,2,\ldots,m\}, \] satisface la condición de Lipschitz en \(D\) respecto las variables \(u_1,\ldots,u_m\) si existe una constante \(L\), denominada constante de Lipschitz de \(f\) tal que para todo \((t,u_1,\ldots,u_m), (t,u_1',\ldots,u_m')\in D\), \[ |f(t,u_1,\ldots,u_m)-f(t,u_1',\ldots,u_m')|\leq L\sum_{i=1}^m |u_i-u_i'|. \]
Verificar la condición de Lipschitz de una función \(m+1\) variables es bastante tedioso a partir de la definición.
El siguiente resultado nos simplifica las cosas para funciones de clase \({\cal C}^1\):
Sea \(f(t,y_1,\ldots,y_m)\) una función de \(m+1\) variables de clase \({\cal C}^1\) definida en el dominio: \[ D=\{(t,u_1,\ldots,u_m),\ |\ a\leq t\leq b,\ -\infty <u_i <\infty,\ i=1,2,\ldots,m\}. \] Supongamos que existe una constante \(L\) tal que para cualquier valor \((t,u_1,\ldots,u_m)\in D\), se cumple \(\left|\frac{\partial f}{\partial u_i}(t,u_1,\ldots,u_m)\right|\leq L\), \(i=1,\ldots,m\).
Entonces \(f\) verifica la condición de Lipschitz en el dominio \(D\) con constante de Lipschitz \(L\).
Sean \((t,u_1,\ldots,u_m), (t,u_1',\ldots,u_m')\in D\). Usando el Teorema del valor medio en \(m+1\) variables, podemos decir que existe un valor \((t,\xi_1,\ldots,\xi_m)\), con \(\xi_i\in <u_i,u_i'>\), \(i=1,\ldots,m\) tal que: \[ \begin{align*} |f(t,u_1,\ldots,u_m)-f(t,u_1',\ldots,u_m')| & =\left|\sum_{i=1}^m \frac{\partial f}{\partial u_i}(t,\xi_1,\ldots,\xi_m)(u_i-u_i')\right|\leq \sum_{i=1}^m \left|\frac{\partial f}{\partial u_i}(t,\xi_1,\ldots,\xi_m)\right|\cdot |u_i-u_i'|\\ &\leq L \sum_{i=1}^m |u_i-u_i'|, \end{align*} \] tal como queríamos demostrar.
El resultado siguiente nos dice cuando un sistema de ecuaciones diferenciales tiene solución única:
Sea \(D\) el dominio siguiente: \[ D=\{(t,u_1,\ldots,u_m),\ |\ a\leq t\leq b,\ -\infty <u_i <\infty,\ i=1,2,\ldots,m\}. \] Supongamos que las funciones \(f_i(t,u_1,\ldots,u_m)\) son continuas y verifican la condición de Lipschitz con constante de Lipschitz \(L_i\).
Entonces el sistema de ecuaciones diferenciales \[ \begin{align*} \frac{dy_1}{dt}=y_1'(t) & = f_1(t,y_1(t),\ldots,y_m(t)),\\ \frac{dy_2}{dt}=y_2'(t) & = f_2(t,y_1(t),\ldots,y_m(t)),\\ & \vdots\\ \frac{dy_m}{dt}=y_m'(t) & = f_m(t,y_1(t),\ldots,y_m(t)), \end{align*} \] con condiciones iniciales: \[ y_1(a)=y_{01},\ y_2(a)=y_{02},\ldots,y_m(a)=y_{0m}, \] tiene solución única \(y_1(t),\ldots,y_m(t)\), \(a\leq t\leq b\).
Considerando \(\displaystyle L=\max_{i=1,\ldots,m}L_i\), podemos afirmar que todas las funciones \(f_i(t,u_1,\ldots,u_m)\) verifican la condición de Lipschitz con la misma constante de Lipschitz \(L\).
Todos los métodos numéricos para resolver el problema de valores iniciales correspondiente a la ecuación diferencial \(y'=f(t,y)\), \(a\leq t\leq b\), \(y(a)=y_0\) se pueden adaptar al problema de valores iniciales correspondiente al sistema de ecuaciones diferenciales: \[ \begin{align*} \frac{dy_1}{dt}=y_1'(t) & = f_1(t,y_1(t),\ldots,y_m(t)),\\ \frac{dy_2}{dt}=y_2'(t) & = f_2(t,y_1(t),\ldots,y_m(t)),\\ & \vdots\\ \frac{dy_m}{dt}=y_m'(t) & = f_m(t,y_1(t),\ldots,y_m(t)), \end{align*} \] con condiciones iniciales: \[ y_1(a)=y_{01},\ y_2(a)=y_{02},\ldots,y_m(a)=y_{0m}. \]
Para no complicar la notación, supondremos que los métodos numéricos son explícitos.
Supongamos que la ecuación en diferencias del método numérico para resolver la ecuación diferencial es de la forma: \[ \hat{y}_{i+1}=\hat{y}_i +h\varphi_f(t_i,\hat{y}_i),\ \hat{y}_0=y_0,\ i=0,\ldots,n-1, \] donde hemos escrito \(\varphi_f\) indicando la dependencia de la función \(\varphi_f\) respecto la función \(f\).
Entonces, dicho método aplicado al sistema de ecuaciones diferenciales constará del siguiente sistema en diferencias:
\[ \begin{align*} \hat{y}_{i+1}^{(1)} & =\hat{y}_i^{(1)} +h \varphi_{f_1}(t_i,\hat{y}_i^{(1)},\hat{y}_i^{(2)},\ldots,\hat{y}_i^{(m)}),\\ \hat{y}_{i+1}^{(2)} & =\hat{y}_i^{(2)} +h \varphi_{f_2}(t_i,\hat{y}_i^{(1)},\hat{y}_i^{(2)},\ldots,\hat{y}_i^{(m)}),\\ & \vdots\\ \hat{y}_{i+1}^{(m)} & =\hat{y}_i^{(m)} +h \varphi_{f_m}(t_i,\hat{y}_i^{(1)},\hat{y}_i^{(2)},\ldots,\hat{y}_i^{(m)}),\\ \end{align*} \] con \(\hat{y}_0^{(1)}=y_{01},\ \hat{y}_0^{(2)}=y_{02},\ldots,\hat{y}_0^{(m)}=y_{0m}\), con \(i=0,\ldots,n-1\).
Recordemos la ecuación en diferencias del método de Euler: \[ \hat{y}_{i+1} = \hat{y}_i +h f(t_i,\hat{y}_i),\ i=0,\ldots,n-1,\ \hat{y}_0=y_0. \] En este caso, tenemos que \(\varphi_f(t,\hat{y})=f(t,\hat{y})\). Por tanto, el sistema en diferencias será en este caso: \[ \begin{align*} \hat{y}_{i+1}^{(1)} & =\hat{y}_i^{(1)} +h f_1(t_i,\hat{y}_i^{(1)},\hat{y}_i^{(2)},\ldots,\hat{y}_i^{(m)}),\\ \hat{y}_{i+1}^{(2)} & =\hat{y}_i^{(2)} +h f_2(t_i,\hat{y}_i^{(1)},\hat{y}_i^{(2)},\ldots,\hat{y}_i^{(m)}),\\ & \vdots\\ \hat{y}_{i+1}^{(m)} & =\hat{y}_i^{(m)} +h f_m(t_i,\hat{y}_i^{(1)},\hat{y}_i^{(2)},\ldots,\hat{y}_i^{(m)}),\\ \end{align*} \] con \(\hat{y}_0^{(1)}=y_{01},\ \hat{y}_0^{(2)}=y_{02},\ldots,\hat{y}_0^{(m)}=y_{0m}\), con \(i=0,\ldots,n-1\).
INPUT valores inicial y final
\(a\), \(b\), entero
\(n\), condición inicial
\(\mathbf{y}_0=(y_{01},\ldots,y_{0m})\) y funciones
\(f_1(t,y_1,\ldots,y_m),\ldots,f_m(t,y_1,\ldots,y_m)\)Set
\(h=\frac{b-a}{n}\).Set
\(t=a\).Set
\(\mathbf{\hat{y}}=\mathbf{0}\). (Definimos inicialmente la matriz de aproximaciones de dimensiones
\(m\times (n+1)\) como
\(0\). Vamos a guardar en la columna
\(i\)-ésima de la matriz
\(\mathbf{\hat{y}}\) la aproximación
\(\mathbf{\hat{y}}(t+(i-1)h)\))Set
\(\mathbf{\hat{y}}(,1)=\mathbf{y}_0\). (Definimos la primera columna de la matriz de aproximaciones como las condiciones iniciales
)For i=1,...,n
For j=1,...,m
Set
\(\mathbf{\hat{y}}(j,i+1)=\mathbf{\hat{y}}(j,i)+h\cdot f_j(t,\mathbf{\hat{y}}(1,i),\ldots,\mathbf{\hat{y}}(m,i))\). (calculamos la componente
\(j\)-ésima
de \(\mathbf{\hat{y}}(t+ih)\))Set
\(t=t+h\). (actualizamos el tiempo
\(t\))Print
\(\mathbf{\hat{y}}\) (Damos la matriz de aproximaciones
).Consideremos el siguiente sistema de ecuaciones diferenciales: \[ \left. \begin{align*} y_1' & =3y_1+2y_2-(2t^2+1)\mathrm{e}^{2t},\\ y_2' & =4 y_1+y_2+(t^2+2t-4)\mathrm{e}^{2t}, \end{align*} \right\} \] con condiciones iniciales \(y_1(0)=y_2(0)=1\), \(0\leq t\leq 1\) y con solución exacta: \[ \begin{align*} y^{(1)}(t) &= \frac{1}{3}\mathrm{e}^{5t}-\frac{1}{3}\mathrm{e}^{-t}+\mathrm{e}^{2t},\\ y^{(2)}(t) &= \frac{1}{3}\mathrm{e}^{5t}+\frac{2}{3}\mathrm{e}^{-t}+t^2\cdot\mathrm{e}^{2t}. \end{align*} \] Vamos a aplicarle el método de Euler con \(h=0.1\).
El sistema en diferencias será en este caso: \[ \begin{align*} \hat{y}_{i+1}^{(1)} & =\hat{y}_i^{(1)} +h \left(3\hat{y}_i^{(1)}+2\hat{y}_i^{(2)}-(2t_i^2+1)\mathrm{e}^{2t_i}\right),\\ \hat{y}_{i+1}^{(2)} & =\hat{y}_i^{(2)} +h \left(4\hat{y}_i^{(1)}+\hat{y}_i^{(2)}+(t_i^2+2t_i-4)\mathrm{e}^{2t_i}\right), \end{align*} \] con \(\hat{y}_0^{(1)}=\hat{y}_0^{(2)}=1\).
El mallado será: \[ t_i=0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1. \]
Calculemos \(\hat{y}_1^{(1)}=\hat{y}^{(1)}(0.1),\ \hat{y}_1^{(2)}=\hat{y}^{(2)}(0.1)\): \[ \begin{align*} \hat{y}_1^{(1)} & =\hat{y}_0^{(1)} +h \left(3\hat{y}_0^{(1)}+2\hat{y}_0^{(2)}-(2 t_0^2+1)\mathrm{e}^{2t_0}\right)=1+0.1\cdot (3\cdot1+2\cdot1-(2\cdot0^2+1)\cdot\mathrm{e}^{2\cdot0})=1.4,\\ \hat{y}_1^{(2)} & =\hat{y}_0^{(2)} +h \left(4\hat{y}_0^{(1)}+\hat{y}_0^{(2)}+(t_0^2+2t_0-4)\mathrm{e}^{2t_0}\right)=1 +0.1\cdot (4\cdot1+1+(0^2+2\cdot 0-4)\mathrm{e}^{2\cdot0})=1.1, \end{align*} \]
A continuación, calculemos \(\hat{y}_2^{(1)}=\hat{y}^{(1)}(0.2),\ \hat{y}_2^{(2)}=\hat{y}^{(2)}(0.2)\): \[ \begin{align*} \hat{y}_2^{(1)} =&\hat{y}_1^{(1)} +h \left(3\hat{y}_1^{(1)}+2\hat{y}_1^{(2)}-(2 t_1^2+1)\mathrm{e}^{2t_1}\right)=1.4+0.1\cdot (3\cdot1.4+2\cdot1.1-(2\cdot0.1^2+1)\cdot\mathrm{e}^{2\cdot0.1})\\ =&1.9154169,\\ \hat{y}_2^{(2)} =&\hat{y}_1^{(2)} +h \left(4\hat{y}_1^{(1)}+\hat{y}_1^{(2)}+(t_1^2+2t_1-4)\mathrm{e}^{2t_1}\right)=1.1 +0.1\cdot (4\cdot1.4+1.1+(0.1^2+2\cdot 0.1-4)\mathrm{e}^{2\cdot0.1})\\ =&1.3070884. \end{align*} \]
Y así sucesivamente.
La siguiente tabla muestra los valores de las soluciones aproximada y exacta en los puntos del mallado:
\(t_i\) | \(\hat{y}_i^{(1)}\) | \(\hat{y}_i^{(2)}\) | \(y_{i}^{(1)}\) | \(y_{i}^{(2)}\) | \(\|y_i-\hat{y}_i\|_2\) |
---|---|---|---|---|---|
0 | 1 | 1 | 1 | 1 | 0 |
0.1 | 1.4 | 1.1 | 1.469364 | 1.1650127 | 0.0950685 |
0.2 | 1.9154169 | 1.3070884 | 2.1250084 | 1.5115874 | 0.2928284 |
0.3 | 2.5903426 | 1.6728744 | 3.0690758 | 2.1517659 | 0.6771429 |
0.4 | 3.4870102 | 2.2731775 | 4.4651196 | 3.2659853 | 1.3936876 |
0.5 | 4.6939774 | 3.2187349 | 6.5769363 | 5.1447556 | 2.6935273 |
\(t_i\) | \(\hat{y}_i^{(1)}\) | \(\hat{y}_i^{(2)}\) | \(y_{i}^{(1)}\) | \(y_{i}^{(2)}\) | \(\|y_i-\hat{y}_i\|_2\) |
---|---|---|---|---|---|
0.6 | 6.3381753 | 4.6706719 | 9.8323587 | 8.2562955 | 5.0065971 |
0.7 | 8.6027022 | 6.8629007 | 14.9281555 | 13.3565888 | 9.0652824 |
0.8 | 11.7531634 | 10.1346244 | 23.0026394 | 21.6688767 | 16.1117872 |
0.9 | 16.1767459 | 14.9776185 | 35.9198347 | 35.1769713 | 28.2454139 |
1 | 22.4402857 | 22.1051777 | 56.7374827 | 57.1053621 | 49.0031695 |
Recordemos que la idea de los métodos de Taylor era desarrollar el valor \(\hat{y}(t_{i+1})=\hat{y}_{i+1}\) alrededor de \(t=t_i\) usando el desarrollo de Taylor pero llegando hasta orden \(k\) donde si \(k=1\), tenemos el método de Euler: \[ \hat{y}_{i+1}= \hat{y}_i+h \hat{y}'(t_i)+\frac{h^2}{2}\hat{y}''(t_i)+\cdots +\frac{h^k}{k!}\hat{y}^{(k)}(t_i). \] El método de Taylor de orden 2 consiste en desarrollar el desarrollo anterior para \(k=2\): \[ \hat{y}_{i+1}= \hat{y}_i+h \hat{y}'(t_i)+\frac{h^2}{2}\hat{y}''(t_i). \] para resolver el problema de valores iniciales \(y'=f(t,y),\ a\leq t\leq b,\ y(a)=y_0\).
En el caso de sistemas, tenemos que aplicar el desarrollo anterior para cada componente \(\hat{y}_i^{(j)}\), \(j=1,\ldots,m\):
\[ \hat{y}_{i+1}^{(j)}= \hat{y}_i^{(j)}+h \hat{y}'(t_i)^{(j)}+\frac{h^2}{2}\hat{y}''(t_i)^{(j)}. \]
El valor de \(\hat{y}'(t_i)^{(j)}\) será el siguiente usando que \(\hat{y}'(t_i)\approx f_j(t_i,\hat{y}_i^{(1)},\ldots,\hat{y}_i^{(m)})\): \[ \hat{y}'(t_i)^{(j)}= f_j(t_i,\hat{y}_i^{(1)},\ldots,\hat{y}_i^{(m)}). \]
Para calcular \(\hat{y}''(t_i)^{(j)}\) usaremos la regla de la cadena: \[ \begin{align*} \hat{y}''(t_i)^{(j)}\approx & f_j'(t_i,\hat{y}_i^{(1)},\ldots,\hat{y}_i^{(m)})\\ = & \frac{\partial f_j}{\partial t}(t_i,\hat{y}_i^{(1)},\ldots,\hat{y}_i^{(m)})+\sum_{l=1}^m\frac{\partial f_j}{\partial y_l}(t_i,\hat{y}_i^{(1)},\ldots,\hat{y}_i^{(m)})\cdot y_l'(t_i,\hat{y}_i^{(1)},\ldots,\hat{y}_i^{(m)})\\ = & \frac{\partial f_j}{\partial t}(t_i,\hat{y}_i^{(1)},\ldots,\hat{y}_i^{(m)})+\sum_{l=1}^m\frac{\partial f_j}{\partial y_l}(t_i,\hat{y}_i^{(1)},\ldots,\hat{y}_i^{(m)})\cdot f_l(t_i,\hat{y}_i^{(1)},\ldots,\hat{y}_i^{(m)}). \end{align*} \]
Usando la notación siguiente introducida anteriormente, \[ \begin{align*} f_{i,j}= & f_j(t_i,\hat{y}_i^{(1)},\ldots,\hat{y}_i^{(m)}),\\ f_{t,i,j}^{(1)}=&\frac{\partial f_j}{\partial t}(t_i,\hat{y}_i^{(1)},\ldots,\hat{y}_i^{(m)}),\\ f_{y,i,l,j}^{(1)}=&\frac{\partial f_j}{\partial y_l}(t_i,\hat{y}_i^{(1)},\ldots,\hat{y}_i^{(m)}), \end{align*} \]
el desarrollo anterior será: \[ \begin{align*} \hat{y}_{i+1}^{(j)}=& \hat{y}_i^{(j)}+h f_{i,j}+\frac{h^2}{2}\left(f_{t,i,j}^{(1)}+\sum_{l=1}^m f_{y,i,l,j}^{(1)}\cdot f_{i,l}\right)\\ = & \hat{y}_i^{(j)}+h \left(f_{i,j}+\frac{h}{2}\left(f_{t,i,j}^{(1)}+\sum_{l=1}^m f_{y,i,l,j}^{(1)}\cdot f_{i,l}\right)\right), \end{align*} \] \(j=1,\ldots,m\), \(i=0,\ldots,n-1\).
Entonces, dicho método aplicado al sistema de ecuaciones diferenciales constará del siguiente sistema en diferencias:
\[ \begin{align*} \hat{y}_{i+1}^{(1)} & =\hat{y}_i^{(1)} +h \left(f_{i,1}+\frac{h}{2}\left(f_{t,i,1}^{(1)}+\sum_{l=1}^m f_{y,i,l,1}^{(1)}\cdot f_{i,l}\right)\right),\\ \hat{y}_{i+1}^{(2)} & =\hat{y}_i^{(2)} +h \left(f_{i,2}+\frac{h}{2}\left(f_{t,i,2}^{(1)}+\sum_{l=1}^m f_{y,i,l,2}^{(1)}\cdot f_{i,l}\right)\right),\\ & \vdots\\ \hat{y}_{i+1}^{(m)} & =\hat{y}_i^{(m)} +h \left(f_{i,m}+\frac{h}{2}\left(f_{t,i,m}^{(1)}+\sum_{l=1}^m f_{y,i,l,m}^{(1)}\cdot f_{i,l}\right)\right), \end{align*} \] con \(\hat{y}_0^{(1)}=y_{01},\ \hat{y}_0^{(2)}=y_{02},\ldots,\hat{y}_0^{(m)}=y_{0m}\), con \(i=0,\ldots,n-1\).
INPUT valores inicial y final
\(a\), \(b\), entero
\(n\), condición inicial
\(\mathbf{y}_0=(y_{01},\ldots,y_{0m})\) y funciones
\(f_j(t,y_1,\ldots,y_m)\), \(j=1,\ldots,m\), \(f_{t,j}^{(1)}(t,y_1,\ldots,y_m)=\frac{\partial f_j}{\partial t}(t,y_1,\ldots,y_m)\), \(j=1,\ldots,m\) y
\(f_{y,l,j}^{(1)}(t,y_1,\ldots,y_m)=\frac{\partial f_j}{\partial y_l}(t,y_1,\ldots,y_m)\), \(l,j=1,\ldots,m\).Set
\(h=\frac{b-a}{n}\).Set
\(t=a\).Set
\(\mathbf{\hat{y}}=\mathbf{0}\). (Definimos inicialmente la matriz de aproximaciones de dimensiones
\(m\times (n+1)\) como
\(0\). Vamos a guardar en la columna
\(i\)-ésima de la matriz
\(\mathbf{\hat{y}}\) la aproximación
\(\mathbf{\hat{y}}(t+(i-1)h)\))Set
\(\mathbf{\hat{y}}(,1)=\mathbf{y}_0\). (Definimos la primera columna de la matriz de aproximaciones como las condiciones iniciales
)For i=1,...,n
For j=1,...,m
Set
\[
\begin{align*}
& \mathbf{\hat{y}}(j,i+1)= \mathbf{\hat{y}}(j,i)+h\cdot (f_{j}(t,\mathbf{\hat{y}}(1,i),\ldots,\mathbf{\hat{y}}(m,i))\\ & +(h/2)\cdot (f_{t,j}^{(1)}(t,\mathbf{\hat{y}}(1,i),\ldots,\mathbf{\hat{y}}(m,i))\\ & +\sum_{l=1}^m f_{y,l}^{(1)}(t,\mathbf{\hat{y}}(1,i),\ldots,\mathbf{\hat{y}}(m,i)) \cdot f_l(t,\mathbf{\hat{y}}(1,i),\ldots,\mathbf{\hat{y}}(m,i)))).
\end{align*}
\] (calculamos la componente
\(j\)-ésima
de \(\mathbf{\hat{y}}(t+ih)\))Set
\(t=t+h\). (actualizamos el tiempo
\(t\))Print
\(\mathbf{\hat{y}}\) (Damos la matriz de aproximaciones
).Recordemos el anterior siguiente sistema de ecuaciones diferenciales: \[ \left. \begin{align*} y_1' & =3y_1+2y_2-(2t^2+1)\mathrm{e}^{2t},\\ y_2' & =4 y_1+y_2+(t^2+2t-4)\mathrm{e}^{2t}, \end{align*} \right\} \] con condiciones iniciales \(y_1(0)=y_2(0)=1\), \(0\leq t\leq 1\) y con solución exacta: \[ \begin{align*} y^{(1)}(t) &= \frac{1}{3}\mathrm{e}^{5t}-\frac{1}{3}\mathrm{e}^{-t}+\mathrm{e}^{2t},\\ y^{(2)}(t) &= \frac{1}{3}\mathrm{e}^{5t}+\frac{2}{3}\mathrm{e}^{-t}+t^2\cdot\mathrm{e}^{2t}. \end{align*} \] Vamos a aplicarle el método de Taylor de orden 2 con \(h=0.1\).
En este caso, las funciones \(f_j,\ f_{t,j}^{(1)}\) y \(f_{y,l,j}^{(1)}\), \(l,j=1,2\) son las siguientes: \[ \begin{align*} f_1(t,y_1,y_2)= & 3y_1+2y_2-(2t^2+1)\mathrm{e}^{2t},\quad & f_2(t,y_1,y_2) = 4 y_1+y_2+(t^2+2t-4)\mathrm{e}^{2t},\\ f_{t,1}^{(1)}(t,y_1,y_2) = & -2(2t^2+2t+1)\mathrm{e}^{2t},\quad & f_{t,2}^{(1)}(t,y_1,y_2) = 2(t^2+3t-3)\mathrm{e}^{2t},\\ f_{y,1,1}^{(1)}(t,y_1,y_2)= & 3,\quad & f_{y,2,1}^{(1)}(t,y_1,y_2)=2,\\ f_{y,1,2}^{(1)}(t,y_1,y_2)= & 4,\quad & f_{y,2,2}^{(1)}(t,y_1,y_2)=1. \end{align*} \]
El sistema en diferencias será en este caso: \[ \begin{align*} \hat{y}_{i+1}^{(1)} & =\hat{y}_i^{(1)} +h \left(f_{i,1}+\frac{h}{2}\left(f_{t,i,1}^{(1)}+f_{y,i,1,1}^{(1)}\cdot f_{i,1}+f_{y,i,2,1}\cdot f_{i,2}\right)\right)\\ & =\hat{y}_i^{(1)} +h \Biggl(3\hat{y}_i^{(1)}+2\hat{y}_i^{(2)}-(2t_i^2+1)\mathrm{e}^{2t_i}+\frac{h}{2}\Bigl(-2(2t_i^2+2t_i+1)\mathrm{e}^{2t_i}+3\cdot (3\hat{y}_i^{(1)}+2\hat{y}_i^{(2)}-(2t_i^2+1)\mathrm{e}^{2t_i})\\ & \quad +2\cdot (4 \hat{y}_i^{(1)}+\hat{y}_i^{(2)}+(t_i^2+2t_i-4)\mathrm{e}^{2t_i})\Bigr)\Biggr),\\ \hat{y}_{i+1}^{(2)} & =\hat{y}_i^{(2)} +h \left(f_{i,2}+\frac{h}{2}\left(f_{t,i,2}^{(1)}+f_{y,i,1,2}^{(1)}\cdot f_{i,1}+f_{y,i,2,2}\cdot f_{i,2}\right)\right)\\ & =\hat{y}_i^{(2)} +h \Biggl(4 \hat{y}_i^{(1)}+\hat{y}_i^{(2)}+(t_i^2+2t_i-4)\mathrm{e}^{2t_i}+\frac{h}{2}\Bigl(2(t_i^2+3t_i-3)\mathrm{e}^{2t_i}+4\cdot (3\hat{y}_i^{(1)}+2\hat{y}_i^{(2)}-(2t_i^2+1)\mathrm{e}^{2t_i})\\ & \quad + 4 \hat{y}_i^{(1)}+\hat{y}_i^{(2)}+(t_i^2+2t_i-4)\mathrm{e}^{2t_i}\Bigr)\Biggr),\\ \end{align*} \] con \(\hat{y}_0^{(1)}=\hat{y}_0^{(2)}=1\).
El mallado será: \[ t_i=0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1. \]
Los valores \(\hat{y}_1^{(1)}=\hat{y}^{(1)}(0.1),\ \hat{y}_1^{(2)}=\hat{y}^{(2)}(0.1)\) serán: \[ \begin{align*} \hat{y}_{1}^{(1)} =& \hat{y}_0^{(1)} +h \left(f_{0,1}+\frac{h}{2}\left(f_{t,0,1}^{(1)}+f_{y,0,1,1}^{(1)}\cdot f_{0,1}+f_{y,0,2,1}\cdot f_{0,2}\right)\right)\\ = &1+0.1\cdot \left(4+\frac{0.1}{2}\left(-2+3\cdot 4+2\cdot 1\right)\right)=1.46,\\ \hat{y}_{1}^{(2)} =& \hat{y}_0^{(2)} +h \left(f_{0,2}+\frac{h}{2}\left(f_{t,0,2}^{(1)}+f_{y,0,1,2}^{(1)}\cdot f_{0,1}+f_{y,0,2,2}\cdot f_{0,2}\right)\right)\\ = & 1+0.1\cdot\left(1+\frac{0.1}{2}\left(-6+4\cdot 4+1\right)\right)=1.155. \end{align*} \]
La siguiente tabla muestra los valores de las soluciones aproximada y exacta en los puntos del mallado:
\(t_i\) | \(\hat{y}_i^{(1)}\) | \(\hat{y}_i^{(2)}\) | \(y_{i}^{(1)}\) | \(y_{i}^{(2)}\) | \(\|y_i-\hat{y}_i\|_2\) |
---|---|---|---|---|---|
0 | 1 | 1 | 1 | 1 | 0 |
0.1 | 1.46 | 1.155 | 1.469364 | 1.1650127 | 0.0137091 |
0.2 | 2.0948372 | 1.4794454 | 2.1250084 | 1.5115874 | 0.0440841 |
0.3 | 2.9959438 | 2.0744123 | 3.0690758 | 2.1517659 | 0.1064512 |
0.4 | 4.3072337 | 3.1003511 | 4.4651196 | 3.2659853 | 0.2288288 |
0.5 | 6.256928 | 4.8117284 | 6.5769363 | 5.1447556 | 0.4618575 |
\(t_i\) | \(\hat{y}_i^{(1)}\) | \(\hat{y}_i^{(2)}\) | \(y_{i}^{(1)}\) | \(y_{i}^{(2)}\) | \(\|y_i-\hat{y}_i\|_2\) |
---|---|---|---|---|---|
0.6 | 9.2090467 | 7.6123236 | 9.8323587 | 8.2562955 | 0.8962241 |
0.7 | 13.7468099 | 12.143738 | 14.9281555 | 13.3565888 | 1.6930991 |
0.8 | 20.8078294 | 19.427407 | 23.0026394 | 21.6688767 | 3.1370971 |
0.9 | 31.9033852 | 31.0929416 | 35.9198347 | 35.1769713 | 5.7281031 |
1 | 49.4742512 | 49.7459487 | 56.7374827 | 57.1053621 | 10.339995 |
Hemos reducido considerablemente los errores pero siguen siendo altos debido a que, como hemos comentado antes, este sistema es de tipo Stiff.
Recordemos que un método de Runge-Kutta explícito general es un método de un paso donde la expresión de la ecuación en diferencias era la siguiente: \(\hat{y}_{i+1}=\hat{y}_i+h\varphi(t_i,\hat{y}_i),\) donde \[ \begin{align*} \varphi(t_i,\hat{y}_i) & =\sum_{p=1}^J c_p k_p,\\ k_p & = f\left(t_i+h a_p,\hat{y}_i+h\sum_{l=1}^{p-1} b_{pl} k_l\right),\ p=1,\ldots,J. \end{align*} \] donde \(\displaystyle\sum_{k=1}^{p-1} b_{pl}=a_p\).
En el caso de sistemas, la generalización de la expresión anterior para la componente \(\hat{y}_i^{(j)}\), \(j=1,\ldots,m\) sería: \(\hat{y}_{i+1}^{(j)}=\hat{y}_i^{(j)}+h\varphi_j(t_i,\hat{y}_i^{(1)},\ldots,\hat{y}_i^{(m)}),\) donde \[ \begin{align*} \varphi_j(t_i,\hat{y}_i^{(1)},\ldots,\hat{y}_i^{(m)}) & =\sum_{p=1}^J c_p k_p^{(j)},\\ k_p^{(j)} & = f_j\left(t_i+h a_p,\hat{y}_i^{(1)}+h\sum_{l=1}^{p-1} b_{pl} k_l^{(1)},\ldots, \hat{y}_i^{(m)}+h\sum_{l=1}^{p-1} b_{pl} k_l^{(m)}\right), \end{align*} \] \(p=1,\ldots,J,\ j=1,\ldots,m.\)
Desarrollemos la expresión anterior para el caso de Runge-Kutta 4.
Recordemos la expresión de la ecuación en diferencias finitas para resolver el problema de valores iniciales \(y'=f(t,y),\ a\leq t\leq b,\ y(a)=y_0\): \[ \begin{align*} \hat{y}_{i+1} & = \hat{y}_i +\frac{h}{6}(k_1+2k_2+2k_3+k_4),\\ k_1 & = f(t_i,\hat{y}_i),\\ k_2 & = f\left(t_i+\frac{h}{2},\hat{y}_i+\frac{h k_1}{2}\right),\\ k_3 & = f\left(t_i+\frac{h}{2},\hat{y}_i+\frac{h k_2}{2}\right),\\ k_4 & = f(t_i+h,\hat{y}_i + h k_3),\ \hat{y}_0=y_0 \end{align*} \]
Las ecuaciones en diferencias finitas para sistemas serían las siguientes: \[ \begin{align*} \hat{y}_{i+1}^{(j)} & = \hat{y}_i^{(j)} +\frac{h}{6}(k_1^{(j)}+2k_2^{(j)}+2k_3^{(j)}+k_4^{(j)}),\\ k_1^{(j)} & = f_j(t_i,\hat{y}_i^{(1)},\ldots,\hat{y}_i^{(m)}),\\ k_2^{(j)} & = f_j\left(t_i+\frac{h}{2},\hat{y}_i^{(1)}+\frac{h k_1^{(1)}}{2},\ldots,\hat{y}_i^{(m)}+\frac{h k_1^{(m)}}{2}\right),\\ k_3^{(j)} & = f_j\left(t_i+\frac{h}{2},\hat{y}_i^{(1)}+\frac{h k_2^{(1)}}{2},\ldots,\hat{y}_i^{(m)}+\frac{h k_2^{(m)}}{2}\right),\\ k_4^{(j)} & = f_j(t_i+h,\hat{y}_i^{(1)} + h k_3^{(1)},\ldots,\hat{y}_i^{(m)} + h k_3^{(m)}),\ \hat{y}_0^{(1)}=y_{01},\ldots,\hat{y}_{0m}=y_{0m}, \end{align*} \] \(i=0,\ldots,n-1\), \(j=1,\ldots,m\).
INPUT valores inicial y final
\(a\), \(b\), entero
\(n\), condición inicial
\(\mathbf{y}_0=(y_{01},\ldots,y_{0m})\) y funciones
\(f_j(t,y_1,\ldots,y_m)\), \(j=1,\ldots,m\).Set
\(h=\frac{b-a}{n}\).Set
\(t=a\).Set
\(\mathbf{\hat{y}}=\mathbf{0}\). (Definimos inicialmente la matriz de aproximaciones de dimensiones
\(m\times (n+1)\) como
\(0\). Vamos a guardar en la columna
\(i\)-ésima de la matriz
\(\mathbf{\hat{y}}\) la aproximación
\(\mathbf{\hat{y}}(t+(i-1)h)\))Set
\(\mathbf{\hat{y}}(,1)=\mathbf{y}_0\). (Definimos la primera columna de la matriz de aproximaciones como las condiciones iniciales
)For i=1,...,n
Set
\(\mathbf{k}=\mathbf{0}\) (En la matriz
\(\mathbf{k}\) de dimensiones
\(m\times 4\) guardaremos
\(k_1^{(j)},k_2^{(j)},k_3^{(j)},k_4^{(j)},\ j=1,\ldots,m\), la columna
\(l\)-ésima de la matriz
\(\mathbf{k}\) será
\(k_l^{(1)},\ldots,k_l^{(m)}\), \(l=1,2,3,4\))
For j=1,...,m
Set
\(\mathbf{k}(j,1)=f_j(t,\mathbf{\hat{y}}(1,i),\ldots,\mathbf{\hat{y}}(m,i))\)For j=1,...,m
Set
\(\mathbf{k}(j,2)=f_j\left(t+\frac{h}{2},\mathbf{\hat{y}}(1,i)+\frac{h\cdot k(1,1)}{2},\ldots,\mathbf{\hat{y}}(m,i)+\frac{h\cdot k(m,1)}{2}\right)\)For j=1,...,m
Set
\(\mathbf{k}(j,3)=f_j\left(t+\frac{h}{2},\mathbf{\hat{y}}(1,i)+\frac{h\cdot k(1,2)}{2},\ldots,\mathbf{\hat{y}}(m,i)+\frac{h\cdot k(m,2)}{2}\right)\)For j=1,...,m
Set
\(\mathbf{k}(j,4)=f_j\left(t+h,\mathbf{\hat{y}}(1,i)+h\cdot k(1,3),\ldots,\mathbf{\hat{y}}(m,i)+h\cdot k(m,3)\right)\)For j=1,...,m
Set
\(\mathbf{\hat{y}}(i+1,j)=\mathbf{\hat{y}}(i,j)+\frac{h}{6}(\mathbf{k}(j,1)+2\cdot\mathbf{k}(j,2)+2\cdot\mathbf{k}(j,3)+\mathbf{k}(j,4))\). (calculamos la componente
\(j\)-ésima
de \(\mathbf{\hat{y}}(t+ih)\))Set
\(t=t+h\). (actualizamos el tiempo
\(t\))Print
\(\mathbf{\hat{y}}\) (Damos la matriz de aproximaciones
).Recordemos el anterior siguiente sistema de ecuaciones diferenciales: \[ \left. \begin{align*} y_1' & =3y_1+2y_2-(2t^2+1)\mathrm{e}^{2t},\\ y_2' & =4 y_1+y_2+(t^2+2t-4)\mathrm{e}^{2t}, \end{align*} \right\} \] con condiciones iniciales \(y_1(0)=y_2(0)=1\), \(0\leq t\leq 1\) y con solución exacta: \[ \begin{align*} y^{(1)}(t) &= \frac{1}{3}\mathrm{e}^{5t}-\frac{1}{3}\mathrm{e}^{-t}+\mathrm{e}^{2t},\\ y^{(2)}(t) &= \frac{1}{3}\mathrm{e}^{5t}+\frac{2}{3}\mathrm{e}^{-t}+t^2\cdot\mathrm{e}^{2t}. \end{align*} \] Vamos a aplicarle el método de Runge-Kutta 4 con \(h=0.1\).
El mallado será: \[ t_i=0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1. \]
\[ \begin{align*} \mathbf{k}(1,3) = & f_1\left(t_0+\frac{h}{2},\hat{y}^{(1)}(0)+\frac{h\cdot\mathbf{k}(1,2)}{2},\hat{y}^{(2)}(0)+\frac{h\cdot\mathbf{k}(2,2)}{2}\right)\\ = & f_1\left(0+\frac{0.1}{2},1+\frac{0.1\cdot4.5893032}{2},1+\frac{0.1\cdot1.5425963}{2}\right)=f_1\left(0.05,1.2294652,1.0771298\right)\\ = & 3\cdot 1.2294652+2\cdot 1.0771298-(2\cdot 0.05^2+1)\cdot\mathrm{e}^{2\cdot0.05}= 4.7319583,\\ \mathbf{k}(2,3) = & f_2\left(t_0+\frac{h}{2},\hat{y}^{(1)}(0)+\frac{h\cdot\mathbf{k}(1,2)}{2},\hat{y}^{(2)}(0)+\frac{h\cdot\mathbf{k}(2,2)}{2}\right)\\ = & f_2\left(0+\frac{0.1}{2},1+\frac{0.1\cdot4.5893032}{2},1+\frac{0.1\cdot1.5425963}{2}\right)=f_2\left(0.05,1.2294652,1.0771298\right)\\ = & 4\cdot 1.2294652+1.0771298+(0.05^2+2\cdot0.05-4)\cdot\mathrm{e}^{2\cdot 0.05}=1.6875868,\\ \mathbf{k}(1,4) = & f_1\left(t_0+h,\hat{y}^{(1)}(0)+h\cdot\mathbf{k}(1,3),\hat{y}^{(2)}(0)+h\cdot\mathbf{k}(2,3)\right)\\ = & f_1\left(0+0.1,1+0.1\cdot4.7319583,1+0.1\cdot1.6875868\right)=f_1\left(0.1,1.4731958,1.1687587\right)\\ = & 3\cdot 1.4731958+2\cdot 1.1687587-(2\cdot 0.1^2+1)\cdot\mathrm{e}^{2\cdot0.1}= 5.5112741,\\ \mathbf{k}(2,4) = & f_2\left(t_0+h,\hat{y}^{(1)}(0)+h\cdot\mathbf{k}(1,3),\hat{y}^{(2)}(0)+h\cdot\mathbf{k}(2,3)\right)\\ = & f_2\left(0+0.1,1+0.1\cdot4.7319583,1+0.1\cdot1.6875868\right)=f_2\left(0.1,1.4731958,1.1687587\right)\\ = & 4\cdot 1.4731958+1.1687587+(0.1^2+2\cdot0.1-4)\cdot\mathrm{e}^{2\cdot 0.1}=2.4324256. \end{align*} \]
\[ \begin{align*} \mathbf{k}(1,3) = & f_1\left(t_1+\frac{h}{2},\hat{y}^{(1)}(0.1)+\frac{h\cdot\mathbf{k}(1,2)}{2},\hat{y}^{(2)}(0.1)+\frac{h\cdot\mathbf{k}(2,2)}{2}\right)\\ = & f_1\left(0.1+\frac{0.1}{2},1.46923+\frac{0.1\cdot6.3918583}{2},1.1648799+\frac{0.1\cdot3.2966518}{2}\right)\\ = & f_1\left(0.15,1.7888229,1.3297125\right) = 3\cdot 1.7888229+2\cdot 1.3297125-(2\cdot 0.15^2+1)\cdot\mathrm{e}^{2\cdot0.15}= 6.6152911,\\ \mathbf{k}(2,3) = & f_2\left(t_1+\frac{h}{2},\hat{y}^{(1)}(0.1)+\frac{h\cdot\mathbf{k}(1,2)}{2},\hat{y}^{(2)}(0.1)+\frac{h\cdot\mathbf{k}(2,2)}{2}\right)\\ = & f_2\left(0.1+\frac{0.1}{2},1.46923+\frac{0.1\cdot6.3918583}{2},1.1648799+\frac{0.1\cdot3.2966518}{2}\right)\\ = & f_2\left(0.15,1.7888229,1.3297125\right)= 4\cdot 1.7888229+1.3297125+(0.15^2+2\cdot0.15-4)\cdot\mathrm{e}^{2\cdot 0.15}=3.5208982,\\ \mathbf{k}(1,4) = & f_1\left(t_1+h,\hat{y}^{(1)}(0.1)+h\cdot\mathbf{k}(1,3),\hat{y}^{(2)}(0.1)+h\cdot\mathbf{k}(2,3)\right)\\ = & f_1\left(0.1+0.1,1.46923+0.1\cdot6.6152911,1.1648799+0.1\cdot3.5208982\right)=f_1\left(0.2,2.1307591,1.5169697\right)\\ = & 3\cdot 2.1307591+2\cdot 1.5169697-(2\cdot 0.2^2+1)\cdot\mathrm{e}^{2\cdot0.2}= 7.8150459,\\ \mathbf{k}(2,4) = & f_2\left(t_1+h,\hat{y}^{(1)}(0.1)+h\cdot\mathbf{k}(1,3),\hat{y}^{(2)}(0.1)+h\cdot\mathbf{k}(2,3)\right)\\ = & f_2\left(0.1+0.1,1.46923+0.1\cdot6.6152911,1.1648799+0.1\cdot3.5208982\right)=f_2\left(0.2,2.1307591,1.5169697\right)\\ = & 4\cdot 2.1307591+1.5169697+(0.2^2+2\cdot0.2-4)\cdot\mathrm{e}^{2\cdot 0.2}=4.72911. \end{align*} \]
La siguiente tabla muestra los valores de las soluciones aproximada y exacta en los puntos del mallado:
\(t_i\) | \(\hat{y}_i^{(1)}\) | \(\hat{y}_i^{(2)}\) | \(y_{i}^{(1)}\) | \(y_{i}^{(2)}\) | \(\|y_i-\hat{y}_i\|_2\) |
---|---|---|---|---|---|
0 | 1 | 1 | 1 | 1 | 0 |
0.1 | 1.46923 | 1.1648799 | 1.469364 | 1.1650127 | 0.0001888 |
0.2 | 2.1245793 | 1.5111614 | 2.1250084 | 1.5115874 | 0.0006046 |
0.3 | 3.0680426 | 2.1507384 | 3.0690758 | 2.1517659 | 0.001457 |
0.4 | 4.4629019 | 3.263777 | 4.4651196 | 3.2659853 | 0.0031297 |
0.5 | 6.5724616 | 5.1402957 | 6.5769363 | 5.1447556 | 0.0063177 |
\(t_i\) | \(\hat{y}_i^{(1)}\) | \(\hat{y}_i^{(2)}\) | \(y_{i}^{(1)}\) | \(y_{i}^{(2)}\) | \(\|y_i-\hat{y}_i\|_2\) |
---|---|---|---|---|---|
0.6 | 9.8236717 | 8.2476307 | 9.8323587 | 8.2562955 | 0.0122696 |
0.7 | 14.9117265 | 13.3401924 | 14.9281555 | 13.3565888 | 0.0232111 |
0.8 | 22.9721491 | 21.638433 | 23.0026394 | 21.6688767 | 0.0430869 |
0.9 | 35.8640456 | 35.1212482 | 35.9198347 | 35.1769713 | 0.0788511 |
1 | 56.6365255 | 57.0044968 | 56.7374827 | 57.1053621 | 0.14271 |
Hemos seguido reduciendo considerablemente los errores debido a que el método tiene orden de consistencia \(4\).
Un problema de valores iniciales asociado a una ecuación diferencial de orden \(m\) consiste en hallar una solución aproximada \(\hat{y}(t)\) de la ecuación diferencial siguiente: \[ y^{(m)}(t)=f(t,y, y',y'',\ldots,y^{(m-1)}),\ a\leq t\leq b, \] con condiciones iniciales \(y(a)=y_0,\ y'(a)=y'_0,\ y''(a)=y''_0,\ldots, y^{(m-1)}(a)=y^{(m-1)}_0\), donde \(y^{(j)}\) indica la derivada \(j\)-ésima de la función \(y(t)\) y los valores \(y_0,y'_0,\ldots,y^{(m-1)}_0\) se suponen conocidos.
Veamos que resolver un problema de valores iniciales asociado a una ecuación diferencial de orden \(m\) es equivalente a resolver un problema de valores iniciales asociado a un sistema de ecuaciones diferenciales de \(m\) ecuaciones.
Para ver dicha equivalencia, dado una ecuación diferencial de orden \(m\): \[ y^{(m)}(t)=f(t,y, y',y'',\ldots,y^{(m-1)}),\ a\leq t\leq b, \] consideramos las funciones siguientes asociadas a dicha ecuación diferencial: \[ y_1(t)=y(t),\ y_2(t)=y'(t),\ldots,y_m(t)=y^{(m-1)}(t),\ a\leq t\leq b. \]
Usando las funciones anteriores, tendremos que el sistema diferencial que verifican dichas funciones es el siguiente: \[ \begin{align*} \frac{dy_1}{dt}= & y_1'(t) = f_1(t,y_1(t),\ldots,y_m(t))=y_2(t),\\ \frac{dy_2}{dt}= & y_2'(t) = f_2(t,y_1(t),\ldots,y_m(t))=y_3(t),\\ & \vdots\\ \frac{dy_{m-1}}{dt}= & y_{m-1}'(t) = f_{m-1}(t,y_1(t),\ldots,y_m(t))=y_{m}(t),\\ \frac{dy_m}{dt}= & y_m'(t) = f_m(t,y_1(t),\ldots,y_m(t))=y^{(m)}(t)=f(t,y_1(t),y_2(t),\ldots,y_{m-1}(t)), \end{align*} \] con \(a\leq t\leq b\) con condiciones iniciales \(y_1(a)=y_0,\ y_2(a)=y'(a)=y'_0,\ y_3(a)=y''(a)=y''_0,\ldots,\) \(y_{m}(a)=y^{(m-1)}(a)=y^{(m-1)}_0\).
Es decir, las funciones \(f_i(t,y_1(t),\ldots,y_m(t))\), \(i=1,\ldots,m\) son las siguientes en el caso de ecuaciones diferenciales de orden \(m\): \[ \begin{align*} f_1(t,y_1(t),\ldots,y_m(t))= &y_2(t),\\ f_2(t,y_1(t),\ldots,y_m(t))= & y_3(t),\\ & \vdots\\ f_{m-1}(t,y_1(t),\ldots,y_m(t))= & y_{m}(t),\\ f_m(t,y_1(t),\ldots,y_m(t))= & f(t,y_1(t),y_2(t),\ldots,y_{m-1}(t)), \end{align*} \]
Recordemos que para que un sistema de ecuaciones diferenciales tenga solución única, las funciones \(f_i(t,y_1(t),\ldots,y_m(t))\) tenían que verifican la condición de Lipschitz con constante de Lipschitz \(L_i\).
En el caso de ecuaciones diferenciales de orden \(m\), después de considerar el cambio al sistema diferencial correspondiente de orden \(m\), las funciones \(f_i(t,y_1(t),\ldots,y_m(t))=y_{i+1}(t)\), \(i=1,\ldots,m-1\) verifican la condición de Lipschitz con constante de Lipschitz \(L_i=1\) ya que: \[ |f_i(t,u_1,\ldots,u_m)-f_i(t,u_1',\ldots,u_m')|=|u_{i+1}-u_{i+1}'|\leq\sum_{j=1}^m |u_j-u_j'|. \]
En resumen, para que una ecuación diferencial de orden \(m\) tenga solución única, es suficiente que la función \(f_m(t,y_1(t),\ldots,y_{m}(t))=f(t,y(t),y'(t),\ldots,y^{(m-1)}(t))\) verifique la condición de Lipschitz con constante de Lipschitz \(L_m\).
Vamos a aplicar el método de Runge-Kutta 4 para hallar la solución aproximada \(\hat{y}(t)\) de la ecuación diferencial de orden \(3\) siguiente: \[ t^3 y'''+t^2 y''-2 t y'+2 y=8 t^3-2, \] donde \(1\leq t\leq 2\), con condiciones iniciales \(y(1)=2,\ y'(1)=8,\ y''(1)=6\), usando un paso \(h=0.1\) con solución exacta \(y(t)=t^3+t^2+2t-1-\frac{1}{t}\).
Definimos \(y_1(t)=y(t),\ y_2(t)=y'(t)\) y \(y_3(t)=y''(t)\). El sistema de ecuaciones asociado a la ecuación diferencial anterior con funciones \(y_1(t), y_2(t), y_3(t)\) es el siguiente: \[ \begin{align*} y_1'(t) = & y_2(t),\\ y_2'(t) = & y_3(t),\\ y_3'(t) = & 8-\frac{2}{t^3}-\frac{1}{t}y_3(t)+\frac{2}{t^2}y_2(t)-\frac{2}{t^3}y_1(t), \end{align*} \] con \(1\leq t\leq 2\) y condiciones iniciales \(y_1(1)=2,\ y_2(1)=8,\ y_3(1)=6.\)
La última ecuación del sistema se deduce de la forma siguiente: \[ y_3'(t)=\frac{dy''}{dt}=y'''(t)=\frac{1}{t^3}(8 t^3-2-t^2 y''(t)+2ty'(t)-2 y(t))=8-\frac{2}{t^3}-\frac{1}{t}y_3(t)+\frac{2}{t^2}y_2(t)-\frac{2}{t^3}y_1(t). \]
El mallado será: \[ t_i=1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2. \]
\[ \begin{align*} \mathbf{k}(1,2) = & f_1\left(t_0+\frac{h}{2},\hat{y}^{(1)}(1)+\frac{h\cdot\mathbf{k}(1,1)}{2},\hat{y}^{(2)}(1)+\frac{h\cdot\mathbf{k}(2,1)}{2},\hat{y}^{(3)}(1)+\frac{h\cdot\mathbf{k}(3,1)}{2}\right)\\ = & f_1\left(1+\frac{0.1}{2},2+\frac{0.1\cdot8}{2},8+\frac{0.1\cdot6}{2},6+\frac{0.1\cdot12}{2}\right)=8+\frac{0.1\cdot6}{2}=8.3,\\ \mathbf{k}(2,2) = & f_2\left(t_0+\frac{h}{2},\hat{y}^{(1)}(1)+\frac{h\cdot\mathbf{k}(1,1)}{2},\hat{y}^{(2)}(1)+\frac{h\cdot\mathbf{k}(2,1)}{2},\hat{y}^{(3)}(1)+\frac{h\cdot\mathbf{k}(3,1)}{2}\right)\\ = & f_2\left(1+\frac{0.1}{2},2+\frac{0.1\cdot8}{2},8+\frac{0.1\cdot6}{2},6+\frac{0.1\cdot12}{2}\right)=6+\frac{0.1\cdot12}{2}=6.6,\\ \mathbf{k}(3,2) = & f_3\left(t_0+\frac{h}{2},\hat{y}^{(1)}(1)+\frac{h\cdot\mathbf{k}(1,1)}{2},\hat{y}^{(2)}(1)+\frac{h\cdot\mathbf{k}(2,1)}{2},\hat{y}^{(3)}(1)+\frac{h\cdot\mathbf{k}(3,1)}{2}\right)\\ = & f_3\left(1+\frac{0.1}{2},2+\frac{0.1\cdot8}{2},8+\frac{0.1\cdot6}{2},6+\frac{0.1\cdot12}{2}\right)\\ = & f_3\left(1.05,2.4,8.3,6.6\right)=8-\frac{2}{1.05^3}-\frac{1}{1.05}\cdot6.6+\frac{2}{1.05^2}\cdot8.3-\frac{2}{1.05^3}\cdot2.4=10.8968794 \end{align*} \]
\[ \begin{align*} \mathbf{k}(1,3) = & f_1\left(t_0+\frac{h}{2},\hat{y}^{(1)}(1)+\frac{h\cdot\mathbf{k}(1,2)}{2},\hat{y}^{(2)}(1)+\frac{h\cdot\mathbf{k}(2,2)}{2},\hat{y}^{(3)}(1)+\frac{h\cdot\mathbf{k}(3,2)}{2}\right)\\ = & f_1\left(1+\frac{0.1}{2},2+\frac{0.1\cdot8.3}{2},8+\frac{0.1\cdot6.6}{2},6+\frac{0.1\cdot10.8968794}{2}\right)=8+\frac{0.1\cdot6.6}{2}=8.33,\\ \mathbf{k}(2,3) = & f_2\left(t_0+\frac{h}{2},\hat{y}^{(1)}(1)+\frac{h\cdot\mathbf{k}(1,2)}{2},\hat{y}^{(2)}(1)+\frac{h\cdot\mathbf{k}(2,2)}{2},\hat{y}^{(3)}(1)+\frac{h\cdot\mathbf{k}(3,2)}{2}\right)\\ = & f_2\left(1+\frac{0.1}{2},2+\frac{0.1\cdot8.3}{2},8+\frac{0.1\cdot6.6}{2},6+\frac{0.1\cdot10.8968794}{2}\right)=6+\frac{0.1\cdot10.8968794}{2}=6.544844,\\ \mathbf{k}(3,3) = & f_3\left(t_0+\frac{h}{2},\hat{y}^{(1)}(1)+\frac{h\cdot\mathbf{k}(1,2)}{2},\hat{y}^{(2)}(1)+\frac{h\cdot\mathbf{k}(2,2)}{2},\hat{y}^{(3)}(1)+\frac{h\cdot\mathbf{k}(3,2)}{2}\right)\\ = & f_3\left(1+\frac{0.1}{2},2+\frac{0.1\cdot8.3}{2},8+\frac{0.1\cdot6.6}{2},6+\frac{0.1\cdot10.8968794}{2}\right)\\ = & f_3\left(1.05,2.415,8.33,6.544844\right)=8-\frac{2}{1.05^3}-\frac{1}{1.05}\cdot6.544844+\frac{2}{1.05^2}\cdot8.33-\frac{2}{1.05^3}\cdot2.415=10.9779156, \end{align*} \]
\[ \begin{align*} \mathbf{k}(1,4) = & f_1\left(t_0+h,\hat{y}^{(1)}(1)+h\cdot\mathbf{k}(1,3),\hat{y}^{(2)}(1)+h\cdot\mathbf{k}(2,3),\hat{y}^{(3)}(1)+h\cdot\mathbf{k}(3,3)\right)\\ = & f_1\left(1+0.1,2+0.1\cdot8.33,8+0.1\cdot6.544844,6+0.1\cdot10.9779156\right)=8+0.1\cdot6.544844=8.6544844,\\ \mathbf{k}(2,4) = & f_2\left(t_0+h,\hat{y}^{(1)}(1)+h\cdot\mathbf{k}(1,3),\hat{y}^{(2)}(1)+h\cdot\mathbf{k}(2,3),\hat{y}^{(3)}(1)+h\cdot\mathbf{k}(3,3)\right)\\ = & f_2\left(1+0.1,2+0.1\cdot8.33,8+0.1\cdot6.544844,6+0.1\cdot10.9779156\right)=6+0.1\cdot10.9779156=7.0977916,\\ \mathbf{k}(3,4) = & f_3\left(t_0+h,\hat{y}^{(1)}(1)+h\cdot\mathbf{k}(1,3),\hat{y}^{(2)}(1)+h\cdot\mathbf{k}(2,3),\hat{y}^{(3)}(1)+h\cdot\mathbf{k}(3,3)\right)\\ = & f_3\left(1+0.1,2+0.1\cdot8.33,8+0.1\cdot6.544844,6+0.1\cdot 10.9779156\right)\\ = & f_3\left(1.1,2.833,8.6544844,7.0977916\right)=8-\frac{2}{1.1^3}-\frac{1}{1.1}\cdot7.0977916+\frac{2}{1.1^2}\cdot8.6544844-\frac{2}{1.1^3}\cdot 2.833\\ = &10.0928158. \end{align*} \]
\[ \begin{align*} \mathbf{k}(1,2) = & f_1\left(t_1+\frac{h}{2},\hat{y}^{(1)}(1.1)+\frac{h\cdot\mathbf{k}(1,1)}{2},\hat{y}^{(2)}(1.1)+\frac{h\cdot\mathbf{k}(2,1)}{2},\hat{y}^{(3)}(1.1)+\frac{h\cdot\mathbf{k}(3,1)}{2}\right)\\ = & f_1\left(1.1+\frac{0.1}{2},2.8319081+\frac{0.1\cdot8.656458}{2},8.656458+\frac{0.1\cdot7.0973734}{2},7.0973734+\frac{0.1\cdot10.0980989}{2}\right)\\ = & 8.656458+\frac{0.1\cdot7.0973734}{2}=9.0113267,\\ \mathbf{k}(2,2) = & f_2\left(t_1+\frac{h}{2},\hat{y}^{(1)}(1.1)+\frac{h\cdot\mathbf{k}(1,1)}{2},\hat{y}^{(2)}(1.1)+\frac{h\cdot\mathbf{k}(2,1)}{2},\hat{y}^{(3)}(1.1)+\frac{h\cdot\mathbf{k}(3,1)}{2}\right)\\ = & f_2\left(1.1+\frac{0.1}{2},2.8319081+\frac{0.1\cdot8.656458}{2},8.656458+\frac{0.1\cdot7.0973734}{2},7.0973734+\frac{0.1\cdot10.0980989}{2}\right)\\ = & 7.0973734+\frac{0.1\cdot10.0980989}{2}=7.6022784,\\ \mathbf{k}(3,2) = & f_3\left(t_1+\frac{h}{2},\hat{y}^{(1)}(1.1)+\frac{h\cdot\mathbf{k}(1,1)}{2},\hat{y}^{(2)}(1.1)+\frac{h\cdot\mathbf{k}(2,1)}{2},\hat{y}^{(3)}(1.1)+\frac{h\cdot\mathbf{k}(3,1)}{2}\right)\\ = & f_3\left(1.1+\frac{0.1}{2},2.8319081+\frac{0.1\cdot8.656458}{2},8.656458+\frac{0.1\cdot7.0973734}{2},7.0973734+\frac{0.1\cdot10.0980989}{2}\right)\\ = & f_3\left(1.15,3.264731,9.0113267,7.6022784\right)\\ = & 8-\frac{2}{1.15^3}-\frac{1}{1.15}\cdot7.6022784+\frac{2}{1.15^2}\cdot9.0113267-\frac{2}{1.15^3}\cdot3.264731=9.4087787 \end{align*} \]
\[ \begin{align*} \mathbf{k}(1,3) = & f_1\left(t_1+\frac{h}{2},\hat{y}^{(1)}(1.1)+\frac{h\cdot\mathbf{k}(1,2)}{2},\hat{y}^{(2)}(1.1)+\frac{h\cdot\mathbf{k}(2,2)}{2},\hat{y}^{(3)}(1.1)+\frac{h\cdot\mathbf{k}(3,2)}{2}\right)\\ = & f_1\left(1.1+\frac{0.1}{2},2.8319081+\frac{0.1\cdot9.0113267}{2},8.656458+\frac{0.1\cdot7.6022784}{2},7.0973734+\frac{0.1\cdot9.4087787}{2}\right)\\ = & 8.656458+\frac{0.1\cdot7.6022784}{2}=9.0365719,\\ \mathbf{k}(2,3) = & f_2\left(t_1+\frac{h}{2},\hat{y}^{(1)}(1.1)+\frac{h\cdot\mathbf{k}(1,2)}{2},\hat{y}^{(2)}(1.1)+\frac{h\cdot\mathbf{k}(2,2)}{2},\hat{y}^{(3)}(1.1)+\frac{h\cdot\mathbf{k}(3,2)}{2}\right)\\ = & f_2\left(1.1+\frac{0.1}{2},2.8319081+\frac{0.1\cdot9.0113267}{2},8.656458+\frac{0.1\cdot7.6022784}{2},7.0973734+\frac{0.1\cdot9.4087787}{2}\right)\\ = & 7.0973734+\frac{0.1\cdot9.4087787}{2}=7.5678124,\\ \mathbf{k}(3,3) = & f_3\left(t_1+\frac{h}{2},\hat{y}^{(1)}(1.1)+\frac{h\cdot\mathbf{k}(1,2)}{2},\hat{y}^{(2)}(1.1)+\frac{h\cdot\mathbf{k}(2,2)}{2},\hat{y}^{(3)}(1.1)+\frac{h\cdot\mathbf{k}(3,2)}{2}\right)\\ = & f_3\left(1.1+\frac{0.1}{2},2.8319081+\frac{0.1\cdot9.0113267}{2},8.656458+\frac{0.1\cdot7.6022784}{2},7.0973734+\frac{0.1\cdot9.4087787}{2}\right)\\ = & f_3\left(1.15,3.2824744,9.0365719,7.5678124\right)\\ & =8-\frac{2}{1.15^3}-\frac{1}{1.15}\cdot7.5678124+\frac{2}{1.15^2}\cdot9.0365719-\frac{2}{1.15^3}\cdot3.2824744=9.453594, \end{align*} \]
\[ \begin{align*} \mathbf{k}(1,4) = & f_1\left(t_1+h,\hat{y}^{(1)}(1.1)+h\cdot\mathbf{k}(1,3),\hat{y}^{(2)}(1.1)+h\cdot\mathbf{k}(2,3),\hat{y}^{(3)}(1.1)+h\cdot\mathbf{k}(3,3)\right)\\ = & f_1\left(1.1+0.1,2.8319081+0.1\cdot9.0365719,8.656458+0.1\cdot7.5678124,7.0973734+0.1\cdot9.453594\right)\\ = & 8.656458+0.1\cdot7.5678124=9.4132392,\\ \mathbf{k}(2,4) = & f_2\left(t_1+h,\hat{y}^{(1)}(1.1)+h\cdot\mathbf{k}(1,3),\hat{y}^{(2)}(1.1)+h\cdot\mathbf{k}(2,3),\hat{y}^{(3)}(1.1)+h\cdot\mathbf{k}(3,3)\right)\\ = & f_2\left(1.1+0.1,2.8319081+0.1\cdot9.0365719,8.656458+0.1\cdot7.5678124,7.0973734+0.1\cdot9.453594\right)\\ = & 7.0973734+0.1\cdot9.453594=8.0427328,\\ \mathbf{k}(3,4) = & f_3\left(t_1+h,\hat{y}^{(1)}(1.1)+h\cdot\mathbf{k}(1,3),\hat{y}^{(2)}(1.1)+h\cdot\mathbf{k}(2,3),\hat{y}^{(3)}(1.1)+h\cdot\mathbf{k}(3,3)\right)\\ = & f_3\left(1.1+0.1,2.8319081+0.1\cdot9.0365719,8.656458+0.1\cdot7.5678124,7.0973734+0.1\cdot 9.453594\right)\\ = & f_3\left(1.2,3.7355653,9.4132392,8.0427328\right)\\ = & 8-\frac{2}{1.2^3}-\frac{1}{1.2}\cdot8.0427328+\frac{2}{1.2^2}\cdot9.4132392-\frac{2}{1.2^3}\cdot 3.7355653= 8.8906877. \end{align*} \]
En particular, la solución de la ecuación diferencial de orden \(3\) original es la función \(y_1(t)\) y la aproximación de su solución es la función \(\hat{y}_1(t_i)\) donde \(t_i\) pertenece al mallado.
La siguiente tabla muestra los valores de las soluciones aproximada y exacta en los puntos del mallado:
\(t_i\) | \(\hat{y}_i^{(1)}\) | \(\hat{y}_i^{(2)}\) | \(\hat{y}_i^{(3)}\) | \(y_{i}^{(1)}\) | \(y_{i}^{(2)}\) | \(y_{i}^{(3)}\) | \(\|y_i-\hat{y}_i\|_2\) |
---|---|---|---|---|---|---|---|
1 | 2 | 8 | 6 | 2 | 8 | 6 | 0 |
1.1 | 2.8319081 | 8.656458 | 7.0973734 | 2.8319091 | 8.6564463 | 7.0973704 | 0.0000121 |
1.2 | 3.7346663 | 9.4144628 | 8.042599 | 3.7346667 | 9.4144444 | 8.0425926 | 0.0000194 |
1.3 | 4.7177705 | 10.2617386 | 8.889677 | 4.7177692 | 10.261716 | 8.8896677 | 0.0000245 |
1.4 | 5.7897177 | 11.1902298 | 9.6711487 | 5.7897143 | 11.1902041 | 9.671137 | 0.0000285 |
1.5 | 6.9583393 | 12.1944728 | 10.407421 | 6.9583333 | 12.1944444 | 10.4074074 | 0.000032 |
\(t_i\) | \(\hat{y}_i^{(1)}\) | \(\hat{y}_i^{(2)}\) | \(\hat{y}_i^{(3)}\) | \(y_{i}^{(1)}\) | \(y_{i}^{(2)}\) | \(y_{i}^{(3)}\) | \(\|y_i-\hat{y}_i\|_2\) |
---|---|---|---|---|---|---|---|
1.6 | 8.2310089 | 13.2706556 | 11.1117338 | 8.231 | 13.270625 | 11.1117188 | 0.0000352 |
1.7 | 9.6147767 | 14.4160535 | 11.792933 | 9.6147647 | 14.4160208 | 11.7929168 | 0.0000385 |
1.8 | 11.1164598 | 15.6286768 | 12.4570817 | 11.1164444 | 15.628642 | 12.4570645 | 0.0000418 |
1.9 | 12.7427032 | 16.9070452 | 13.1084303 | 12.7426842 | 16.9070083 | 13.1084123 | 0.0000452 |
2 | 14.5000227 | 18.2500389 | 13.7500186 | 14.5 | 18.25 | 13.75 | 0.0000488 |
Ejercicio
Aprovechando todos los métodos ya programados anteriormente, crear una rutina que convierta una ecuación diferencia de orden \(m\) en un sistema de \(m\) ecuaciones diferenciales de orden \(1\) y lo resuelva por el método de Runge-Kutta 4 aplicado a sistemas.