Extrapolación de Richardson

Si $M$ es un valor desconocido y $N(h)$ una fórmula de aproximación, el error será

\begin{equation*} M - N(h) = K_{1} h + K_{2} h^{2} + K_{3} h^{3} + K_{4} h^{4} + K_{5} h^{5} + \cdots \end{equation*}

Reescribiendo la anterior ecuación el valor desconocido $M$ tiene una aproximación de $\mathcal{O}(h)$

\begin{equation*} M = N(h) + K_{1} h + K_{2} h^{2} + K_{3} h^{3} + K_{4} h^{4} + K_{5} h^{5} + \cdots \end{equation*}

Combinando dos fórmulas de aproximación de diferente tamaño de paso puede obtenerse una aproximación de $\mathcal{O}(h^{2})$

\begin{equation*} M = \hat{N}(h) + \hat{K}_{1} h^{2} + \hat{K}_{2} h^{3} + \hat{K}_{3} h^{4} + \hat{K}_{4} h^{5} + \cdots \end{equation*}

Extrapolación usando todas las potencias de $h$

Aproximación $\mathcal{O}(h)$

\begin{equation} M = N_{1}(h) + K_{1} h + K_{2} h^{2} + K_{3} h^{3} + K_{4} h^{4} + K_{5} h^{5} + \cdots \end{equation}

Aproximación $\mathcal{O}(h^{2})$

Disminuyendo el tamaño de paso a la mitad de la aproximación $\mathcal{O}(h)$

\begin{equation*} M = N_{1} \biggl( \frac{h}{2} \biggr) + \frac{1}{2} K_{1} h + \frac{1}{4} K_{2} h^{2} + \frac{1}{8} K_{3} h^{3} + \frac{1}{16} K_{4} h^{4} + \frac{1}{32} K_{5} h^{5} + \cdots \end{equation*}

Multiplicando por dos

\begin{equation*} 2 M = 2 N_{1} \biggl( \frac{h}{2} \biggr) + K_{1} h + \frac{1}{2} K_{2} h^{2} + \frac{1}{4} K_{3} h^{3} + \frac{1}{8} K_{4} h^{4} + \frac{1}{16} K_{5} h^{5} + \cdots \end{equation*}

Restando la aproximación $\mathcal{O}(h)$

\begin{equation*} M = 2 N_{1} \biggl( \frac{h}{2} \biggr) - N_{1}(h) - \frac{1}{2} K_{2} h^{2} - \frac{3}{4} K_{3} h^{3} - \frac{7}{8} K_{4} h^{4} - \frac{15}{16} K_{5} h^{5} - \cdots \end{equation*}

Agrupando términos

\begin{equation*} M = N_{1} \biggl( \frac{h}{2} \biggr) + \biggl[ N_{1} \biggl( \frac{h}{2} \biggr) - N_{1}(h) \biggr] - \frac{1}{2} K_{2} h^{2} - \frac{3}{4} K_{3} h^{3} - \frac{7}{8} K_{4} h^{4} - \frac{15}{16} K_{5} h^{5} - \cdots \end{equation*}

Usando un cambio de variable

\begin{equation} M = N_{2}(h) - \frac{1}{2} K_{2} h^{2} - \frac{3}{4} K_{3} h^{3} - \frac{7}{8} K_{4} h^{4} - \frac{15}{16} K_{5} h^{5} - \cdots \end{equation}

Aproximación $\mathcal{O}(h^{3})$

Disminuyendo el tamaño de paso a la mitad de la aproximación $\mathcal{O}(h^{2})$

\begin{equation*} M = N_{2} \biggl( \frac{h}{2} \biggr) - \frac{1}{8} K_{2} h^{2} - \frac{3}{32} K_{3} h^{3} - \frac{7}{128} K_{4} h^{4} - \frac{15}{512} K_{5} h^{5} - \cdots \end{equation*}

Multiplicando por cuatro

\begin{equation*} 4 M = 4 N_{2} \biggl( \frac{h}{2} \biggr) - \frac{1}{2} K_{2} h^{2} - \frac{3}{8} K_{3} h^{3} - \frac{7}{32} K_{4} h^{4} - \frac{15}{128} K_{5} h^{5} - \cdots \end{equation*}

Restando la aproximación $\mathcal{O}(h^{2})$

