Métodos de quinto orden

Para \( s = 6 \) $$ \begin{align*} k_{1} &= f(t_{n}, y_{n}) \\ k_{2} &= f(t_{n} + c_{2} h, y_{n} + h(a_{21} k_{1})) \\ k_{3} &= f(t_{n} + c_{3} h, y_{n} + h(a_{31} k_{1} + a_{32} k_{2})) \\ k_{4} &= f(t_{n} + c_{4} h, y_{n} + h(a_{41} k_{1} + a_{42} k_{2} + a_{43} k_{3})) \\ k_{5} &= f(t_{n} + c_{5} h, y_{n} + h(a_{51} k_{1} + a_{52} k_{2} + a_{53} k_{3} + a_{54} k_{3})) \\ k_{6} &= f(t_{n} + c_{6} h, y_{n} + h(a_{61} k_{1} + a_{62} k_{2} + a_{63} k_{3} + a_{64} k_{3} + a_{65} k_{3})) \\ y_{n+1} &= y_{n} + h (b_{1} k_{1} + b_{2} k_{2} + b_{3} k_{3} + b_{4} k_{4} + b_{5} k_{5} + b_{6} k_{6}) \end{align*} $$

Método RK de quinto orden de Butcher (1964)

\begin{array}{c|c c c c} 0 & & & & & & \\ \frac{1}{4} & \frac{1}{4} & & & & & \\ \frac{1}{4} & \frac{1}{8} & \frac{1}{8} & & & & \\ \frac{1}{2} & 0 & -\frac{1}{2} & 1 & & & \\ \frac{3}{4} & \frac{3}{16} & 0 & 0 & \frac{9}{16} & & \\ 1 & -\frac{3}{7} & \frac{2}{7} & \frac{12}{7} & -\frac{12}{7} & \frac{8}{7} & \\ \hline & \frac{7}{90} & 0 & \frac{16}{45} & \frac{2}{15} & \frac{16}{15} & \frac{7}{90} \end{array}

reemplazando se obtiene $$ \begin{align*} k_{1} &= f(t_{n}, y_{n}) \\ k_{2} &= f \left( t_{n} + \frac{1}{4} h, y_{n} + h \left( \frac{1}{4} k_{1} \right) \right) \\ k_{3} &= f \left( t_{n} + \frac{1}{4} h, y_{n} + h \left( \frac{1}{8} k_{1} + \frac{1}{8} k_{2} \right) \right) \\ k_{4} &= f \left( t_{n} + \frac{1}{2} h, y_{n} + h \left( -\frac{1}{2} k_{2} + k_{3} \right) \right) \\ k_{5} &= f \left( t_{n} + \frac{3}{4} h, y_{n} + h \left( \frac{3}{16} k_{1} + \frac{9}{16} k_{4} \right) \right) \\ k_{6} &= f \left( t_{n} + h, y_{n} + h \left( -\frac{3}{7} k_{1} + \frac{2}{7} k_{2} + \frac{12}{7} k_{3} - \frac{12}{7} k_{4} + \frac{8}{7} k_{5} \right) \right) \\ y_{n+1} &= y_{n} + h \left( \frac{7}{90} k_{1} + \frac{32}{90} k_{3} + \frac{12}{90} k_{4} + \frac{32}{90} k_{5} + \frac{7}{90} k_{6} \right) \end{align*} $$

function prueba5(f::Function, n, xi, yi, xf)
    h = (xf - xi)/n
    y = yi
    x = xi
    c2 = 1/4
    a21 = 1/4
    c3 = 1/4
    a31 = 1/8
    a32 = 1/8
    c4 = 1/2
    a41 = 0
    a42 = -1/2
    a43 = 1
    c5 = 3/4
    a51 = 3/16
    a52 = 0
    a53 = 0
    a54 = 9/16
    c6 = 1
    a61 = -3/7
    a62 = 2/7
    a63 = 12/7
    a64 = -12/7
    a65 = 8/7
    b1 = 7/90
    b2 = 0
    b3 = 16/45
    b4 = 2/15
    b5 = 16/45
    b6 = 7/90
    @printf("%s  %s  %8s  %8s  %8s  %8s  %8s  %7s  %8s\n", "i", "k1", "k2", "k3", "k4", "k5", "k6", "x", "y")
    for i = 1:n
        k1 = f(x,y)
        k2 = f(x + (c2 * h), y + (h * a21 * k1))
        k3 = f(x + (c3 * h), y + (h * ((a31 * k1) + (a32 * k2))))
        k4 = f(x + (c4 * h), y + (h * ((a41 * k1) + (a42 * k2) + (a43 * k3))))
        k5 = f(x + (c5 * h), y + (h * ((a51 * k1) + (a52 * k2) + (a53 * k3) + (a54 * k4))))
        k6 = f(x + (c6 * h), y + (h * ((a61 * k1) + (a62 * k2) + (a63 * k3) + (a64 * k4) + (a65 * k5))))
        y = y + (h * ((b1 * k1) + (b2 * k2) + (b3 * k3) + (b4 * k4) + (b5 * k5) + (b6 * k6)))
        x = x + h
        @printf("%d  %f  %f  %f  %f  %f  %f  %f  %f\n", i, k1, k2, k3, k4, k5, k6, x, y)
    end
    println("x = $x")
    println("y = $y")
end

    prueba5 (generic function with 1 method)

prueba5(f,2,0,2,1)

    i  k1        k2        k3        k4        k5        k6        x         y
    1  3.000000  3.233184  3.225897  3.483285  3.768973  4.091245  0.500000  3.751522
    2  4.091538  4.463403  4.451782  4.857694  5.304346  5.804402  1.000000  6.194633
    x = 1.0
    y = 6.194633188434668