Skip to main content

BVP: y'' = x + y

Short answer

Discretizing y''=x+y with central differences, h=0.25, and y(0)=y(1)=0 yields: y(0.25)≈-0.0349, y(0.5)≈-0.0563, y(0.75)≈-0.0500.

Solve the following boundary value problem using the finite difference method, by dividing the interval into four sub-intervals. d²y/dx² = x + y, y(0) = y(1) = 0.

Replace y'' by the central difference (yᵢ₋₁ − 2yᵢ + yᵢ₊₁)/h² at each interior node.

Set up

n = 4 on [0, 1], so h = 0.25; nodes x = 0, 0.25, 0.5, 0.75, 1 with y₀ = y₄ = 0. Unknowns y₁, y₂, y₃.

(yᵢ₋₁ − 2yᵢ + yᵢ₊₁)/h² = xᵢ + yᵢ
yᵢ₋₁ − (2 + h²)yᵢ + yᵢ₊₁ = h²·xᵢ
yᵢ₋₁ − 2.0625 yᵢ + yᵢ₊₁ = 0.0625 xᵢ

Equations

i=1 (x=0.25):  y₀ − 2.0625y₁ + y₂ = 0.0625(0.25) →  −2.0625y₁ +  y₂           = 0.015625
i=2 (x=0.50):  y₁ − 2.0625y₂ + y₃ = 0.0625(0.50) →   y₁ − 2.0625y₂ + y₃        = 0.031250
i=3 (x=0.75):  y₂ − 2.0625y₃ + y₄ = 0.0625(0.75) →   y₂ − 2.0625y₃              = 0.046875

Solution

y₁ = -0.0349
y₂ = -0.0563
y₃ = -0.0500

Check: the exact solution y = sinh x / sinh 1 − x gives y(0.25) = -0.0350, y(0.5) = -0.0566, y(0.75) = -0.0503.

Answer: y(0.25) ≈ -0.0349, y(0.5) ≈ -0.0563, y(0.75) ≈ -0.0500

✓ Answer checked by Claude Opus 5.5 (high effort)

All Numerical Method chapter 6 questions →