\begin{equation*} 3 M = 4 N_{2} \biggl( \frac{h}{2} \biggr) - N_{2}(h) + \frac{3}{8} K_{3} h^{3} + \frac{21}{32} K_{4} h^{4} + \frac{105}{128} K_{5} h^{5} + \cdots \end{equation*}

Simplificando y agrupando términos

\begin{equation*} M = N_{2} \biggl( \frac{h}{2} \biggr) + \frac{1}{3} \biggl[ N_{2} \biggl( \frac{h}{2} \biggr) - N_{2}(h) \biggr] + \frac{1}{8} K_{3} h^{3} + \frac{7}{32} K_{4} h^{4} + \frac{35}{128} K_{5} h^{5} + \cdots \end{equation*}

Usando un cambio de variable

\begin{equation} M = N_{3}(h) + \frac{1}{8} K_{3} h^{3} + \frac{7}{32} K_{4} h^{4} + \frac{35}{128} K_{5} h^{5} + \cdots \end{equation}

Aproximación $\mathcal{O}(h^{4})$

Disminuyendo el tamaño de paso a la mitad de la aproximación $\mathcal{O}(h^{3})$

\begin{equation*} M = N_{3} \biggl( \frac{h}{2} \biggr) + \frac{1}{64} K_{3} h^{3} + \frac{7}{512} K_{4} h^{4} + \frac{35}{4096} K_{5} h^{5} + \cdots \end{equation*}

Multiplicando por ocho

\begin{equation*} 8 M = 8 N_{3} \biggl( \frac{h}{2} \biggr) + \frac{1}{8} K_{3} h^{3} + \frac{7}{64} K_{4} h^{4} + \frac{35}{512} K_{5} h^{5} + \cdots \end{equation*}

Restando la aproximación $\mathcal{O}(h^{3})$

\begin{equation*} 7 M = 8 N_{3} \biggl( \frac{h}{2} \biggr) - N_{3}(h) - \frac{7}{64} K_{4} h^{4} - \frac{105}{512} K_{5} h^{5} - \cdots \end{equation*}

Simplificando y agrupando términos

\begin{equation*} M = N_{3} \biggl( \frac{h}{2} \biggr) + \frac{1}{7} \biggl[ N_{3} \biggl( \frac{h}{2} \biggr) - N_{3}(h) \biggr] - \frac{1}{64} K_{4} h^{4} - \frac{15}{512} K_{5} h^{5} - \cdots \end{equation*}

Usando un cambio de variable

\begin{equation} M = N_{4}(h) - \frac{1}{64} K_{4} h^{4} - \frac{15}{512} K_{5} h^{5} - \cdots \end{equation}

Aproximación $\mathcal{O}(h^{n})$

\begin{equation} N_{n}(h) = N_{n-1} \biggl( \frac{h}{2} \biggr) + \frac{1}{2^{n-1} - 1} \biggl[ N_{n-1} \biggl( \frac{h}{2} \biggr) - N_{n-1}(h) \biggr] \end{equation}

Ejemplo

Calcular $f'(0.5)$ usando una diferencia hacia adelante

\begin{equation*} f(x) = - 0.10 x^{4} - 0.15 x^{3} - 0.5 x^{2} - 0.25 x + 1.2 \end{equation*}

Aproximación con $h=1$

\begin{equation*} f'(0.5) = \frac{f(1.5) - f(0.5)}{1} = \frac{-1.3125 - 0.925}{1} = -2.2375 \end{equation*}

Aproximación con $h=0.5$

\begin{equation*} f'(0.5) = \frac{f(1) - f(0.5)}{1} = \frac{0.2 - 0.925}{0.5} = -1.45 \end{equation*}

Extrapolación $\mathcal{O}(h)$

\begin{equation*} f'(0.5) = -1.45 + \bigl[ -1.45 - (-2.2375) \bigr] = -0.6625 \end{equation*}

Error relativo

\begin{equation*} e_{r} = \bigg|\frac{-0.6625 - (-1.45)}{-0.6625}\bigg| \times 100\% = 118.87\% \end{equation*}

Aproximación con $h=0.25$

\begin{equation*} f'(0.5) = \frac{f(0.75) - f(0.5)}{0.25} = \frac{0.636328 - 0.925}{0.25} = -1.154688 \end{equation*}

