Skip to main content

RK-2: y' = xy + y²

Short answer

Use second-order Runge-Kutta (Heun) with f(x,y)=xy+y^2, h=0.2, starting y(0)=1. Three steps give y(0.2) approximately 1.2680, y(0.4) approximately 1.7888, and y(0.6) approximately 2.9961.

Using the Runge-Kutta method of second order, obtain a solution of the equation y' = xy + y², with the initial condition y(0) = 1 for the range 0 ≤ x ≤ 0.6, with increments of 0.2.

Given f(x, y) = xy + y², y(0) = 1, h = 0.2, range 0 ≤ x ≤ 0.6 (three steps).

The second-order Runge–Kutta (Heun / modified Euler) formulas are:

k₁ = h·f(xₙ, yₙ)
k₂ = h·f(xₙ + h, yₙ + k₁)
yₙ₊₁ = yₙ + ½(k₁ + k₂)

First step

k₁ = 0.2·f(0, 1)         = 0.2(0 + 1)                       = 0.2000
k₂ = 0.2·f(0.2, 1.2000)  = 0.2[0.2(1.2000) + (1.2000)²] = 0.3360
y(0.2) = 1 + (0.2000 + 0.3360)/2          = 1.2680

All steps

stepxₙyₙk₁k₂yₙ₊₁
00.00001.00000.20000.33601.2680
10.20001.26800.37230.66931.7888
20.40001.78880.78311.63152.9961

Answer: y(0.2) ≈ 1.2680, y(0.4) ≈ 1.7888, y(0.6) ≈ 2.9961

(The solution grows quickly because y' contains y². The exact solution blows up near x ≈ 0.87, and its value at x = 0.6 is about 3.31, so a coarse step such as h = 0.2 gives large errors here.)

✓ Answer checked by Claude Opus 5.5 (high effort)

All Numerical Method chapter 6 questions →