Skip to main content

BVP: xy'' + y = 0

Short answer

Apply central difference with h=0.25 to xy''+ y=0: x_i (y_{i-1}-2y_i+y_{i+1})/0.0625 + y_i=0. With y0=1, y4=2, solving yields y(0.25)≈1.7517, y(0.5)≈2.0655, y(0.75)≈2.1212.

Using the finite difference method, find y(0.25), y(0.5) and y(0.75) satisfying the differential equation xy'' + y = 0, subject to the boundary conditions y(0) = 1, y(1) = 2.

Use the central difference y''ᵢ = (yᵢ₋₁ − 2yᵢ + yᵢ₊₁)/h² in x·y'' + y = 0.

Set up

Nodes x₀ = 0, x₁ = 0.25, x₂ = 0.5, x₃ = 0.75, x₄ = 1 (h = 0.25), y₀ = 1, y₄ = 2. Unknowns y₁, y₂, y₃. At node i:

xᵢ(yᵢ₋₁ − 2yᵢ + yᵢ₊₁)/h² + yᵢ = 0
Multiply by h² = 0.0625:  xᵢ·yᵢ₋₁ + (h² − 2xᵢ)·yᵢ + xᵢ·yᵢ₊₁ = 0

Equations

i=1 (x=0.25): 0.25(1) − 0.4375y₁ + 0.25y₂ = 0   →  −0.4375y₁ + 0.25y₂              = −0.25
i=2 (x=0.50): 0.50y₁ − 0.9375y₂ + 0.50y₃ = 0     →   0.5y₁ − 0.9375y₂ + 0.5y₃       =  0
i=3 (x=0.75): 0.75y₂ − 1.4375y₃ + 0.75(2) = 0    →   0.75y₂ − 1.4375y₃              = −1.5

Solution (Gaussian elimination)

y₁ = y(0.25) = 1.7517
y₂ = y(0.50) = 2.0655
y₃ = y(0.75) = 2.1212

Answer: y(0.25) ≈ 1.7517, y(0.5) ≈ 2.0655, y(0.75) ≈ 2.1212

✓ Answer checked by Claude Opus 5.5 (high effort)

All Numerical Method chapter 6 questions →