Skip to main content

BVP: y'' = e^x + 2y' - y

Short answer

Using central differences with h=0.5 for y''-2y'+y=e^x, boundary conditions give: y(0.5)≈1.3487, y(1.0)≈1.0447, y(1.5)≈0.9695.

Solve the following boundary value problem using the finite difference method by dividing the interval into four sub-intervals. y'' = e^x + 2y' - y; y(0) = 1.5; y(2) = 2.5

Write the equation as y'' − 2y' + y = eˣ and replace the derivatives by central differences at each interior node:

y''ᵢ = (yᵢ₋₁ − 2yᵢ + yᵢ₊₁)/h², y'ᵢ = (yᵢ₊₁ − yᵢ₋₁)/(2h)

Set up

n = 4 sub-intervals on [0, 2], so h = 0.5 and the nodes are x₀ = 0, x₁ = 0.5, x₂ = 1.0, x₃ = 1.5, x₄ = 2.0, with y₀ = 1.5 and y₄ = 2.5. Unknowns: y₁, y₂, y₃.

Substituting at node i:

(yᵢ₋₁ − 2yᵢ + yᵢ₊₁)/0.25 − 2(yᵢ₊₁ − yᵢ₋₁)/1 + yᵢ = e^xᵢ
Multiply out:  (4+2)yᵢ₋₁ + (−8+1)yᵢ + (4−2)yᵢ₊₁ = e^xᵢ
               6yᵢ₋₁ − 7yᵢ + 2yᵢ₊₁ = e^xᵢ

Equations

i=1 (x=0.5):  6(1.5) − 7y₁ + 2y₂ = e^0.5 = 1.6487   →  −7y₁ + 2y₂         = -7.3513
i=2 (x=1.0):  6y₁ − 7y₂ + 2y₃     = e^1.0 = 2.7183   →   6y₁ − 7y₂ + 2y₃    = 2.7183
i=3 (x=1.5):  6y₂ − 7y₃ + 2(2.5)  = e^1.5 = 4.4817   →   6y₂ − 7y₃          = -0.5183

(Right sides: 1.6487 − 9 = -7.3513, and 4.4817 − 5 = -0.5183.)

Solve (Gaussian elimination)

y₁ = 1.3487
y₂ = 1.0447
y₃ = 0.9695
x00.51.01.52.0
y1.50001.34871.04470.96952.5000

Answer: y(0.5) ≈ 1.3487, y(1.0) ≈ 1.0447, y(1.5) ≈ 0.9695

✓ Answer checked by Claude Opus 5.5 (high effort)

All Numerical Method chapter 6 questions →