Extrapolación $\mathcal{O}(h)$

\begin{equation*} f'(0.5) = -1.154688 + \bigl[ -1.154688 - (-1.45) \bigr] = -0.859376 \end{equation*}

Error relativo

\begin{equation*} e_{r} = \bigg|\frac{-0.859376 - (-1.154688)}{-0.859376}\bigg| \times 100\% = 34.36\% \end{equation*}

Extrapolación $\mathcal{O}(h^{2})$

\begin{equation*} f'(0.5) = -0.859376 + \frac{1}{3} \bigl[ -0.859376 - (-0.6625) \bigr] = -0.925001 \end{equation*}

Error relativo

\begin{equation*} e_{r} = \bigg|\frac{-0.925001 - (-0.859376)}{-0.925001}\bigg| \times 100\% = 7.09\% \end{equation*}

Aproximación con $h=0.125$

\begin{equation*} f'(0.5) = \frac{f(0.625) - f(0.5)}{0.125} = \frac{0.796558 - 0.925}{0.125} = -1.027539 \end{equation*}

Extrapolación $\mathcal{O}(h)$

\begin{equation*} f'(0.5) = -1.027539 + \bigl[ -1.027539 - (-1.154688) \bigr] = -0.900390 \end{equation*}

Error relativo

\begin{equation*} e_{r} = \bigg|\frac{-0.900390 - (-1.027539)}{-0.900390}\bigg| \times 100\% = 14.12\% \end{equation*}

Extrapolación $\mathcal{O}(h^{2})$

\begin{equation*} f'(0.5) = -0.900390 + \frac{1}{3} \bigl[ -0.900390 - (-0.859376) \bigr] = -0.914061 \end{equation*}

Error relativo

\begin{equation*} e_{r} = \bigg|\frac{-0.914061 - (-0.900390)}{-0.914061}\bigg| \times 100\% = 1.5\% \end{equation*}

Extrapolación $\mathcal{O}(h^{3})$

\begin{equation*} f'(0.5) = -0.914061 + \frac{1}{7} \bigl[ -0.914061 - (-0.925001) \bigr] = -0.912498 \end{equation*}

Error relativo

\begin{equation*} e_{r} = \bigg| \frac{-0.912498 - (-0.914061)}{-0.912498} \bigg| \times 100\% = 0.17\% \end{equation*}

Resumiendo los resultados en una matriz

\begin{equation*} \begin{array}{c|cccc} h & f'(0.5) & \mathcal{O}(h) & \mathcal{O}(h^{2}) & \mathcal{O}(h^{3}) \\ \hline 1 & -2.2375 & & & \\ 0.5 & -1.45 & -0.6625 & & \\ 0.25 & -1.154688 & -0.859376 & -0.925001 & \\ 0.125 & -1.027539 & -0.900390 & -0.914061 & -0.912498 \end{array} \end{equation*}

Lo anterior puede escribirse como

\begin{equation*} \begin{matrix} \mathcal{O}(h) & \mathcal{O}(h^{2}) & \mathcal{O}(h^{3}) & \mathcal{O}(h^{4}) \\ \hline N_{(1,1)} & & & \\ N_{(2,1)} & N_{(2,2)} & & \\ N_{(3,1)} & N_{(3,2)} & N_{(3,3)} & \\ N_{(4,1)} & N_{(4,2)} & N_{(4,3)} & N_{(4,4)} \end{matrix} \end{equation*}

Patrón de cálculo

