Runge-Kutta (RK4) Method Calculator

Solve first-order ordinary differential equations using the classical 4th order Runge-Kutta (RK4) method. Enter dy/dx = f(x, y), initial value y(x0), step size, and number of steps to get a detailed solution table.

Full original guide (expanded)

Runge-Kutta (RK4) Method Calculator

Solve ODEs with the RK4 method using step size and initial conditions.

1. Problem setup

Use JavaScript/Math syntax: x + y, x*y, Math.sin(x), y - x*x. We already expose common Math functions via with(Math){...}.

2. Solution steps

No computation yet. Fill the form and click “Run RK4”.

Runge–Kutta 4th order formula

Given \(\frac{dy}{dx} = f(x, y)\) and a current point \((x_n, y_n)\) with step \(h\):

k₁ = f(xₙ, yₙ)
k₂ = f(xₙ + h/2, yₙ + h·k₁/2)
k₃ = f(xₙ + h/2, yₙ + h·k₂/2)
k₄ = f(xₙ + h, yₙ + h·k₃)
yₙ₊₁ = yₙ + (h/6)(k₁ + 2k₂ + 2k₃ + k₄)

This method is popular because it strikes an excellent balance between accuracy and computational cost.

Tips

  • If the solution diverges, try a smaller step size \(h\).
  • For stiff ODEs, RK4 might not be the best choice.
  • Always check your function syntax if you get NaN results.

Audit: Complete
Formula (LaTeX) + variables + units
This section shows the formulas used by the calculator engine, plus variable definitions and units.
Formula (extracted LaTeX)
\[','\\]
','\
Formula (extracted text)
k₁ = f(xₙ, yₙ) k₂ = f(xₙ + h/2, yₙ + h·k₁/2) k₃ = f(xₙ + h/2, yₙ + h·k₂/2) k₄ = f(xₙ + h, yₙ + h·k₃) yₙ₊₁ = yₙ + (h/6)(k₁ + 2k₂ + 2k₃ + k₄)
Variables and units
  • T = property tax (annual or monthly depending on input) (currency)
Sources (authoritative):
Changelog
Version: 0.1.0-draft
Last code update: 2026-01-19
0.1.0-draft · 2026-01-19
  • Initial audit spec draft generated from HTML extraction (review required).
  • Verify formulas match the calculator engine and convert any text-only formulas to LaTeX.
  • Confirm sources are authoritative and relevant to the calculator methodology.
Verified by Ugo Candido on 2026-01-19
Profile · LinkedIn
Formulas

(Formulas preserved from original page content, if present.)

Version 0.1.0-draft
Citations

Add authoritative sources relevant to this calculator (standards bodies, manuals, official docs).

Changelog
  • 0.1.0-draft — 2026-01-19: Initial draft (review required).