Q 3.7-8E

Question

Use the fourth-order Runge–Kutta subroutine with h = 0.25 to approximate the solution to the initial value problem y'=1-y,y(0)=0 , at x = 1. Compare this approximation with the one obtained in Problem 6 using the Taylor method of order 4.

Step-by-Step Solution

Verified
Answer

ϕ(1)=0.6321

1Step 1: Find the values of k i, i = 1, 2, 3, 4

Since  f(x,y)=1-yand x = 0, y = 0 and h = 0.25


k1=hf(x,y)=0.25(1-0)=0.25k2=hfx+h2,y+k12=0.21875k3=hfx+h2,y+k22=0.222656k4=hfx+h,y+k3=0.184336

2Step 2: Find the values of x and y

x=0+0.25=0.25y=0+16k1+2k2+2k3+k4=0+16(0.25-2(0.21875)-2(0.222656)-0.194336)=0.22119

3Step 3: Use values of x and y for finding values of k i, i = 1, 2, 3, 4

k1=hf(x,y)=0.25(1-0.22119)=0.194703k2=hfx+h2,y+k12=0.170365k3=hfx+h2,y+k22=0.173407k4=hfx+h,y+k3=0.151351


Now 


x=0.25+0.25=0.5y=0.22119+16(0.194703+2(0.170365)+2(0.173407)+1.151351)=0.39345

4Step 4: Repeat the procedure for two times

k1=hf(x,y)=0.25(1-0.39345)=0.151637k2=hfx+h2,y+k12=0.132683k3=hfx+h2,y+k22=0.135052k4=hfx+h,y+k3=0.117874x=0.5+0.25=0.75y=0.39345+16k1+2k2+2k3+k4=0.39345+16(0.151637+2(0.132683)+2(0.1350520)+0.117874)=0.52


And


k1=hf(x,y)=0.25(1-0.52761)=0.118098k2=hfx+h2,y+k12=0.103335k3=hfx+h2,y+k22=0.105781k4=hfx+h,y+k3=0.0918024x=0.75+0.25=1y=0.52761+16k1+2k2+2k3+k4=0.52761+16(0.118098+2(0.103335)+2(0.105781)+0.0918024)=0.632099


Therefore,  ϕ(1)=0.6321

 

Hence the solution is ϕ(1)=0.6321