\begin{equation*} \begin{matrix} \mathcal{O}(h) & \mathcal{O}(h^{2}) & \mathcal{O}(h^{3}) & \mathcal{O}(h^{4}) \\ \hline N_{(1,1)} = N(h) & & & \\ N_{(2,1)} = N \bigl( \frac{h}{2} \bigr) & N_{(2,2)} = N_{(2,1)} + \frac{1}{2^{2-1} - 1} \bigl[ N_{(2,1)} - N_{(1,1)} \bigr] & & \\ N_{(3,1)} = N \bigl( \frac{h}{4} \bigr) & N_{(3,2)} = N_{(3,1)} + \frac{1}{2^{2-1} - 1} \bigl[ N_{(3,1)} - N_{(2,1)} \bigr] & N_{(3,3)} = N_{(3,2)} + \frac{1}{2^{3-1} - 1} \bigl[ N_{(3,2)} - N_{(2,2)} \bigr] & \\ N_{(4,1)} = N \bigl( \frac{h}{8} \bigr) & N_{(4,2)} = N_{(4,1)} + \frac{1}{2^{2-1} - 1} \bigl[ N_{(4,1)} - N_{(3,1)} \bigr] & N_{(4,3)} = N_{(4,2)} + \frac{1}{2^{3-1} - 1} \bigl[ N_{(4,2)} - N_{(3,2)} \bigr] & N_{(4,4)} = N_{(4,3)} + \frac{1}{2^{4-1} - 1} \bigl[ N_{(4,3)} - N_{(3,3)} \bigr] \end{matrix} \end{equation*}

Primer patrón

\begin{equation*} \begin{matrix} \mathcal{O}(h) & \mathcal{O}(h^{2}) & \mathcal{O}(h^{3}) & \mathcal{O}(h^{4}) \\ \hline N_{(\color{blue}{1},1)} = N(h) & & & \\ N_{(\color{green}{2},1)} = N \bigl( \frac{h}{2} \bigr) & N_{(\color{green}{2},2)} = N_{(\color{green}{2},1)} + \frac{1}{2^{2-1} - 1} \bigl[ N_{(\color{green}{2},1)} - N_{(\color{green}{2}-1,1)} \bigr] & & \\ N_{(\color{red}{3},1)} = N \bigl( \frac{h}{4} \bigr) & N_{(\color{red}{3},2)} = N_{(\color{red}{3},1)} + \frac{1}{2^{2-1} - 1} \bigl[ N_{(\color{red}{3},1)} - N_{(\color{red}{3}-1,1)} \bigr] & N_{(\color{red}{3},3)} = N_{(\color{red}{3},2)} + \frac{1}{2^{3-1} - 1} \bigl[ N_{(\color{red}{3},2)} - N_{(\color{red}{3}-1,2)} \bigr] & \\ N_{(\color{fuchsia}{4},1)} = N \bigl( \frac{h}{8} \bigr) & N_{(\color{fuchsia}{4},2)} = N_{(\color{fuchsia}{4},1)} + \frac{1}{2^{2-1} - 1} \bigl[ N_{(\color{fuchsia}{4},1)} - N_{(\color{fuchsia}{4}-1,1)} \bigr] & N_{(\color{fuchsia}{4},3)} = N_{(\color{fuchsia}{4},2)} + \frac{1}{2^{3-1} - 1} \bigl[ N_{(\color{fuchsia}{4},2)} - N_{(\color{fuchsia}{4}-1,2)} \bigr] & N_{(\color{fuchsia}{4},4)} = N_{(\color{fuchsia}{4},3)} + \frac{1}{2^{4-1} - 1} \bigl[ N_{(\color{fuchsia}{4},3)} - N_{(\color{fuchsia}{4}-1,3)} \bigr] \end{matrix} \end{equation*}

Lo anterior puede escribirse como

\begin{align*} N_{(i,?)} &= N(h) \\ N_{(i,?)} &= N_{(i,?)} + \frac{1}{2^{?-1} - 1} \bigl[ N_{(i,?)} - N_{(i-1,?)} \bigr] \end{align*}

para $i = 1, 2, 3, 4 = 1, \dots, m$

Segundo patrón

