Docsity

Heun method example to solve equations, Exercises of Mathematics

Partial preview of the text

Download Heun method example to solve equations and more Exercises Mathematics in PDF only on Docsity!

Example: Use the non-self-starting Heun method to integrate 0.82 y = 4e""" — 0.5y using a step size of h. = 1.0 and an initial condition of y = 2 at x = 0. Additional information is required for the multistep method: y = —0.3929953 at « = —1. Solution: x_, = —1, y_) = —0.3929953; xy = 0, yy = 2. Step 1: 23 =29+h=1. The predictor is used to extrapolate linearly from x_; to x1: y} = y-1 + f (x0, yo)2h = —0.3929953 + (4e28*? — 0.5 x 2) x 2 x 1 = 5.607005 The corrector is then used to compute the value. When j = 1, a F (0, Yo) * F(x1, vw), ft de? 0.5 x 24 i 8x9 _ 0.5 x 5.607005 = 6.519331 The approximate percentage relative error is éa= ui : vi x 100% = 14.39% n When j = 2, yh = yp + Leow) * flrwl), — Fy. 4e98*0 0.5 x 2+ — — 0.5 x 6.549331 = 6.313749 The approximate percentage relative error is — ii2 3 ny x 100% = 3.73% The iteration can be repeated until €, is below a prespecified value of €,. The itera- tions converge on a value of 6.360865. Sei 2: te — 4) +R — 7. The predictor is: yd = yo + fai, y1)2h = 2 + (49° — 0.5 x 6.360865) x 2 x 1 = 13.44346 The correctors can be calculated similarly as in Step 1.