- 2073 Magh · 6 marks
RK-2: y' = sin x + cos y
Short answer
With RK2 (Heun's method) and h=0.5, evaluating f(x,y)=sin x+cos y. Results: y(0.5)≈1.9610, y(1.0)≈2.0897, y(1.5)≈2.2660, y(2.0)≈2.3909.
Solve y' = sin x + cos y subject to initial condition y(0) = 2 in the range 0(0.5)2 using the Runge-Kutta second order method.
Given y' = sin x + cos y, y(0) = 2, range 0(0.5)2 means x = 0, 0.5, 1.0, 1.5, 2.0, so h = 0.5 (four steps). Angles are in radians.
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₁ = h·f(x₀, y₀) = 0.5·f(0.0000, 2.0000) = -0.2081
k₂ = h·f(x₀+h, y₀+k₁) = 0.5·f(0.5000, 1.7919) = 0.1300
y₁ = y₀ + (k₁+k₂)/2 = 2.0000 + (-0.2081 + 0.1300)/2 = 1.9610
All steps (h = 0.5)
| step | xₙ | yₙ | k₁ = h·f(xₙ,yₙ) | k₂ = h·f(xₙ+h, yₙ+k₁) | yₙ₊₁ = yₙ + (k₁+k₂)/2 |
|---|---|---|---|---|---|
| 0 | 0.0000 | 2.0000 | -0.2081 | 0.1300 | 1.9610 |
| 1 | 0.5000 | 1.9610 | 0.0495 | 0.2079 | 2.0897 |
| 2 | 1.0000 | 2.0897 | 0.1728 | 0.1798 | 2.2660 |
| 3 | 1.5000 | 2.2660 | 0.1785 | 0.0713 | 2.3909 |
Answer: y(0.5) ≈ 1.9610, y(1) ≈ 2.0897, y(1.5) ≈ 2.2660, y(2) ≈ 2.3909
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- Program for RK-4 second order IVP · Numerical Method, chapter 6
- RK-4: y'' - 3y' + y = sin x · Numerical Method, chapter 6
- RK-2: y' = 4e^(0.8x) - 0.5y · Numerical Method, chapter 6
- RK-2: y' = xy + y² · Numerical Method, chapter 6 · asked 2×
- Program for RK-4 first order IVP · Numerical Method, chapter 6
- RK-2: y'' = y - x y' · Numerical Method, chapter 6 · asked 2×
- Condition for x cosα + y sinα = p to touch ellipse · Mathematics I, chapter 3
- Solve sin x dy/dx + y cos x = x sin x · Mathematics I, chapter 4
- Second derivatives of r with x=r cosθ, y=r sinθ · Mathematics, chapter 1
- Volume of cardioid r=a(1+cosθ) about initial line · Mathematics I, chapter 2 · asked 6×