\begin{equation*} \begin{matrix} \mathcal{O}(h) & \mathcal{O}(h^{2}) & \mathcal{O}(h^{3}) & \mathcal{O}(h^{4}) \\ \hline N_{(1,\color{blue}{1})} = N(h) & & & \\ N_{(2,\color{blue}{1})} = N \bigl( \frac{h}{2} \bigr) & N_{(2,\color{green}{2})} = N_{(2,\color{green}{2}-1)} + \frac{1}{2^{\color{green}{2}-1} - 1} \bigl[ N_{(2,\color{green}{2}-1)} - N_{(1,\color{green}{2}-1)} \bigr] & & \\ N_{(3,\color{blue}{1})} = N \bigl( \frac{h}{4} \bigr) & N_{(3,\color{green}{2})} = N_{(3,\color{green}{2}-1)} + \frac{1}{2^{\color{green}{2}-1} - 1} \bigl[ N_{(3,\color{green}{2}-1)} - N_{(2,\color{green}{2}-1)} \bigr] & N_{(3,\color{red}{3})} = N_{(3,\color{red}{3}-1)} + \frac{1}{2^{\color{red}{3}-1} - 1} \bigl[ N_{(3,\color{red}{3}-1)} - N_{(2,\color{red}{3}-1)} \bigr] & \\ N_{(4,\color{blue}{1})} = N \bigl( \frac{h}{8} \bigr) & N_{(4,\color{green}{2})} = N_{(4,\color{green}{2}-1)} + \frac{1}{2^{\color{green}{2}-1} - 1} \bigl[ N_{(4,\color{green}{2}-1)} - N_{(3,\color{green}{2}-1)} \bigr] & N_{(4,\color{red}{3})} = N_{(4,\color{red}{3}-1)} + \frac{1}{2^{\color{red}{3}-1} - 1} \bigl[ N_{(4,\color{red}{3}-1)} - N_{(3,\color{red}{3}-1)} \bigr] & N_{(4,\color{fuchsia}{4})} = N_{(4,\color{fuchsia}{4}-1)} + \frac{1}{2^{\color{fuchsia}{4}-1} - 1} \bigl[ N_{(4,\color{fuchsia}{4}-1)} - N_{(3,\color{fuchsia}{4}-1)} \bigr] \end{matrix} \end{equation*}

Lo anterior puede escribirse como

\begin{align*} N_{(i,1)} &= N(h) \\ N_{(i,j)} &= N_{(i,j-1)} + \frac{1}{2^{j-1} - 1} \bigl[ N_{(i,j-1)} - N_{(i-1,j-1)} \bigr] \end{align*}

para

\begin{align*} j &= 2 \\ &= 2, 3 \\ &= 2, 3, 4 \end{align*}

Fórmula matemática

\begin{align*} i &= 1, \dots, m \\ N_{(i,1)} &= N(h) \\ j &= 2, \dots, i+1 \\ N_{(i,j)} &= N_{(i,j-1)} + \frac{1}{2^{j-1} - 1} \bigl[ N_{(i,j-1)} - N_{(i-1,j-1)} \bigr] \\ h &= \frac{h}{2} \end{align*}

Seudocódigo

function extrapolacion_Richarson_n(f, x, h)
    for i=1 to m do
        N(i,1) = g(f, x, h)
        for j=2 to i+1 do
            N(i,j) = N(i,j-1) + (N(i,j-1) - N(i-1,j-1))/(2^(j-1) - 1)
        end for
        h = h/2
    end for
    return N
end function

Implementación


In [1]:
import numpy as np

def g(x):
    resultado = - 0.1*x**4 - 0.15*x**3 - 0.5*x**2 - 0.25*x + 1.2
    return resultado

def diferencia_adelante(f,x,h):
    derivada = (f(x+h) - f(x))/h
    return derivada

def extrapolacion_Richarson_n(f,x,h):
    m = 4
    N = np.zeros((m,m))
    for i in range(0,m):
        N[i,0] = diferencia_adelante(f,x,h)
        for j in range(1,i+1):
            N[i,j] =  N[i,j-1] + (N[i,j-1] - N[i-1,j-1])/(2**j - 1)
        h = h/2
    return N

In [2]:
A = extrapolacion_Richarson_n(g,0.5,1.0)
print(A)


[[-2.2375      0.          0.          0.        ]
 [-1.45       -0.6625      0.          0.        ]
 [-1.1546875  -0.859375   -0.925       0.        ]
 [-1.02753906 -0.90039062 -0.9140625  -0.9125    ]]

Extrapolación usando potencias pares de $h$

Aproximación $\mathcal{O}(h^2)$

\begin{equation} M = N_{1}(h) + K_{1} h^{2} + K_{2} h^{4} + K_{3} h^{6} + K_{4} h^{8} + K_{5} h^{10} + \cdots \end{equation}

Aproximación $\mathcal{O}(h^4)$

Disminuyendo el tamaño de paso a la mitad de la aproximación $\mathcal{O}(h^{2})$

