Runge-Kutta (RK4) Method Calculator

Published on: July 18, 2026
Final Answer: Free Full Steps: Pro

This Runge-Kutta Method Calculator uses the classic fourth-order (RK4) scheme to approximate the solution of y' = f(x, y). Each step combines four slope estimates for high accuracy, and the results are shown as a table.

Step-by-step method

  1. Set up the initial value problem and read x0, y0, h, and n.
  2. Write the fourth-order Runge-Kutta update rule.
  3. Apply the four slope estimates row by row.
  4. Report the final approximation y at x_n.

Formula:

\(y_{k+1} = y_{k} + \tfrac{h}{6}\left(k_{1} + 2k_{2} + 2k_{3} + k_{4}\right)\)

Example 1:

\\(y' = x + y,\quad y(0.0) = 1.0,\; h = 0.2,\; n = 4\\)

Step 1 - Set up the initial value problem and read x0, y0, h, and n.

In this problem: We approximate the solution of \(y' = x + y\) starting at \((0.0, 1.0)\) with step size 0.2 for 4 steps.

\(y' = x + y,\quad y(0.0) = 1.0,\; h = 0.2,\; n = 4\)

Step 2 - Write the fourth-order Runge-Kutta update rule.

In this problem: This is the update rule applied at each step.

\(y_{k+1} = y_{k} + \tfrac{h}{6}\left(k_{1} + 2k_{2} + 2k_{3} + k_{4}\right)\)

Step 3 - Apply the four slope estimates row by row.

In this problem: Each row applies the update rule to move from one point to the next.

\(\begin{array}{ccc} k & x_k & y_k \\ \hline 0 & 0.0 & 1.0 \\ 1 & 0.2 & 1.2428 \\ 2 & 0.4 & 1.583636 \\ 3 & 0.6 & 2.044213 \\ 4 & 0.8 & 2.651042 \end{array}\)

Step 4 - Report the final approximation y at x_n.

In this problem: After 4 steps, the approximation is \(y(0.8) \approx 2.651042\).

\(y(0.8) \approx 2.651042\)

Final answer:

\\(y(0.8) \approx 2.651042\\)

Example 2:

\\(y' = - x^{2} + y + 1,\quad y(0.0) = 0.5,\; h = 0.2,\; n = 5\\)

Step 1 - Set up the initial value problem and read x0, y0, h, and n.

In this problem: We approximate the solution of \(y' = - x^{2} + y + 1\) starting at \((0.0, 0.5)\) with step size 0.2 for 5 steps.

\(y' = - x^{2} + y + 1,\quad y(0.0) = 0.5,\; h = 0.2,\; n = 5\)

Step 2 - Write the fourth-order Runge-Kutta update rule.

In this problem: This is the update rule applied at each step.

\(y_{k+1} = y_{k} + \tfrac{h}{6}\left(k_{1} + 2k_{2} + 2k_{3} + k_{4}\right)\)

Step 3 - Apply the four slope estimates row by row.

In this problem: Each row applies the update rule to move from one point to the next.

\(\begin{array}{ccc} k & x_k & y_k \\ \hline 0 & 0.0 & 0.5 \\ 1 & 0.2 & 0.829293 \\ 2 & 0.4 & 1.214076 \\ 3 & 0.6 & 1.648922 \\ 4 & 0.8 & 2.127203 \\ 5 & 1.0 & 2.640823 \end{array}\)

Step 4 - Report the final approximation y at x_n.

In this problem: After 5 steps, the approximation is \(y(1.0) \approx 2.640823\).

\(y(1.0) \approx 2.640823\)

Final answer:

\\(y(1.0) \approx 2.640823\\)
See Example 1 Hide Example 1

Problem

\(y' = x + y,\quad y(0.0) = 1.0,\; h = 0.2,\; n = 4\)

Approach

Step-by-step method

  1. Set up the initial value problem and read x0, y0, h, and n.
  2. Write the fourth-order Runge-Kutta update rule.
  3. Apply the four slope estimates row by row.
  4. Report the final approximation y at x_n.

Step 1

Step 1 - Set up the initial value problem and read x0, y0, h, and n.

In this problem:

\(y' = x + y,\quad y(0.0) = 1.0,\; h = 0.2,\; n = 4\)

Step 2

Step 2 - Write the fourth-order Runge-Kutta update rule.

In this problem:

\(y_{k+1} = y_{k} + \tfrac{h}{6}\left(k_{1} + 2k_{2} + 2k_{3} + k_{4}\right)\)

Step 3

Step 3 - Apply the four slope estimates row by row.

In this problem:

\(\begin{array}{ccc} k & x_k & y_k \\ \hline 0 & 0.0 & 1.0 \\ 1 & 0.2 & 1.2428 \\ 2 & 0.4 & 1.583636 \\ 3 & 0.6 & 2.044213 \\ 4 & 0.8 & 2.651042 \end{array}\)

Step 4

Step 4 - Report the final approximation y at x_n.

In this problem:

\(y(0.8) \approx 2.651042\)

Final Answer

\(y' = x + y,\quad y(0.0) = 1.0,\; h = 0.2,\; n = 4 = y(0.8) \approx 2.651042\)
See Example 2 Hide Example 2

Problem

\(y' = - x^{2} + y + 1,\quad y(0.0) = 0.5,\; h = 0.2,\; n = 5\)

Approach

Step-by-step method

  1. Set up the initial value problem and read x0, y0, h, and n.
  2. Write the fourth-order Runge-Kutta update rule.
  3. Apply the four slope estimates row by row.
  4. Report the final approximation y at x_n.

Step 1

Step 1 - Set up the initial value problem and read x0, y0, h, and n.

In this problem:

\(y' = - x^{2} + y + 1,\quad y(0.0) = 0.5,\; h = 0.2,\; n = 5\)

Step 2

Step 2 - Write the fourth-order Runge-Kutta update rule.

In this problem:

\(y_{k+1} = y_{k} + \tfrac{h}{6}\left(k_{1} + 2k_{2} + 2k_{3} + k_{4}\right)\)

Step 3

Step 3 - Apply the four slope estimates row by row.

In this problem:

\(\begin{array}{ccc} k & x_k & y_k \\ \hline 0 & 0.0 & 0.5 \\ 1 & 0.2 & 0.829293 \\ 2 & 0.4 & 1.214076 \\ 3 & 0.6 & 1.648922 \\ 4 & 0.8 & 2.127203 \\ 5 & 1.0 & 2.640823 \end{array}\)

Step 4

Step 4 - Report the final approximation y at x_n.

In this problem:

\(y(1.0) \approx 2.640823\)

Final Answer

\(y' = - x^{2} + y + 1,\quad y(0.0) = 0.5,\; h = 0.2,\; n = 5 = y(1.0) \approx 2.640823\)