Calculus & Numerical Methods

Runge-Kutta 2 (ODE)

Solve y' = f(x, y) with the midpoint RK2 method.

Formula

Formula
yn+1 = yn + h·f(x+h2, y+h2·k1)

Variables

SymbolDefinitionType & rangeUnitsRole
f derivative function expression / text x, y input
x₀, y₀ initial condition real number (ℝ) input
x target real number (ℝ) input

Try it yourself

Interactive calculator
math expression (e.g. x*x, sin(x))
Result

Worked examples

Example 1
Givenf(x, y) = x + y, x₀ = 0, y₀ = 1, target x = 1, steps = 200
Result3.436541089
Example 2
Givenf(x, y) = y, x₀ = 0, y₀ = 1, target x = 1, steps = 200
Result2.718270545