\begin{equation*} M = N_{1} \biggl( \frac{h}{2} \biggr) + \frac{1}{4} K_{1} h^{2} + \frac{1}{16} K_{2} h^{4} + \frac{1}{64} K_{3} h^{6} + \frac{1}{256} K_{4} h^{8} + \frac{1}{1024} K_{5} h^{10} + \cdots \end{equation*}

Multiplicando por cuatro

\begin{equation*} 4 M = 4 N_{1} \biggl( \frac{h}{2} \biggr) + K_{1} h^{2} + \frac{1}{4} K_{2} h^{4} + \frac{1}{16} K_{3} h^{6} + \frac{1}{64} K_{4} h^{8} + \frac{1}{256} K_{5} h^{10} + \cdots \end{equation*}

Restando la aproximación $\mathcal{O}(h^{2})$

\begin{equation*} 3 M = 4 N_{1} \biggl( \frac{h}{2} \biggr) - N_{1}(h) - \frac{3}{4} K_{2} h^{4} - \frac{15}{16} K_{3} h^{6} - \frac{63}{64} K_{4} h^{8} - \frac{255}{256} K_{5} h^{10} - \cdots \end{equation*}

Simplificando y agrupando términos

\begin{equation*} M = N_{1} \biggl( \frac{h}{2} \biggr) + \frac{1}{3} \biggl[ N_{1} \biggl( \frac{h}{2} \biggr) - N_{1}(h) \biggr] - \frac{1}{4} K_{2} h^{4} - \frac{5}{16} K_{3} h^{6} - \frac{21}{64} K_{4} h^{8} - \frac{85}{256} K_{5} h^{10} - \cdots \end{equation*}

Usando un cambio de variable

\begin{equation} M = N_{2}(h) - \frac{1}{4} K_{2} h^{4} - \frac{5}{16} K_{3} h^{6} - \frac{21}{64} K_{4} h^{8} - \frac{85}{256} K_{5} h^{10} - \cdots \end{equation}

Aproximación $\mathcal{O}(h^{2 n})$

\begin{equation} N_{n}(h) = N_{n-1} \biggl( \frac{h}{2} \biggr) + \frac{1}{4^{n-1} - 1} \biggl[ N_{n-1} \biggl( \frac{h}{2} \biggr) - N_{n-1}(h) \biggr] \end{equation}

Ejemplo

Calcular $f'(0.5)$ usando una diferencia hacia adelante

\begin{equation*} f(x) = - 0.10 x^{4} - 0.15 x^{3} - 0.5 x^{2} - 0.25 x + 1.2 \end{equation*}

Aproximación con $h=1$

\begin{equation*} f'(0.5) = \frac{f(1.5) - f(0.5)}{1} = \frac{-1.3125 - 0.925}{1} = -2.2375 \end{equation*}

Aproximación con $h=0.5$

\begin{equation*} f'(0.5) = \frac{f(1) - f(0.5)}{1} = \frac{0.2 - 0.925}{0.5} = -1.45 \end{equation*}

Extrapolación $\mathcal{O}(h^{2})$

\begin{equation*} f'(0.5) = -1.45 + \frac{1}{3} \bigl[ -1.45 - (-2.2375) \bigr] = -1.1875 \end{equation*}

Error relativo

\begin{equation*} e_{r} = \bigg|\frac{-1.1875 - (-1.45)}{-1.1875}\bigg| \times 100\% = 22.1\% \end{equation*}

Aproximación con $h=0.25$

\begin{equation*} f'(0.5) = \frac{f(0.75) - f(0.5)}{0.25} = \frac{0.636328 - 0.925}{0.25} = -1.154688 \end{equation*}

Extrapolación $\mathcal{O}(h^{2})$

\begin{equation*} f'(0.5) = -1.154688 + \frac{1}{3} \bigl[ -1.154688 - (-1.45) \bigr] = -1.056251 \end{equation*}

Error relativo

\begin{equation*} e_{r} = \bigg|\frac{-1.026251 - (-1.154688)}{-1.026251}\bigg| \times 100\% = 9.32\% \end{equation*}

Extrapolación $\mathcal{O}(h^{4})$

\begin{equation*} f'(0.5) = -1.056251 + \frac{1}{15} \bigl[ -1.056251 - (-1.1875) \bigr] = -1.047501 \end{equation*}

Error relativo

