Skip to main content

RK-4: dy/dx = (1+x²)y

Short answer

Apply the classical fourth-order Runge-Kutta formulas to f(x,y)=(1+x^2)y with h=0.2 and y(0)=1. Two steps give y(0.2) approximately 1.2247 and y(0.4) approximately 1.5240.

Solve the differential equation, dy/dx = (1 + x²)y, within x ≤ 0(0.2)0.4 and y(0) = 1 using RK 4th order method.

Given f(x, y) = (1 + x²)y, y(0) = 1, h = 0.2, so x = 0, 0.2, 0.4 (two steps).

The classical fourth-order Runge–Kutta formulas are:

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

Step 1: x = 0, y = 1.0000

k₁ = 0.2·f(0.0000, 1.0000)                       = 0.2000
k₂ = 0.2·f(0.1000, 1.1000)                       = 0.2222
k₃ = 0.2·f(0.1000, 1.1111)                       = 0.2244
k₄ = 0.2·f(0.2000, 1.2244)                       = 0.2547
y(0.2) = 1.0000 + (0.2000 + 2(0.2222) + 2(0.2244) + 0.2547)/6 = 1.2247

Step 2: x = 0.2, y = 1.2247

k₁ = 0.2·f(0.2000, 1.2247)                       = 0.2547
k₂ = 0.2·f(0.3000, 1.3520)                       = 0.2947
k₃ = 0.2·f(0.3000, 1.3720)                       = 0.2991
k₄ = 0.2·f(0.4000, 1.5238)                       = 0.3535
y(0.4) = 1.2247 + (0.2547 + 2(0.2947) + 2(0.2991) + 0.3535)/6 = 1.5240

Answer: y(0.2) ≈ 1.2247, y(0.4) ≈ 1.5240

The exact solution y = exp(x + x³/3) gives 1.2247 and 1.5240.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Numerical Method chapter 6 questions →