\begin{equation*} e_{r} = \bigg|\frac{-1.047501 - (-1.056251)}{-1.047501}\bigg| \times 100\% = 0.84\% \end{equation*}

Aproximación con $h=0.125$

\begin{equation*} f'(0.5) = \frac{f(0.625) - f(0.5)}{0.125} = \frac{0.796558 - 0.925}{0.125} = -1.027539 \end{equation*}

Extrapolación $\mathcal{O}(h^{2})$

\begin{equation*} f'(0.5) = -1.027539 + \frac{1}{3} \bigl[ -1.027539 - (-1.154688) \bigr] = -0.985152 \end{equation*}

Error relativo

\begin{equation*} e_{r} = \bigg|\frac{-0.985152 - (-1.027539)}{-0.985152}\bigg| \times 100\% = 4.3\% \end{equation*}

Extrapolación $\mathcal{O}(h^{4})$

\begin{equation*} f'(0.5) = -0.985152 + \frac{1}{15} \bigl[ -0.985152 - (-1.056251) \bigr] = -0.980412 \end{equation*}

Error relativo

\begin{equation*} e_{r} = \bigg|\frac{-0.980412 - (-0.985152)}{-0.980412}\bigg| \times 100\% = 0.48\% \end{equation*}

Extrapolación $\mathcal{O}(h^{6})$

\begin{equation*} f'(0.5) = -0.980412 + \frac{1}{63} \bigl[ -0.980412 - (-1.047501) \bigr] = -0.979347 \end{equation*}

Error relativo

\begin{equation*} e_{r} = \bigg|\frac{-0.979347 - (-0.980412)}{-0.979347}\bigg| \times 100\% = 0.11\% \end{equation*}

Resumiendo los resultados en una matriz

\begin{equation*} \begin{array}{c|cccc} h & f'(0.5) & \mathcal{O}(h^{2}) & \mathcal{O}(h^{4}) & \mathcal{O}(h^{6}) \\ \hline 1 & -2.2375 & & & \\ 0.5 & -1.45 & -1.1875 & & \\ 0.25 & -1.154688 & -1.056251 & -1.047501 & \\ 0.125 & -1.027536 & -0.985152 & -0.980412 & -0.979347 \end{array} \end{equation*}

Lo anterior puede escribirse como

\begin{equation*} \begin{matrix} \mathcal{O}(h^{2}) & \mathcal{O}(h^{4}) & \mathcal{O}(h^{6}) & \mathcal{O}(h^{8}) \\ \hline N_{(1,1)} & & & \\ N_{(2,1)} & N_{(2,2)} & & \\ N_{(3,1)} & N_{(3,2)} & N_{(3,3)} & \\ N_{(4,1)} & N_{(4,2)} & N_{(4,3)} & N_{(4,4)} \end{matrix} \end{equation*}

Fórmula matemática

\begin{align*} i &= 1, \dots, m \\ N_{(i,1)} &= N(h) \\ j &= 2, \dots, i+1 \\ N_{(i,j)} &= N_{(i,j-1)} + \frac{1}{4^{j-1} - 1} \bigl[ N_{(i,j-1)} - N_{(i-1,j-1)} \bigr] \\ h &= \frac{h}{2} \end{align*}

Seudocódigo

function extrapolacion_Richarson_2n(f, x, h)
    for i=1 to m do
        N(i,1) = g(f, x, h)
        for j=2 to i+1 do
            N(i,j) = N(i,j-1) + (N(i,j-1) - N(i-1,j-1))/(4^(j-1) - 1)
        end for
        h = h/2
    end for
    return N
end function

Implementación


In [3]:
def extrapolacion_Richarson_2n(f,x,h):
    m = 4
    N = np.zeros((m,m))
    for i in range(0,m):
        N[i,0] = diferencia_adelante(f,x,h)
        for j in range(1,i+1):
            N[i,j] =  N[i,j-1] + (N[i,j-1] - N[i-1,j-1])/(4**j - 1)
        h = h/2
    return N

In [4]:
B = extrapolacion_Richarson_2n(g,0.5,1.0)
print(B)


[[-2.2375      0.          0.          0.        ]
 [-1.45       -1.1875      0.          0.        ]
 [-1.1546875  -1.05625    -1.0475      0.        ]
 [-1.02753906 -0.98515625 -0.98041667 -0.97935185]]